community-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Kienenberger <mkien...@gmail.com>
Subject Re: Apache Velocity for Producing Document
Date Sat, 18 Jul 2015 00:12:30 GMT
Velocity can generate a report from a template and a dataset, but
you'd still need something that can parse the original .dot files.

POI can both read and write documents, at least excel documents.   I
haven't tried using it to parse or write a .docx file, but a quick
search should determine whether that is supported.

I'm not familiar with the .dotx/.dot files so I have no idea what
those are or how you'd parse them.

My suspicion is that it's probably easier to create the .docx files
using POI, assuming that docx is as well supported as excel files are.

Velocity is great at generating text documents.  I have no idea what
the data type of docx is, but I'd guess it'd be xml text.   However,
it might be difficult to create your own docx file template.

Then again, I guess you could start by creating a docx file by hand
that looks the way you want, then go in and edit it to insert the
dynamic pieces by replacing static text with velocity directives.

In any case, the real trick is parsing the .dot files.

On Fri, Jul 17, 2015 at 7:03 PM, Antoine Levy Lambert <antoine@gmx.de> wrote:
> Hi,
>
> I made a google search and found some articles on Stack Overflow : [1] and this one :
[2]
>
> (this one mentions another non Apache java framework called docx4j ).[3]
>
> What about investing some time doing some quick prototypes to get a feeling of the options
?
>
> Neither poi nor docx4j seem to be templating engines but you can use them to create documents
programatically and you might be able to define your own rules for generating documents from
templates.
>
> Antoine
>
> [1] http://stackoverflow.com/questions/16264247/create-document-from-dotx-template-with-apache-poi-hwpf
> [2] http://www.smartjava.org/content/create-complex-word-docx-documents-programatically-docx4j
> [3] http://www.docx4java.org/trac/docx4j
>
> On Jul 17, 2015, at 6:47 PM, velocityuser user <apachevelocityuser@gmail.com> wrote:
>
>> Thanks Antoine for the quick response.
>>
>> I have requirements such as conditional data population and nested templates.
>>
>> Does POI support these two requirements?
>>
>> Also I need to know if the Template can handle any kind of start /  end tag or it
need to have a standard format?
>>
>> Thanks in advance for your help.
>>
>>
>>
>> On Fri, Jul 17, 2015 at 3:15 PM, Antoine Levy Lambert <antoine@gmx.de> wrote:
>> Hi,
>>
>> The last release of velocity was on the 29th of November 2010. [1]
>>
>> I would look at Apache POI instead [2]
>>
>> This project has most likely a user list where you can discuss your use case.
>>
>> Antoine
>> [1] http://velocity.apache.org
>> [2] http://poi.apache.org
>>
>>
>> On Jul 17, 2015, at 1:43 PM, velocityuser user <apachevelocityuser@gmail.com>
wrote:
>>
>> > Hello,
>> >
>> > I have a requirement where I need to read a work template such as *.dot /
>> > *.dotx, merge the template with data and generate a word document in *.doc
>> > / *.docx.
>> >
>> > I read Velocity can be used to do this but I can not find any example
>> > anywhere.
>> >
>> > Appreciate if I get some guidance on this problem.
>> >
>> > Thanks in advance.
>>
>>
>

Mime
View raw message