Forum


Replies: 11   Views: 4151
Don't work in google doc viewer (embedhtml)
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 acanthis  · 03-10-2013 - 12:48

When I create or add html table in my .docx file, document is not displayed on the Google Doc Viewer.


Posted by jorgelj  · 03-10-2013 - 14:10

Hello,



Please try the most simple example of a table to check if it works. Using embedHTML, the HTML is transformed to WordML so it must works fine with any DOCX viewer; maybe you're adding some element that Google Doc doesn't support.



Regards.


Posted by acanthis  · 04-10-2013 - 06:56


$html = '<table style="border-collapse: collapse; width: 200px;" border="1">
<tbody>
<tr>
<td>123</td>
<td>321</td>
</tr>
</tbody>
</table>';
$docx = new CreateDocx();
$docx->embedHTML($html);
$docx->createDocx('test');


Don't show in GDocs Viewer.



It is noteworthy that, if I re-save file as 'test.docx' in MS Word, I can view this file in GDocs Viewer



Proof:



Before re-save: 



https://docs.google.com/viewer?url=http://fs1.d-h.st/download/00075/FdD/test.docx



After re-save: 



https://docs.google.com/viewer?url=http://fs1.d-h.st/download/00075/UC5/test.docx


Posted by jorgelj  · 04-10-2013 - 07:39

Hello,



We're going to check the problem and fix it.



Regards.


Posted by acanthis  · 04-10-2013 - 23:16

please keep me informed


Posted by jorgelj  · 07-10-2013 - 09:54

Hello,



We've been checking the issue and it's a Google Doc problem. The problem is due to this element:




<w:gridCol/>


Google doesn't allow to set an empty w:gridCol property, but as you can read in the standard:



http://www.schemacentral.com/sc/ooxml/e-w_gridCol-1.html



w:gridCol is not mandatory but optional. So as PHPDocX follows the standard as much as possible, we'll don't force a value for this element. We recommend you to contact Google to fix it.



Regards.


Posted by acanthis  · 09-10-2013 - 11:42

Forgive me for arrogance, but you could not send a working code to the generated files in PHPDOCX open correctly in Google Viewer?

I have absolutely no time to contact Google, but the service I needed now.



Thank you for understanding


Posted by jorgelj  · 09-10-2013 - 15:30

Hello,



We can't calculate automatically the value of the properties of <w:gridCol/> tag, it takes a value when it's displayed in a document or saved by them. The problem is that Google fails on that tag of the OOXML standard:



http://www.schemacentral.com/sc/ooxml/e-w_gridCol-1.html



OpenOffice fails too when reading some tags of the standard.



PHPDocX is a library to generate DOCX documents according to a standard and we must apply this OOXML standard and not solve every miss and errors of the viewers.



Of course as PHPDocX is an open library, you can change the code to fit your needs.



Thank you for your understanding.



Regards.


Posted by jorgelj  · 21-10-2013 - 16:49

Hello,



The next version of PHPDocX, 3.5.1, allows you to fix this issue forcing a width:



$html = '<table style="border-collapse: collapse; width: 200px;" border="1">

<tbody>

<tr>

<td width="200px;">123</td>

<td width="200px;">321</td>

</tr>

</tbody>

</table>';

$docx = new CreateDocx();

$docx->enableCompatibilityMode();

$docx->embedHTML($html);

$docx->createDocx('test');



Regards.


Posted by acanthis  · 25-10-2013 - 11:05

[quote=jorgelj]



Hello,



The next version of PHPDocX, 3.5.1, allows you to fix this issue forcing a width:



$html = '<table style="border-collapse: collapse; width: 200px;" border="1">

<tbody>

<tr>

<td width="200px;">123</td>

<td width="200px;">321</td>

</tr>

</tbody>

</table>';

$docx = new CreateDocx();

$docx->enableCompatibilityMode();

$docx->embedHTML($html);

$docx->createDocx('test');



Regards.



[/quote]



Don't work ((


Posted by jorgelj  · 28-10-2013 - 09:20

Hello,



That fix is only available for PRO+, Corporate and Enterprise versions. We have sent you an email.



Regards.