Hi,
I am trying to copy paste a chart as an image (back into the worksheet) similar to how in Excel you can paste a chart as an image.
I am using the following code:
var workbook = new Workbook(“ChartAsPic.xlsx”);
var sheet = workbook.Worksheets[0];
var chart = workbook.Worksheets[0].Charts[0];
var ms = new MemoryStream();
chart.ToImage(ms, ImageFormat.Png);
sheet.Shapes.AddPicture(23, 10, ms, 100, 100);
workbook.Save(“ChartAsPicOut.xlsx”);
I am not sure if this is the recommended way of doing this, but the resulting image looks ok a part from the fonts being very ‘blocky’.
I have attached the concerned Excel file where you can see the result from Excel’s own ‘paste as image’ implementation.
I have also attached a zoomed-in screenshot to show you what I mean with ‘blocky’ (top is Aspose, bottom is Excel’s own picture).
The ‘blocky’ characters exist for all axes and legends including the chart title.
Am I adding the picture using the wrong method or is this something that will have to be fixed as a bug?
Best regards.