urvin-compliance/caracal

How to get Page Number of docx

Opened this issue · 1 comments

Hi Guys,

Is there a way to get current page of docx while generating them. I want to make a 'table of content' or 'index' for my word file in which I need page numbers so that i can describe them in 'table of content' or 'index'.

HI

Hi Guys,

Is there a way to get current page of docx while generating them. I want to make a 'table of content' or 'index' for my word file in which I need page numbers so that i can describe them in 'table of content' or 'index'.

Hi,
I created with word a new page with table of content and then merge it to my caracal word with docx.iframe data: File.read("#{Rails.root}/table.docx). Once you have this you can use docx.h1 '1. Example h1', bold:true, size: 32 and when you open this new caracal docx with word you'll can update your table of content.
So you can apply :

  • Normal
  • Title
  • Subtitle
  • Heading1
  • Heading2
  • Heading3
  • Heading4
  • Heading5
  • Heading6
    ....to the text that you want to see later in your table of content.
    I used h4 and h5 to create a table of pictures.

I hope this can help you.
Good luck!