We are trying to create table on content section in the word document dynamically and it seems that aspose engine just ignores the styles that we are specifying.
Just wondering if anyone else has also come across this issue and what would be the best possible solution ??
Thanks for your request. Is it requirement of your application to use HTML? Actually, there is very simple way to achieve what you need without using HTML or Tables at all. Please see the following simple code:
DocumentBuilder builder = new DocumentBuilder();
// Remove all tabstops and add one right aligned tab.
builder.CurrentParagraph.ParagraphFormat.TabStops.Clear();
// Calculate position of the tab.
double tabPosition = builder.PageSetup.PageWidth - builder.PageSetup.LeftMargin - builder.PageSetup.RightMargin;
builder.CurrentParagraph.ParagraphFormat.TabStops.Add(tabPosition, TabAlignment.Right, TabLeader.Dots);
// Insert text
builder.Write("test\t100");
builder.Document.Save(@"Test001\out.doc");
Thanks for your response. Unfortunately yes my application needs to be in HTML as we are not just creating one table of content, we in fact have many sections within the document that are formatted to look like TOC.
Thank you for additional information. Unfortunately, you cannot be 100% sure that HTML inserted into the document will look exactly as it looks in browsers. This is because:
Aspose.Words is originally designed to work with Word documents formats, like DOC, DOCX, WordML, RTF etc. HTML is not Word format and it is difficult and sometimes impossible to map between HTML and Word features. These formats are very different internally.
Aspose.Words does not support some HTML features, so you can lose some formatting of your HTML. Unfortunately, we do not have a list of HTML features supported upon HTML import. Currently we have only list of supported features for HTML export (saving to HTML). You can find it here: https://docs.aspose.com/words/net/save-in-html-xhtml-mhtml-formats/