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.