Document creation with odfpy

DarkBlue pict100 at gmail.com
Fri Jul 20 11:31:19 EDT 2007


Hello

I hope here is the right place to ask this:

I use the python odfpy library to create and
load an  odt file , however, spaces
in the passed in text are removed.

http://opendocumentfellowship.org/development/projects/odfpy

python2.4


from odf.opendocument import OpenDocumentText
from odf.style import Style, TextProperties
from odf.text import H, P, Span

def SaveIt(MYTEXT) :
      doc = OpenDocumentText()
      for line in MYTEXT:
		p = P(text=line)
	        doc.text.addElement(p)
      doc.save('mynewfile.odt')


MYTEXT is a list containing lines from a wx.TextCtrl
if a line is:

abcabc          abcabc         abcabc

the result in the odt file looks like:

abcabc abcabc abcabc



Is there anything I am doing wrong ?



Thanks
Db




More information about the Python-list mailing list