- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: php script
Operating System - Linux
1751981
Members
4917
Online
108784
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-06-2006 04:36 PM
тАО09-06-2006 04:36 PM
php script
Hi
I generated a excel file which contains the data fetched form mysql database.I used the following to do it
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=spreadsheet.xls");
header("Pragma: no-cache");
header("Expires: 0тА│);
print тАЬ$headern$data";
using this I could generate an excel file with only one spreadsheet having the file name.
I NEED TO GENERATE 2 SPREADSHEETS in a single excel sheet and each sheet should contain a table content fetched from the db in the same format as in db.
The another way I tried is like below
require_once('C:\apachefriends\xampp\php\pear\Spreadsheet\Excel\Writer.php'); //specify path
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// sending HTTP headers
$sel_USchema = filename;
if($sel_USchema!= 'None')
{
$workbook->send($sel_USchema.'.xls'); //specify path
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('Products');
$worksheet =& $workbook->addWorksheet('Products_details');
$workbook->close();
}
else
{
alert("Please select any UserSchema Name");
}
?>
with the above code I was could generate 2 spread sheets in single excel file but struck up while trying to write the data in the 2 sheets..
Please help me out..
Thanks
I generated a excel file which contains the data fetched form mysql database.I used the following to do it
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=spreadsheet.xls");
header("Pragma: no-cache");
header("Expires: 0тА│);
print тАЬ$headern$data";
using this I could generate an excel file with only one spreadsheet having the file name.
I NEED TO GENERATE 2 SPREADSHEETS in a single excel sheet and each sheet should contain a table content fetched from the db in the same format as in db.
The another way I tried is like below
require_once('C:\apachefriends\xampp\php\pear\Spreadsheet\Excel\Writer.php'); //specify path
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// sending HTTP headers
$sel_USchema = filename;
if($sel_USchema!= 'None')
{
$workbook->send($sel_USchema.'.xls'); //specify path
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('Products');
$worksheet =& $workbook->addWorksheet('Products_details');
$workbook->close();
}
else
{
alert("Please select any UserSchema Name");
}
?>
with the above code I was could generate 2 spread sheets in single excel file but struck up while trying to write the data in the 2 sheets..
Please help me out..
Thanks
- Tags:
- PHP
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2006 10:06 PM
тАО09-07-2006 10:06 PM
Re: php script
Try Adding One and add data to it and add the second one. Else use the select() oject to select the sheet and then add. or you can use seperate variables for each sheet and then you can add it.
A Sibple sample is given below.
require_once 'C:\php\Excel\Writer.php';
// We give the path to our file here
$workbook = new Spreadsheet_Excel_Writer('C:\php\Excel\test.xls');
$worksheet1 =& $workbook->addWorksheet('Products');
$worksheet1->write(0, 0, 'Name');
$worksheet1->write(0, 1, 'Age');
$worksheet1->write(1, 0, 'John Smith');
$worksheet1->write(1, 1, 30);
$worksheet1->write(2, 0, 'Johann Schmidt');
$worksheet1->write(2, 1, 31);
$worksheet1->write(3, 0, 'Juan Herrera');
$worksheet1->write(3, 1, 32);
$worksheet1 =& $workbook->addWorksheet('Products');
$worksheet2 =& $workbook->addWorksheet('Products_details');
$worksheet2->write(0, 0, 'Name');
$worksheet2->write(0, 1, 'Age');
$worksheet2->write(1, 0, 'Frijo');
$worksheet2->write(1, 1, 30);
$worksheet2->write(2, 0, 'John Antony');
$worksheet2->write(2, 1, 31);
$worksheet2->write(3, 0, 'James Rad');
$worksheet2->write(3, 1, 32);
// We still need to explicitly close the workbook
$workbook->close();
?>
A Sibple sample is given below.
require_once 'C:\php\Excel\Writer.php';
// We give the path to our file here
$workbook = new Spreadsheet_Excel_Writer('C:\php\Excel\test.xls');
$worksheet1 =& $workbook->addWorksheet('Products');
$worksheet1->write(0, 0, 'Name');
$worksheet1->write(0, 1, 'Age');
$worksheet1->write(1, 0, 'John Smith');
$worksheet1->write(1, 1, 30);
$worksheet1->write(2, 0, 'Johann Schmidt');
$worksheet1->write(2, 1, 31);
$worksheet1->write(3, 0, 'Juan Herrera');
$worksheet1->write(3, 1, 32);
$worksheet1 =& $workbook->addWorksheet('Products');
$worksheet2 =& $workbook->addWorksheet('Products_details');
$worksheet2->write(0, 0, 'Name');
$worksheet2->write(0, 1, 'Age');
$worksheet2->write(1, 0, 'Frijo');
$worksheet2->write(1, 1, 30);
$worksheet2->write(2, 0, 'John Antony');
$worksheet2->write(2, 1, 31);
$worksheet2->write(3, 0, 'James Rad');
$worksheet2->write(3, 1, 32);
// We still need to explicitly close the workbook
$workbook->close();
?>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-07-2006 10:14 PM
тАО09-07-2006 10:14 PM
Re: php script
Hi,
seems you have forgotten about your other thread covering the same topic:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1057181
Everytime you provide updates, your thread 'bounces' to the top of the forum tree, so no need to generate additional threads.
seems you have forgotten about your other thread covering the same topic:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1057181
Everytime you provide updates, your thread 'bounces' to the top of the forum tree, so no need to generate additional threads.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP