We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is it possible to add image for each row

Is it possible to add image for each row in the exported excel file. The image can be downloaded from URL


The image can be downloaded from below URL
https://www.google.com/finance/chart?cht=s&cid=658890

I would like to get the output as shown in the attached file.

Thanks,
Cpunji

Hi Cpunji,


Thank you for contacting Aspose support.

Please check the below provided code snippet and the detailed article on Adding Pictures to Worksheet Cells.

C#

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Adding a new worksheet to the Excel object
int sheetIndex = workbook.Worksheets.Add();

//Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[sheetIndex];

//Adding a sample value to “A1” cell
worksheet.Cells[0,0].PutValue(1);

//Adding a sample value to “A2” cell
worksheet.Cells[1,0].PutValue(2);

//Adding a sample value to “A3” cell
worksheet.Cells[2,0].PutValue(3);

//Adding pictures
worksheet.Pictures.Add(0, 1, myDir + “chart.png”);
worksheet.Pictures.Add(1, 1, myDir + “chart.png”);
worksheet.Pictures.Add(2, 1, myDir + “chart.png”);

//Saving the Excel file
workbook.Save(myDir + “book1.xlsx”);

Please feel free to write back in case you face any difficulty.
Hi Babar,

Thanks for the quick response.

I am looking something different. The example provided by you helps me to add image once I have downloaded it from the URL and I have it in my physical drive.

But in my case I will be getting the URL generated at run time and for each row it will differ and while exporting I need to contact to respective URL and then fetch the image and add it back to the workbook. It will be great if you could get me some working solution for my case.

Actually my requirement is to draw a sparkline for given data sets. If their is any other way to get the same, do please let me know.

Thanks,
Cpunji
Hi,

cpunji:

Actually my requirement is to draw a sparkline for given data sets. If their is any other way to get the same, do please let me know.


Please see the document/ article for your reference on how to create Sparklines in Excel sheet via Aspose.Cells APIs:
http://www.aspose.com/docs/display/cellsnet/Using+Sparklines

Hope, this helps a bit.

Thank you.