Hi,
Please use my code below:
using (var ms = new FileStream("/tmp/chart-of-anothersheet.xlsx", FileMode.OpenOrCreate, FileAccess.Read))
{
using (var workbook = new Workbook(ms))
{
Worksheet worksheet = workbook.Worksheets[0];
worksheet.PageSetup.PrintArea = “A1:N50”;
// Set all margins as 0
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.ImageType = Aspose.Cells.Drawing.ImageType.Png;
options.OnlyArea = true;
options.HorizontalResolution = 90;
options.VerticalResolution = 90;
SheetRender sr = new SheetRender(worksheet, options);
sr.ToImage(0, "/tmp/" + Guid.NewGuid() + ".png");
}
}
And attached file chart-of-anothersheet.xlsx.zip (12.1 KB)
Please advise as it only broken on Linux (I installed all necessary fonts from Windows already)