MohamedSaeed / xdocreport

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

display the values in column wise using velocity, #455

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.When I am using @before-cell#foreach loop.

   Java Code : 
    ==========
    List<DosData> dosData = new ArrayList<DosData>();
    DosData data1 = new DosData();
    data1.setDosStart("10/10/2014");

    DosData data2 = new DosData();
    data2.setDosStart("11/10/2014");

    DosData data3 = new DosData();
    data3.setDosStart("12/10/2014");

    dosData.add(data1);
    dosData.add(data2);
    dosData.add(data3);
    context.put("dosData", dosData);

What is the expected output? What do you see instead?

Expected output in the form of columns :

     ---------------------------------------  
     |10/10/2014  |  11/10/2014  | 12/10/2014|
     ---------------------------------------.

Instead of this I am getting some exceptions like below(Facing some exceptions 
like below headline)

What version of the product are you using? On what operating system?

I am using the below version.
<version>1.0.0</version> 

Please provide any additional information below.

When I am using below code : 

     ----------------------------
    |                           |
    |                           |
    |                           |
    |       «@before-cell#      |
        foreach($d in $dosData) |
        »«$d.dosStart»«@after-  |
        cell#end»               |
    |                           |
    |                           |
    |                           |
    |                           |
     ---------------------------

Facing some exceptions like below : 

When I am using above code getting some exceptions like below :

org.apache.fop.fo.ValidationException: The column-number or number of cells in 
the row overflows the number of fo:table-columns specified for the table. (No 
context info available)at 
org.apache.fop.events.ValidationExceptionFactory.createException(ValidationExcep
tionFactory.java:38) at 
org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager
.java:54) at 
org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.j
ava:175) at $Proxy297.tooManyCells(Unknown Source) at 
org.apache.fop.fo.flow.table.TableCellContainer.addTableCellChild(TableCellConta
iner.java:51) at 
org.apache.fop.fo.flow.table.TableRow.addChildNode(TableRow.java:95) at 
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:31
5) at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171) at 
org.apache.xml.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:206
) at 
org.apache.xml.serializer.ToXMLSAXHandler.characters(ToXMLSAXHandler.java:524) 
at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.dispatchNodeData(DOM2DTM.java:1690) 
at 
org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.dispatchCharactersEvents(DOM2DTM.java:162
2) at 
org.apache.xml.dtm.ref.DTMTreeWalker.dispatachChars(DTMTreeWalker.java:204) at 
org.apache.xml.dtm.ref.DTMTreeWalker.startNode(DTMTreeWalker.java:333) at 
org.apache.xalan.transformer.TreeWalker2Result.startNode(TreeWalker2Result.java:
146) at org.apache.xml.dtm.ref.DTMTreeWalker.traverse(DTMTreeWalker.java:114) 
at 
org.apache.xalan.transformer.TreeWalker2Result.traverse(TreeWalker2Result.java:7
4) at org.apache.xalan.templates.ElemCopyOf.execute(ElemCopyOf.java:186) at 
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTe
mplates.java:395) at 
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:17
8) at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerIm
pl.java:2400) at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376
) at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerIm
pl.java:2400) at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376
) at 
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTe
mplates.java:395) at 
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:17
8) at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerIm
pl.java:2400) at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:1376
) at 
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTe
mplates.java:395) at 
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:17
8) at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerIm
pl.java:2400) at 
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl
.java:2270) at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:
1356) at 
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:709)
 at 
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1273
) at 
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251
) at org.docx4j.XmlUtils.transform(XmlUtils.java:834) at 
org.docx4j.XmlUtils.transform(XmlUtils.java:727)

I have an idea that expected output will get using the syntax of above, Can any 
one suggest how to use "cell" syntax for above to work successfully.

Please find attached document which contains syntax how I am using.

the same way I have used row concept it works fine(@before-row#foreach), But in 
the case of column I am fail,Please suggest me any one.

Original issue reported on code.google.com by arun.har...@gmail.com on 27 Nov 2014 at 7:41

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by arun.har...@gmail.com on 27 Nov 2014 at 7:47

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

It seems that you use the docx->fop converter. This converter was just a POC 
but it was so long time that we have not maintained. You must use the itext 
docx->pdf converter.

At first I suggest you that you don't convert the report to see if the 
generated docx is ok.

Regard's Angelo

Original comment by angelo.z...@gmail.com on 27 Nov 2014 at 7:56

GoogleCodeExporter commented 9 years ago
Thanks Angelo for quick reply.

My main goal is to convert docx --> PDF.

When I am using @before-row#foreach I am not facing any issues at all(Please 
find attached docs to reference)
Attachments : render.pdf,Cook test1.dotx (why those were generated with the 
same application)

By seeing this message "org.apache.fop.fo.ValidationException:" you are 
suggested me to don't convert  DOCX --> FOP.Related to this I will delete fop 
related jars.

Can you please tell me any jars is required to generate in the form of columns 
or to use itext docx --> PDF converter.

Existed jar files are attached document(Jar files related file)

.

Original comment by arun.har...@gmail.com on 27 Nov 2014 at 9:21

Attachments:

GoogleCodeExporter commented 9 years ago
I suggest you that you download 
https://code.google.com/p/xdocreport/downloads/list 
docxandvelocity.converters-1.0.4-sample.zip you have JARs and sample to 
generate report with docx+velocity and convert it to pdf with itext.

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

GoogleCodeExporter commented 9 years ago
Thanks Angelo, for quick reply.

I have tried above what you said above and I have added the statement like 
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);

earlier it was like
Options options = 
Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.DOCX4J);

Finally i got successfully running @before-cell#foreach statement.

Original comment by arun.har...@gmail.com on 28 Nov 2014 at 5:18

GoogleCodeExporter commented 9 years ago
Can I close this issue?

Original comment by angelo.z...@gmail.com on 28 Nov 2014 at 8:49

GoogleCodeExporter commented 9 years ago
Sure, Thanks your support.

Original comment by arun.har...@gmail.com on 28 Nov 2014 at 8:59

GoogleCodeExporter commented 9 years ago

Original comment by angelo.z...@gmail.com on 28 Nov 2014 at 9:00