PHP and COM

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TexMex4Me
Forum Newbie
Posts: 3
Joined: Thu Jun 17, 2004 12:59 pm
Location: Atlanta GA

PHP and COM

Post by TexMex4Me »

I am using a 3rd party package called ExcelWriter from Softartisans to create report spreadsheets. They have a VB example of how to set the cell width as:
------------------------------------------------------
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set Cells = XlwApp.Worksheets(1).Cells

'--- Set column width for the third column to 10
Cells.ColumnWidth(3) = 10
------------------------------------------------------

I have a php function to do the same thing. It follows:
------------------------------------------------------
function cellWidth($wkbk,$sheet,$col,$value) {
$tmp = $wkbk -> worksheets($sheet);
$tmp = $tmp->cells;
$tmp->ColumnWidth($col) = $value;
}
------------------------------------------------------

When I run this, I get a PHP parse error of "unexpected '=' ". Any ideas of how I can get around this?

Also, is there a better/proper way to access the methods/properties than the way I am doing it? It seems that PHP does not like it when a '->' follows a value in parenthesis, such as $sheet and $col in the example.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You probably need to add the return of ColumnWidth() to a reference variable, so it properly affects the change..
Post Reply