Ask Your Question

Writer master document using reportbuilder output, need to remove pagebreaks [closed]

asked 2018-01-22 18:18:38 +0200

Spun69 gravatar image

updated 2018-01-22 19:41:48 +0200


I need to create a document consisting of some header text, then the output of two Base ReportBuilder (RB) files. I am currently using a Writer master document for this. I can load the two subdocuments successfully with silent update to refresh content. My problem is the tables generated in RB have 'break before' attribute, so there is a page break before each subdocument; cannot find anyway to change this in RB. I want to change the tables BreakType to NONE.

The code below tries to do this, but does not seem to be working as the saved document still has the page breaks. I have tried a couple approaches, neither works. I can manually change the output to remove the page break, but need this automated. Any suggestions?

Using LO Version:

    REM Variable declarations not shown for brevity
    Set oController = CurrentDb.Document.CurrentController

    'Create registration base file
    pvArgs(0).Name  = "Hidden"
    pvArgs(0).Value = True
    Set odReport = oController.loadComponentWithArguments(, acCampRegRep, acViewNormal, pvArgs)
    pvArgs(0).Name  = "Overwrite"
    pvArgs(0).Value = True
    odReport.storeAsURL(acCampRegURL, pvArgs)

    'Create registration invoice file
    pvArgs(0).Name  = "Hidden"
    pvArgs(0).Value = True
    Set odReport = oController.loadComponentWithArguments(, acCampInvRep, acViewNormal, pvArgs)
    pvArgs(0).Name  = "Overwrite"
    pvArgs(0).Value = True
    odReport.storeAsURL(acCampInvURL, pvArgs)

    'Open MASTER file and update links
    pvArgs(0).Name  = "UpdateDocMode"
    pvArgs(0).Value =
    Set odReport = StarDesktop.loadComponentFromURL(acCampTplURL, "_blank", 0, pvArgs)

    'Set textflow on ingested subdocuments
    Set oTables = odReport.getTextTables()
    Set oTable = oTables.getByIndex(0)
    oTable.BreakType =
'    odReport.getTextTables().getByIndex(0).BreakType =
    odReport.getTextTables().getByIndex(1).BreakType =

    oCurs = odReport.getViewCursor() 
    oCurs.BreakType =

    pvArgs(0).Name  = "Overwrite"
    pvArgs(0).Value = True
    odReport.storeAsURL(acCampOutURL, pvArgs)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Spun69
close date 2018-01-27 23:52:23.659099

1 Answer

Sort by » oldest newest most voted

answered 2018-01-27 23:51:54 +0200

Spun69 gravatar image

After reading " Macros Explained " by Andrew D. Pitonyak, I reworked my code to make use of TextFrames and Bookmarks. Now I generate the report, extract required table(s), then paste into the output document at a bookmark location within a frame. This does exactly what I need. Working code below.

'Routine to import block from generated report
Sub InsertReportBlock(odOutput As Object, sReportName As String, sTables As Object, sBkmrkName As String )
   Dim odReport, oController, oTable, oInCursor, oOutCursor, oBlock, oBookmark
   Dim pvArgs(2) As New
   Dim i

   Set odReport = createunoservice("")
   Set oTable   = createunoservice("")
   Set oController = CurrentDb.Document.CurrentController

   'Generate reports for reservation details & invoice
   pvArgs(0).Name  = "Hidden" : pvArgs(0).Value = True
   Set odReport  = oController.loadComponentWithArguments(, sReportName, acViewNormal, pvArgs)

   Set oInCursor  = odReport.CurrentController.getViewCursor()
   Set oOutCursor = odOutput.CurrentController.getViewCursor()
   Set oBookmark  = odOutput.getBookmarks().getByName(sBkmrkName)

   'Loop over list of table names
   For i = LBound(sTables) To UBound(sTables)
      'Copy report content
      Set oTable = odReport.getTextTables().getByName(sTables(i))  
       oInCursor.gotoEnd(True)  'Move to the end of the current cell.
        oInCursor.gotoEnd(True)  'Move to the end of the table.  
        Set oBlock = odReport.CurrentController.getTransferable()  

      'Paste at bookmark 
        oOutCursor.gotoRange(oBookmark.getAnchor(), False)  'Move the cursor to bookmark location


End Sub
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-01-22 18:18:38 +0200

Seen: 109 times

Last updated: Jan 27 '18