Feature: Work item 8769 - Implement Gnumeric File Format
Print margins git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@60426 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
84c449b74a
commit
1586444ba9
|
@ -248,7 +248,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||||
|
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// echo htmlentities($gFileData);
|
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
|
||||||
// echo '</pre><hr />';
|
// echo '</pre><hr />';
|
||||||
//
|
//
|
||||||
$xml = simplexml_load_string($gFileData);
|
$xml = simplexml_load_string($gFileData);
|
||||||
|
@ -344,6 +344,39 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||||
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||||
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
|
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
|
||||||
|
|
||||||
|
if ((!$this->_readDataOnly) && (isset($sheet->PrintInformation))) {
|
||||||
|
if (isset($sheet->PrintInformation->Margins)) {
|
||||||
|
foreach($sheet->PrintInformation->Margins->children('gnm',TRUE) as $key => $margin) {
|
||||||
|
$marginAttributes = $margin->attributes();
|
||||||
|
switch($marginAttributes['PrefUnit']) {
|
||||||
|
case 'mm' :
|
||||||
|
$marginSize = intval($marginAttributes['Points']) / 100;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch($key) {
|
||||||
|
case 'top' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
|
||||||
|
break;
|
||||||
|
case 'bottom' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
|
||||||
|
break;
|
||||||
|
case 'left' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
|
||||||
|
break;
|
||||||
|
case 'right' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
|
||||||
|
break;
|
||||||
|
case 'header' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
|
||||||
|
break;
|
||||||
|
case 'footer' :
|
||||||
|
$objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach($sheet->Cells->Cell as $cell) {
|
foreach($sheet->Cells->Cell as $cell) {
|
||||||
$cellAttributes = $cell->attributes();
|
$cellAttributes = $cell->attributes();
|
||||||
$row = (int) $cellAttributes->Row + 1;
|
$row = (int) $cellAttributes->Row + 1;
|
||||||
|
@ -617,6 +650,10 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||||
$styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
|
$styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($styleRegion->Style->HyperLink)) {
|
||||||
|
// TO DO
|
||||||
|
$hyperlink = $styleRegion->Style->HyperLink->attributes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// var_dump($styleArray);
|
// var_dump($styleArray);
|
||||||
// echo '<br />';
|
// echo '<br />';
|
||||||
|
@ -625,8 +662,8 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((!$this->_readDataOnly) && (isset($sheet->Cols))) {
|
||||||
// Column Widths
|
// Column Widths
|
||||||
if (isset($sheet->Cols)) {
|
|
||||||
$columnAttributes = $sheet->Cols->attributes();
|
$columnAttributes = $sheet->Cols->attributes();
|
||||||
$defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
|
$defaultWidth = $columnAttributes['DefaultSizePts'] / 5.4;
|
||||||
$c = 0;
|
$c = 0;
|
||||||
|
@ -654,8 +691,8 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((!$this->_readDataOnly) && (isset($sheet->Rows))) {
|
||||||
// Row Heights
|
// Row Heights
|
||||||
if (isset($sheet->Rows)) {
|
|
||||||
$rowAttributes = $sheet->Rows->attributes();
|
$rowAttributes = $sheet->Rows->attributes();
|
||||||
$defaultHeight = $rowAttributes['DefaultSizePts'];
|
$defaultHeight = $rowAttributes['DefaultSizePts'];
|
||||||
$r = 0;
|
$r = 0;
|
||||||
|
|
Loading…
Reference in New Issue