I am reading excel files through php, the contents are to be displayed in a table on web
I read this data in range A1 to D1 is one data and it is to be presented in this format
The data
is different,
i开发者_如何学JAVAn every,
cell.
This data is to be <br/>
line breaked based on strlen (This is a single string is different, in every, cell.
Line one The data
is heading)
So line breaks are made based on ,
but max data has to fit in single line
So how can I count strlen to each ,
so that I can echo if the data can fit in single line or else a line break is made after ,
The data
is different,
in every, cell.
Use strpos() with an offset in a loop in order to find the commas. After finding the first comma, use this position as the new offset for finding the next comma.
Have your tried the PEAR Excel Package(s)? It Simplifies things (reading/writing .xls files)
The str_getcsv() function added in PHP 5.3 may be of use to you.
If not, surely you could just explode(',', $string)?
精彩评论