hyunsikki / xdocreport

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

TextStyling does not work with variable in #foreach #423

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write à document containing:

«#foreach ($item in $html_texts)» 
«$item»
«#end»

What is the expected output? What do you see instead?
We have this exception:
org.apache.velocity.exception.ParseErrorException: Encountered "(" at <unknown 
template>[line 1, column 4011]
Was expecting one of:
    "[" ...
    "}" ...

Generated template xml is:
#set($___NoEscape0=${___TextStylingRegistry.transform($#foreach($item in 
$html_texts),"Html",$false,"DOCX","0_elementId",$___context,"word/document.xml")
}) 
$___NoEscape0.TextBefore
        <w:p w:rsidR="00874442" w:rsidRDefault="00874442">
            <w:pPr>
                <w:pStyle w:val="Corpsdetexte2"/>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:sz w:val="18"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:noProof/>
                    <w:sz w:val="18"/>
                </w:rPr>
                <w:t>$___NoEscape0.TextBody</w:t>
            </w:r>
        </w:p>
$___NoEscape0.TextEnd

Instead of:
        <w:p w:rsidR="00874442" w:rsidRDefault="00874442" w:rsidP="00874442">
            <w:pPr>
                <w:pStyle w:val="Corpsdetexte2"/>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:sz w:val="18"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:noProof/>
                    <w:sz w:val="18"/>
                </w:rPr>
                <w:t>
#foreach ($item in $html_texts)
                </w:t>
            </w:r>
            <w:r w:rsidRPr="00874442">
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:sz w:val="18"/>
                </w:rPr>
                <w:t xml:space="preserve"> </w:t>
            </w:r>
        </w:p>
#set($___NoEscape0=${___TextStylingRegistry.transform($item,"Html",$false,"DOCX"
,"0_elementId",$___context,"word/document.xml")}) 
$___NoEscape0.TextBefore
        <w:p w:rsidR="00874442" w:rsidRDefault="00874442">
            <w:pPr>
                <w:pStyle w:val="Corpsdetexte2"/>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:sz w:val="18"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:noProof/>
                    <w:sz w:val="18"/>
                </w:rPr>
                <w:t>$___NoEscape0.TextBody</w:t>
            </w:r>
        </w:p>
$___NoEscape0.TextEnd
        <w:p w:rsidR="00874442" w:rsidRDefault="00874442" w:rsidP="00874442">
            <w:pPr>
                <w:pStyle w:val="Corpsdetexte2"/>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:sz w:val="18"/>
                </w:rPr>
            </w:pPr>
            <w:r>
                <w:rPr>
                    <w:b w:val="0"/>
                    <w:noProof/>
                    <w:sz w:val="18"/>
                </w:rPr>
                <w:t>
#end
                </w:t>
            </w:r>
        </w:p>

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

Please provide any additional information below.
I need this feature to display some lines surrounding the styled text in html 
inside the loop

Original issue reported on code.google.com by gueri...@free.fr on 17 Jul 2014 at 10:04

GoogleCodeExporter commented 9 years ago
Please post a simple docx+Java code which causes your problem.

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 3:51

GoogleCodeExporter commented 9 years ago
here is an example posing the problem

Original comment by gueri...@free.fr on 11 Aug 2014 at 2:39

Attachments:

GoogleCodeExporter commented 9 years ago
Try with 

metadata.addFieldAsTextStyling("item", SyntaxKind.Html);

Original comment by angelo.z...@gmail.com on 11 Aug 2014 at 4:32

GoogleCodeExporter commented 9 years ago
Try with 

metadata.addFieldAsTextStyling("item", SyntaxKind.Html);

Original comment by angelo.z...@gmail.com on 11 Aug 2014 at 4:32

GoogleCodeExporter commented 9 years ago
Try with 

metadata.addFieldAsTextStyling("item", SyntaxKind.Html);

and remove

metadata.addFieldAsTextStyling("html_texts", SyntaxKind.Html);

Original comment by angelo.z...@gmail.com on 11 Aug 2014 at 4:33

GoogleCodeExporter commented 9 years ago
I have the same error

Original comment by gueri...@free.fr on 12 Aug 2014 at 8:53

GoogleCodeExporter commented 9 years ago
Ok, I will study your sample when I will have time.

Regard's Angelo

Original comment by angelo.z...@gmail.com on 12 Aug 2014 at 9:02