Dynamic creation of .doc files
How can you dynamically generate a .doc file using AJAX? Python? Adobe AIR? I am thinking of a situation where an online pc / desktop app takes user feedback in the form of an article (a la wiki) in Icelandic character encoding, and then when the button is clicked, it produces a .doc file containing user input for the web page. Any solutions / suggestions would be much appreciated.
PS- I don't want to go with this C # / Java way.
a source to share
The problem with *.doc
MS text format is that it is not well documented, so it may not have very good support, for example PDF
, which is the standard.
Except for problems with creation doc
, you may have problems reading files doc
. For example, users on Linux machines.
You should consider creating RTF on the server. It is more standard and therefore more supported for both creating documents and reading the document afterwards. Unless you need very specific functionality, this should be sufficient for most document types, and MS word opens it by default, just as it opens its own native format.
PyRTF is a project you can use to generate RTF with python.
a source to share
This doesn't need to be done with ajax (in the sense that ajax is typically used for dynamic client side interactions)
You need a server side script that takes input and converts it to doc.
You can use something like openoffice and python if it has some interface see http://wiki.services.openoffice.org/wiki/Python
or in windows you can directly use Word COM objects to create a document using win32apis but less likely a windows server serving python :)
I think the best alternative is to create a PDF file, which would be better and easier. Reportlab has a wonderful PDF generation library and works like a charm from python. Once you have the pdf, you can use some pdf to doc converter, but I think the PDF will be good enough.
Edit: Generating Doc On the other hand, if you insist on DOC you can have a Windows server in which case you can use COM objects to generate DOC, xls or whatever http://win32com.goermezer.de/content/view / 173/284 /
a source to share