wrap text height

Topics: Developer Forum, User Forum
Jun 22, 2009 at 1:52 AM

I'm going to create a list from my database and some of the data contain a longtext data

I know how to wrap the text but then how do i get the height of the row that contain wrapped text

I try using getRowHeight and i always got -1.

I also try setRowHeight first to 18 and using getRowHeight i got the number 18, but it break the wrapped text like half close the row

i need the rowheight for automatic print break

lets say if the total height larger then 30" then i didnt print the data, instead create a print break that write the data after that


Is there a way to get this ?

Jun 23, 2009 at 10:19 PM

Sorry, it is unfortunately not possible to calculate the final row height in PHPExcel. That would probably require that PHPExcel laid out all the glyphs in the wrapped text to figure out how many lines it occupies based on column width, font, glyph widths, and heights. I have no idea how this could be done.

If someone knows how to do this, please post. It affects not only problems like the one you are describing, but also the creation of xls files when images which are laid over cells containing wrapped text. Images in xls files need two anchor points to be specifed internally in the binary file, and if they are not exact, the image will appear distorted.