We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Font Name Is Lost After Save As

Hi,

I have attached a sample application of how we build the word document based on external ones.
The external document (nova5.docm) contains one cell with text on Time New Romain.
We notice the following problem:

Scenario:
1. We generate a report using Aspose.Word (in a temp folder) - Use the attached application.
2. In the generated document, we click on “Save As” to make another copy.
3. Close the copy and reopen it.

Expected result: After step 3, the font should remain Time New Romain.
Actual Result: The font name is switched to Calibri.

If we do the step 2 and 3 on the original document (nova5.docm), the font is not changed. So this issue is introduced by Aspose.

Can you provide us with a fix or a wordaround?

Thank you,

Hi Jawad,


Thanks for your inquiry. I have tested the scenario while using latest version of Aspose.Words for .NET and have not found any issue with output document. Please use the latest version of Aspose.Words for .NET.

I have attached the output Docm file with this post for your kind reference. Please let us know if you have any more queries.

thank for your response.

Actually, it is still reproducible in the latest Aspose.Words. Even if I do a “Save As” to the file you sent me (out.docm), I can see the font changes.

Remender: this issue is not on the out put of my application, it is in the document created from the output via SaveAs commend in Office.

Hi Jawad,


Thanks for your inquiry. Please note that when you copy nodes from one document to another, this option specifies how formatting is resolved when both documents have a style with the same name, but different formatting.

The formatting is resolved as follows:
    1. Built-in styles are matched using their locale independent style identifier. User defined styles are matched using case-sensitive style name.
    2. If a matching style is not found in the destination document, the style (and all styles referenced by it) are copied into the destination document and the imported nodes are updated to reference the new style.
    3. If a matching style already exists in the destination document, what happens depends on the importFormatMode parameter passed to Document.ImportNode as described below.
    When using the UseDestinationStyles option, if a matching style already exists in the destination document, the style is not copied and the imported nodes are updated to reference the existing style.

    The drawback of using UseDestinationStyles is that the imported text might look different in the destination document comparing to the source document. For example, the “Heading 1” style in the source document uses Arial 16pt font and the “Heading 1” style in the destination document uses Times New Roman 14pt font. When importing text of “Heading 1” style with no other direct formatting, it will appear as Times New Roman 14pt font in the destination document.

    Using the KeepSourceFormatting option allows to make sure the imported text looks in the destination document exactly like it was in the source document. If a matching style already exists in the destination document, the source style is copied and given a unique name by appending a suffix number to it, for example “Normal_0” or “Heading 1_5”.

    The drawback of using KeepSourceFormatting is that if you perform several imports, you could end up with many styles in the destination document and that could make using consistent style formatting in Microsoft Word difficult for this document.

    In your case, the styles are duplicated in output document which causes this issue. Please see the attached image for detail. I have logged this issue as WORDSNET-8033 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.


    Thank for your explanation. We need to use KeepSourceFormatting in our implementation. We had issue with UseDestinationStyles in the past.

    So you recognize it is a bug while using KeepSourceFormatting. Let us know when the bug is fixed.

    Thank you,

    Hi Jawad,


    The styles are duplicated in output document which causes “Save As” issue. Please see the attached image for detail. We will update you via this forum thread once this issue is resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

    Thank you. We will be waiting your fix.

    Hi Jawad,


    We will update you via this forum thread once this issue is resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

    Hi Jawad,

    Thanks for your patience. On further investigation our development team came to know that they won't be able to implement the fix to your issue. Most likely, your issue will be closed with ''Won't Fix'' resolution. I am quoting developer's comment here for your reference:

    Upon appending document with KeepSourceFormatting option set, we correctly copying this style to destination document. The result – document looks good in MS Word.
    But the destination document has docDefaults\rPrDefault\rPr\rFonts which looks exactly the same like inside Normal_New style. That is why MS Word removes duplicated “unneeded” part from this style.

    On the one hand it is good idea because MS Word suspects that this font will be inherited from defaults but on the other hand MS Word forgets that this font can be inherited from Table style, and in this case font will be changed.