Inserting page breaks in LibreOffice Calc sheets works a little bit different than in MS Office VBA. With LibreOffice Basic (or OpenOffice.org Basic), you insert a (horizontal) page break by setting the row's IsStartOfNewPage
property to true
. To access every n
th row, you could simply use ThisComponent.Sheets(0).Row(n)
.
So, combining this in a LibreOffice Basic macro, the result could look like this:
sub pagebreak
rem ----------------------------------------------------------------------
rem define variables
Dim Sheet As Object
Dim Cell As Object
Sheet = ThisComponent.Sheets(0)
for i = 10 to 100 Step 10
Sheet.Rows(i).IsStartOfNewPage = true
next i
end sub
This macro just inserts a manual page break after each 10th row (notice that the first row is Rows(0)
, so Rows(10)
is row # 11), up to row 101 of the current sheet. You can easily adjust that code to fit your needs (max. number of rows etc).