cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobia Conforto <>
Subject Re: .DOC and .PPT modifying
Date Tue, 09 Oct 2007 15:02:08 GMT
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

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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message