Forum


Replies: 3   Views: 4437
Width and height properties
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by nsilberman  · 14-11-2012 - 05:12

Hi

I don't understand why in this code, phpdocx_pro doesn't recognize the width and the height properties of the table, or the rows or the cells or the image. On the word document, I want to use 100% of the page width. As it isn't understood by phpdocx, the image is also resized to 52% of its original size (because of the dpi conversion I think)

[code]
$return_txt = "<table style="font-family: Arial; font-size: 10pt;width:700px;">";
$return_txt .= "<tr><td style="width:200px;"><p>My question is not so simple</p></td>";
$return_txt .= "<td style="width:500px;"><img style="width:'500px';height:'400px';" src='$fileName' /></td></tr>";
$return_txt .= "</table>";
[/code]

Did I write something wrong ?

Thanks

Posted by darren77  · 11-04-2013 - 12:13

Same here, but no replies...

Posted by pphornet  · 11-04-2013 - 12:13

try it code (without image, sorry)

[code]<?php
require_once '../phpdocx_pro/classes/CreateDocx.inc'; // don't forget change path!


$docx = new CreateDocx();
$docx->enableCompatibilityMode();

$return_txt = "<table style="width:400pt;">";
$return_txt .= "<tr style="height:150pt; vertical-align:top;"><td style="width:100pt;border:1px solid black"><p>My question is not so simple</p></td>";
$return_txt .= "<td style="width:300pt;border:1px dotted red; vertical-align:middle;"><p style="text-align: center;">here image</p></td></tr>";
$return_txt .= "</table>";
$docx->embedHTML($return_txt);

$return_txt = "<table style="width:100%;">";
$return_txt .= "<tr style="height:150pt; vertical-align:top;"><td style="width:100pt;border:1px solid black"><p>My question is not so simple</p></td>";
$return_txt .= "<td style="border:1px dotted red; vertical-align:middle;"><p style="text-align: center;">here image</p></td></tr>";
$return_txt .= "</table>";
$docx->embedHTML($return_txt);


$docx->createDocx('Example');
?>[/code]