How to access Asian/Latin font in chart legends / axis labels / textboxes?

@ServerSide527

Thanks for using Aspose APIs.

Please also provide us sample Excel file as you have shown in your screenshots. It will help us look into your issue more closely and precisely and we will let you know any solution or workaround if possible. Thanks for your cooperation in this regard and have a good day.

sample.zip (776.0 KB)

Hi,

I’ve attached the excel file I used for testing and also a recording of the steps in a gif file. Could you please check this?

Thanks,

@ServerSide527

I am unable to find two dropdowns as shown inside your GIF image. Please see the following screenshot and its comment for your reference. Let us know how can we enable Microsoft Excel to show two dropdowns like yours.

Screenshot:

sc.png (151.9 KB)

Hi,

I’m using 2016 but this feature is available from Office 2010 (or even earlier). You need to add the language in File → Options → Add an Asian language and restart Office. (see my attached screenshot)
image.png (68.5 KB)

This will then allow you to set more fonts depending on the text in the font settings for shapes. You can also visit the option by Start → All Programs → Microsoft Office → Office Tools → Language Preferences.

In fact this is supported and easily accessible in a Word document using Aspose.Words (Font.NameFarEast | Aspose.Words for .NET), so I’m wondering how to access it in Excel using Aspose.Cells.

Could you please help me with this?

Thanks,

@ServerSide527

Thanks for using Aspose APIs.

We are afraid, it seems this feature is not available at the moment. We will need to look into it and implement it if possible. Once, we will have some fix or other news for you, we will update you asap.

This issue has been logged as New Feature as follows

  • CELLSNET-46058 - NameFarEast property needed in Aspose.Cells to set or access Asian/Latin font in chart legends or axis labels or textboxes etc.

Hi,

Many thanks for the follow-up. In fact we considered it as an issue (not only a new feature) because it had impact on the existing image rendering feature. A chart with this kind of settings cannot be rendered properly to an image. Please find my test code below:

var workbook = new Workbook(@“test.xlsx”);
var options = new ImageOrPrintOptions
{
ImageFormat = ImageFormat.Emf,
ChartImageType = ImageFormat.Emf,
OnlyArea = false,
TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
OnePagePerSheet = true
};
workbook.Worksheets[0].Charts[0].ToImage(@“testout.emf”, options);

I’ve attached the test files for your reference. As you can see if I copy/paste manually using Office the fonts are correct for both Asian and Latin characters, while if I used Aspose rendering the font were wrong for Asian text (Please see my screenshot).

screenshot.png (13.9 KB)
test files.zip (60.0 KB)

I wanted to attach the font file (simkai.tff for KaiTI) for your convenience but the file size exceeded the limit, so if you still need the font file please let me know the alternative method to provide, otherwise you can use any Asian font to reproduce the issue.

Could you please check the attachments and see if the image rendering is a separate issue and could it be fixed?

Thanks

@ServerSide527

Thanks for using Aspose APIs.

You get rendering error because this feature i.e. CELLSNET-46058 is not supported at the moment. Once, this feature is implemented, we think, rendering problems of the chart should also be resolved.

However, we have tested your code and found the rendering problem in chart so we have recorded it as follows.

  • CELLSNET-46062 - Legend of Chart is not rendered properly because of Asian and Latin Characters

@ServerSide527

We only input the name of the font in MS Excel UI, but there are 4 attributes for <a:ea font in the file. i.e.

<a:ea typeface="MS Gothic" panose="020B0609070205080204" pitchFamily="49" charset="-128"/>

We could not simply get other 3 attributes by the font’s name. If you insist on this feature, please list your needed fonts’ names.

Hi,

Thanks for the investigation.

I believe we only need Aspose to access the properties that we can naturally access using Ms Excel, if there’s no equivalent in Ms Office (as in, they are hard-coded in Excel), we should be in the good place. We expect Aspose to behave the same as in office, but we don’t expect it to access anything beyond using Office manually.

