Re: Re: excel output question
| From: | Jake McHenry | Date: | Sat, 07 Feb 2004 13:46:12 +0000 |
| Subject: | Re: Re: excel output question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-177092@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Phillip Jackson" <tzmguitarist@hotmail.com>
To: <php-general@lists.php.net>
Sent: Saturday, February 07, 2004 4:37 AM
Subject: Re: [PHP] Re: excel output question
> I would do it like this:
>
> $build = " '%s','%s','%s','%s'\n";
> $build = sprintf($build,$field1,$field2,$field3,$fieldN);
>
> you could also try escaping the comma. if this doesn't work you can always
> just dump to html tables and save the file as *.xls (excel spreadsheet);
> excel understands html tables and simple markup as spreadsheet data.
>
> ie:
>
> <html>
> <table>
> <tr>
>
> <td>field1</td><td>field2</td><td>field3</td><td>field4</td>
> </tr>
> <tr>
>
> <td>value1</td><td>value2</td><td>value3</td><td>value4</td>
> </tr>
> </table>
> </html>
>
>
> ~phillip
> "Jake McHenry" <linux@nittanytravel.com> wrote in message
> news:006001c3ed4c$39c057f0$7fa1e518@JS...
> > ----- Original Message -----
> > From: "Paul Furman" <paul@edgehill.net>
> > To: <php-general@lists.php.net>
> > Sent: Saturday, February 07, 2004 1:56 AM
> > Subject: [PHP] Re: excel output question
> >
> >
> > > Single quote everything should work.
> > >
> > > Jake McHenry wrote:
> > >
> > > > Hi everyone. I'm outputing payroll information to an excel csv file,
> and
> > when anyone get's paid over 1k, the amount is split into two fields
> because
> > of the comma in the amount. Is there anyway I can tell excel that this
> > particular comma is not a deliminator?
> > > >
> > > > Thanks,
> > > > Jake
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > like this?
> >
> > output =
> >
>
"'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
> >
>
urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
> > ,,,'$sub401k
> > ','$payrate','$gross5'\n";
> >
> > That just filled my spreadshit with quotes around everything... still
the
> > amounts larger than 1k are in 2 columns......
> >
> > did I do something wrong?
> >
> > Thanks,
> > Jake
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
This is in a simple while loop, data is coming from a mysql database.
Creating a seperate function would too time consuming changing all of the
existing code for what this page is doing. It orignally was in html form in
an xls file, but when the file was opened, there were no cell borders
anymore. If anyone can tell me how to turn on the cell boarders in an xls
html outputted file, that would also work. This is the only reason I went
back to a csv file.
Thanks,
Jake