Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322198 - create a HTML table and run it in PDF format width of a table is not dividing properly
Summary: create a HTML table and run it in PDF format width of a table is not dividing...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 01:00 EDT by kavitha.shivaramaiah CLA
Modified: 2014-06-26 07:50 EDT (History)
4 users (show)

See Also:


Attachments
test report (52.64 KB, text/xml)
2010-08-11 01:42 EDT, Xiaoying Gu CLA
no flags Details
A test case using both styling and the width attribute (4.78 KB, application/octet-stream)
2010-11-29 18:14 EST, Jaret Ward CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kavitha.shivaramaiah CLA 2010-08-10 01:00:59 EDT
Build Identifier: 20090920-1017

I have created html table for my requirement like,
if(HTMLCommentsList.length>0){
HTMLCommentsList = HTMLCommentsList + "<table border= '1' WIDTH='100%'><tr><td WIDTH='10%'>"+row["ORDERNUMBER"]+"</td>"+
"<td WIDTH='90%'>"+row["COMMENTS"]+"</td></tr></table>";
}else{
HTMLCommentsList = HTMLCommentsList + "<table border= '1'><tr><th>Item No: (e.g. A2)</th><th>Comments</th></tr><tr><td WIDTH='10%'>"+row["ORDERNUMBER"]+"</td>"+
"<td WIDTH='90%'>"+row["COMMENTS"]+"</td></tr></table>";
}
}

Even though column width is given while running in PDF format width is divided into 50/50 and as 10/90. 

Reproducible: Always

Steps to Reproduce:
1.create a table on render script
2.copy the above code
3.run the report in PDF format
Comment 1 Xiaoying Gu CLA 2010-08-10 23:01:16 EDT
Would you please attach the test report for reproducing?
Comment 2 kavitha.shivaramaiah CLA 2010-08-11 00:41:37 EDT
As I could not able to attach rptdesign file.I am sending it through mail.Please check the mail.
Comment 3 Xiaoying Gu CLA 2010-08-11 01:42:53 EDT
Created attachment 176296 [details]
test report
Comment 4 Jaret Ward CLA 2010-11-29 18:14:21 EST
Created attachment 184087 [details]
A test case using both styling and the width attribute

This report is experiencing similar issues to the original test report.  It is organized as a grid control, with a Text control inside.  The content of the Text control is a table that uses an inline style for width on the first column and no width on the second.  In the second column is an embedded table with width defined in the first <td> width attribute.

Neither approach works for configuring the column width.
Comment 5 Jaret Ward CLA 2010-12-02 12:26:13 EST
This problem starts in the TableProcessor$TableState.processNodes() method. In that method, you can see that only <col> tags are analyzed for width information.  <td> tags are not analyzed for width information, even in the TableProcessor$CellState class, although they probably should be since this is the most common approach to HTML table definitions.

Unfortunately, it does not appear that styled width information is processed at any level for any tag.  For table columns, the width must be placed in the width attribute, e.g.:

<table>
  <col width="10%">
  </col>
  <col>
  </col>
  <tr>
    <td>10%</td>
    <td>90%</td>
  </tr>
</table>

This works fine if you do not need a width measurement in something other than % or px.  However, if you need it in, for instance, "em", that poses issues because the col width attribute has an HTML limitation that forbids it.  However, it will display correctly in the PDF output when "em" is used because the PDF conversion does not have that limitation.

I encountered this issue while creating an ExtendedReportItem plug-in control, so it was possible to vary the output according to the target (PDF or HTML), you'd need to set up visibility rules on two separate Text controls to get a similar result.  In that case you'd have to use <col width="2em"> for the PDF target and <col style="width: 2em"> for the HTML target.
Comment 6 Henning von Bargen CLA 2014-06-26 07:50:38 EDT
BIRT does not officially support the table tag in HTML text items.

And I think that's sad, but ok - I don't know of any other comparable tool that would support this.

You should use Grid or Table items to create the desired layout.

That's the way to go - except if you want to display dynamic, user-generated HTML including tables.

BIRT is not a HTML-to-anything converter, but a report engine.