Hi,
when I create an image from a range, the chart inside is included but not the bars.
This is the code:
Workbook w2 = new Workbook(“data_V11.xlsx”);
Worksheet excelWorksheet = w2.Worksheets[“Sheet3”];
Aspose.Cells.Range range = excelWorksheet.Workbook.Worksheets.GetRangeByName(“BIPLI_chart”);
string startCell = CellsHelper.CellIndexToName(range.FirstRow, range.FirstColumn);
string endCell = CellsHelper.CellIndexToName(range.FirstRow + range.RowCount - 1, range.FirstColumn + range.ColumnCount - 1);
string rangeAddress = string.Format("{0}:{1}", startCell, endCell);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.AllColumnsInOnePagePerSheet = true;
options.ImageType = Aspose.Cells.Drawing.ImageType.Emf;
options.OnePagePerSheet = true;
options.HorizontalResolution = 600;
options.VerticalResolution = 600;
options.OnlyArea = true;
Aspose.Cells.PageSetup pageSetup = excelWorksheet.PageSetup;
pageSetup.PrintArea = rangeAddress;
using (MemoryStream imageStream = new MemoryStream())
{
SheetRender sr = new SheetRender(excelWorksheet, options);
sr.ToImage(0, imageStream);
Image.FromStream(imageStream).Save("pic.png", ImageFormat.Emf);
//imagePartsList.Add(rangeName, );
};
And here the file with the result: for testing.zip (46.6 KB)
we use version 20.9.0.0
Kind regards,
Guido