Export data to OpenDocument Text

P

phasma

Hi!

I'm trying to save data from sqlite to OpenDocument Text.

Code:

localtime = time.localtime(time.time())

try:
odt_file = zipfile.ZipFile(file_name, "w")
except:
print("îÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÆÁÊÌ ÄÌÑ ÚÁÐÉÓÉ")
return False


buff_file = zipfile.ZipInfo("mimetype", localtime)

odt_file.writestr(buff_file, "application/
vnd.oasis.opendocument.text")

buff_file = zipfile.ZipInfo("content.xml", localtime)
buff_file.external_attr = 2179792896
buff_file.flag_bits = 8
buff_file.compress_type = zipfile.ZIP_DEFLATED

odt_file.writestr(buff_file, "\n".join(content_xml))

buff_file = zipfile.ZipInfo("styles.xml", localtime)
buff_file.external_attr = 2179792896
buff_file.flag_bits = 8
buff_file.compress_type = zipfile.ZIP_DEFLATED

odt_file.writestr(buff_file, "\n".join(style_xml))

buff_file = zipfile.ZipInfo("meta.xml", localtime)
buff_file.external_attr = 2179792896
buff_file.flag_bits = 8
buff_file.compress_type = zipfile.ZIP_DEFLATED

odt_file.writestr(buff_file, "\n".join(meta_xml))

buff_file = zipfile.ZipInfo("META-INF/manifest.xml", localtime)
buff_file.external_attr = 2179792896
buff_file.flag_bits = 8
buff_file.compress_type = zipfile.ZIP_DEFLATED

odt_file.writestr(buff_file, "\n".join(manifest_xml))

odt_file.close()

OpenOffice can't open this file, in what a problem ?

sample file: http://omploader.org/vZjlo/test.odt
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top