StimVinsh / xdocreport

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

Error "$___NoEscape4.TextBody" when trying to set SyntaxKind.Html in combination with a list #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Code fragment:

FieldsMetadata metadata = report.createFieldsMetadata();
metadata.addFieldAsTextStyling("person.firstname", SyntaxKind.Html);
metadata.addFieldAsTextStyling("person.lastname", SyntaxKind.Html);

// Person is a bean containing the properties firstname and lastname
List<Person> persons = new ArrayList<Person>();
persons.add(new Person("John", "<b>Smith</b>"));
persons.add(new Person("<i>Amy</i>", "Backer"));
IContext context = report.createContext();
context.put( "persons", persons );

The output is correct if I comment out either the first or the second method 
addFieldAsTextStyling(). If both are there, the output in the ODT is (the 
formatting of lastname is still right, "Smith" is bold):

$___NoEscape4.TextBody Smith
$___NoEscape4.TextBody Backer

Thanks for your answer.

Original issue reported on code.google.com by mmus...@gmail.com on 27 Apr 2012 at 3:55

GoogleCodeExporter commented 8 years ago
It seems the text styling works only for the first field. If I add another one, 
the result is:

$___NoEscape0.TextBody $___NoEscape1.TextBody JoSm 

Original comment by mmus...@gmail.com on 27 Apr 2012 at 4:04

GoogleCodeExporter commented 8 years ago
I used Velocity before and it didn't throw any exception. Switch to Freemarker, 
here is the stack trace:

fr.opensagres.xdocreport.core.XDocReportException: 
freemarker.core.InvalidReferenceException: Expression ___NoEscape3 is undefined 
on line 3, column 1
5159 in fr.opensagres.xdocreport.document.odt.ODTReport@1e59128!content.xml.
    at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.process(FreemarkerTemplateEngine.java:146)
    at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.processWithCache(FreemarkerTemplateEngine.java:92)
    at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:110)
    at fr.opensagres.xdocreport.template.AbstractTemplateEngine.process(AbstractTemplateEngine.java:82)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.processTemplateEngine(AbstractXDocReport.java:748)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:500)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.process(AbstractXDocReport.java:466)
    at ch.intertec.storybook.test.export.TestXdocreport.main(TestXdocreport.java:79)
Caused by: freemarker.core.InvalidReferenceException: Expression ___NoEscape3 
is undefined on line 3, column 15159 in fr.opensagres.xdocreport.documen
t.odt.ODTReport@1e59128!content.xml.
    at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
    at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
    at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
    at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
    at freemarker.core.Expression.getStringValue(Expression.java:93)
    at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.NoEscapeBlock.accept(NoEscapeBlock.java:70)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
    at freemarker.core.Environment.visit(Environment.java:428)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.EscapeBlock.accept(EscapeBlock.java:84)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:221)
    at freemarker.core.Environment.process(Environment.java:199)
    at fr.opensagres.xdocreport.template.freemarker.FreemarkerTemplateEngine.process(FreemarkerTemplateEngine.java:142)
    ... 7 more

Original comment by mmus...@gmail.com on 27 Apr 2012 at 4:33

GoogleCodeExporter commented 8 years ago
Hi,

Coudl you attach your docx or odt, java sampel please.

Thank a lot.

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 May 2012 at 1:37

GoogleCodeExporter commented 8 years ago
The files are attached. Basically I merge the list and text styling sample.
Thanks,
- Martin

Original comment by mmus...@gmail.com on 4 May 2012 at 2:20

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

Many thanks for your files.
For the moment, I have no time to study your case. I will do that as soon as 
possible.

Regards Angelo

Original comment by angelo.z...@gmail.com on 4 May 2012 at 7:08

GoogleCodeExporter commented 8 years ago
Hi Martin,

I tell me which version of XDocReport do you use? I have tested your sample and 
it works great the future version of XDocReport 0.9.8. I think it should work 
with 0.9.7 (I have do nothining for manage your case since 0.9.7).

If you are using 0.9.7, could you test with 0.9.8 (with Git or use 0.9.8 
SNAPSHOT).

Many thank's.

Regards Angelo

Original comment by angelo.z...@gmail.com on 22 Jun 2012 at 10:09

GoogleCodeExporter commented 8 years ago
Thanks, yes, I've used 0.9.7. You can close this issue. We are using another 
framework now.

Original comment by mmus...@gmail.com on 22 Jun 2012 at 12:52

GoogleCodeExporter commented 8 years ago
Hi Martin,

That's really shame for us-(
I'm sorry that you are disapointed with XDocReport. Could you tell me which 
framework do you use now and why you wish use it instead of XDocReport.

Many thank's.

Regards Angelo

Original comment by angelo.z...@gmail.com on 22 Jun 2012 at 1:06

GoogleCodeExporter commented 8 years ago
Nothing to be ashamed of. A simple HTML export was enough for our purpose - at 
least so far. We'll probably come back to your framework for a later version of 
our software.

Original comment by mmus...@gmail.com on 22 Jun 2012 at 1:23

GoogleCodeExporter commented 8 years ago
OK thank's for your reply.
I close this issue.

Regards Angelo

Original comment by angelo.z...@gmail.com on 22 Jun 2012 at 1:43

GoogleCodeExporter commented 8 years ago
Please reopen it.

Works with list, but not inside a table

I'm using Freemarker and xdocreport 0.9.8

Thanks

Original comment by mauretto79@gmail.com on 25 Jul 2012 at 10:19

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

What is your problem? (throw an error? text styling is not applied?)
I have testes and it works great for me.

Could you attach your Java code please (Main+Pojo).

Many thank's

Regards Angelo

Original comment by angelo.z...@gmail.com on 25 Jul 2012 at 12:57