Page 1 of 1

table of figures

PostPosted: Thu Aug 01, 2013 4:13 am
by utaylsa
Is there an easy way to generate a table of figure like you can generate a table of contents?

Re: table of figures

PostPosted: Thu Aug 01, 2013 7:17 pm
by jason
If you create a docx containing a table of figures, and upload it to the demo webapp, you'll be able to see the resulting XML, and generate code to get started.

You'll see XML with the following structure:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting

  <w:p>
    <w:pPr>
      <w:pStyle w:val="TableofFigures"/>
      <w:tabs>
        <w:tab w:val="right" w:leader="dot" w:pos="9350"/>
      </w:tabs>
    <w:r>
      <!-- start of table of figures -->
      <w:fldChar w:fldCharType="begin"/>
      <w:instrText xml:space="preserve"> TOC \h \z \c "Figure" </w:instrText>
      <w:fldChar w:fldCharType="separate"/>
    </w:r>
<!-- start of entries -->
      <!-- first entry -->
      <w:hyperlink w:history="true" w:anchor="_Toc363143697">
      <w:r>
        <w:rPr>
          <w:rStyle w:val="Hyperlink"/>
        </w:rPr>
        <w:t>Figure 1...</w:t>
        <w:tab/>
        <w:fldChar w:fldCharType="begin"/>
        <w:instrText xml:space="preserve"> PAGEREF _Toc363143697 \h </w:instrText>
        <w:fldChar w:fldCharType="separate"/>
        <w:t>1</w:t> <!-- a page number -->
        <w:fldChar w:fldCharType="end"/>
      </w:r>
    </w:hyperlink>
  </w:p>
  <!-- second entry -->
  <w:p>
    <w:pPr>
      <w:pStyle w:val="TableofFigures"/>
      <w:tabs>
        <w:tab w:val="right" w:leader="dot" w:pos="9350"/>
      </w:tabs>
    </w:pPr>
    <w:hyperlink w:history="true" w:anchor="_Toc363143698">
      <w:r>
        <w:rPr>
          <w:rStyle w:val="Hyperlink"/>
          <w:noProof/>
        </w:rPr>
        <w:t>Figure 2...</w:t>
        <w:tab/>
        <w:fldChar w:fldCharType="begin"/>
        <w:instrText xml:space="preserve"> PAGEREF _Toc363143698 \h </w:instrText>
        <w:fldChar w:fldCharType="separate"/>
        <w:t>4</w:t><!-- a page number -->
        <w:fldChar w:fldCharType="end"/>
      </w:r>
    </w:hyperlink>
  </w:p>
  <w:p>
    <!-- end of entries -->
    <w:r>
      <w:fldChar w:fldCharType="end"/>
    </w:r>
  </w:p>

 
Parsed in 0.005 seconds, using GeSHi 1.0.8.4


As with a table of contents, the challenge is to generate the page numbers (assuming you are including them) without relying on Word to do it.