danishiumca / xdocreport

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

Styled text in loop are escaped #425

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Styled text in loop are escaped

What steps will reproduce the problem?
1. Write a DOCX document containing a loop:
#foreach($item in $allItems)
$item.htmlText
#end

2. Define allItems.htmlText as Html textStyling text:
FieldsMetadata metadata = report.createFieldsMetadata();
metadata.addFieldAsTextStyling("allItems.htmlText", SyntaxKind.Html);

3. Set the HTML value:
IContext context = report.createContext();
List<Object> listArray = new ArrayList<Object>();
IContext subcontext = report.createContext();
subcontext.put("htmlText", "<b>A bold text in HTML</b>");
listArray.add(subcontext);
context.put("allItems", listArray);

What is the expected output? What do you see instead?
It must show the HTML text without markup but it show:
<b>A bold text in HTML</b>

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 1:14

GoogleCodeExporter commented 9 years ago
Yout fields metadata should be configured like this : 

FieldsMetadata metadata = report.createFieldsMetadata();
metadata.addFieldAsTextStyling("item.htmlText", SyntaxKind.Html);

Original comment by angelo.z...@gmail.com on 7 Aug 2014 at 6:08

GoogleCodeExporter commented 9 years ago
Thank you for the tip.

It would be useful, for simplicity, that the library can handle this case to 
avoid having to know the name of the variable used in the #foreach loop and to 
avoid having to program different meta-data generation code for .fields.xml 
generation and for the report generation.

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

GoogleCodeExporter commented 9 years ago
I agree with you but it means that XDocReport should be enable to parse 
Velocity/Freemarker syntax to retrieve the item name of the loop.

I think it's an hard task.

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