473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Format text in a CSV file

code green
1,726 Expert 1GB
Does anybody know how to apply formatting when writing to a CSV file that is to be opened in MS Excel?
I mean simple formatting such as bold and center.
I have written a simple class for CSV reading-writing and this is the function that writes an array to a CSV
[PHP]function writeArray($array)
{
$writedata = implode(',',$array);
$writedata .= "\r\n";
if (!fwrite($this->handle, $writedata))
{
$this->errmsg = '<br>Failed writing array to this file';
return FALSE;
}
return TRUE;
}[/PHP]
Oct 5 '07 #1
1 7908
Motoma
3,237 Expert 2GB
Does anybody know how to apply formatting when writing to a CSV file that is to be opened in MS Excel?
I mean simple formatting such as bold and center.
I have written a simple class for CSV reading-writing and this is the function that writes an array to a CSV
[PHP]function writeArray($array)
{
$writedata = implode(',',$array);
$writedata .= "\r\n";
if (!fwrite($this->handle, $writedata))
{
$this->errmsg = '<br>Failed writing array to this file';
return FALSE;
}
return TRUE;
}[/PHP]
The CSV is a plain text format. There are no formatting options, there is no markup. If you need formatting, you will have to use another file format for saving your data sets.
Oct 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: | last post by:
I am new to VB6 and need some advice... I am developing software which aims to capture a text feed from a serial port consisting of news stories in ASCII format and then save this text for...
2
by: Pat | last post by:
Here is my problem that I am having with a current project. I went and backed up all my hard drives to DVD's. After backing up the drives, I used a batch file to get all the file names from the...
14
by: Manish | last post by:
The project I am developing doesn't involves database. I want to parse the mailbox file (.mbx) and store the summary in the text file for fast retrieval and display of information in the Inbox...
6
by: Ted | last post by:
I used bcp to produce the apended format file. How can it be modified to recognize the quotes that surround the text fields and not insert the quotes along with the text? Invariably, the first...
5
by: ChinChin | last post by:
Hi, I have made a window application that get file information from the server the file size return in bytes. I need help on how to format the file size accordingly so that it will return the file...
2
by: johnperl | last post by:
i am working on the script as below, i want an output according to the format. i am trying to put everything in one loop but cannot figure out the way to do so. could anyone please help me with this....
6
by: aagarwal8 | last post by:
Hi, I am trying to write the contents of a textbox to a file in binary format. My code looks like this... private void btnWriteToFile_Click(object sender, EventArgs e) { FileStream fs =...
5
by: The Pipe | last post by:
Hello I have a table that I need to export to a .asc file format. I have had several attempts at getting this to work but with no luck. Basically the file would need to have every record...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
In the Registry at HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Jet \ 4.0 \ Engines \ Text the default key for Text Format is: "Format" = "CSVDelimited" I can use the following OleDB...
5
by: sonu | last post by:
hey good morning ...... how to convert a video file in .flv format in php for linux hosting......is there any package whis provide this facility . Can i use ffmpeg for linux hosting...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.