Hope this could clarify your question.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

We have logged your comment in our database for further consideration and evaluation. Once, we will have some news for you, we will update you asap.

Hi,

I have noticed in 18.5 release note it mentioned “Adds TextOptions.FarEastName and TextOptions.LatinName properties”.

Regarding ticket 46058, I have tried myself and noticed I could indeed access the FarEast font and the Latin font. However I still couldn’t find a way to access these options in chart legend. Is there any update on this?

Regarding ticket 46062, I understand if the ticket above is still on going, this is not expected to have been fixed at the moment. But I already noticed some text alignment issue in the image if I tried to render a shape with such settings using my code in How to access Asian/Latin font in chart legends / axis labels / textboxes? - #7 by ServerSide527 and the new test template I’ve attached:
image.png (105.5 KB)
testfilesfor1851.zip (29.7 KB)

I hope this could help your further development on this feature.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

You should use 18.5.1 instead of 18.5. We have added the following properties for your needs.


Adds TextOptions.FarEastName and TextOptions.LatinName property

Get and sets the Far East and Latin name of the font.


You can download 18.5.1 from NuGet

NuGet Gallery | Aspose.Cells 18.5.1

or from the following links.


Please note:

We are still working on supporting them for Charts.

Hi,

In fact the version I tested this morning was 18.5.1 already and all my conclusion and comments above were based on this version (including the alignment issue in rendering).

I’m looking forward this feature fully supported in charts and the image text alignment issue being corrected.

Thanks

@ServerSide527

Thanks for using Aspose APIs.

I have tested this issue with your sample code (as shown below) and sample Excel file and it generated the correct output Emf image.

There might be some issues in it however, you should elaborate them clearly by highlighting them as they are not easily noticeable.

Download Link:
Output EMF.zip (4.6 KB)
testfilesfor1851.zip (29.7 KB)

C#

var workbook = new Workbook("test.xlsx");
var options = new ImageOrPrintOptions
{
    ImageFormat = ImageFormat.Emf,
    ChartImageType = ImageFormat.Emf,
    OnlyArea = false,
    TextRenderingHint = TextRenderingHint.ClearTypeGridFit,
    OnePagePerSheet = true,
    HorizontalResolution =200,
    VerticalResolution = 200
};
workbook.Worksheets[0].Charts[0].ToImage(@"output.emf", options);

Hi,

Thanks for looking into this. Looks like your pc didn’t have the Asian font I used installed. The font for Asian is KaiTi. (You can see the font in my screenshot is different from your screenshot)

image.png (95.7 KB)

I couldn’t attach the font because of the size limit on the forum, but you may find it here: Download KaiTi Font - Thousands of fonts to download for free

Thanks,

@ServerSide527

Thanks for using Aspose APIs.

KaiTi font is already installed on my machine and when I try to install the font that is downloaded from your location (URL), I get the message that this font is already installed on your machine.

Please see the following screenshots.



Hi,

Many thanks for checking this. I had a look again and think it might be the Latin font, not the Asian font. Please see my screenshot where you can see the Latin text in your output looks different than the one in Excel/my output:
image.png (92.8 KB)

I’ve attached the font file for your convenience. Could you please kindly check?

SHOWG.zip (33.2 KB)

Thanks

@ServerSide527

Thanks for the further information and using Aspose.Cells.

We were able to observe the text alignment issue in the chart image and logged it in our database for investigation and for a fix. Once, we will have some news for you about it, we will update you in this topic.

This issue has been logged as

  • CELLSNET-46149 - Text Alignment Issue in the Chart Image

@ServerSide527,
Please try our latest version/fix: Aspose.Cells for .NET v20.4.6 (attached)

Your issue should be fixed in it.

Let us know your feedback.

Aspose.Cells20.4.6 For .NetStandard20.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net4.0.Zip (5.4 MB)

The issues you have found earlier (filed as CELLSNET-46149) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi