954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Modify Excel Column Width via PHP?

Is it possible? Currently, I am inserting data to a CSV file using PHP via the fputcsv() function. When opened in Excel, it works fine. The problem is that all the columns are of the default size. Is there a way to autofit the column width and possibly modify the formatting of the data(font size,color,alignment) in the cells as well?

martin11ph
Junior Poster in Training
74 posts since Jan 2011
Reputation Points: 7
Solved Threads: 0
 

Not while you are using a CSV file. If you use a tool such as PHPExcel, which can generate a real Excel file, then it is possible.

pritaeas
Posting Expert
Moderator
5,483 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
 

I was afraid of that. Thank you for answering. I have already downloaded PHPExcel and am going to study it for now. Gonna leave the thread open in case there are other suggestions. :)

martin11ph
Junior Poster in Training
74 posts since Jan 2011
Reputation Points: 7
Solved Threads: 0
 

Oh well I realized PHPExcel is good and useful. I'll just close and suggest it for people who want the same done.

martin11ph
Junior Poster in Training
74 posts since Jan 2011
Reputation Points: 7
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: