开发者

CSV files and multi line text cells

开发者 https://www.devze.com 2022-12-16 04:58 出处:网络
I am generating a simple csv file using php. The file contains some user\'s personal data. When I open the generated file in office, the addresses are not displayed in full height. I have to double cl

I am generating a simple csv file using php. The file contains some user's personal data. When I open the generated file in office, the addresses are not displayed in full height. I have to double click on the cell for the address to be shown fully (in full width and height) otherwise I can only see the first word/number of the address. Also, I have date of births displayed as ######, I have to expand the whole column to see them fully.

This doesn't happen in open office.

Is there any way to force MS Office to show all fields in full? Because otherwise it'll be to confusing for the peopl开发者_JS百科e who will use (Hey where are all the details!:)

Thanks :)


I don't think you can "format" your sheets with CSV. You will have to produce some other file format that Excel understands. I would suggest XML which is really easy to generate. Just make a sample sheet with the data you want, save it as XML and you'll see how your file should be generated. Or you could use some ready-made PHP solution for writing excel files if you can't be bothered with analysing the XML file.


you could try the auto-size columns feature.


This is a UI issue with how Excel works, you can't force Excel or anything else how they handle it.

The quickest work around is to perhaps create an XLS file that runs a macro to retrieve the CVS file and format the cells as needed, but there's nothing you can do inside the CSV to affect what Excel is displaying.

0

精彩评论

暂无评论...
验证码 换一张
取 消