Add guide words to the top of pages in LibreOffice Writer
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!
macros libreoffice basic
add a comment |
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!
macros libreoffice basic
add a comment |
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!
macros libreoffice basic
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!
macros libreoffice basic
macros libreoffice basic
edited Feb 1 at 13:48
Nicolas
asked Feb 1 at 13:41
NicolasNicolas
346
346
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400989%2fadd-guide-words-to-the-top-of-pages-in-libreoffice-writer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1400989%2fadd-guide-words-to-the-top-of-pages-in-libreoffice-writer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown