Page 1 of 1

Help on Printing Excel File

Posted: Wed May 30, 2007 9:52 pm
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]

Posted: Thu May 31, 2007 12:18 am
by feyd
If this is intended to print out on the user's computer, it won't, unless it is also the server.