awalker89 / openxlsx

R package for .xlsx file reading and writing.
Other
364 stars 78 forks source link

InsertImage - Not able to add images to excel sheet #455

Open SaiPavanKumarB opened 5 years ago

SaiPavanKumarB commented 5 years ago

Expected Behavior

png(paste0("Line_Graph_Aggregated.png"), width=15, height=10, units="in", res = 144) p<-ggplot(data=temp,aes(x=Date_Time, y=value, colour=variable))+geom_line()+ theme(axis.text.x = element_text(angle = 60, vjust = 0.5, hjust = 0.5))+scale_x_datetime(breaks = temp$Date_Time)+ ggtitle(paste0("Forecast Vs Adjusted")) print(p) pic_file<-paste0("Line_Graph_Aggregated.png") insertImage(WorkBook,"Aggregated Data", pic_file, startRow = 14, startCol = 'A') saveWorkbook(WorkBook,file = paste0(BookName,".xlsx"), overwrite = TRUE)

Actual Behavior

Image is being generated & saved as .png file in the working directory. But it is not being inserted to the Workbook

Steps to Reproduce the Problem

(please attach an example xlsx file if possible)

1.

2.

3.

sessionInfo()

SaiPavanKumarB commented 5 years ago

Version of openxlsx : 4.1 Version of R: 3.4