foreach ($chapters as $c) {\r
$c['label'] = trim($c['label']);\r
$n = (string) $c['page'];\r
- $c['label'] = trim(preg_replace('|' . $n . '$|iu', '', $c['label']));\r
+ $c['label'] = trim(preg_replace('|\s+' . $n . '$|iu', '', $c['label']));\r
$res[] = $c;\r
}\r
\r
);
new PHPExcel();
-
- $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_memcache;
- $cacheSettings = array('memcacheServer' => 'localhost',
- 'memcachePort' => 11211,
- 'cacheTime' => 600
- );
- PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+
+ /* $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_memcache;
+ $cacheSettings = array('memcacheServer' => 'localhost',
+ 'memcachePort' => 11211,
+ 'cacheTime' => 600
+ );
+ PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); */
$xls = new PHPExcel();
}
$value = $l[$id];
}
-
- $s->setCellValueByColumnAndRow($i, $j, $value);
- $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+ if ($value != '') {
+ $s->setCellValueByColumnAndRow($i, $j, $value);
+ //$s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+ }
$i++;
}
$j++;
}
+
// Rulers
$s = $xls->createSheet();
$s->setTitle('Rulers');
- $rcols = array( 'page', 'type', 'pos');
+ $rcols = array('page', 'type', 'pos');
$i = 0;
// Labels
foreach ($rcols as $id) {
$s->setCellValueByColumnAndRow($i, 1, $id);
$s->getColumnDimensionByColumn($i)->setAutoSize(true);
- $s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
+ //$s->getStyleByColumnAndRow($i, 1)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$i++;
}