zkh152 / xdocreport

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

SAXParseException when generating a Report from HTML with tag: <p style="text-align: center;"> #226

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Trying to generate a report for docx from HTML with text styling tag <p 
style="text-align: center;">

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

The excpected output is the centered text in the report.

But I just get an exception: (see attached file)

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

1.0.0

Please provide any additional information below.

Could anybody implement that text styling function supporting the style 
"text-align: center?

Original issue reported on code.google.com by Frank.Nu...@bechtle.com on 20 Feb 2013 at 1:28

Attachments:

GoogleCodeExporter commented 9 years ago
As you can see your stacktrace, your XHTML is not valid, you should close your 
p element 

-----------------------------------------
<p style="text-align: center;"></p>
-----------------------------------------

But text-align is not supported, please read supported html textstyling :

 *for docx http://code.google.com/p/xdocreport/wiki/DocxReportingJavaMainHTMLTextStyling#Supported_styles

 for odt http://code.google.com/p/xdocreport/wiki/ODTReportingJavaMainHTMLTextStyling#Supported_styles

But I agree with you, html etxt styling should be improved but before doing 
that, docx and odt styles should be generated on the fly because you can have 
any styles (today there are static for bold, italic, etc).

For the moment, I have no time to manage that.

Rregards Angelo

Original comment by angelo.z...@gmail.com on 20 Feb 2013 at 1:37

GoogleCodeExporter commented 9 years ago
My p element is closed after the text that I whish to align:

<p style="text-align: center;">
    Ihre Bewerbung hat uns gefallen und wir möchten Sie nun gerne persönlich kennen lernen.</p>

The parser doesn't seem to work correctly!

If you don't have time to implement text align I will try to do so because I 
need it urgently.

Thank's for Your help anyway!

Best Regards,

Frank

Original comment by Frank.Nu...@bechtle.com on 20 Feb 2013 at 1:52

GoogleCodeExporter commented 9 years ago
Please test step by step, the parser used is SAX, so you need to have a valid 
xml. I suspect that it's because of your & characteres. Please try with <p 
style="text-align: center;">aaa</a> for instance.

> If you don't have time to implement text align I will try to do so because I 
need it urgently.

I'm afraid that it's very complex because as I said you, we must compute style 
on the fly (big task I think) before wanting to add other properties.

Original comment by angelo.z...@gmail.com on 20 Feb 2013 at 2:23

GoogleCodeExporter commented 9 years ago
Hello Angelo,

we implemented text-alignment center in xdocreport for docx in a simple way 
that works for us.

Best regards

Alexander

Original comment by googlec...@norz.de on 5 Apr 2013 at 11:01

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Alexander,

Many thank's for your contribution!

Is it possible for you to attach a patch instead of zip (it will be easy for me 
to see your contribution).

Regards Angelo

Original comment by angelo.z...@gmail.com on 5 Apr 2013 at 12:04

GoogleCodeExporter commented 9 years ago
I close this issue because the SAX error is a problem of the not well formated 
XML.

 * For odt text align, I have created the issue https://code.google.com/p/xdocreport/issues/detail?id=244
 * For docx text align, I have implemented that (and manages justify,  right, left and center) see the (done) issue https://code.google.com/p/xdocreport/issues/detail?id=243

Original comment by angelo.z...@gmail.com on 6 Apr 2013 at 1:34

GoogleCodeExporter commented 9 years ago
Hi Frank,

I have understood your bug with SAX. It was not a bug with XDocReport but with 
the webapp demo. I think you have tested with the webapp demo. I have fixed the 
problem and you can see in the demo 
http://xdocreport.opensagres.cloudbees.net/processReport?reportId=ODTTextStyling
WithFreemarker.odt&dispatch=load&converter=PDF_ODFDOM your snippet :

--------------------------------------------------------------------------------
-
<p style="text-align: center;">
    Ihre Bewerbung hat uns gefallen und wir möchten Sie nun gerne persönlich kennen lernen.</p>
--------------------------------------------------------------------------------
-

I have managed text-align too for odt.

Regards Angelo

Original comment by angelo.z...@gmail.com on 8 Apr 2013 at 11:14