Re: [libreoffice-users] Re: Save UNO state?

2015-08-22 Thread Hi-Angel
Yay, that's actually cool! I added to my function also a maximum level. With level 5 it produces ≈23Mb output which is a miserable 267604 lines, vimdiff works fine with that. def printUNO(parent, listChecked, maxLevel): try: for propName in dir(parent): if str(propName)[0].

Re: [libreoffice-users] Re: Save UNO state?

2015-08-22 Thread X Roemer
Hi, I wrote some code some time ago. The code also checks the differences between two states of an object. The first part is similar to yours, it's also a recursive function, but it creates a dict and you can use a level to stop searching, so you won't get an infinite cycle. The second part

Re: [libreoffice-users] Re: Save UNO state?

2015-08-22 Thread Piet van Oostrum
Hi-Angel wrote: > Okay, I wrote a python code that explores every property, and doesn't > fall into an infinite cycle. It is > [...] > However it produces too much output, e.g. from a test document it > produced 1gb of output. I think the problem is that most elements > still appears in outp

Re: [libreoffice-users] Re: Save UNO state?

2015-08-22 Thread Hi-Angel
Okay, I wrote a python code that explores every property, and doesn't fall into an infinite cycle. It is def printUNO(parent, listChecked): try: for propName in dir(parent): if str(propName)[0].islower(): #function, skip continue try:

Re: [libreoffice-users] Re: Save UNO state?

2015-08-20 Thread Hi-Angel
>What is the purpose of comma separated machine data in a word processor >document? That is to save in file. The more newlines, the easier differ the text with vimdiff. Because if'd left these thousands symbols lines as is, it would be really hard to see what just changed. >Why don't you save th

[libreoffice-users] Re: Save UNO state?

2015-08-20 Thread Andreas Säger
WTF are you trying to do? What is the purpose of comma separated machine data in a word processor document? Why don't you save the shit in plain text and then do whatever you want with it without struggling this horrible API? -- View this message in context: http://nabble.documentfoundation.or

Re: [libreoffice-users] Re: Save UNO state?

2015-08-20 Thread Hi-Angel
Yay, that's actually cool :з So, I modified the code a bit to make it Pythonish. It doesn't print all existing properties though, but I modified it to print also at least every paragraph property. It is: doc = desktop.loadComponentFromURL("file:///tmp/output.odt" ,"_blank", 0, ()) file = open('/tm

[libreoffice-users] Re: Save UNO state?

2015-08-20 Thread Andreas Säger
Quick and dirty Basic routine to copy properties from obj1 to obj2: > Sub cloneProperties(obj1, obj2) > dim a, i, s, v > a() = obj1.PropertySetInfo.getProperties() > on error goto resumeNextErr > for each i in a() > s = i.Name > v = obj1.getPropertyValue(s) > obj2.setPropertyValu