|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66092 Adding shadow to border on generated Word document fails
Submitted: 2013-11-14 09:38 UTC Modified: 2014-12-30 10:42 UTC
From: adam dot tallon at version1 dot com Assigned:
Status: No Feedback Package: COM related
PHP Version: 5 OS: Windows Server 2008 R2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-11-14 09:38 UTC] adam dot tallon at version1 dot com
Moving from PHP 4 to PHP 5 and the below works fine in PHP 4, now on PHP 5, regardless what version and the below line fails with the error underneath it. If the line is changed to FALSE it will generate the file with no border shadow on tables.

@$vTable->Borders->Shadow = TRUE;

Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: Command failed' in genworddoc_class.php:436
Stack trace:
#0 genworddoc_class.php(436): genWordDoc::addFormattedTable7()
#1 genworddoc_class.php(330): genWordDoc->addFormattedTable7('BULK_TABL...', 1, 5, Array, Array, Array)
#2 c_generate_correspondence.php(444): genWordDoc->addTableArrayObjectsToTemplate('BULK_TABL...', Array, Array, NULL, NULL, Array)
#3 main.php(190): include('C:\htdocs\...')
#4 index.php(6): include('C:\htdocs\...')
#5 {main} thrown in genworddoc_class.php on line 436

Test script:
$vObjBookmark = $this->mWord->ActiveDocument->Bookmarks($pBookmarkName);
$vRange = $vObjBookmark->Range;
$vTable = $this->mWord->ActiveDocument->Tables->Add($vRange, 2, 2, 0, 2);
@$vTable->Borders->Shadow = TRUE;
$vTable->AllowAutoFit = 1;

Expected result:
Generated document with tables that have a border shadow on them.

Actual result:
No document generated, error thrown in logs at border->shadow line of code, blank page displayed.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-14 09:44 UTC] adam dot tallon at version1 dot com
-PHP Version: Irrelevant +PHP Version: 5
 [2013-11-14 09:44 UTC] adam dot tallon at version1 dot com
Updated PHP version the issue is occurring on.
 [2013-11-14 18:16 UTC]
-Status: Open +Status: Feedback
 [2013-11-14 18:16 UTC]
I'm sure it's not a PHP bug. Have you considered that it's an issue with Word? Some very brief Googling suggests that even executing too quickly can cause this problem.
 [2013-11-15 09:12 UTC] adam dot tallon at version1 dot com
The same version of word is being used on the old server and the new server, the only thing that's change is the version of PHP from 4 too 5.
 [2013-11-15 09:22 UTC] adam dot tallon at version1 dot com
Meant to add that the error is only thrown when the '$vTable->Borders->Shadow = TRUE;' line is set yo true, if it's set to FALSE then the document generates fine, which would indicate to me that there is a bug in passing a true value for shadows.

Thanks for your feedback.
 [2013-11-15 19:15 UTC]
PHP neither knows nor cares that you're trying to set a shadow. Word is the one throwing the exception, not PHP, and it does so for all sorts of situations - not just border shadows on a table.

Speaking of which, here's someone who claims Table.Borders.Shadow=true never works.

As for what I was getting at earlier, it's quite possible that PHP 5 is executing faster than Word can handle the scripting. I see you added the table on the line before - maybe it's too soon to modify it. Try making the script pause for a second before continuing.
 [2014-05-08 16:19 UTC]
@adam dot tallon at version1 dot com, please post a worky reproduce snippet, your current containing things like "$this->mWord" are unfortunately not usable.

 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 14:01:29 2024 UTC