The image Aspose.Cell captures does not look like the original excel chart

@JThomas98,

You’re welcome! I’m glad to hear the output image meets your needs well.

Hi Aspose Team, I’m seeing another set of issues:

            // Access the worksheet
            Worksheet worksheet = workbook.Worksheets["Segmentation"];

            // Set the print area with your desired range in the worksheet
            worksheet.PageSetup.PrintArea = "P1:AR39"; // "P47:AR85"
            worksheet.PageSetup.LeftMargin = 0;
            worksheet.PageSetup.RightMargin = 0;
            worksheet.PageSetup.TopMargin = 0;
            worksheet.PageSetup.BottomMargin = 0;
            // Clear any header/footer as they'll be captured when converting the worksheet to image
            worksheet.PageSetup.ClearHeaderFooter();

            // Set OnePagePerSheet option as true
            ImageOrPrintOptions options = new ImageOrPrintOptions()
            {
                OnePagePerSheet = true,
                ImageType = Aspose.Cells.Drawing.ImageType.OfficeCompatibleEmf,
                HorizontalResolution = 100 /*(int)oldShape.ImageData.ImageSize.HorizontalResolution*/,
                VerticalResolution = 100,
                OnlyArea = true
            };
            // Take the image of your worksheet
            SheetRender sr = new SheetRender(worksheet, options);
            string dataDir = @"C:\Aspose Test\Test_02272025\out_image1.emf";
            sr.ToImage(0, dataDir);

You can see that the first bar graph on the right has the value on top either being cropped out or barely visible. And majority of the vertical line to the right of this bar graph is missing.
Test_02272025.zip (856.6 KB)

And this template I have shared also contains another example that can be used to test CELLSNET-57840 - Labels moved for small proportions in Pie chart;
Worksheet: RespDemographics
Chart10
PieChart_Out1.png (8.9 KB)

→ When you compare charts in worksheet QuadrantMap, you’ll notice that the horizontal and vertical axis labels in “R1:AG38”, “R40:AG77” is in a different font and the footer text seems to be really bold (look at comparison2.PNG for reference)
→ And lastly, certain plottings in each quadrant is pointing the wrong way when compared to its excel counter part (look at comparison3.PNG for reference)
Test_02272025_2.zip (869.8 KB)

            // Access the worksheet
            Worksheet worksheet = workbook.Worksheets["QuadrantMap"];

            // Set the print area with your desired range in the worksheet
            worksheet.PageSetup.PrintArea = "R1:AG38"; // "R40:AG77"
            worksheet.PageSetup.LeftMargin = 0;
            worksheet.PageSetup.RightMargin = 0;
            worksheet.PageSetup.TopMargin = 0;
            worksheet.PageSetup.BottomMargin = 0;
            // Clear any header/footer as they'll be captured when converting the worksheet to image
            worksheet.PageSetup.ClearHeaderFooter();

            // Set OnePagePerSheet option as true
            ImageOrPrintOptions options = new ImageOrPrintOptions()
            {
                OnePagePerSheet = true,
                ImageType = Aspose.Cells.Drawing.ImageType.OfficeCompatibleEmf,
                HorizontalResolution = 100 /*(int)oldShape.ImageData.ImageSize.HorizontalResolution*/,
                VerticalResolution = 100,
                OnlyArea = true,
                SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
            };
            // Take the image of your worksheet
            SheetRender sr = new SheetRender(worksheet, options);
            string dataDir = @"C:\Aspose Test\Test_02272025_2\out_image1.emf";
            sr.ToImage(0, dataDir);

@JThomas98

By testing with the latest version v25.2 using the following example code, we were able to reproduce the issue. The top value of the first bar chart on the right has been cropped when converting chart to emf, but the vertical lines were correct. Please check the attachment. out_net.zip (17.9 KB)

Additionally, set the image type to ImageType.Emf can achieve better results. The sample code as follows:

Workbook workbook = new Workbook(filePath + "Chart_TEMPLATE.XLSM");
// Access the worksheet
Worksheet worksheet = workbook.Worksheets["Segmentation"];

