Search code examples
asp.netchartssyncfusion

Syncfusion ChartWebControl.SaveImage messing with image ratio


I've migrated a ASP.NET Web Forms solution from .NET framework 3.5 to .NET 4.0 and along with it, from syncfusion 6.303.1.8 to 13.240.0.29.

I'm currently fixing the differences.

I have some ChartWebControls in an aspx page, which are all 400x324. It all worked and continues working well in the page. Eventually, those charts are exported to XLS. They are saved to a Png Stream and then added to the sheet Pictures collection:

this.cwb_chart1.SaveImage(stream1, ImageFormat.Png);
sheet.Pictures.AddPicture(4, 2, stream1);

But if I check the resolution of the Image in the Stream saved, even before adding it to the Worksheet, it shows 560x324, not 400x324. All charts are now getting wider.

I tried to resize the control do 800x648, then saving it to stream and then resizing the image to 400x324 before adding to the Worksheet. The ratio is maintained, but the chart becomes unreadable, because the letters get too small.

Also tried using SaveImage(Size chartSize, bool drawHiddenElements) specifying 400x324 size, but the behaviour is the same.

Is there a way to preserve the original resolution of 400x324 for all charts when saving?


Solution

  • For the related query, we have confirmed that the issue with "Chart export image size not proper resolution in Excel" is a defect and logged a defect report with new incident 14315. The fix for this issue will be included in our Volume 3 main release which has been scheduled to be rolled out at the end of September 2015.

    Please contact Syncfusion Support if you have any related questions.