Qlik Community

QlikView Documents

Documents for QlikView related information.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.

Do not allow row to break across pages when exporting to word

Valued Contributor II

Do not allow row to break across pages when exporting to word

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. 1. Finding the page number where the table in word.

         CurPage1 = objSelection.Information (wdactiveendpagenumber)

  1. 2. Moving position of cursor after the table

    objSelection.Collapse wdCollapseEnd

  1. 3. Finding the page number at after the table.

    CurPage2 = objSelection.Information (wdactiveendpagenumber)

  1. 4. Comparing page numbers, if same then continue with script otherwise move the tables down.

    If CurPage1<>CurPage2 then
    objSelection.Collapse wdCollapseStart
    rLast =w  ‘ no.of.rows
    For r1 = 1 To rLast+1
    With objSelection.Tables(1).Rows(r1).Range.ParagraphFormat
    .KeepTogether = True  ‘keep the rows together
    .KeepWithNext = True ‘Moving to next page in word
    End With
    end if
Labels (3)
Valued Contributor III

Its a nice post,

One question for you, is it possible when we are exporting an straight table or pivot table to Excel, can we get page by page data based on the dimension values using macros.

For eg:

I have a table with Product, Supplier as dimensions and I have 5 products info ,when I export this table using a button , what I want is I want to have the products info page by page, if Product1 ends 2 1/2 page then Product 2 info should start in fourth page.

Hope you got my point.


Kiran Kumar

Valued Contributor II

Yes, you can export tables based on dimension values.But i have tried to fit in the page like you want. Below is a way you can export tables,

SET vFld = ActiveDocument.Fields("FieldName")

SET vField = vFld .GetPossibleValues(1000, true)

Using for loop to export possible values of a dimension

FOR n = 0 TO vField .Count -1

ActiveDocument.Fields("FieldName").Select vField .Item(n).Text

'Paste your Object here


Valued Contributor III

Can you put it in a sample and start a new document for it.


Kiran Kumar

Version history
Revision #:
1 of 1
Last update:
‎04-08-2016 02:27 AM
Updated by: