MohamedSaeed / xdocreport

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

extractFields doesn't extract image fieds #451

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, 
TemplateEngineKind.Velocity);
2.FieldsExtractor<FieldExtractor> extractor = FieldsExtractor.create();
3.report.extractFields(extractor);

What is the expected output? What do you see instead?
I'm not see the fieds corresponding of dynamic image

What version of the product are you using? On what operating system?
xdocreport 1.4.0, windows 7+word

Please provide any additional information below.

Original issue reported on code.google.com by coralie....@gmail.com on 12 Nov 2014 at 1:28

GoogleCodeExporter commented 9 years ago
fields extractor is used just to retrieve simple field name ${name}. It doesn't 
work for image.

Original comment by angelo.z...@gmail.com on 12 Nov 2014 at 1:49

GoogleCodeExporter commented 9 years ago
so, how read the dynamic image fieds from the docx ?

Original comment by coralie....@gmail.com on 12 Nov 2014 at 2:02

GoogleCodeExporter commented 9 years ago
> so, how read the dynamic image fieds from the docx ?

You cannot. FieldsExtractor was created just for our demo  : after uploading a 
docx you have a form which display simple text field to fill teh data model.

In real case, the data model should be known, so you need not to use 
FieldsExtractor.

Original comment by angelo.z...@gmail.com on 12 Nov 2014 at 2:08

GoogleCodeExporter commented 9 years ago
ok, thanks. (In my case, the model isn't be known by the application because 
it's dynamic)

Original comment by coralie....@gmail.com on 12 Nov 2014 at 2:15

GoogleCodeExporter commented 9 years ago
hello Angelo
think you develop the feature that allows you to extract images from template? 
I think it would be useful because in the context of an application that uses a 
template to generate a docx, the application does not know which fields to 
fill. extractFields helps to know the text fields to fill in, but not the 
images.
What do you think?

Original comment by coralie....@gmail.com on 13 Nov 2014 at 9:57

GoogleCodeExporter commented 9 years ago
Hi Coralie,

> think you develop the feature that allows you to extract images from template?

No sorry -( 

Simple fields and dynamic images are very different : 

 * simple field use standard Velocity/Freemarker syntax. So extractor uses the template engine to retrieve the fields name.
 * dynamic image works with image+bookmark (to name image) and you must use FieldsMetadata to tell to XDocReport that image+bookmark should be replaced with dynamic image. 

So you could have an image+bookmark and XDocReport could not replace the image. 
To know if image must be replaced, FieldsMetadata must be used. So the image 
name comes from FieldsMetadata.

After you could tell me, that you wish to retrieve names from the whole 
image+bookmark. To do that, you cannot use template engine. It's specific to 
docx. So you could use perhaps use POI to retrieve bookmark name.

Original comment by angelo.z...@gmail.com on 13 Nov 2014 at 11:06