Free Support Forum - aspose.com

Find and replace text with Emoji generates question mark boxes using C#

Hi Tahir,

I have confirmed that I have “Segoe UI Emoji” installed on my desktop. I am using Microsoft Office Professional Plus 2016.

If I explicitly change the format of the {Assigned} to “Segoe UI Emoji”, the generated document displays the emoji correctly.

If I set the format of the {Assigned} to Times new Roman or Calibri, the generated document doesn’t display the emoji correctly.

I noticed that Aspose was able to automatically format the Chinese characters in the string as “DengXian”. Unfortunately, it was not able to do the conversions for emoji.

Thank you!

@Otter

It seems that MS Word 2016 behaves differently at your end and out end. We are using MS Word 2016 English version at our side. MS Word 2016 displays the emoji correctly at our end.

Moreover, it seems that it is not a bug. The template document contains the tag {Assigned} with font name ‘Times New Roman’. Aspose.Words sets the font name of inserted text as ‘Times New Roman’.

Hi Tahir,

As you can see in my generated document, the first 2 Chinese characters was automatically converted to DengXian(body) format while the rest of the characters remain as Calibri.

image.png (8.6 KB)

Does ASPOSE API perform the conversion internally (from Calibri to DengXian when it detects Chinese characters) or it is MS Word’s magic?

Thanks!

@Otter

Your input document has tag {Assigned} and its style is “Title” that has font name ‘Times New Roman’.

In your shared document “Generated.docx” (generated by Aspose.Words) has style for same paragraph as ‘Title’ and its font name is ‘Times New Roman’.

You can check it by unzipping document. Please change the extension of document from .docx to .zip and unzip the document. You can find the detail of Emoji in document.xml. Please check the attached image for detail. generated document.xml.png (29.9 KB)

So, Aspose.Words generates the document Generated.docx correctly.

It seems that you are using different document or MS Word behaves differently. We suggest you please check the same document at some other system. Moreover, please unzip your document and check the document.xml as shared above.

Hope this answers your query. If you still face problem, please let us know.

Hi Tahir,

The generated document.xml does display correctly on IE. However, it doesn’t display correctly on MS Word. Is there some metadata that we can add to the generated document that will make MS word know that it needs to fall back to other fonts? We are hoping to upgrade our ASPOSE version, however it is hard to justify if we can’t get this resolved.

It looks like we are dealing with a similar issue as:

With the example data from that post, I have received quite a few boxes instead of the correct fonts.

the quick brown fox jumped over the lazy dog ૂપા ૌહગમક વીદૈલ િદં રહસજા્ દનાી ૂપા તોબ ્દુ 快速的棕色狐狸跳過懶惰的狗 тхе љуицк броњн фоџ јумпед овер тхе лаѕз дог فاث ضعهؤن لاقخصى بخء تعةحثي خرثق فاث مشئغ يخل տհէ խըիգկ բրուն ֆոց ճըմպէդ ովէր տհէ լազե դոք ੂਪਾ ੌਹਗਮਕ ਵੀਦੈਲ ਿਦੰ ਰਹਸਜਾ੍ ਦਨਾੀ ੂਪਾ ਤੋਬ ੍ਦੁ тхе љуицк броњн фоџ јумпед овер тхе лаѕз дог otğ frnvm çıhgz ahö krspğe hcğı otğ lujd ehü:)Ended here last…:joy::joy::joy::joy::joy::joy: 絵文字"

image.png (8.9 KB)

Is it something that is fixed in Java but not .Net?

Thanks!

@Otter

You may try to convert text into UTF-8 encoding and then insert it into Word document. Hope this helps you.

Could you please share the screenshot of document.xml?

Could you please share the operating system detail that you are using?

We will further investigate this issue and provide you more information on it.

Hi Tahir,

I have tried to explicitly convert the text to UTF-8 encoding before insert, but it didn’t help.

Please find the screenshot of the document.xml.
image.png (47.3 KB)

Here is my OS information:
OS Name: Microsoft Windows 10 Enterprise
Version: 10.0.17134 Build 17134

I do have the necessary fonts installed on my desktop. Is it something to do with Office Word setting? Since the same document works on your desktop but not on my desktop. Unfortunately, our organization deploys a standard configuration to all desktops. It means that all desktops in our organization will not be able to see the emoji correctly unless we are able to pinpoint what need to be changed in the setting.

image.png (73.1 KB)

Thank you!

@Otter

Thanks for sharing the detail. The document.xml is correct at your end. The style of Emoji is also correct. MS Word should display the Emoji correctly. Have you checked the same document at different systems? Please check it and share your findings here for our reference. Thanks for your cooperation.

Perhaps, you are facing this issue due to MS Word version. Please read the following article.
Emojis are not displayed in Office applications

Yes, I have my colleagues to check it on their machines. The emoji were not displayed correctly on their machines.

Thanks for the article, but it is for Windows 7. All our machines are on Windows 10.

@Otter

Aspose.Words writes the Emoji into document correctly and it is visible in document.xml. It seems that this issue is related to MS Word. Could you please share the complete version of MS Word as shared in attached image?
office version.png (18.0 KB)

A post was split to a new topic: DOCX to PDF conversion issue with Emojis rendering

Here you are:

image.png (28.2 KB)

@Otter

Thanks for sharing the detail. It seems that this issue is related to MS Word. Please upgrade to the latest version of MS Word 2016. Hope this helps you.

We have logged this problem in our issue tracking system as WORDSNET-19668 . You will be notified via this forum thread once there is an update available on it. We apologize for your inconvenience.

Hi Tahir,

As this is the standard version my organization is currently using, there is no way for end user to upgrade their word version. I will pass the finding along the chain and hope for the best.

Thanks!

@Otter

Thanks for the detail. Currently, this issue is under analysis phase. We will inform you via this forum thread once there is an update available on this issue.

The issues you have found earlier (filed as WORDSNET-19668) have been fixed in this Aspose.Words for .NET 20.1 update and this Aspose.Words for Java 20.1 update.

Thank you! I have tried with the new version and the same problem still exists. :frowning:

@Otter

Please check the attached output document generated by the latest version of Aspose.Words for .NET 20.1. 20.1_ouput.zip (11.0 KB)

We suggest you please check the document at some other system using different MS Word version.

I think we have established last Dec that Aspose.Words .Net 19.11.0 also works with newer version of MS Word 2016. It is not working with the version of MS Word that my organization has chosen to use. We can’t upgrade the version as it locked by the IT department. The new version (20.1) didn’t fix it either.
Thanks!

@Otter

You are using lower version of Word 2016 that causes this issue. It is not a bug in Aspose.Words. The document.xml has the correct Emoji.