Open theArhar opened 10 years ago
Hi there, I'm new to this project and would agree the documentation is terrible. There are not many active developers involved in the project at this time. Would you like to assist making it better?
As I see it there are two problems.
So far I've only been using the library to read ods files so I can't even answer your question :(
found square-wheels-bike-solution:
old_text=unicode(span.firstChild) new_text=my_megafunction(old_text) new_S=text.Span() new_S.addText(new_text) new_S.setAttribute("stylename",span.getAttribute("stylename")) #save same style for text span.parentNode.insertBefore(new_S,span) #add new in right place span.parentNode.removeChild(span) #remove old
well, I've been using odf2xml a lot to understand what's going on... I think that there are some low hanging fruits to make things a bit more accessible to newcomers
I know this is an old post, but there is some documentation that related to odfpy that's available in HTML format via Nullege here: http://nullege.com/codes/search/odf . I've found it to be a moderately useful reference overall.
I wrote a blog post regarding usage of odfpy and it is available here - http://balasankarc.in/tech/using-python-and-odfpy-to-create-open-document-texts.html . Please check that also. :)
Maybe the documentation is not that bad. Take a look at this file: https://github.com/eea/odfpy/blob/master/api-for-odfpy.odt
The code uses Doxygen. The documentation it generates is sparse because the code itself is sparsely documented. The api-for-odfpy.odt seems to draw on this, but provides a poor discussion on usage, functionality and variables.
I think the best place to start would be improving the code comments so that Doxygen generates some useful documentation. In my Java days, good Javadoc was as helpful as any textbook. From good code documentation, some good wiki tutorials would probably emerge.
found square-wheels-bike-solution:
span is old element accessed by .getElementsByType(text.Span)
old_text=unicode(span.firstChild) new_text=my_megafunction(old_text) new_S=text.Span() new_S.addText(new_text) new_S.setAttribute("stylename",span.getAttribute("stylename")) #save same style for text span.parentNode.insertBefore(new_S,span) #add new in right place span.parentNode.removeChild(span) #remove old
This example does not work correctly. Some text is not replaced.
Is this mundane task (replace one text to another) impossible to implement?
Please explain how to modify existing text in existing file