I am generating epubs from various word documents and notice that the table of contents in the epub are not linked.
Thanks for interest in Aspose.
I believe to get the contents linking like this you need to add the "\h" switch to your TOC.
You can achieve this by:
- Opening your document in MS Word
- Toggling field codes by pressing ALT+F9
- Adding the "\h" switch in your TOC field after the "\u" switch.
- Adding the lines doc.UpdateFields(), doc.UpdatePagelayout() to your code if they are not already there, before you saved your document.
If you have any other queries please feel free to ask.
Thank you for the prompt reply.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your inquiry. You can modify filed code of TOC field programmatically. You can use the same technique as described here:
But in your case you will work with TOC fields, and not with MERGEFIELS. Hope this helps. Please let us know if you need more assistance, we will be glad to help you.
Thanks for your inquiry.
It seems the method of updating the field code using the field result does not work as expected for the TOC field. The current code does not completely remove the TOC text and some unlinked runs still remain causing there to appear to be two TOCs.
Instead I suggest just updating the field code itself and then letting the UpdateFields method handle this.
I have attached the the reworked class to this post.