Hi Hitesh, Best way I found: Calculate the string widths and define fixed column widths. And pray you don't have line breaks, subelements, blocks in blocks, multiple inlines or other strange stuff like padding, insets, borders... Here's the method I use:
private static FOP analyser = null; public float getWidthPoint2() { double width = 0; if ( analyser == null ) { analyser = new FOP(); } Font f = getActiveFont(); // get the relevant font from somewhere... if (f != null) { try { width = analyser.getTextWidth( text, f.getName(), (int)Math.ceil(f.getSize())); // text is the actual string displayed in the table cell } catch (Exception e) { e.printStackTrace(); } } return (float) width; } Regards, Georg Datterl ------ Kontakt ------ Georg Datterl Geneon media solutions gmbh Gutenstetter Straße 8a 90449 Nürnberg HRB Nürnberg: 17193 Geschäftsführer: Yong-Harry Steiert Tel.: 0911/36 78 88 - 26 Fax: 0911/36 78 88 - 20 www.geneon.de Weitere Mitglieder der Willmy MediaGroup: IRS Integrated Realization Services GmbH: www.irs-nbg.de Willmy PrintMedia GmbH: www.willmy.de Willmy Consult & Content GmbH: www.willmycc.de -----Ursprüngliche Nachricht----- Von: hitesh_jain [mailto:hitesh.m.j...@gmail.com] Gesendet: Freitag, 20. Februar 2009 09:18 An: fop-users@xmlgraphics.apache.org Betreff: Re: auto table column width with FOP? Hi, I need column width to be equal to content inside the cell for FOP output, which is same as what we see in html by default. I am using FOP 0.94. Can anybody give idea on the same. Thanks Hitesh Sidi Mohamed Idrissi Yaghir wrote: > > hi mailing list, > > i´ve defined a table with 3 columns, that contains blocks with a > dynamic content (image or text with different width) , and i want, > that the width of these columns will autoresized depending upon > contents. > > Is this possible with FOP? > > thnx a lot! > > Simo > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org > For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org > > > -- View this message in context: http://www.nabble.com/auto-table-column-width-with-FOP--tp12257232p22116551.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org