I need to convert all the excel(.xls, xlsx) sheets into images. Excel file contains images, charts. Let me know how to do the convertion.
Hi Karthik,
Thank you for considering Aspose products.
Aspose.Cells component is capable of converting excel worksheets to images. If you could let us know the platform (.NET, Java, Cloud, Android) under discussion, we will provide the appropriate source code examples for your need.
Looking forward to your response.
Our platform is .Net C#.
Hi,
Thank you for your response.
Please check out the below provided source code to convert the Workbook’s first Worksheet to an Image of Jpeg format. You can suerly modify this code upto your scenario.
C#
//Create a new Workbook object and open a template Excel file.
Workbook book = new Workbook(myDir +“pivottable.xls”);
//Get the first worksheet.
Worksheet sheet = book.Worksheets[0];
//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
//Specify the image format
imgOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
//Only one page for the whole sheet would be rendered
imgOptions.OnePagePerSheet = true;
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(sheet, imgOptions);
//Render the image for the sheet
Bitmap bitmap = sr.ToImage(0);
//Save the image file specifying its image format.
bitmap.Save(myDir + “SheetImage.jpg”);
Thanks… It is working for me…