Surprising that setReadDataOnly(true) returns Rich-Text?

Topics: Developer Forum, User Forum
Sep 2, 2008 at 8:26 PM
When one reads a spreadsheet using Excel2007 reader together with the setReadDataOnly(true) option one finds that Rich-Text cell values are not converted to plain text. This may be a bit surprising since all other cell formatting (fonts, colors etc.) is removed during the load process. Besides being surprising I think it may be impractical too and I am therefore asking whether or not it would be better to return plain text whenever one uses setReadDataOnly(true).

Consider that one wants to use PHPExcel to process orders submitted via Excel 2007 spreadsheets. In such situations I think one would rarely be interested in more than plain text. Still it may be hard to prevent the customer from inserting Rich-Text because this may happen accidentally when copying from other applications such as Microsoft Office Word. To process a spreadsheet that may or may not contain Rich-Text one would have to use multiple constructions like this to get the plain text:

$value = $cell->getValue();

// get plain text
$plainText = ($value instanceof PHPExcel_RichText) ?
    $value->getPlainText() : $value;

What should be the effect of setReadDataOnly(true) for cell values? A guideline could be this: It gives what you see in the Microsoft Office Excel formula bar after selecting number format "General".
Sep 3, 2008 at 7:11 AM
Edited Sep 3, 2008 at 7:12 AM
Sounds like a small bug. Will fix this one! -->