Page 1 of 1
[resolved] Importing to Excel
Posted: Thu Aug 10, 2006 10:48 am
by ibanez270dx
Hi,
I am seriously at my wit's end about this... I need to be able to click a link, which opens up a dynamically created Excel page with X number of rows and 9 columns. I am currently using a script called "excelwriter", but I can't seem to get it to work properly - that is, write all the rows into the excel file (I can only write one, which is a little useless...). So, my question would be: How would I be able to accomplish this if I rewrote the whole script? I'm talking from scratch... Also, is it possible to import my data as an HTML table to Excel? I think that would be easiest.
Thanks in advance,
- Jeff
Posted: Thu Aug 10, 2006 1:16 pm
by feyd
Are you referring to the PEAR Excel Writer class? the documentation for it has examples of specifying where to place output.
Posted: Thu Aug 10, 2006 1:20 pm
by ibanez270dx
feyd | Please use 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]
no, I was using a script called "ExcelWriter" by Harish Chauhan. Anyhow, I have switched to now exporting my data as a CSV. However, I just can't format it. Does anyone know how to add formatting (like bold text, etc...) into a CSV? Whenever I try using HTML tags, it just prints the tags.
Here is my current code:
Code: Select all
$cr = "\n";
$xojet = "TITLE" . ',' . $monthname . ',' . $year . $cr;
$catanames =
"Type" . ',' . "Date" . ',' . "Downtime" . ',' . "Hours Down" . ',' .
"ATA" . ',' . "Discrepancy" . ',' . "Resolution" . ',' . "Logged" . ',' .
"Logged By" . $cr;
$data .=
$dwntime_type . ',' . $dwntime_date . ',' . $dwntime_times . ',' .
$dwntime_hrs . ',' . $dwntime_ata . ',' . $dwntime_reason . ',' .
$dwntime_solution . ',' . $dwntime_log . ',' . $dwntime_log_by . $cr;
}
$fp = fopen($filename2,"a");
if($fp)
{
fwrite($fp, $title);
fwrite($fp, $catanames);
fwrite($fp, $data);
fclose($fp);
echo "File saved successfully. <a href=$filename.csv>click here to access $filename2</a>";
} else {
echo "Error saving file!";
}
feyd | Please use 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 Aug 10, 2006 3:31 pm
by Ollie Saunders
Does anyone know how to add formatting (like bold text, etc...) into a CSV?
Can't do it. CSV is values in a 2 tier structure, nothing else.
Whenever I try using HTML tags, it just prints the tags
Somewhat predictible.
no, I was using a script called "ExcelWriter" by Harish Chauhan
That sounds like your problem right there

Posted: Thu Aug 10, 2006 5:46 pm
by ibanez270dx
Yeah, I actually dumped the idea and went with using simple tables. Thanks for the help, though!