Issue
I am using "Writer.php" file provided by pear.php.net to generate excel files. What i'm finding difficult to do is adding worksheets to an existent workbook. I tried few things but failed to add worksheet. I am really bad at OOP, any help would be much appreciated. Thanks in advance.
Here is the php code that genrates the excel file:
<?php
session_start();
require_once('Spreadsheet/Excel/Writer.php');
include ("config.php");
$username = $_SESSION['username'];
$uid = $_SESSION['uid'];
$name_in_logo=$_POST['name_in_logo'];
if (!is_dir($username))
{
$oldumask = umask(0);
mkdir($username, 0777);
umask($oldumask);
}
$now = new DateTime(null, new DateTimeZone('Asia/Kolkata'));
$date_time = $now->format('d-m-Y H:i:s');
$filename1 = $username;
$filename2 = "_Design Brief ";
$filename3 = ".xls";
$final_filename = $filename1.$filename2.$date_time.$filename3;
$path_xls = "/";
$path_to_xls = $username.$path_xls.$final_filename;
$workbook = new Spreadsheet_Excel_Writer($path_to_xls);
$_SESSION['objworkbook'] = $workbook;
$worksheet =& $workbook->addWorksheet('Design Brief Details');
$worksheet->write(0, 0, 'uid');
$worksheet->write(0, 1, $uid);
$worksheet->write(1, 0, 'name_in_logo');
$worksheet->write(1, 1, $name_in_logo);
$workbook->close();
?>
Solution
You cannot use Spreadsheet_Excel_Writer
to read existing files.
Answered By - cweiske Answer Checked By - David Goodson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.