eea / odfpy

API for OpenDocument in Python
GNU General Public License v2.0
311 stars 64 forks source link

Terrible documentation #1

Open theArhar opened 10 years ago

theArhar commented 10 years ago

Please explain how to modify existing text in existing file

bufke commented 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.

  1. It's hard to do relatively common tasks like editing, viewing text. This might be best solved by additional code. Perhaps something like odfpy.shortcuts that has the most common use cases down to very simple functions.
  2. The documentation is about non existent.

So far I've only been using the library to read ods files so I can't even answer your question :(

theArhar commented 10 years ago

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

boucman commented 10 years ago

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

sicada commented 8 years ago

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.

balasankarc commented 8 years ago

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. :)

guimaraesrodrigues commented 7 years ago

Maybe the documentation is not that bad. Take a look at this file: https://github.com/eea/odfpy/blob/master/api-for-odfpy.odt

bordenc commented 5 years ago

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.

thunderamur commented 4 years ago

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?