Layout issue on axis labels in image rendered from Excel chart


#1

Hi,

When rendering an Excel chart to an image, I noticed some axis labels became two lines and overlapped the legend.

Code:

var fileName = “axis line”;
var workbook = new Workbook(fileName + “.xlsx”);
var options = new ImageOrPrintOptions
{
ImageType = ImageType.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true,
Transparent = true
};

        workbook.Worksheets["sheet1"].Charts[0].ToImage(fileName + ".emf", options);

I’ve attached the test files and a screenshot for your reference. Could you please help me check this?

axis line.png (44.2 KB)
axis line.zip (14.8 KB)

Thanks,


#2

@ServerSide527,

Thanks for the template file, sample code, screenshot and output image.

Please try our latest version/fix: Aspose.Cells for .NET v18.10.7:

Aspose.Cells18.10.7 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.10.7 For .Net4.0.Zip (4.7 MB)

If you still find the issue with v18.10.7, kindly do provide the underlying font files used in the workbook (e.g “Source Sans Pro”), we will check it soon.


#3

Hi,

Thanks for the update. I have tried 18.10.7 but still no luck. Please find my attached SourceSansPro-Regular font.

SourceSansPro-Regular.zip (126.8 KB)

Thanks,


#4

@ServerSide527,

Thanks for sharing the font file.

I did install the font on my pc (OS: Windows 8) but still the exception (“Font ‘Source Sans Pro’ does not support style ‘Regular’”) occurred. Even Ms Excel does not show the axis labels when opening the file into it, see the screenshot for your reference:

Could you change the font and re-save the file to provide us here to reproduce the issue on our end, we will check it soon.


#5

Hi,

Thanks for your feedback. I’ve attached the test files with changed font ‘Calibri’ and was still able to reproduce the issue.

Please find my attachment.

axis line (2).zip (14.8 KB)

Meanwhile I have another post also using the same font in the attachment, would you like me to update that as well?

Thanks


#6

@ServerSide527,

I tried your new file (I still have to remove the TextBox because it is using “Source Sans Pro” font) with your sample code using v18.10.7 and the output image is fine tuned. Please find it attached.

Let us know if you see any issue with the output image.
axis line.zip (4.1 KB)


#7

Hi,

Thanks for your tests. I have taken a look and it seems it used an unlicensed version, I’m not sure if that would make a difference. Also even if the text was not wrapped into two lines, some labels are missing in your output:
image.png (4.4 KB)

Could you please check that?

Thanks,


#8

@ServerSide527,

I am also using Aspose.Cells for .NET v18.10.7 without a license. Could you open my output image file if you see any issue in it.


#9

@Amjad_Sahi

I mean the one I used was the licensed version and I don’t know if that was why it made a difference on your output.

The screenshot I took in my last reply was from your output, where the labels are still incorrect. Could you check that?


#10

@ServerSide527,

I used a valid license now (to be set in the code at the start) and tried the code segment with v18.10.7 to produce the output image, the output image is again fine tuned. Please find it attached too. Also, see the screenshot when I opened the output image into MS Paint, you can see the x-axis labels are ok.

Moreover, I saved your template file to PDF and now I found those labels are in two lines. So, I find the issue only when I save your template file to PDF file format. But using your sample code (Chart to image feature) to render to image for the chart does not reproduce the issue. Do you want me to log a ticket for Excel to PDF rendering? We can log a ticket for it on your confirmation.
axis line_new1.zip (3.6 KB)


#11

Hi,

Many thanks for the investigation. It is still weird that when I opened your attachment using paint, the text on ‘Mar’ is still missing, while clearly in your pc the image is looking ok. (I’ve attached a gif for you)
record.zip (273.5 KB)

There’s also one thing I found very weird on this image: if I drag and drop this image to a Word document, and saved to pdf using Word ‘save as’. It throws an error:
image.png (13.9 KB)

I’ve attached the docx with your image for your reference. You can try saving it to pdf using Office and see the result. Maybe it is also related?
cannotsavedtopdf.zip (13.1 KB)

And thanks for observing the issue in pdf, as it could be related, could we log a ticket on this first?

Thanks


#12

@ServerSide527,

That is strange. Could you try your scenario on some other machines with different OS and let us know your feedback. Also provide details about your environment (OS, CPU, display settings, .NET Framework versions, etc.) where you find this issue, we will log the details.

I am able to reproduce the issue as per your description and details. May be this issue is relevant to your original issue. I have logged a ticket with an id “CELLSNET-46451” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.


#13

Hi, @Amjad_Sahi

Many thanks for your information and the ticket related to the issue on pdf.

Regarding the image difference, as you suggested I have tried using different machines to open your emf, and here are my findings

Machine 1: Windows 7 SP1 64bit, gdi32.dll version 6.1.7601.24260, GdiPlus.dll version 6.1.7601.24234, the highest .net framework is 4.7.1, the text is missing
Machine 2: Windows 10 64bit, gdi32.dll version 6.2, GdiPlus.dll version 6.2, the highest .net framework is 4.7.1, the text is not missing
Machine 3: Windows Server 2012, gdi32.dll version 6.3, GdiPlus.dll version 6.3, the text is not missing.

Could it be the version of the gdi32, gdi+ installed on the OS that made the graphic difference? Does Aspose have any known limitation on the gdi+ versions? Which gdi32.dll and GdiPlus.dll version are you using?

Thanks,


#14

@ServerSide527,

Thanks for sharing details about your environments and findings.

It looks like issue occurs on the machines with gdi32 and gdi+ libraries having version < 6.2. I have logged your details and findings against your issue into our database. We will investigate and look into your issue soon.

Once we have an update on it, we will let you know.


#15

@ServerSide527,

We don’t know why your machine does not display the text. We use Metafile(Stream, IntPtr, Rectangle, MetafileFrameUnit, EmfType) method to create emf image and specify EmfType.EmfPlusDual. EmfPlusDual means that all EMF+ records in the metafile are associated with an alternative EMF record. Metafiles of type EmfPlusDual can be displayed by GDI or by GDI+. We will try to fix the issues and provide a new hot-fix this weekend.

Keep in touch.


#16

@ServerSide527,

Please try our latest version/fix: Aspose.Cells for .NET v18.11.6 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells18.11.6 For .Net2_AuthenticodeSigned.Zip (4.7 MB)
Aspose.Cells18.11.6 For .Net4.0.Zip (4.7 MB)