Forums / Setup & design / pdf exports : how to align content in cells ?

pdf exports : how to align content in cells ?

Author Message

francis Nart

Friday 21 July 2006 8:48:42 am

Hi,

we have a problem when exporting content in pdf. When we have a table in a template, we can't center or align on the right the content of the table cells in the pdf export. Has any of you found a solution ?

Thanks for your help !

Francis.

Kåre Køhler Høvik

Tuesday 25 July 2006 1:54:50 am

Hi

I think you can use the <i>justification</i> td element attribute din the PDF templates to align the cell content.

<tr><td justification="center">Some text</td></tr>

Kåre Høvik

francis Nart

Tuesday 25 July 2006 3:26:49 am

Unfortunately Kåre, alignment doesn't work using the following codes :

<tr>
<td align="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ),hash('align', 'center' ) )}</td>
</tr>
{pdf(table, $tableau, hash('showLines',2,
'firstRowTitle',1,
'titleCellCMYK',array( 0, 0, 0 ),
'titleTextCMYK',array(0.9,0.3,0,0.2),
'titleFontSize',8,
'cellCMYK',array( 0, 0, 0 ),
'textCMYK',array( 255, 255, 255 ),
'rowGap',4,
'colGap',4,
'cellPadding',0,
'width',435,
'repeatTableHeader',0) )}

We also tried the "cellData" option which is used in "lib/ezpdf/classes/class.ezpdftable.php" but the aligment doesn't change either:

{pdf(table, $tableau, hash('cellData',array('0,0',array('justification',right)),
'showLines',2,
'firstRowTitle',1,
'titleCellCMYK',array( 0, 0, 0 ),
'titleTextCMYK',array(0.9,0.3,0,0.2),
'titleFontSize',8,
'cellCMYK',array( 0, 0, 0 ),
'textCMYK',array( 255, 255, 255 ),
'rowGap',4,
'colGap',4,
'cellPadding',0,
'width',435,
'repeatTableHeader',0) )}

we're stuck with this !

Kåre Køhler Høvik

Tuesday 25 July 2006 4:01:00 am

Hi

What about this:

{pdf(table, $tableau, hash('cellData',array('0,0',array('justification',right,
 'showLines',2,
 'firstRowTitle',1,
 'titleCellCMYK',array( 0, 0, 0 ),
 'titleTextCMYK',array(0.9,0.3,0,0.2),
 'titleFontSize',8,
 'cellCMYK',array( 0, 0, 0 ),
 'textCMYK',array( 255, 255, 255 ),
 'rowGap',4,
 'colGap',4,
 'cellPadding',0,
 'width',435,
 'repeatTableHeader',0) ) )}

Kåre Høvik

Vanessa Merle

Tuesday 25 July 2006 5:48:35 am

Hello Kåre,

The content of the table cells are still not aligned on the right with this code.
For me, the best solution would be to put the attribute "justification" or "align" in the template for certain cells but that does not function.

These various codes does not align the text :

<tr>
<td align="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td justification="center">{pdf( 'text', $text|wash( 'pdf' ),hash('align', 'center' ) )}</td>
</tr>

Do you have an idea?

Thanks.

Vanessa

fabian schoen

Wednesday 18 October 2006 6:04:50 am

@Vanessa

Did you figure out, how to align it?

regards
fabian

Vittal Aithal

Friday 22 December 2006 4:55:00 am

Hi Kåre,

Passing in cellData (or cols for that matter) isn't going to work, because the array gets serialised into a string with value "Array" before it gets passed to any of the underlying PDF generation code. Having delved around inside the code for a bit (and got royally confused :), I've added a patch to http://issues.ez.no/IssueView.php?Id=8724 to allow alignment to be set within the set-block variable.

However, you need to use a syntax like:

<tr>
<td:align:left:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td:align:center:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
<td:align:right:>{pdf( 'text', $text|wash( 'pdf' ) )}</td>
</tr>

There does seem to be some cruftiness in the PDF code - are there any plans to review the PDF stuff and bring it back to speed?

Regards
Vittal

Vittal Aithal | Geek | VisionWT

Award-winning brand and technical development

www.visionwt.com

James Ward

Wednesday 16 April 2008 1:53:58 pm

I know this thread is old but hopefully someone is still watching. I'm trying to export a pdf table and having no luck setting cell widths in ez 3.10.

I added Vittal's patch and got alignment working.

I see in the file class.ezpdftable.php parameters that should allow the setting of cell width but I can not get it to work.

I have tried the following:

<td:width:200:>some test text</td>

and it seems to have no effect on the cell width.

Any suggestions would be much appreciated.

working at www.wardnet.com
blogging at www.jamesward.ca