Dear Sir or Madam,
We have a document in which we insert 2 TOC. Currently to change formatting of TOCs we retrieve TOC1 and TOC2 style (as the first TOC has 2 levels) and apply formatting properties to both these style. We have a request to have different formatting for the first and the second TOC (different tab leads, different spacing). Our approach doesn’t work as any change in style applies to both TOC. How can we achieve different TOCs formatting?
The code looks like this:
List<Style> tocs = new List<Style> { mOutputDocument.Styles[StyleIdentifier.Toc1], mOutputDocument.Styles[StyleIdentifier.Toc2]};
foreach (Style tocStyle in tocs)
{
tocStyle.ParagraphFormat.TabStops.Clear();
TabStop tabStop = new TabStop(ConvertUtil.MillimeterToPoint(206 - mRoService.ReportingOptions.LeftMarginIdent - mRoService.ReportingOptions.RightMarginIdent), TabAlignment.Right, tabLeader);
tocStyle.ParagraphFormat.TabStops.Add(tabStop);
tocStyle.ParagraphFormat.LineSpacing = spacing;
// Sets the default space between TOC lines.
tocStyle.ParagraphFormat.SpaceAfter = 0;
// Right indent in paragraphs of TOC. Otherwise long lines will go to page numbers area.
tocStyle.ParagraphFormat.RightIndent = ConvertUtil.MillimeterToPoint(10);
A sample document is attached, first TOC is in p 6, second on p 11._Alex test-Annual Report-_Alex test-AlexPara-Suffix (6).docx (334.1 KB)
Thank you in advance,
Alex