Reputation: 235
Recently I mastered fgetcsv
in the hope of writing an array to a file so that I could later open it via Excel, there was no problem with it. Everything turned out ok. But, as far as I understand, there can not be done so to automatically push apart the cells to the length of the string (maybe looked bad)
Now it is written like this:
I want to know are there are any libraries, so that the cells length is set to the length of the string written to the cell?
It is necessary that it was like this:
Or maybe there is another approach? For example, manually in Excel to convert all at once so?
I will be grateful for any help, thanks!
Upvotes: 0
Views: 142
Reputation: 1213
CSV files doesn't have any cell length defintion They are text files, with Comma Seperated Values (CSV ...)
xlsx files however DO hold such a feature They are basically xml zipped
You can either look for a php excel library with a function ready or parse the XML yourself...
XML sturcture is reffred to here Looking for a clear description of Excel's .xlsx XML format
Upvotes: 1