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?

Recommended Answers

All 3 Replies

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.

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. :)

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.