help developing an editor to view openoffice files.

K

krishnakant Mane

hello,
right now I am involved on doing a very important accessibility work.
as many people may or may not know that I am a visually handicap
person and work a lot on accessibility. the main issue at hand is to
create an accessible editor for open office.
there are a lot of things remaining on that front.
so right now I am trying to find out a temporary work around by
creating a simple accessible editor (with wxpython) for viewing and
editing open office files.
I know there must be python libraries that can open/ save .odt files
because it is an open standard any ways.
but I am trying to work out a kind of a program where those files can
also be displayed in a text area with all the formatting.
probably one way of doing it is to use some thing like a rich text
editor and allow the file to be converted to rtf from odt for viewing
and back again to odt when the user wishes to save it.
another way I find is to actually find out if there is a odt text box
that can display these files as they are.
viewing the contents of the files in an editable way is most important.
any suggestions?
regards.
Krishnakant.
 
K

Ken Starks

krishnakant said:
hello,
right now I am involved on doing a very important accessibility work.
as many people may or may not know that I am a visually handicap
person and work a lot on accessibility. the main issue at hand is to
create an accessible editor for open office.
there are a lot of things remaining on that front.
so right now I am trying to find out a temporary work around by
creating a simple accessible editor (with wxpython) for viewing and
editing open office files.
I know there must be python libraries that can open/ save .odt files
because it is an open standard any ways.
but I am trying to work out a kind of a program where those files can
also be displayed in a text area with all the formatting.
probably one way of doing it is to use some thing like a rich text
editor and allow the file to be converted to rtf from odt for viewing
and back again to odt when the user wishes to save it.
another way I find is to actually find out if there is a odt text box
that can display these files as they are.
viewing the contents of the files in an editable way is most important.
any suggestions?
regards.
Krishnakant.

There is an O'Reilly Book about hacking the Open Office Format, and
it is available free on line in both html and pdf.

Open office files are a variation on 'Zipped' archives and
many unzip tools can be used to open them, apart from ones
that insist on a .zip extension. These include python tools.

The one 'case study' in the book that uses python is actually for
a spreadsheet, but that makes little difference to the
'unzipping' part. You can find it at:

http://books.evc-cit.info/odbook/ch05.html#modify-spreadsheet-section

Once you have the raw XML you should be able to convert it to any one of
many more accessible XML formats, for screen readers, brail
printers and so on. I don't know much about them, but hopefully you
do!

Don't re-invent the wheel! You will find quite a few ways on the Open
Office Wiki for converting the format to other things. You can also
daisy-tail the XSLT files; for example use one to convert to xhtml and
a second that converts xhtml to text.

Example (Display write files in the 'Firefox' browser).
http://wiki.services.openoffice.org/wiki/Firefox_ODFReader_extension


Don't forget that Open Office already has PDF export facilities, and
Acrobat reader already has some accessibility ability for simple
documents (i.e single column, 'start at the beginning, keep going until
you get to the end, and then stop'). For adding structure to other PDF
files you would need Acrobat Professional or software that can export
'tagged' PDFs.

The case-study code is:

import xml.dom
import xml.dom.ext
import xml.dom.minidom
import xml.parsers.expat
import sys
import od_number
from zipfile import *
from StringIO import *

if (len(sys.argv) == 4):

# Open an existing OpenDocument file
#
inFile = ZipFile( sys.argv[1] )

# ...and a brand new output file
#
outFile = ZipFile( sys.argv[2], "w", ZIP_DEFLATED );

getParameters( sys.argv[3] )

#
# modify all appropriate currency styles
#
fixCurrency( "styles.xml" )
fixCurrency( "content.xml" )

#
# copy the manifest
#
copyManifest( )

inFile.close
outFile.close
else:
print "Usage: " + sys.argv[0] + " inputfile outputfile parameterfile"
 
C

Colin J. Williams

Ken said:
There is an O'Reilly Book about hacking the Open Office Format, and
it is available free on line in both html and pdf.
More expensive but well reviewed is:

http://www.amazon.com/gp/product/cu.../103-7133293-6391046?ie=UTF8&n=283155&s=books

Colin W.
Open office files are a variation on 'Zipped' archives and
many unzip tools can be used to open them, apart from ones
that insist on a .zip extension. These include python tools.

The one 'case study' in the book that uses python is actually for
a spreadsheet, but that makes little difference to the
'unzipping' part. You can find it at:

http://books.evc-cit.info/odbook/ch05.html#modify-spreadsheet-section

Once you have the raw XML you should be able to convert it to any one of
many more accessible XML formats, for screen readers, brail
printers and so on. I don't know much about them, but hopefully you
do!

Don't re-invent the wheel! You will find quite a few ways on the Open
Office Wiki for converting the format to other things. You can also
daisy-tail the XSLT files; for example use one to convert to xhtml and
a second that converts xhtml to text.

Example (Display write files in the 'Firefox' browser).
http://wiki.services.openoffice.org/wiki/Firefox_ODFReader_extension


Don't forget that Open Office already has PDF export facilities, and
Acrobat reader already has some accessibility ability for simple
documents (i.e single column, 'start at the beginning, keep going until
you get to the end, and then stop'). For adding structure to other PDF
files you would need Acrobat Professional or software that can export
'tagged' PDFs.

The case-study code is:

import xml.dom
import xml.dom.ext
import xml.dom.minidom
import xml.parsers.expat
import sys
import od_number
from zipfile import *
from StringIO import *

if (len(sys.argv) == 4):

# Open an existing OpenDocument file
#
inFile = ZipFile( sys.argv[1] )

# ...and a brand new output file
#
outFile = ZipFile( sys.argv[2], "w", ZIP_DEFLATED );

getParameters( sys.argv[3] )

#
# modify all appropriate currency styles
#
fixCurrency( "styles.xml" )
fixCurrency( "content.xml" )

#
# copy the manifest
#
copyManifest( )

inFile.close
outFile.close
else:
print "Usage: " + sys.argv[0] + " inputfile outputfile parameterfile"
 
K

krishnakant Mane

hello,
well what I exactly need to do is firstly have a way to read .odt and
..ods files.
I have a lot of information in open office format which I need to access.
The most important thing is that I completely want to avoid the use of
microsoft office.
so I need to firstly get access to open office documents through a
python module that can read and parse those documents and may be
convert it to html and display in some kind of an html/ text area may
be wxpython can help?
secondly I want to edit those documents may be in html format and then
when I say sayve it should save the changes back to .odt with the
formatting information.
can this be made possible?
thanks and regards,
Krishnakant.
 
K

krishnakant Mane

I actually just read this in the O'Reilly book "Python Cookbook," so I
know this answer off the top of my head. OpenOffice files are merely
zip files with well documented XML inside. Use the builtin zip module
to open them, and then it's just XML parsing. As far as the editor,
you'll have to familiarize yourself with the XML data from the
documentation, and it sounds like that's quite a project.
it is indeed a huge project but I need to get started.
I know that it is xml inside a zipped archive. but reading the
documents is one thing and rendering them is another.
just in case we can convert it to html and then render it in some kind
of a html browser or html text area and then when user makes changes
to the document, we can save it back to odt. but for that we need
both way conversion.

Just out of curiosity, why not just download OpenOffice?
I wished I could use it out of the box.
but the problem is that open office does not provide any accessibility
on windows and on linux the work is going on.
regards.
Krishnakant.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top