// Set the print area with your desired range in the worksheet
worksheet.PageSetup.PrintArea = "P1:AR39"; // "P47:AR85"
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
// Clear any header/footer as they'll be captured when converting the worksheet to image
worksheet.PageSetup.ClearHeaderFooter();

// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions()
{
    OnePagePerSheet = true,
    ImageType = Aspose.Cells.Drawing.ImageType.Emf,
    HorizontalResolution = 100 /*(int)oldShape.ImageData.ImageSize.HorizontalResolution*/,
    VerticalResolution = 100,
    OnlyArea = true
};
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
string dataDir = filePath + @"out_net.emf";
sr.ToImage(0, dataDir);

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57938

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@JThomas98

By testing with the latest version v25.2 using the following example code, we were able to reproduce the issue. The position of the pie chart label is incorrect when converting chart to image. Please check the attachment. chat_net.png (9 KB)

Workbook workbook = new Workbook(filePath + "Chart_TEMPLATE.XLSM");
// Access the worksheet
Worksheet worksheet = workbook.Worksheets["RespDemographics"];
Chart chart = worksheet.Charts["Chart 10"];
chart.ToImage(filePath + "chat_net.png");

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57939

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@JThomas98

By testing with the latest version v25.2 using the following example code, we were able to reproduce the issue. Horizontal and vertical labels are garbled when converting chart to image. Please refer to the attachment. out_image_R1_AG38.zip (17.5 KB)

Workbook workbook = new Workbook(filePath + "Chart_TEMPLATE.XLSM");
// Access the worksheet
Worksheet worksheet = workbook.Worksheets["QuadrantMap"];

// Set the print area with your desired range in the worksheet
worksheet.PageSetup.PrintArea = "R1:AG38";
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
// Clear any header/footer as they'll be captured when converting the worksheet to image
worksheet.PageSetup.ClearHeaderFooter();

// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions()
{
    OnePagePerSheet = true,
    ImageType = Aspose.Cells.Drawing.ImageType.Emf,
    HorizontalResolution = 100 /*(int)oldShape.ImageData.ImageSize.HorizontalResolution*/,
    VerticalResolution = 100,
    OnlyArea = true,
    SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
};
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
string dataDir = filePath + @"out_image_R1_AG38.emf";
sr.ToImage(0, dataDir);

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57940

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@JThomas98

By testing with the latest version v25.2 using the following example code, we were able to reproduce the issue. Certain plottings in each quadrant is pointing the wrong way when converting chart to image. Please refer to the attachment. out_image_R40_AG77.zip (24.3 KB)

Workbook workbook = new Workbook(filePath + "Chart_TEMPLATE.XLSM");
// Access the worksheet
Worksheet worksheet = workbook.Worksheets["QuadrantMap"];

// Set the print area with your desired range in the worksheet
worksheet.PageSetup.PrintArea = "R40:AG77";
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
// Clear any header/footer as they'll be captured when converting the worksheet to image
worksheet.PageSetup.ClearHeaderFooter();

// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions()
{
    OnePagePerSheet = true,
    ImageType = Aspose.Cells.Drawing.ImageType.Emf,
    HorizontalResolution = 100 /*(int)oldShape.ImageData.ImageSize.HorizontalResolution*/,
    VerticalResolution = 100,
    OnlyArea = true,
    SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
};
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
string dataDir = filePath + @"out_image_R40_AG77.emf";
sr.ToImage(0, dataDir);

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57941

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@JThomas98
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57943

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @JThomas98
For the issue of a missing datalabel you mentioned before, we have recorded it as “CELLSNET-57943” and fixed it, the result is as follows, it will take effect in version 25.3.
CELLSNET-57943-fix.png (1.9 KB)

Also, for the area you previously circled in yellow in “KeyDrivers_G1_L17.jpg”, I would like to confirm with you, do you referring to the style of the arrow, which is different from Excel? The Excel arrow seems to be sharper and more slender, which is the problem you want to solve, right?
arrow.png (2.2 KB)

@John.He, you are right about the vertical line being correctly in that particular chart. Please refer range “Segmentation!P47:AR85”. Here you’ll see both the issues happening, vertical line separation is missing as well as the value at the top of the left most bar chart being cropped.
I’ve attached a screenshot for your reference:
Comparison.png (147.3 KB)

