Search found 12 matches

by yijinger
Wed May 19, 2021 7:48 pm
Forum: Macros and UNO API
Topic: [Python] [Writer] Remove empty pages?
Replies: 8
Views: 6911

Re: [Python] [Writer] Remove empty pages?

Sorry, but I don't see any reason to make this problem personal. I'd like to see a pure solution: you get a document from somewhere and you have to remove blank pages from it. The problem looks simple in this wording, but how simple the solution is?
by yijinger
Tue May 18, 2021 7:24 pm
Forum: Macros and UNO API
Topic: [Python] [Writer] Remove empty pages?
Replies: 8
Views: 6911

Re: [Python] [Writer] Remove empty pages?

But my document is not for printing. The problem still not solved.
by yijinger
Mon May 10, 2021 7:35 pm
Forum: Macros and UNO API
Topic: [Python] [Writer] Memory consumption?
Replies: 0
Views: 2618

[Python] [Writer] Memory consumption?

Hi all, I'm somewhat disturbed by how much RAM LibreOffice consumes while running in hidden mode. My script creates about 90 text documents (.odt files), writes them in a temporary folder, then compiles into one document. Source files are about 100-400 KB each, with some OLE objects in them, and the...
by yijinger
Fri Apr 23, 2021 5:39 am
Forum: Macros and UNO API
Topic: [Python] [Writer] Remove empty pages?
Replies: 8
Views: 6911

Re: [Python][Writer] Remove empty pages?

Blank pages appeared due to paragraph breaks - the last element on the previous page inserts "PARAGRAPH_BREAK", and it adds another page, which does not fill. But if I insert a condition concerning this paragraph break, I observe bugs with the previous paragraph.
by yijinger
Thu Apr 22, 2021 11:49 pm
Forum: Macros and UNO API
Topic: [Python] [Writer] Remove empty pages?
Replies: 8
Views: 6911

[Python] [Writer] Remove empty pages?

Hello,

I compiled my document and found some empty pages. How can I look through each page and remove empty ones? I could not find anything useful for my case.
by yijinger
Tue Apr 06, 2021 8:59 pm
Forum: Macros and UNO API
Topic: [Solved] [Python][Writer] Page numbering in footer - Style
Replies: 1
Views: 2832

Re: [Python][Writer] Page numbering in footer - font style

Well, I played with formattings and cursors and finally solved this puzzle. Maybe not very neat solution, but it works. I'll show the whole code (with already known part). addpages_doc = self.desktop.loadComponentFromURL(not_paged_doc_url, "_default", 0, ()) addpages_doc.StyleFamilies.Page...
by yijinger
Tue Apr 06, 2021 8:54 pm
Forum: Macros and UNO API
Topic: [Solved] [Python][Writer] Insert a bookmark with text?
Replies: 5
Views: 5504

Re: [Python][Writer] Insert a bookmark with text?

Yes! It works. I begin to understand power of cursors. Here is my final code, I insert a bookmark into a hidden text section, so that I can refer to this bookmark and get somewhere around this section: outer_section_cursor = tasks_part_doc.Text.createTextCursor() outer_section_cursor.gotoEnd(False) ...
by yijinger
Tue Apr 06, 2021 11:31 am
Forum: Macros and UNO API
Topic: [Solved] [Python][Writer] Page numbering in footer - Style
Replies: 1
Views: 2832

[Solved] [Python][Writer] Page numbering in footer - Style

Hi all, another problem with not evident solution: insert page numbers into a new document's footer. After reading lots of manuals and (fortunately) some forum code sheets, I came to the following: from com.sun.star.text.PageNumberType import PREV as PAGING_PREV, CURRENT as PAGING_CURRENT, NEXT as P...
by yijinger
Mon Apr 05, 2021 10:28 pm
Forum: Macros and UNO API
Topic: [Solved] [Python][Writer] Insert a bookmark with text?
Replies: 5
Views: 5504

Re: [Python][Writer] Insert a bookmark with text?

Yes, thank you very much, I found this "oAnchor.setString(...)", and it sets text for my bookmarks, but somewhy texts do not appear in references. My references are just empty fields. I revised all bookmarks after compiling the whole document, but nothing changed, references are still empt...
by yijinger
Mon Apr 05, 2021 7:32 pm
Forum: Macros and UNO API
Topic: [Solved] [Python][Writer] Insert a bookmark with text?
Replies: 5
Views: 5504

[Solved] [Python][Writer] Insert a bookmark with text?

Hello, all, I try to insert bookmarks using Python in my document. I read this article: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Bookmarks , but it does not show how to bind some text to bookmark. I write this in my code: task_num = str(part_index) + "." + str(subpart_i...
by yijinger
Mon Apr 05, 2021 3:38 pm
Forum: Macros and UNO API
Topic: [Solved][Python][Writer] Copying cell text into another file
Replies: 1
Views: 2458

Re: [Python][Writer] Copying cell text into another file

Well, I found a solution yesterday. Maybe it's not ideal, but it works for my task so far. I just got into that TextFrame: it had some TextContent instances (paragraphs really), available through an iterator. So I just copied them one by one with the following method. def copyframe(self, frame, src_...
by yijinger
Fri Apr 02, 2021 8:51 am
Forum: Macros and UNO API
Topic: [Solved][Python][Writer] Copying cell text into another file
Replies: 1
Views: 2458

[Solved][Python][Writer] Copying cell text into another file

Hello, all, I need to create a Python script which will take tasks from separate files (like "example_src.odt") and make an exercise book file: list tasks firstly (cell "B1"), and then list solutions (cell "B3") with tags (cell "B4"). The problem here is in em...