MohamedSaeed / xdocreport

Automatically exported from code.google.com/p/xdocreport
1 stars 0 forks source link

Open up fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine#extractVariables API #388

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Angelo,

it would be great if you could change the visibility of 
fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine#extractVar
iables to protected so that one can easily extend the handling of extracting 
variables for documentation purposes.

I'm faced with generating an Excel spreadsheet with Reports vs Variables, 
Macros, etc. to provide an overview which document uses which field.

This task would be quite easy thanks to the structure of XDocReport. However, 
the only thing that makes it hard to extend the extraction of field types other 
than ${} ("DollarVariable") is the private access of this method.

You may even go a step further an provide an extension API for the variable 
extraction. 

Thanks,
    Stefan

Original issue reported on code.google.com by stefan.g...@googlemail.com on 28 Mar 2014 at 9:17

GoogleCodeExporter commented 9 years ago
Hi Stefan,

I had created extractVariables for our demo : use create a docx/odt with some 
fields and after upload it the docx/odt (see 
http://xdocreport.opensagres.cloudbees.net/loadReport.jsp), an HTML form shows 
each fields to filled (see 
http://xdocreport.opensagres.cloudbees.net/processReport.jsp). 

But IMHO, in real case, I think it's a bad idea to do that. I think it's better 
to define your field with FieldsMetadata and after create your docx/odt.

I could set extractVariables as protected, but for the moment I prefer avoiding 
that and understand your need. Which extension do you want to do? Is this 
extension is specific for your project? Perhaps it will better to improve 
extractVariables of XDocReport?

> I'm faced with generating an Excel spreadsheet
XDocReport provides an ods support, but very very basic (just replace a cell 
which contains $name), so I don't suggest you to use XDocReport today to manage 
excel.

Regards Angelo

Original comment by angelo.z...@gmail.com on 29 Mar 2014 at 10:27

GoogleCodeExporter commented 9 years ago
Hi Angelo,

we do have documented DOM trees for the various Document we generate. However, 
we also use Freemarker macros and functions to hide some of the document logic 
(select different tree elements based on the type of Document, basically). 
However, this got slightly out of hand, and now we need to document, which 
document uses which field (DollarVariable), and which Macro (which is of type 
UnifiedCall), which document contains #if-expressions, and to forth.

For this, I found it rather convenient to customize FreemarkerTemplateEngine to 
extract more field information than just DollarVariable.

The Excel-issue is in my case none of XDocReport concerns -- I just wanted to 
put my task in context. I use POI to generate the overview which document uses 
which field/makro/function/etc. 

Makes sense so far?

Cheers,
    Stefan

Original comment by stefan.g...@googlemail.com on 30 Mar 2014 at 8:51

GoogleCodeExporter commented 9 years ago
Hi Stefen,

It should be cool if you attach a sample with your case. Do you think we could 
have a generic code to improve extractVariables ? 

Regards Angelo

Original comment by angelo.z...@gmail.com on 30 Mar 2014 at 6:33

GoogleCodeExporter commented 9 years ago
Hi Stefen, I think it should be good to study 
https://github.com/cwong15/freemarker-introspection

Perhaps XDocReport could use this project?

Original comment by angelo.z...@gmail.com on 16 Jun 2014 at 12:56