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

Free Support Forum - aspose.com

Chart image position in pdf after resizing & replacing plotarea

Dear all, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

If I change the height of the plot area of a chart and also change the Y value of the plot area, then a chart image is not placed at the correct place if you save the file in pdf format (excel is fine). Please find attached all required files to reproduce the problem.

Thanks in advance

Erik

Hi Erik,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our internal issue tracking system with issue id CELLSNET-13466.

Thank you & Best Regards,

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

For making the value of plot area's position valid, please move the code(chart.Calculate()) and the end after setting the plot area’s position. Please check the attached code for reference.

Thank You & Best Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

if I apply your code I don’t get the correct output. The plot area appears shrunken and aligned to the right chart border. I’m using the latest aspose version (4.8.2.1)

Regards

Erik

Hi Erik,

After conducting a test, we did notice the image is not rendered correctly at its original position in the generated pdf file.

We will re-open the issue and let you know about it soon.


Thank you.

Hi Erik,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Please set the position of plot area before calling Chart.Calculate method.

chart.PlotArea.Y = 1000;

chart.PlotArea.X = 50;

chart.Calculate();

FileStream stream = new FileStream(@"F:\FileTemp\files\logochart.bmp", FileMode.Open, FileAccess.Read);

Aspose.Cells.Picture pic0 = chart.Shapes.AddPictureInChart(chart.PlotAreaWithoutTickLabels.Y + 25, chart.PlotAreaWithoutTickLabels.X + 15, stream, 90, 90);

wb.Save(@"F:\FileTemp\files\reportAspose.xls");

wb.Save(@"F:\FileTemp\files\reportAspose.pdf", FileFormatType.Pdf);

Thank You & Best Regards,

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

It doesn’t make any difference whether I call chart.Calculate() before or after the resizing of the plot area. If I apply the following lines of code, the image position in pdf isn’t correct and the chart is also shrunken and moved to the right site.

chart.PlotArea.Height = chart.PlotArea.Height - 350;

chart.PlotArea.Y = chart.PlotArea.Y + 450;

chart.PlotArea.X = 50;

chart.Calculate();

If I call chart.Calculate() before resizing the plot area, only the image position in pdf is wrong.

Maybe this problem also depends on changing the height of the plot area. Applying the lines of code shown above without changing the height of the plot area results only in the wrong image position in pdf

It is possible to set the image as a background image which is shown in the top left corner? (I think I saw this in excel 2007, but at the moment I’m creating xls files)

Regards

Erik

Hi Erik

It is possible to set
the image as a background image which is shown in the top left corner?
(I think I saw this in excel 2007, but at the moment I’m creating xls
files)

Well, I am afraid the feature is available but for Excel formats only, see the document: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/set-picture-as-background-fill-in-the-chart.html When you convert the spreadsheet to pdf, the would be lost because it is not currently supported.

We have added the feature into our issue tracking system with an issue id:
CELLSNET-13520. We will keep you updated about the feature soon.

Thank you.

Hi, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Will you also continue work to fix the basic issue of different image positions in pdf and excel?

Regards

Erik

Hi,

We will get back to you soon.

Thank you.

Hi,

As we have re-opened your original issue, we can check it later on.

Once we have any update about it, we will let you know.

Thank you.

Hi,

We have improved the related module in Aspose.Cells for .NET. Please try the attached fix.


Thank you.