PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 5th, 2006, 04:45 AM
yawdivad yawdivad is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 yawdivad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old October 5th, 2006, 05:55 AM
desrtfx desrtfx is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sometimes Austria, sometimes Sahara
Posts: 27 desrtfx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 sec
Reputation Power: 0
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
php Code:
Original - php Code
  1. $workbook = new Spreadsheet_Excel_Writer();
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
php Code:
Original - php Code
  1. $workbook = new Spreadsheet_Excel_Writer('<yourfilename>.xls');
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:

php Code:
Original - php Code
  1. $worksheet =& $workbook->addWorksheet('<sheetname>');
instead of the
php Code:
Original - php Code
  1. $workbook = new Spreadsheet_Excel_Writer();
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
php Code:
Original - php Code
  1. require_once 'Spreadsheet/Excel/Writer.php';
outside the loop - probably at the beginning of the main file.

The part:
php Code:
Original - php Code
  1. $y = "sheet{$i}.xls";
  2. $workbook->send("$y");
can be omitted if you use the filename in the "new..." statement.

Regards,
desrtfx (Georg)

Reply With Quote
  #3  
Old October 8th, 2006, 04:00 AM
yawdivad yawdivad is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 yawdivad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: making multiple pages with spreadsheet_excel_writer

Thanks for the reply . I ended up making my worksheets within the workbook. Thanks for all the info .

Reply With Quote
  #4  
Old October 18th, 2006, 01:27 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: making multiple pages with spreadsheet_excel_writer


Quote:
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


Reply With Quote
  #5  
Old November 9th, 2009, 09:36 PM
vodslougs vodslougs is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Thailand
Posts: 5 vodslougs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 13 sec
Reputation Power: 0
Send a message via ICQ to vodslougs
Yes you are right

you can't be acute

Reply With Quote
  #6  
Old November 9th, 2009, 10:11 PM
vodslougs vodslougs is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Thailand
Posts: 5 vodslougs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 13 sec
Reputation Power: 0
Send a message via ICQ to vodslougs
Our first guess is

this is not dangerous

Reply With Quote
  #7  
Old November 9th, 2009, 10:40 PM
vodslougs vodslougs is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Thailand
Posts: 5 vodslougs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 13 sec
Reputation Power: 0
Send a message via ICQ to vodslougs
the superior thing to do

this is not sombre

Reply With Quote
  #8  
Old November 10th, 2009, 12:39 AM
vodslougs vodslougs is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Thailand
Posts: 5 vodslougs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 13 sec
Reputation Power: 0
Send a message via ICQ to vodslougs
Our best fancy is

Ye ye, what can I utter this appears to obtain worked very well

Reply With Quote
  #9  
Old November 14th, 2009, 10:45 AM
kayliemae kayliemae is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Wyoming
Posts: 1 kayliemae User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m
Reputation Power: 0
Message

Reply With Quote
  #10  
Old November 14th, 2009, 10:46 AM
fishingmad fishingmad is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Birmingham
Posts: 1 fishingmad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 47 sec
Reputation Power: 0
Message

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > making multiple pages with spreadsheet_excel_writer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek