Bugfix: Work item 15121 - Column reference rather than cell reference in Print Area definition
Fixed Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges... added a static absoluteReference() method to PHPExcel_Cell that will return an absolute row, column or cell reference, and modified the _writeDefinedNameForPrintArea() method of the Excel2007 Workbook Writer to call that rather than absoluteCoordinate() git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@68176 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
919df79991
commit
8a83e847cd
|
@ -509,11 +509,33 @@ class PHPExcel_Cell
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make string row, column or cell coordinate absolute
|
||||
*
|
||||
* @param string $pCoordinateString e.g. 'A' or '1' or 'A1'
|
||||
* @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1'
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function absoluteReference($pCoordinateString = 'A1')
|
||||
{
|
||||
if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
|
||||
// Create absolute coordinate
|
||||
if (ctype_digit($pCoordinateString)) {
|
||||
return '$'.$pCoordinateString;
|
||||
} elseif (ctype_alpha($pCoordinateString)) {
|
||||
return '$'.strtoupper($pCoordinateString);
|
||||
}
|
||||
return self::absoluteCoordinate($pCoordinateString);
|
||||
} else {
|
||||
throw new Exception("Coordinate string should not be a cell range.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make string coordinate absolute
|
||||
*
|
||||
* @param string $pCoordinateString
|
||||
* @return string Absolute coordinate
|
||||
* @param string $pCoordinateString e.g. 'A1'
|
||||
* @return string Absolute coordinate e.g. '$A$1'
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function absoluteCoordinate($pCoordinateString = 'A1')
|
||||
|
|
|
@ -430,8 +430,8 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
|
|||
|
||||
$chunks = array();
|
||||
foreach ($printArea as $printAreaRect) {
|
||||
$printAreaRect[0] = PHPExcel_Cell::absoluteCoordinate($printAreaRect[0]);
|
||||
$printAreaRect[1] = PHPExcel_Cell::absoluteCoordinate($printAreaRect[1]);
|
||||
$printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]);
|
||||
$printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]);
|
||||
$chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ Fixed in SVN:
|
|||
- Bugfix: (MBaker) Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV)
|
||||
- Bugfix: (MBaker) The freezePaneByColumnAndRow() method row argument should default to 1 rather than 0.
|
||||
Default row argument for all __ByColumnAndRow() methods should be 1
|
||||
- Bugfix: (MBaker) Work item 15121 - Column reference rather than cell reference in Print Area definition
|
||||
Fix Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges
|
||||
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
|
||||
- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.
|
||||
|
||||
|
|
Loading…
Reference in New Issue