For help!Why this has errors about excel???

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
mike.zhu
Forum Newbie
Posts: 2
Joined: Thu Jun 05, 2003 4:47 am
Contact:

For help!Why this has errors about excel???

Post by mike.zhu »

:(
the code is :

Code: Select all

$exapp = new COM("Excel.application");
$exapp->SheetsInNewWorkbook = 1;
$exapp->Application->Visible = 1;
$exapp->DisplayAlerts = True;
$wkb=$exapp->Workbooks->add();
$sheets = $wkb->Worksheets(1);
$sheets->activate;
$sheets->name = "hello";

for ($i=0; $i < 100; $i++)
{
	for ($j=0; $j < 10; $j++)
	{
		$a = chr(65 + $j);	
		$ran = $sheets->Range($a.$i);
		$ran->value = $i;
	}
}

$exapp->Quit();
mod_edit: added

Code: Select all

tags[/size]
 
and the errores are:
1.can't written in memory address,the address XXXXXXXXX is read ,can't be write.but i succes make a new excel file.
2.this code: header("Location:",$file_name);it doesn't work.

P.S:My enviorment:
Windows 2000 Professional,Apache 2.0.45,PHP 4.0.13

Thanks a lot.
[]InTeR[]
Forum Regular
Posts: 416
Joined: Thu Apr 24, 2003 6:51 am
Location: The Netherlands

Post by []InTeR[] »

2.this code: header("Location:",$file_name);it doesn't work.

must be
header("Location: ".$file_name);
mike.zhu
Forum Newbie
Posts: 2
Joined: Thu Jun 05, 2003 4:47 am
Contact:

Post by mike.zhu »

sorry,i make a mistake when i post it.
it realy is header("Location:".$file_name".)";

It is so strange that sometimes it will work,but sometimes it won't work?

I think it is the bug of PHP or Apache.Because use ASP/VBA,it work good.
toshesh
Forum Commoner
Posts: 33
Joined: Thu Jun 19, 2003 9:32 pm

Post by toshesh »

what does this code do? can it read excel files?
Post Reply