0

You may know it from dictionaries or phone books where in the top left or right corner of every page there is mentioned the first word that occurs on that certain page. It's called guide word (similar zu Catch words) or Kustode in German.

I am creating an ODT file using Python and then let lowriter create the PDF I need as result. It works like so: Someone creates an empty ODT file and adds all the paragraph, character and page styles which are needed in the process. Then my Python script receives a DocBook and the mentioned ODT template as input and creates a new ODT file which then has a proper content which is using the styles defined before.

Of course my Python script does not have any clue about the flow of the text when lowriter renders it to a PDF. It only sees the XML structure. That means I can not decide when I should put a textframe in the header of a page which the right guide word.

At first I thought about using variables which I reset after every new word on the page with the text that should appear on top of the page and then show this variable in the header field of the page layout. But unfortunately after setting a variable in the body of a page the new value can not be seen in the header of that same page but on the following one. Then I thought about anchoring a text frame in the footer and placing it in the header but then there would be always the last word of the page placed in the header which is also wrong.

So it seems I need a LO macro for that which I have to call before I create the PDF and which iterates over all the paragraphs in the document with a certain style, takes its content and puts it as a text frame in the header. Do you know a macro which can do that or do I have to create one by myself which seems to be complicated because of a seemingly non-existing documentation and a lack of examples.

All these things are running on a headless Ubuntu machine somewhere in the infrastructure of our customer. So if have to write a macro I somehow have to make it public to the LO installation on that server without using the GUI.

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.