Summary: (CSSToXLSFO, html tables) Rendering table columns
                    without fo:table-column specified
           Product: Fop
           Version: all
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: rtf

--- Comment #0 from Pavel Molchanov <> 2009-09-09 11:56:17 
PDT ---
Created an attachment (id=24240)
FO test case

I faced this bug when I tried to render table with no exact widths for the
table cells. 

FO was generated by CSSToXSLFO converter from very simple html code and it was
generated correctly.

Original html:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="";>
<table><tr><td>cell 1</td><td>cell 2</td></tr></table>

CSSToXSLFO produced FO stylesheet that I attached to the bug as a test case.
It's perfectly correct and works fine with FO->PDF conversion. RTF however
produced ugly table with huge unreadable columns.

Quick fix:

Modify Replace:

    public void setTableUnit(Table table, int tableUnit) {
        tableUnitMap.put(table, new Integer(tableUnit));


    public void setTableUnit(Table table, int tableUnit) {
        Integer tableUnitAsInt = new Integer(tableUnit);
        tableUnitMap.put(table, tableUnitAsInt);
        // put table units for all columns
        for (Object tc : table.getColumns()) {
            tableUnitMap.put(tc, tableUnitAsInt);


Checking the source code I found that RTF render can't resolve columns widths
correctly in the startColumn(TableColumn tc) method of RTFHandler. The column
width always come out as 0 for proportional width columns.

Actual call is:

int iWidth = tc.getColumnWidth().getValue(percentManager);

Which finally comes to int getBaseLength(int lengthBase, FObj fobj) in
PercentContext class

First argument comes as LengthBase.TABLE_UNITS, second - TableColumn object to
resolve width. Length is extracted from the Map:
    Object unit = tableUnitMap.get(fobj);

However this Map is never initialized correctly for TableColumn objects.
Initialization is done only for the Table object but not for columns. All
requests for width calculation could not find width for columns specified in
TABLE_UNITS, returned 0.0.

As a result 0.0 width passed to RTF call tag and produce ugly output for

Simple fix was straight-forward. Fill tableUnitMap with correct widths for
TableColumn objects too. That fixed the problem and produce nice table output
in RTF.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to