el

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

Thursday, October 17, 2019

Exporting to word in Qlikview can be achieved through the VB macro. When export to word, the chart properties won’t remain the same in word example, width and height of cell, horizontal chart automatically aligns to vertical, background color will not reflect, table header splits between pages and few more.   This blog discuss how to avoid row to break across pages. In the word, the table doesn’t fit on one page the remaining rows flows to next page, 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 identifies whether tables fits in same page or two pages if tables split 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 objSelection.Tables(1).Select objSelection.Collapse wdCollapseEnd   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 objSelection.Tables(1).Select 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 Next end if

No items found.