Start a new topic
Answered

Style of Table Of Contents

Is there any way to change the style of TableOfContents in a report?


Best Answer

The Table Of Content uses predefined font styles and paragraph styles named accordingly:

FontStyleTOC1, FontStyleTOC2, ...  
ParaStyleTOC1, ParaStyleTOC2, ...

These styles can be modified, using the <ParaStyles> and <FontStyles>

Example for a Default style of TableOfContents :


<Report>
  <TableOfContents/>
  <Section title="Introduction">
  </Section>
  <Section title="Chapter 1">
    <Section title="This is a section">
    </Section>
    <Section title="This is another section">
      <Section title="This is third level section">
      </Section>
    </Section>
  </Section>
</Report>

 Result:

image


Example for a Modified style of TableOfContents :

 

<Report>
 <ParaStyles>
    <ParaStyle name="TOC1" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC2" alignment="left" spaceBefore="0"/> 
 </ParaStyles>
 <FontStyles>
    <FontStyle name="TOC1" style="bold" font="Times New Roman" size="24" color="Aqua" />
    <FontStyle name="TOC2" style="bold" font="Times New Roman" size="20" color="Aqua" />
 </FontStyles>
  <TableOfContents/>
  <Section title="Introduction">
  </Section>
  <Section title="Chapter 1">
    <Section title="This is a section">
    </Section>
    <Section title="This is another section">
      <Section title="This is third level section">
      </Section>
    </Section>
  </Section>
</Report>

 Result:

image




1 person has this question

Answer

The Table Of Content uses predefined font styles and paragraph styles named accordingly:

FontStyleTOC1, FontStyleTOC2, ...  
ParaStyleTOC1, ParaStyleTOC2, ...

These styles can be modified, using the <ParaStyles> and <FontStyles>

Example for a Default style of TableOfContents :


<Report>
  <TableOfContents/>
  <Section title="Introduction">
  </Section>
  <Section title="Chapter 1">
    <Section title="This is a section">
    </Section>
    <Section title="This is another section">
      <Section title="This is third level section">
      </Section>
    </Section>
  </Section>
</Report>

 Result:

image


Example for a Modified style of TableOfContents :

 

<Report>
 <ParaStyles>
    <ParaStyle name="TOC1" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC2" alignment="left" spaceBefore="0"/> 
 </ParaStyles>
 <FontStyles>
    <FontStyle name="TOC1" style="bold" font="Times New Roman" size="24" color="Aqua" />
    <FontStyle name="TOC2" style="bold" font="Times New Roman" size="20" color="Aqua" />
 </FontStyles>
  <TableOfContents/>
  <Section title="Introduction">
  </Section>
  <Section title="Chapter 1">
    <Section title="This is a section">
    </Section>
    <Section title="This is another section">
      <Section title="This is third level section">
      </Section>
    </Section>
  </Section>
</Report>

 Result:

image



Hello

Does the results of his code really duplicate the ToC first in Aqua and then in black? My version did not.

How to make the ToC aligned as in the black cases above? My statement 


  <ParaStyles>
    <ParaStyle name="TOC1" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC2" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC3" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC4" alignment="left" spaceBefore="0"/>
    <ParaStyle name="TOC5" alignment="left" spaceBefore="0"/>
   </ParaStyles>
   <FontStyles>
    <FontStyle name="TOC1" font="Times New Roman" size="14" color="#000000" style="bold"/>
    <FontStyle name="TOC2" font="Times New Roman" size="12" color="#000000" />
    <FontStyle name="TOC3" font="Times New Roman" size="12" color="#000000" />
    <FontStyle name="TOC4" font="Times New Roman" size="12" color="#000000" />
    <FontStyle name="TOC5" font="Times New Roman" size="12" color="#000000" />
  </FontStyles>
  <TableOfContents/>


... still produced sub-sections indented one character per level and not to a straight left margin as expected.

Ops. Did just realize the black "ToC" is the actual content of the document and not the ToC. 

Still, hoe to make alignment left create an alignment to a left margin without indentation per level?

Hi Mikael, 


Thanks for your participation in this forum! 


The indentation is fixed and cannot be changed.  I have noted this now in How to Modify the Table of Contents Paragraph and Font Styles.


SystemWeaver Support

Login to post a comment