|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
making multiple pages with spreadsheet_excel_writer
Hi,
I've been going over this for awhile and I can't seem to figure it out. Basically I'd like to be able to create 5 or 10 spreadsheets and save them to disk. Is it possible to do this? I can only get one to save at a time. I'm using php 4.4.4 with spreadsheet_excel_writer and everything works well but I just cant seem to figure this out. Here's my code: <?php for($i=0; $i<=5; $i++){ include 'sheetmaker.php'; } ?> where sheetmaker.php is my spreadsheet maker: <?php require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer(); $worksheet->write(3, 2, "Cell contents1"); $worksheet->write(4, 2, "Cell2"); $y = "sheet{$i}.xls"; $workbook->send("$y"); $workbook->close(); } ?> I can get it to save the first file, which is sheet0.xls but then nothing else happens. Is it possible to create and then save more than 1 sheet at a time or would I have to do something like creating all of my files in one file seperated by new pages? Thanks, David |
|
#2
|
|||
|
|||
|
RE: making multiple pages with spreadsheet_excel_writer
Hi,
First, it would be good to know whether you want to create several worksheets in one workbook or several workbooks. The documentation at PEAR :: Mnual :: Spreadsheet_Excel_Writer gives good examples on how to accomplish your tasks. Seems like the catch is the line. according to the documentation creating a worksheet like this uses http headers to determine the file name. if you change that line to something like then the spreadsheet gets written to a file. Change <yourfilename>.xlx on every loop and you should get 5 files with different names - if that's what you want. If you ant to create several worksheets in one workbook then you have to use a different approach like: instead of the line at the beginning of "sheetmaker.php". rather, put the creation of the workbook outside the loop. it is also a good idea to put the outside the loop - probably at the beginning of the main file. The part: can be omitted if you use the filename in the "new..." statement. Regards, desrtfx (Georg) |
|
#3
|
|||
|
|||
|
RE: making multiple pages with spreadsheet_excel_writer
Thanks for the reply
|
|
#4
|
|||
|
|||
|
RE: making multiple pages with spreadsheet_excel_writer
Quote:
|
|
#5
|
|||
|
|||
|
Yes you are right
you can't be acute
|
|
#6
|
|||
|
|||
|
Our first guess is
this is not dangerous
|
|
#7
|
|||
|
|||
|
the superior thing to do
this is not sombre
|
|
#8
|
|||
|
|||
|
Our best fancy is
Ye ye, what can I utter this appears to obtain worked very well
|
|
#9
|
|||
|
|||
|
Message
|
|
#10
|
|||
|
|||
|
Message
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PEAR Packages > making multiple pages with spreadsheet_excel_writer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|