Hello, we are having an issue with a Table of Contents (TOC) item in bold font, that should not be bolded. We think this is due to the styles being dropped in only one section of a table (on a page referenced in the TOC).
See attached zip file for example documents mentioned below and screen snips.
When a new document is being created, before we start appending, we attach the DSTNormalTemplate.dot template. This holds some custom styles.
Code to create new document:
m_oAsposeDoc = new Document(myDocStylesFile.ToString());
object oTemplateName = this.m_sDocStylesFile;
m_oAsposeDoc.AttachedTemplate = oTemplateName.ToString();
m_oAsposeDoc.CopyStylesFromTemplate(oTemplateName.ToString());
m_oAsposeDoc.AutomaticallyUpdateStyles = false;
Then the following documents are appended to the m_oAsposeDoc
:
DST TOC.DOC
SCHED BEN2 20231113c.DOC
HC-PRA1V5c2.DOC
Before the m_oAsposeDoc
is saved to a file, the Document.UpdateFields()
is executed to update the TOC. The results are in “Aspose18320.doc”
Now, if you look at the document with the screen snips, it shows the parts of the source document, “SCHED BEN2 20231113c.DOC”, with the custom styles there, and then it shows the same parts on the “Aspose18320.doc” without the custom styles, until a point where the custom styles match again between the source doc and the results.
I also included the results from the Word Interop assembly with the same source docs, “Word18320.doc”, and the styles are not dropped.
We believe this is what is causing the bold font issue in the TOC.
This is hard to explain, but the screen snips document in the zip file makes it easy to see what our issue is. Thank you!!
ForAsposeSupport.zip (734.6 KB)