hanya wrote:PyUNO object is not simple Python object but it is the wrapper object that references instance of the office. When you access to Text with "." operator, new instance is created for each call. If it is temporally object, the new instance is created and then died. In most case, this is not wrong for performance but I suggest to keep it into a variable. This is happen on each method callings, I sometimes keep method instance into a variable if I need to call it many times.
You mean a
Code: Select all
# document.Text.insertString(...)
text = document.Text
text.insertString(...)
text.insertString(...)
...
is a cleaner way of doing this? I assume then this goes for every object created by a "." operator here? Thanks for the tip!
hanya wrote:Apply the paragraph style to the paragraph that bound to numbering style with NumberingStyleName property. Numbering styles are little bit complicated. Please learn how to use object inspector.
Can I just modify the "Default style" for that paragraph or should I generate a new one for the lists?
Do you have a link to the object inspector and how to use it? I've looked around for useful documentation and just can't find much!
hanya wrote:Depends on the structure of your document. Use template document if you have some static parts in your document.
That's what I worried about: that I have to provide an empty and pre-formatted document. I noticed, for example, that the generated paragraphs with a custom style (see above for code from JFCC) don't accept changes to their font weight or slant (LibreOffice 4). Don't know if this is a problem in my document or a bug. It seemed to work in OpenOffice.
EDIT: Correction, it doesn't work in OO either. So basically, I've created a new paragraph style as per above instructions, but changing font properties on that style (slant, weight) doesn't have any effect. Changing the font itself, however, or indentation etc, works.
Mac 10.14 using LO 7.2.0.2, Gentoo Linux using LO 7.2.3.2 headless.