Hi, I have prepared a template document for booklets that have the original English text on the left (even) pages and the Dutch translation on the right (odd) pages.
To be able to work with two languages I've made empty pages with linked frames on the even pages and the same on the odd pages. In total 150 pages.
To make things a bit more complicated: every page has next to the main text frame also a narrow frame in which paragraph letters will appear. These also are linked in the same way.
See the attached document.
The first booklet now in preparation is a very small one (also to test if OpenOffice is really the way to go for us) and uses only 11 pages.
The rest of the pages now need to be deleted.
BUT: no matter how hard I tried: the pages only disappear when I manually select every single frame on each page and delete them, which is quite tedious.
Does anybody know a better way to do this?
Delete (unused) pages containing only empty frames
Delete (unused) pages containing only empty frames
- Attachments
-
- Empty Template EN-NL 150-pgs OO.odt
- Example of the Template document
- (21.42 KiB) Downloaded 135 times
OpenOffice 4.1.7 - Windows 10
Re: Delete (unused) pages containing only empty frames
This macro with delete all the text frames anchored to pages beyond page 11.
*To be on the safe side copy your document before running*.
EDIT: CORRECTION PAGE NOS NOT ZERO BASED BUT ONE BASED.
*To be on the safe side copy your document before running*.
Code: Select all
Sub DeleteTextFrames
en = thiscomponent.textframes
for i = en.count - 1 to 0 step -1
c = en.getbyindex(i)
if c.AnchorPageNo > 11 then
thiscomponent.text.removetextcontent(c)
end if
next
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Delete (unused) pages containing only empty frames
note correction.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Delete (unused) pages containing only empty frames
At one stage I considered a template of linked frames, much as the example file (with minor differences) for use with translation texts - one language on left, one on right. I did not proceed with the project, as I was able to find an old (150 yrs) printed copy of the text in question.
Rather than make a file of more pages than might be needed, with the need to delete the blank end pages (as in this case), I had contemplated writing a macro that generated a pair of new pages of the linked frames each time new pages were required.
Having acquired a copy of an earlier translation (borrowed from a library and photocopied), I did not need to proceed with the project.
Rather than make a file of more pages than might be needed, with the need to delete the blank end pages (as in this case), I had contemplated writing a macro that generated a pair of new pages of the linked frames each time new pages were required.
Having acquired a copy of an earlier translation (borrowed from a library and photocopied), I did not need to proceed with the project.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Delete (unused) pages containing only empty frames
This is brilliant. Having come from MS-Office I did not immediately think of programming in OO.JeJe wrote:This macro with delete all the text frames anchored to pages beyond page 11.
The code (not surprisingly ) did indeed work, but I discovered that the pages did not immediately disappear because of the page-breaks on them (how else does one get new empty pages to put frames on )
Thanks JeJe for helping
That's quite an idea as well, Thanks for your response as well, RoryOFRoryOF wrote:I had contemplated writing a macro that generated a pair of new pages of the linked frames each time new pages were required.
Might somebody has given this a go earlier, then I would be much interested, else it will likely become my first step into OO-Basic
All in all (being a novice in OO) OO feels like a very good replacement of MS-Publisher with many more capabilities, but also quite a steep learning-curve in some of it's areas.
OpenOffice 4.1.7 - Windows 10
Re: Delete (unused) pages containing only empty frames
I could not find that anyone had actually done this; having found a workaround (viz, borrowing a book from a library unbeknownst to the librarians over a long weekend) I did not have to proceed further with my plan.
Macro programming in OpenOffice/LibreOffice is not a trivial task; the best exposition is in the works of Andrew Pitonyak, which can be downloaded from http://www.pitonyak.org/oo.php
It is probable that most macros will not need further knowledge than contained in OO's BASIC; manual is at https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide
so I suggest you start there.
Macro programming in OpenOffice/LibreOffice is not a trivial task; the best exposition is in the works of Andrew Pitonyak, which can be downloaded from http://www.pitonyak.org/oo.php
It is probable that most macros will not need further knowledge than contained in OO's BASIC; manual is at https://wiki.openoffice.org/wiki/Docume ... ASIC_Guide
so I suggest you start there.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS