I'm converting a XLS/XLSX file to HTML table and I'm trying to keep the embedded Excel styles saved in the XLS file. Up to now I managed to detect if a cell has certain styles:
$objPHPExcel = new PHPExcel();
$objPHPExcel = PHPExcel_IOFactory::load("ExcelFile.xls");
$objWorksheet = $objPHPExcel->getActiveSheet();
foreach ($objWorksheet->getRowIterator() as $row) {
foreach ($cellIterator as $cell) {
$background_color = $cell->getStyle()->getFill()->getStartColor()->getRGB();
$fore_color = $cell->getStyle()->getFont()->getColor()->getRGB();
$font_bold = $cell->getStyle()->getFont()->getBold();
$font_italic = $cell->getStyle()->getFont()->getItalic();
}
}
But I can't find how to detect if a cell has a border and what style the border is (there's documentation about setting border but not retreiving borders).
答案 0 :(得分:0)
你可以使用
->getStyle('A1')->getBorders()->getTop()->getColor()->getRGB();
->getStyle('A1')->getBorders()->getTop()->getBorderStyle();
依旧......
:)