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

Free Support Forum - aspose.com

TOC Issue with bookmarks and TC fields not working (Multiple TOC issue)

The second table of contents should not include the heading test1.
Any suggestion for a work around ?     

       DocumentBuilder db = new DocumentBuilder();
            db.ParagraphFormat.SpaceAfterAuto = false;
        db.ParagraphFormat.SpaceAfter = 25;

        db.Writeln();

        db.ParagraphFormat.StyleIdentifier = <span style="color:#2b91af;">StyleIdentifier</span>.Toc1;

        <span style="color:blue;">string</span> bookmark = <span style="color:#2b91af;">Guid</span>.NewGuid().ToString();
        db.StartBookmark(bookmark);
        db.InsertTableOfContents(<span style="color:blue;">string</span>.Format(<span style="color:#a31515;">"\\f \\b </span><span style="color:mediumseagreen;">{0}</span><span style="color:#a31515;">"</span>, bookmark));

        db.InsertField(<span style="color:#a31515;">"TC "</span> + <span style="color:#a31515;">"\""</span> + <span style="color:#a31515;">"Test1"</span> + <span style="color:#a31515;">"\""</span>);
        db.EndBookmark(bookmark);

        db.Writeln();

        bookmark = <span style="color:#2b91af;">Guid</span>.NewGuid().ToString();

        db.StartBookmark(bookmark);
        db.InsertTableOfContents(<span style="color:blue;">string</span>.Format(<span style="color:#a31515;">"\\f \\b </span><span style="color:mediumseagreen;">{0}</span><span style="color:#a31515;">"</span>, bookmark));
         
        db.InsertField(<span style="color:#a31515;">"TC "</span> + <span style="color:#a31515;">"\""</span> + <span style="color:#a31515;">"Test2"</span> + <span style="color:#a31515;">"\""</span>);
        db.EndBookmark(bookmark);

        db.Document.UpdateFields();
        db.Document.Save(<span style="color:#a31515;">"c:\\temp.docx"</span>, <span style="color:#2b91af;">SaveFormat</span>.Docx);</pre>
Hi Neil,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7616 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.

Thanks Tahir

The issues you have found earlier (filed as WORDSNET-7616) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.