@leoluo, what is the issue assigned to ticket #CELLSNET-57943? I didn’t find a description for the issue.

@leoluo, issue ID CELLSNET-57943 fix looks great! Thank you for sharing the output.

Now with respect to “KeyDrivers_G1_L17”, as you mentioned, the style of the arrow is different meaning the arrows in excel are slimmer and more sharper looking and that is what I’m expecting to get fixed.
But I have more pressing issues to pinpoint that I’m seeing in this particular chart. Please look at this screenshot of “KeyDrivers!G1:L17”
KeyDriversP1_G17.png (435.9 KB)

Highlighted as #1 in this screenshot shows the discrepancy in the spacing between the text and the arrow.
Highlighted as #2 shows how the text is overlapping the arrow.

This is the code I’ve used:

            // Access the worksheet
            Worksheet worksheet = workbook.Worksheets["KeyDrivers"];

            // Set the print area with your desired range in the worksheet
            worksheet.PageSetup.PrintArea = "G1:L17";
            worksheet.PageSetup.LeftMargin = 0;
            worksheet.PageSetup.RightMargin = 0;
            worksheet.PageSetup.TopMargin = 0;
            worksheet.PageSetup.BottomMargin = 0;
            // Clear any header/footer as they'll be captured when converting the worksheet to image
            worksheet.PageSetup.ClearHeaderFooter();

            // Set OnePagePerSheet option as true
            ImageOrPrintOptions options = new ImageOrPrintOptions()
            {
                OnePagePerSheet = true,
                ImageType = Aspose.Cells.Drawing.ImageType.Emf,
                HorizontalResolution = 100,
                VerticalResolution = 100,
                OnlyArea = true,
                SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
            };
            // Take the image of your worksheet
            SheetRender sr = new SheetRender(worksheet, options);
            string dataDir = @"C:\Aspose Test\KeyDriversP1_G17.emf";
            sr.ToImage(0, dataDir);

@JThomas98
Thanks for your confirm.
And we have opened the following new ticket :CELLSNET-57953 in our internal issue tracking system for “discrepancy in the spacing between the text and the arrow”

@JThomas98

The issue #1 is caused by different text wrap in the Cell. Please check the difference of the last word in the first line.
The text wrap may be different on different Windows with different system display scale setting.(e.g. 100%, 200%). Aspose.Cells takes the result on Windows with 100% system display scale setting as the rule. Please check the screenshot of Excel on Windows with 100% system display scale setting. It is same as Aspose.Cells generated result.
Screenshot_issue1_text_wrap.jpg (101.1 KB)

Hi @JThomas98
CELLSNET-57839 (Missing legend key) is fixed, it will take effect in version 25.3.
CELLSNET-57839-fix.png (23.6 KB)

This issue is different from the cause of “CELLSNET-55343”, and we have all conducted tests so you don’t have to worry about the problem of “CELLSNET-55343” appearing again.

Sometimes the logic of excel for legend is complex, if you encounter other issues, please pointing out them, we will continue make corrections. Thank you.

@peyton.xu ,
Issue #1 seems to no longer be an issue. I appreciate the suggestion! Please take a look at the output comparison of aspose output to excel when scaling is set to 100%.
KeyDriversP1_G16_Scaling100.png (111.3 KB)

@leoluo,
This is looking good. Thank you for letting me know this had nothing to do with the previous issue of legends missing.

@JThomas98,

Thanks for the screenshot and details.

I noticed the value “+0.02” is still overlapping even in 100% display settings. We have logged your findings and screenshot with the existing ticket “CELLSNET-57953” into our database. We will evaluate it soon.

You are welcome and thank you for confirming that it’s unrelated to the previous issue of missing legends.

1 Like

@leoluo, I just remembered that this issue (CELLSNET-57839) had two parts:

  1. Missing legends
  2. Blue headers had vertical lines across it.

In the screenshot you shared, I see that the legends issue has been fixed and I also don’t see the lines in the blue header. So my assumption is that both parts of the issue has been fixed. Am I right?