note 89657 added to book.com
| From: | long2hu3ATTyahooDOTTcom at osu1 dot php dot net | Date: | Wed, 18 Mar 2009 12:38:09 +0000 |
| Subject: | note 89657 added to book.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152075@lists.php.net to get a copy of this message | ||
When you work with MS Excel, Word, ... and other applications, never forget that COM doesnât
know their predefined constants, thus if you want to do sth. that would look like this in VB:
With myRange.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
you should either use numbers or define constants above, like this:
<?php
define('xlEdgeBottom', 9);
define('xlContinuous', 1);
define('xlThin', 2);
define('xlAutomatic', -4105);
$ex = new COM("Excel.Application", NULL, CP_UTF8) or Die ("Did not instantiate
Excel");
$wb = $ex->Application->Workbooks->Add();
$ws = $wb->Worksheets(1);
$xra = $ws->Range("A1:A6");
$bs = $xra->Borders(xlEdgeBottom);
$bs->LineStyle = xlContinuous;
$bs->Weight = xlThin;
$bs->ColorIndex = xlAutomatic;
?>
It is pointless to try to use text strings, i.e.
<?php
$bs = $xra->Borders('xlEdgeBottom');
$bs->Weight = 'xlThin';
?>
this will cause an error: Unable to set property Weight of class Border ...
----
Server IP: 69.147.83.197
Probable Submitter: 95.102.88.218
----
Manual Page -- http://www.php.net/manual/en/book.com.php
Edit -- https://master.php.net/note/edit/89657
Del: integrated -- https://master.php.net/note/delete/89657/integrated
Del: useless -- https://master.php.net/note/delete/89657/useless
Del: bad code -- https://master.php.net/note/delete/89657/bad+code
Del: spam -- https://master.php.net/note/delete/89657/spam
Del: non-english -- https://master.php.net/note/delete/89657/non-english
Del: in docs -- https://master.php.net/note/delete/89657/in+docs
Del: other reasons-- https://master.php.net/note/delete/89657
Reject -- https://master.php.net/note/reject/89657
Search -- https://master.php.net/manage/user-notes.php