Excel - Chart Texts Misaligned in Chart - overlay shifted up

Dear Aspose.
As you can see from example.

When Worksheet is printed, position of chart and its overlay is not aligned correctly.

  1. Rectangles and red texts are more on top when printed by Aspose then in original.
  2. Legend texts are displayed diagonally in Excel but printed horizontally in Aspose.

Attaching image demonstrating the difference in output:
BUG-1265387-Chart-Texts-Misaligned.xlsx-Difference.png (227.3 KB)

Attaching sample application demonstrating the issue:
BUG-1265387-Chart-Texts-Misaligned.zip (255.3 KB)

We have used Windows and latest Aspose.Cells 25.2 to produce the results.

Best Regards
Pavel

@ottap

It seems you are experiencing issues with chart alignment and text display when printing from Aspose.Cells. Here are a few suggestions to address the problems you mentioned:

  1. Chart Positioning: If the rectangles and text overlays are misaligned when printed, you may need to adjust the chart’s position and size programmatically. You can use the following code snippet to reposition and resize the chart:

    Workbook workbook = new Workbook("path/to/your/file.xls");
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Chart chart = worksheet.getCharts().get(0);
    
    // Resize the chart
    chart.getChartObject().setWidth(400);
    chart.getChartObject().setHeight(300);
    
    // Reposition the chart
    chart.getChartObject().setX(250);
    chart.getChartObject().setY(150);
    
    // Save the modified workbook
    workbook.save("path/to/save/modified_file.xls");
    

    This code allows you to set the width, height, and position of the chart, which may help in aligning it correctly when printed.

  2. Legend Text Orientation: For the issue with legend text being displayed diagonally in Excel but horizontally when printed, ensure that the text orientation settings for the legend are correctly configured. You may need to check the properties of the legend in your chart and adjust them accordingly.

If these adjustments do not resolve the issues, consider checking for any updates or patches for Aspose.Cells, as newer versions may contain fixes for known bugs related to chart rendering and printing.

If you continue to face challenges, please provide additional details or examples, and I would be happy to assist further.

Sources:
[1]: Change Chart Position and Size Example

Thanks for offered workaround. If we have only one chart we can use your advice, write a routine to recognize and fix layer offset.

Unfortunately there are more charts being processed and it is tricky for us to programmatically recognize which layer and of how many points is printed misaligned and needs correction.

@ottap
We can reproduce your mentioned issues and have opened the two issues:
CELLSNET-57980 Rectangles and red texts are more on top when printed by Aspose then in original.
CELLSNET-57981 Legend texts are displayed diagonally in Excel but printed horizontally in Aspose.
If there is any update , we will inform you soon.

Hi @ottap
We can see from your screenshot that you are using net8.
Could you please confirm your specific usage environment, whether it is Windows or Linux, and you are using Skiasharp or System.Drawing.Common for the graphics library.
Different environments and graphics libraries may cause differences, in order to better test and correct, we need to know these, thank you.

For sample creation was used system with windows - application producing results is attached.

@ottap
Thank you for your feedback. We will further investigate your issue. We will notify you promptly once there are any updates.

Hi @ottap

Please try the latest version of Aspose.Cells 25.3, I just tested it in 25.2 and 25.3, the results are as follows. This issue may have been resolved in daily optimization. Please let us know the result after you try it, thank you very much.

250326.png (113.0 KB)