Closed GoogleCodeExporter closed 9 years ago
That's very strange, are you sure you have none conflicts with old version of
XDocReport?
Original comment by angelo.z...@gmail.com
on 8 Apr 2015 at 8:45
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.core</artifactId>
<version>${xdocreport.version}</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document</artifactId>
<version>${xdocreport.version}</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
<version>${xdocreport.version}</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.converter</artifactId>
<version>${xdocreport.version}</version>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>fr.opensagres.xdocreport.template.freemarker</artifactId>
<version>${xdocreport.version}</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.20</version>
</dependency>
Original comment by pain.ste...@gmail.com
on 8 Apr 2015 at 3:58
This is my dependencies in my pom.xml file
Original comment by pain.ste...@gmail.com
on 8 Apr 2015 at 3:59
Ok your problem is because your FieldsMetadata must be created on the first
place before calling report.extractFields.
In other words :
--------------------------------------------------------------
// 1) Load Docx file by filling Freemarker template engine and cache
// it to the registry
final IXDocReport report = XDocReportRegistry.getRegistry().loadReport(new
FileInputStream("E:/Temp/POI/Test.docx"),
TemplateEngineKind.Freemarker);
// 2) Create fields metadata to manage text styling
final FieldsMetadata metadata = report.createFieldsMetadata();
metadata.addFieldAsTextStyling("data", SyntaxKind.Html, true);
metadata.addFieldAsTextStyling("interfaces", SyntaxKind.Html);
metadata.addFieldAsImage("logo");
final FieldsExtractor fields = new FieldsExtractor();
report.extractFields(fields);
for (int i = 0; i < fields.getFields().size(); i++) {
final FieldExtractor field = (FieldExtractor) fields.getFields().get(i);
System.out.println("Field : " + field.getName());
}
--------------------------------------------------------------
Original comment by angelo.z...@gmail.com
on 9 Apr 2015 at 8:31
It works. Thank you
Original comment by pain.ste...@gmail.com
on 9 Apr 2015 at 9:14
Ok that's cool. Next time please create issue at
https://github.com/opensagres/xdocreport/issues
Original comment by angelo.z...@gmail.com
on 9 Apr 2015 at 9:20
Original issue reported on code.google.com by
pain.ste...@gmail.com
on 8 Apr 2015 at 7:30Attachments: