Hi,
How do you render a specific range as an image?
What I want is something that resembles what Excel does.
If you select a range in a sheet in Excel and press copy, you can then paste this range into Paint, Word or whatever other program you want and save it as a picture.
How do you achieve the same thing in Aspose?
I have tried the following but I get white space bottom and right:
var book = new Workbook(“someSource.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.xlsx”);
Best regards,