using Aspose.Cells; using Aspose.Cells.Rendering; namespace ConvertExcelToImageInCSharp { class Program { static void Main(string[] args) { // Load the license to avoid trial version watermark in the converted images from the source Excel License RtfToPdfLicense = new License(); RtfToPdfLicense.SetLicense("Aspose.Cells.lic"); // Load the source Excel file that will be converted to multiple images Workbook excelToImages = new Workbook("ExcelToImage.xlsx"); // Get a reference to the first worksheet in the source Excel file for conversion to images Worksheet targetWorksheet = excelToImages.Worksheets[0]; // Create and initialize ImageOrPrintOptions class object to customize the output images Aspose.Cells.Rendering.ImageOrPrintOptions imageOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions(); // Set images properties like display all columns in one page and type of the image imageOptions.AllColumnsInOnePagePerSheet = true; imageOptions.ImageType = Aspose.Cells.Drawing.ImageType.Jpeg; // Instantiate a SheetRender class object to generate images SheetRender sheetRender = new SheetRender(targetWorksheet, imageOptions); //Parse through all the pages and render as an image for (int pageCounter = 0; pageCounter < sheetRender.PageCount; pageCounter++) { sheetRender.ToImage(pageCounter, "WorksheetToImage_" + (pageCounter + 1) + ".jpg"); } System.Console.WriteLine("Done"); } } }