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

Free Support Forum - aspose.com

Terms of Condition Problem

We created the toc using this code.


builder.InsertTableOfContents(@"\o ““1-3"” \h \z \u”);

the problem is we are inserting html data which contains h1,h2,h3 and so on… what we wanted is that it should only add the header of the paragraph and not the h1,h2,h3 inside the body.

so here

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
builder.Writeln((innerItem.Text)); // this is the main title ie US States

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln(CleanHtmlString(item.Text)); //this is the state laws

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.PlainText;
builder.InsertHtml(s); // this is the body which contains the html so all in all its something like this.

this is the toc

New York
Drug Testing
Overtime
RecordKeeping
California
Drug Testing
Overtime
RecordKeeping


the body is

New york

Drugtesting

is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Overtime
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

RecordKeeping
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

California

Drugtesting

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Overtime

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

Record Keeping
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.



Right now i parse the html body and remove the h1,h2,h3,h4,h5 since it adds it in TOC which we dont want…

my question is how can we set the toc to exlcude the h1,h2,h3,h4,h5 in the body text which came form html… cause my requirement is they wanted the h1-h5 be retain inside the body.

dont be confuse… this is state laws on top…


so

law
state
body of text

state
body of text

law
state
body of text etc

Hi Joebet,


Thanks for your inquiry. You are using an old version of Aspose.Words i.e. 13.12.0, we encourage you to upgrade to the latest version of Aspose.Words as it contains newly introduced features, enhancements and fixes to the issues that were reported earlier. So, I would suggest you please download the latest version 14.7.0 from the following link. I hope, this helps:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Best regards,

im using the latest version.

im using the latest one

Hi Joebet,


Thanks for your inquiry. But, in this case, Aspose.Words mimics the behavior of Microsoft Word 2013. Please try executing the following code on your documents:

Document doc = new Document(MyDir + @“we+need+to+be+this+but+the+body+h1-h5+will+retain.docx”);

doc.UpdateFields();

doc.Save(MyDir + @“out.docx”);


PFA output documents here with this post. Now open these documents with MS Word 2013 and manually “Update TOC Fields”. You’ll notice MS Word 2013 produces the same TOC entries after update. So, this is the expected behavior. If we can help you with anything else, please feel free to ask.

Best regards,