MS Word stores font metadata in “word/fontTable.xml” file for a docx document.
http://openxmldeveloper.org/discussions/formats/f/13/p/1074/2697.aspx - my understanding is that, fontTable.xml is an important piece of information… The fontTable.xml contains the information about each of the fonts used by the content in the Word document. When displaying/processing a Word document, if a particular font used by the content is not available in the consuming application (i guess MS Word tool or any other Wordprocessing tool), then it uses the corresponding font metadata from the fontTable.xml and uses the corresponding font as a substitute font to display the content or for processing… Even the theme1.xml refers to fonts for their major and minor font settings (tags <a:majorFont> and <a:minorFont>). Beyond this not sure on any other significances of this fontTable.xml data.
So when copying styles (from styles.xml) or themes from one document to another, it also make sense to copy the corresponding font metadata (from fontTable.xml) used by those styles or themes.
Please correct me if am wrong…
So we need Aspose API support for copying fonts (from fontTable.xml) one document to another document.
Currently I don’t see Aspose has something like addFont() API method. There is font retrieval method Document.getFontInfos() which returns FontInfoCollection, But not API for font copying unless I miss something.
Can you please add this functionality to copy fonts as well to take care of copying fonttable.xml metadata from one document to another document.
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you copy style information from one document into another, the style information will be available in styles.xml.
Could you please share input documents along with expected output document here for our reference? We will then provide you more information on this along with code.
http://openxmldeveloper.org/discussions/formats/f/13/p/1074/2697.aspx - my understanding is that, MS Word uses fontTable.xml as a fallback mechanism.
Following is mentioned in the above URL:
*"[An instance of this part type contains information about each of the fonts used by content in the document. When a consumer reads a WordprocessingML document, it shall use this information to determine which fonts to use to display the document when the specified fonts are not available on the consumer’s system.]
This part has an implicit relationship with the main document part.
The details will be stored in the fontTable.xml part…"*
So my understanding on the fontTable.xml is that, it can used by a consuming WordprocessingML application, when consumer’s system don’t have specified fonts… as a fallback mechanism.
Said that, when we copying styles from one document to another document, it also sets certain font names from the source document into target document for the copied styles… During this process, i am not sure if fontTable.xml metadata also needs to be carried forward or not into the target document… I am not sure… So i can’t describe the requirement details here… Can you please check this with the MS Word documentation or Microsoft open xml specification in order to understand this…
Here I just thought to bring this to your notice about the fontTable.xml file inside MS Word docx archive (because I see Aspose doesn’t touch it)… Said that, currently we are not specifically seeing any problem with fontTable.xml thing during styles copy, if any we will let you know…
Thanks for your inquiry. StyleCollection.AddCopy method does the followings:
- Copies a style into this collection.
- Copies linked style
- Does not copy base styles.
Please note that Aspose.Words mimics the same behavior as MS Word does. MS Word does not copy information from fontTable.xml into target document. However, you can find the copied styles in styles.xml.