In my previous blog i have given the solution for vertical table conversion in word.Similarly, this blog we are going to see another issue with word , table row to break across pages. In word, the table doesn’t fit in one page the remaining rows flows to next page, which is the general feature of word. This can be avoided in word settings manually. But when export automatically from Qlikview with a word template, this can’t be fixed. This can be achieved using vbscript in Qlikview Module while export.
Below script identify whether tables fits in same page or two pages, if tables splits in two pages then macro push the table to next page.
Here are the steps,
- 1. Finding the page number where the table in word.
CurPage1 = objSelection.Information (wdactiveendpagenumber)
- 2. Moving position of cursor after the table
- 3. Finding the page number at after the table.
CurPage2 = objSelection.Information (wdactiveendpagenumber)
- 4. Comparing page numbers, if same then continue with script otherwise move the tables down.
If CurPage1<>CurPage2 then
rLast =w ‘ no.of.rows
For r1 = 1 To rLast+1
.KeepTogether = True ‘keep the rows together
.KeepWithNext = True ‘Moving to next page in word