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

Free Support Forum - aspose.com

Chart legend rendering issues

Hello! When using SheetRender to export chart container range as image, some issues take place:

- text below the legend is shrinked/compressed
- legend’s width is increased (more values displayed on one row)

- axis values are out of the cell’s boundaries

Please, check the attached console project and image showing the above issues!

Thank you.


Thanks for providing us the sample project and screen shot.

I can notice two of the three issues you have mentioned.

- text below the legend is shrinked/compressed
- legend's width is increased (more values displayed on one row)

The third issue you mentioned, I think if we could open the sheet in the Print Preview (in MS Excel), the view is same as the output image, may be you are asking for a bold category axis labels, anyways we need to check it out and we will do.

Sample code:

var workbook = new Workbook(@"E:\test2\TextBoxInExcelchartlegend\TextBoxInExcel\bin\Debug\Legend.xls");

var imageOptions = new ImageOrPrintOptions
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Png,
OnePagePerSheet = true

var worksheet = workbook.Worksheets[0];

worksheet.PageSetup.PrintArea = string.Format("a1:p20");
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.BottomMargin = 0;

var sheetRender = new SheetRender(worksheet, imageOptions);

sheetRender.ToImage(0, @"E:\test2\TextBoxInExcelchartlegend\TextBoxInExcel\bin\Debug\output1.png");

I have logged a ticket with an id: CELLSNET-40913. We will look into your issue(s) to figure it out soon.

Thank you.


Please try our latest version Aspose.Cells 21.6.0.
If you find any issue, please provide the source Excel file to help us analyze it.