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

Free Support Forum - aspose.com

Create a single image using cell range and a chart from excel sheet using aspose cells?

We are evaluating your api and just wanted to know whether there are any ways to create a single image using cell range and a chart from excel sheet using aspose cells?

Regards,
Prathap

@PrathapSV,

You may try following sample code and provide feedback.

var book = new Workbook(@"source.xlsx");
Worksheet sheet = book.Worksheets[0];
var range = sheet.Cells.CreateRange(0, 0, 10, 10);
sheet.PageSetup.PrintArea = range.RefersTo;
sheet.PageSetup.LeftMargin = sheet.PageSetup.RightMargin = sheet.PageSetup.TopMargin = sheet.PageSetup.BottomMargin = sheet.PageSetup.HeaderMargin = sheet.PageSetup.FooterMargin = 0;
var options = new ImageOrPrintOptions
{
    OnePagePerSheet = true, // setting this to false adds even more whitespace
};
var renderer = new SheetRender(sheet, options);
renderer.ToImage(0, @"out.jpg");

// Accesses the 1st chart from the collection
Chart chart = sheet.Charts[0];
// Refreshes the chart
chart.Calculate();
// Renders the chart to image
chart.ToImage(@"outputCustomTextForLabels.png", new ImageOrPrintOptions());