Help on Printing Excel File

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
bsilver10
Forum Newbie
Posts: 1
Joined: Wed May 30, 2007 9:44 pm
Location: Pasig City, Philippines
Contact:

Help on Printing Excel File

Post by bsilver10 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I have this problem.  i wanted to print an excel file without oppenning the file.  I've already tried this code but it didn't work.

Code: Select all

$filename = "Leave.xls";
        $excel = new COM("Excel.Application") or die("Excel could not be started");
        $excel->visible = 1;
        $excel->Workbooks->Open($filename) or Die('Did not open filename');
        $excel->ActiveWorkBook->PrintOut();
        $excel->ActiveWorkBook->Close();
        $excel->Quit();
The situation would be this.. i have a list of excel filenames and a print link beside it, and when the print link is clicked, the file
beside it would be printed.
ex.

sample1.xls PRINT
sample2.xls PRINT
sample3.xls PRINT

If the above code is correct, are there any notes or things to remember or to be done before I can make the code work? Thanks
in advance.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If this is intended to print out on the user's computer, it won't, unless it is also the server.
Post Reply