Yeah, pretty good ideas, Tobia. I think that, if all the recent version of office software tools handle XML, I should get do change the templates. The problem is the usage of office software tool's old versions by the users.
My web application must receives the templates, store them and allow the users select some values stored in a database to be changed in the file which will be generated. So, user can download it. In this way, if the user has an old version that not generate the files XML-based, it wouldn't work, would it? Another requirement of the software is that the files for word processing must be .DOC instead of .RTF. So, I can't consider .RTF file format. About the content of files, it should have pictures, any different kinds of text format (italic, bold, etc), text box, tables, etc. Thanks for the help! Luiz On 10/9/07, Tobia Conforto <[EMAIL PROTECTED]> wrote: > > Luiz Antonio Falaguasta Barbosa wrote: > > Is it possible to use Cocoon to change keys by values into .DOC and > > .PPT file types? Does anybody could give me some example? > > I don't have first-hand experience with it, but here are a few ideas. > > If the file is not too big, you can load it into memory as a string and > perform string replacement on it, then write it back to disk or stream > it to the user. You can accomplish this with a number of Cocoon > technologies, for example with a custom Reader or with a piece of > Flowscript. Actually you can do the same with any other web language or > web application framework: string substitution is pretty basic stuff. > > You should check whether those file formats store strings in plain text, > which encoding they use, and how well they tolerate string substitution. > For example, any substitution will break the format if it employs a CRC > or another integrity check; variable-length substitutions will fail if > they break record lengths or offsets. It's a hack in any case, and it > should be treated as such. > > I have had good results with the RTF format, which is well understood by > most word processing applications, is text-based and allows arbitrary > substitutions. > > On the other hand, the newer office productivity file formats are all > XML-based (both OpenDocument and that other Microsoft equivalent) and > Cocoon excels at handling XML. > > You could create (or convert) your document templates into such a format, > using specific tags or element IDs as placeholders, or anything else that > can easily be replaced with an XSLT stylesheet. Then have Cocoon perform > the substitution, zip the resulting XML with other needed resources (such > as images) using the ZipArchiveSerializer, and serve it to users. > > Just a few ideas. > > > Tobia > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
