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

The issues you have found earlier (filed as CELLSNET-56511) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

Hey Aspose Team,
I’m still having some issues with the way some of the charts look when converted to an image using aspose compared to what it looks like in excel.
I’ve attached a document called differences which list out the issues I have. I’ve also attached a template for you to use for testing.
Test.zip (1.7 MB)

@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.

CELLSNET-57742: icon set is not same as MS Excel
CELLSNET-57741: Invalid color of category axis

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.

Thanks. I found another issue as well.
The background pattern in a few charts are missing in the aspose output.
I’ve attached a comparison document
Differences.zip (180.7 KB)

I think you’ve missed one issue I’ve mentioned. Issue #3 - Label wrapping into another line. Please let me know if you’ve noticed this. Thanks.

@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-57768

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,

Given that the thread is getting lengthy, certain part/portion might be overlooked. Could you please provide a more detailed explanation along with a sample Excel file, output image/PDF, and screenshots to demonstrate the issue and emphasize the differences? We will also check it.

Sure, here you go:
Test.zip (1.3 MB)

@JThomas98,

Thanks for the template Excel file and differences document.

Which version of the API you are using? I tested your scenario/case using Aspose.Cells 25.1.x to convert the table range in the specified sheet to image, it works fine and the output image is OK without labels being wrapped. I used the following sample code with your template Excel file.
e.g.,
Sample code:

//Load the Excel file
Workbook workbook = new Workbook("e:\\test2\\Template_Stnd_Type1.xlsm");

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

// Set the print area with your desired range in the worksheet
worksheet.PageSetup.PrintArea = "G3:L17";

// Set OnePagePerSheet option as true
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.OnePagePerSheet = true;
options.ImageType = ImageType.Jpeg;
// Take the image of your worksheet
SheetRender sr = new SheetRender(worksheet, options);
string dataDir = "e:\\test2\\out_image1.jpg";
sr.ToImage(0, dataDir);

Please find attached the output image for your reference.
out_image1.jpg (156.6 KB)

I’m using version 25.1.2 of Aspose Cells

Here’s the code I used.

//Load the Excel file
Workbook workbook = new Workbook(@“C:\Aspose Test\Test\Template_Stnd_Type1.xlsm”);
// Access the worksheet
Worksheet worksheet = workbook.Worksheets[“KeyDrivers”];

        // Set the print area with your desired range in the worksheet
        worksheet.PageSetup.PrintArea = "G2: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.Jpeg,
            HorizontalResolution = 300,
            VerticalResolution = 300,
            OnlyArea = true
        };
        // Take the image of your worksheet
        SheetRender sr = new SheetRender(worksheet, options);
        string dataDir = @"C:\Aspose Test\Test\out_image1.jpg";
        sr.ToImage(0, dataDir);

Test.zip (2.5 MB)

@JThomas98
By testing with sample files and code on the latest version v25.1, we can reproduce the issue. Data label has line break error when converting chart to image.

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-57769

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
I opened the file “Template_Stnd_Type1.xlsm” and found charts looks like this:
250207.png (61.7 KB)

The lines seem to be different from the picture you have in your Word document, can you confirm this, thank you. I found this chart in the “Demographics” page.

What I mean is, the dotted lines I see in your xlsm file are made up of continuous dots. And in your word document, the picture I see, the dotted lines are made up of dots and lines. This template doesn’t seem to match your screenshot.

You are right. In the screenshot I shared, it appears as dashes and dots. This is because of the zoom level and it being a screenshot. When i zoom in enough, it comes in as dot. This is what it looks like when I zoom in and capture a screenshot:
Screenshot 2025-02-07 120606.png (17.0 KB)

@JThomas98,

Thank you for sharing the screenshot and relevant details. We will investigate the issue and respond with updates soon.

Hi @JThomas98
Thank you for your reply. I would like to confirm the following issues with you:
1, For CELLSNET-57741, about the dotted line in the chart, after you set the zoom, is the rendered picture actually consistent with Excel and there is no problem anymore?
2, For CELLSNET-57768, about the background pattern in chart, it should also be related to the resolution. Please try the following code:

        Workbook workbook = new Workbook(path + "Template_Stnd_Type1.xlsm");
        // Access the worksheet
        Worksheet worksheet = workbook.Worksheets["DetailCharts"];

        // Set the print area with your desired range in the worksheet
        worksheet.PageSetup.PrintArea = "B73:M107";
        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.Jpeg,
            HorizontalResolution = 100,
            VerticalResolution = 100,
            OnlyArea = true
        };
        // Take the image of your worksheet
        SheetRender sr = new SheetRender(worksheet, options);
        sr.ToImage(0, path + "MyOut.jpg");

You will clearly see the background lines in the output picture.
If you change the resolution, for example, scale by 5 times:

        HorizontalResolution = 500,
        VerticalResolution = 500,

It will present the effect of your screenshot. But if you zoom in the picture, you can see that there are actually background lines (See attachment). In fact, if you zoom in 5 times in Excel, you will also see the same situation.
So, this should be the different effects of the background pattern after the resolution change, please confirm. Thank you.
compare.zip (1.2 MB)

And for CELLSNET57769 ( Data label has line break error), our optimized results are as follows, which will take effect in version 25.2.
CELLSNET57769_250208.jpg (163.0 KB)

I understand the implication of setting the scaling of the image. When I set it to 100, these issues are no longer there. Thanks.

This is looking good. But please take a look at these screenshot:

Screen shot 1:
KeyDrivers_G1_L17.jpg (391.0 KB)
The above screenshot is from Worksheet KeyDrivers and cell address G1:L17.

In this screenshot, the section highlighted in yellow shows the differences in the graphical representation of arrows. The design itself is different in aspose.

The section highlighted purple shows how different the blue bar graphs are in terms of its size. With both scale factor set to 100. Aspose one seems to be quite different in terms of the spacing and dimension.

The section highlighted in red shows the graph text is missing in aspose.

Screenshot 2:
RespTable_K4_P24.jpg (265.6 KB)
Screenshot 2 is from worksheet RespTable cell address K4:P24

In the section highlighted in purple, when you compare where the line breaks/carriage return are after each sentence, you’ll notice that the one in aspose splits the sentence into the next line usually a word off the original one. Look at the Line break/CR at the end of each line in aspose and compare the position of the line break/CR in excel.

@leoluo
Thanks for further details. Let us investigate and analyze your issue in details. Hopefully we could figure it out soon. Once we have an update on it, we will let you know.