Mr. Eric Minick,
        Here is the solution to your problem:
 
Please modify the SAXiTextHandler.java (from iTextXML.jar or srcXML.tar.gz) as mentioned below.
 
 
public class SAXiTextHandler extends DefaultHandler 
{
...
public void handleEndingTags(String name) {
{
...

                float total = 0;

                int j = 0;

                for (Iterator i = cells.iterator(); i.hasNext(); ) {

                    cell = (Cell) i.next();

                    if ((width = cell.cellWidth()) == null) {

                        if (cell.colspan() == 1 && cellWidths[j] == 0) {

                            try {

                                cellWidths[j] = 100f / columns;

                                total += cellWidths[j];

                                cellNulls[j] = false;/** NAIDU 20040303: added to fix 1st column width 50% */

                            }

                            catch(Exception e) {

                                // empty on purpose

                            }

                        }

                        else if (cell.colspan() == 1) {

                            cellNulls[j] = false;

                        }

                    }

                    else if (cell.colspan() == 1 && width.endsWith("%")) {

                        try {

                            cellWidths[j] = Float.valueOf(width.substring(0, width.length() - 1) + "f").floatValue();

                            total += cellWidths[j];

                            cellNulls[j] = false;/** NAIDU 20040303: added to fix 1st column width 50% */

                        }

                        catch(Exception e) {

                            // empty on purpose

                        }

                    }

                    j += cell.colspan();

                    table.addCell(cell);

                }
 
...
}
...
}
Satheesh Naidu
Alabama Interactive
 
----------------------------------------------------------------------------------------
I'm new to iText and like what I've seen so far.
 
 I did have some problems converting simple HTML into PDF though. The first
 column was given 50% of the screen space while the others are mashed
 together. I saw another post to the forum on this topic from earlier in the
 month but couldn't find a response. Is there something I'm doing wrong or is
 this still on the edge of what works and what doesn't? If that's the case,
 where would I look to see if I can improve the handling of tables?
 
 Thanks much,
 
 Eric Minick
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.596 / Virus Database: 379 - Release Date: 2/26/2004

 

Reply via email to