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

Free Support Forum - aspose.com

Insert LineBreaks in TOC fields

how can i use linebreaks (with additional fontchanges) in toc-fields so that it looks like this (also see attachment)
2nd line of Heading2.0…2
2nd line of Heading2.1…3

Thanks for your inquiry. As I can see you have edited TOC manually in the attached document. Unfortunately Aspose.Words does not evaluate TOC fields. So you can’t edit TOC using Aspose.Words. Also if you update you TOC additional line breaks and formatting will disappear.
If you need change formatting of TOC you should change TOC style. For example see the following code:

// Change formating of TOC
doc.Styles[StyleIdentifier.Toc1].Font.Bold = true;
doc.Styles[StyleIdentifier.Toc2].Font.Italic = true;
// etc...

After creating TOC using Aspose.Words you should update fields inside the document manually (ctrl+A and F9). Also you can use macro to update fields. See the following link to learn more.
Best regards.