Hello,
I’ve attached a xlsx document that contains a chart(source) and an image(result of chart.ToImage). The code sequence is the following:
var xlsDoc = new Workbook(“C:\doc.xlsx”);
var chart = xlsDoc.Worksheets[0].Charts[0];
var img = chart.ToImage(new ImageOrPrintOptions
{
Quality = 100,
VerticalResolution = 200,
HorizontalResolution = 200,
PrintingPage = PrintingPageType.IgnoreBlank,
ImageFormat = ImageFormat.Jpeg,
OnePagePerSheet = true,
OnlyArea = true,
ChartImageType = ImageFormat.Bmp
});
img.Save(“C:\img.jpg”,ImageFormat.Jpeg);
You can see that the resulting image is different from the original chart: the x axis from the image doesn’t contain the same values as the x axis from the chart. I’m getting the same result when saving the image as Png.
Thank you,
George Radu
Software Developer
IBM Romania