Reply to Re: output to spreadsheet - how to use format?

Your name:

Reply:


Posted by Paul on 06/08/07 14:31

"Moot" <usenet@mootsoft.com> wrote in message
news:1181306731.381061.86350@q75g2000hsh.googlegroups.com...
> On Jun 7, 7:33 pm, "Paul" <l...@invalid.com> wrote:
>> I use OpenOffice but I suppose similar formatting rules apply to MS
>> Excel.
>> For example, to format a cell for two digit numbering, the format code
>> is:
>>
>> #,##0.00
>>
>> I can use formulas (=F$temp + 5) and there's likely a way to write
>> formatting strings in the output code, I just need a little help. Any
>> ideas?
>>
>> My code is fairly typical to export to spreadsheet:
>> //get data from database
>> header("Content-type: application/octet-stream");
>> header("Content-Disposition: attachment; filename=\"my-data.xls\"");
>> $data = "";
>> $temp = 0;
>> foreach($r as $row) {
>> $temp++;
>> $data .= $row['data1'].",".$row['some_number'].",=F$temp + 5\r\n";};
>>
>> echo $data;
>
> I'm not sure OOo can do the same thing, but how I format for Excel is
> pretty simple. What I do is create a new spreadsheet with some sample
> data formatted to look how I want, then Save As... as XML. You can
> then open the file up in any text editor to see the xml code and from
> there you should be able to figure out how to format the way you
> want.
>
> In fact, this is the way I do all my excel stuff now, since it's much
> easier this way. Just create a mock-up, then recreate the same thing
> programmatically.

That's beautiful - thanks!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация