Korean font in Excel chart label

I am having a problem using Korean text in chart labels. My characters gets all squished together and are illegible. See the attachment for an example.


I am opening the Excel file with Aspose.Cells, putting the Korean text into the cells bound to the chart labels, and then calling the ToImage function to export the chart to an EMF in a memory stream, which I am inserting into a Word file using Aspose.Words.

Any advice? Thanks!

Hi,

Thanks for your posting and using Aspose.Cells.

Are all the fonts used in your Excel file installed on your machine? If not then please install them.

Please provide us your sample code and source excel file replicating the issue with the latest version:

Aspose.Cells for .NET 8.6.3

. We will look into your issue and update you asap.

No problem. I have attached a sample which replicates the problem. This is using the latest Aspose versions.


While creating the sample, I’m realizing that this may be a problem with Aspose.Words more than Aspose.Cells.

If you run the application, it opens the Excel file and then:
  • Exports the workbook to a PDF, which looks fine
  • Exports the chart to a JPG, which looks fine
  • Exports the chart to an EMF, which I believe looks fine
  • Creates a new Word file and inserts the EMF - This file cannot open in Word, because it indicates it is corrupt
  • Exports the Word file to a PDF - This file has the Korean letters all overlapping
So it seems like Aspose.Words is having some kind of trouble with the EMF file generated by Aspose.Cells, which results in a corrupted DOCX and a PDF with spacing issues in the chart graphic.

If there is a better way to get the charts into the document, which doesn’t involve putting them into a JPG (which wouldn’t maintain the same quality), I’m open to your advice.

Thank you for your help!

Hi,


Thank you for sharing the sample project.

We have evaluated your presented scenario while using the latest revisions of Aspose.Cells for .NET 8.6.3.2 & Aspose.Words for .NET 15.12.0, and we think you are correct as the problem seems to be more related to Aspose.Words for .NET API for handling EMF files generated with Aspose.Cells for .NET API. Please note, during our testing, we have generated the images (Jpeg & EMF) of the chart using Aspose.Cells, which look good when viewed in different image viewing applications. We have also inserted the Aspose.Cells’ generated EMF in a Word document manually using Microsoft’s Word application in order to convert it to PDF. In this case, the result is correct as well (please check attached archive for resultant files). However, when we tried to insert the EMF in a new Word document using Aspose.Words, the resultant PDF shows the overlapping of textual contents in the chart’s image.

Based on the investigation as discussed above, we are going to move this thread to Aspose.Total support forum for broader coverage. We will soon analyze the presented behaviour from Aspose.Words perspective and share our findings here.

Regarding alternative solutions, if you are concerned about the quality of the exported images then the only available option is to export the charts in metafile format (EMF), which tends to generate incorrect final result at the moment so we need to further investigate the matter in order to assist you further in this regard.

Hi John,

Thanks for your inquiry.

You are getting corrupted DOCX because the SaveFormat is incorrect in your code. See the following incorrect SaveFormat. Please change it to SaveFormat.Docx.

doc.Save(".\Test.docx", Aspose.Words.SaveFormat.Pdf);

Regarding Korean text issue in output Pdf, we have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-12925. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks Tahir, and thanks for catching that bug in my sample code.

As it has been a month, I’m just following up to see if there is any update to this issue. Thank you!

Hi John,

Thanks for your inquiry. We regret to share with you that this issue (WORDSNET-12925) has been postponed. We will inform you via this forum thread as soon as there are any further developments. We apologize for your inconvenience.

As a workaround of this issue, please use MetafileRenderingOptions.EmfPlusDualRenderingMode as EmfPlusDualRenderingMode.Emf. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.InsertImage(MyDir + "Chart.emf");

PdfSaveOptions options = new PdfSaveOptions();
options.MetafileRenderingOptions.EmfPlusDualRenderingMode = EmfPlusDualRenderingMode.Emf;

doc.Save(MyDir + "Out.pdf", options);

The issues you have found earlier (filed as WORDSNET-12925) have been fixed in this Aspose.Words for .NET 23.6 update also available on NuGet.