I cannot read styles from xls by PHPexcel. I browsing for a solution a lot but everywhere writes solutions for write xls but I like it to read. I like especially strikethrough but it cannot reads neither this nor any other style informations. My code is the following, this reads all data correctly but nothing more. Im sure to make text styled in the xls.
require_once 'PHPExcel.php';
$filepath = "path/to/your/xls/file.xls";
$inputFileType = PHPExcel_IOFactory::identify($filepath);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($filepath);
$total_sheets = $objPHPExcel->getSheetCount();
$allSheetName = $objPHPExcel->getSheetNames();
$objWorksheet = $objPHPExcel->setActiveSheetIndex(0) ;
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$headingsArray = $objWorksheet->rangeToArray('A1:' . $highestColumn . '1', null, true, true, true);
$headingsArray = $headingsArray[1];
print_r( $objWorksheet->toArray() );
Does anybody have an idea?
thx
PHPExcel is perfectly capable of reading styles from xls files: have you actually tried getting the style details from a cell, because your code here doesn't show any tests to check that styles have been read?
reads the content from cells as simple PHP scalar values.
To determin the styling of a cell, you need to read that cell's style details.
e.g.
The API documentation shows all the details for reading style information such as colours, fills, fonts, borders, etc
EDIT
A cell's contain may also be rich text, with different parts of the content having different styles. If you retrieve a rich text value from a cell using
a richtext object will be returned. It is then possible to iterate through each block (or run) of the richtext object checking the style for that block