, ...)
+ *
+ * @param array $pValue
+ */
+ public function setIDCLs($pValue)
+ {
+ $this->IDCLs = $pValue;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php
new file mode 100644
index 0000000..1af2432
--- /dev/null
+++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php
@@ -0,0 +1,57 @@
+BSECollection[] = $BSE;
+ $BSE->setParent($this);
+ }
+
+ /**
+ * Get the collection of BLIP Store Entries
+ *
+ * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[]
+ */
+ public function getBSECollection()
+ {
+ return $this->BSECollection;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php
new file mode 100644
index 0000000..d17e91e
--- /dev/null
+++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php
@@ -0,0 +1,112 @@
+parent = $parent;
+ }
+
+ /**
+ * Get the BLIP
+ *
+ * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
+ */
+ public function getBlip()
+ {
+ return $this->blip;
+ }
+
+ /**
+ * Set the BLIP
+ *
+ * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip
+ */
+ public function setBlip($blip)
+ {
+ $this->blip = $blip;
+ $blip->setParent($this);
+ }
+
+ /**
+ * Get the BLIP type
+ *
+ * @return int
+ */
+ public function getBlipType()
+ {
+ return $this->blipType;
+ }
+
+ /**
+ * Set the BLIP type
+ *
+ * @param int
+ */
+ public function setBlipType($blipType)
+ {
+ $this->blipType = $blipType;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php
new file mode 100644
index 0000000..3bcbbbe
--- /dev/null
+++ b/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php
@@ -0,0 +1,83 @@
+data;
+ }
+
+ /**
+ * Set the raw image data
+ *
+ * @param string
+ */
+ public function setData($data)
+ {
+ $this->data = $data;
+ }
+
+ /**
+ * Set parent BSE
+ *
+ * @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
+ */
+ public function setParent($parent)
+ {
+ $this->parent = $parent;
+ }
+
+ /**
+ * Get parent BSE
+ *
+ * @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/Excel5.php b/Classes/PHPExcel/Shared/Excel5.php
new file mode 100644
index 0000000..c3ff209
--- /dev/null
+++ b/Classes/PHPExcel/Shared/Excel5.php
@@ -0,0 +1,298 @@
+getParent()->getDefaultStyle()->getFont();
+
+ $columnDimensions = $sheet->getColumnDimensions();
+
+ // first find the true column width in pixels (uncollapsed and unhidden)
+ if (isset($columnDimensions[$col]) and $columnDimensions[$col]->getWidth() != -1) {
+ // then we have column dimension with explicit width
+ $columnDimension = $columnDimensions[$col];
+ $width = $columnDimension->getWidth();
+ $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
+ } elseif ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
+ // then we have default column dimension with explicit width
+ $defaultColumnDimension = $sheet->getDefaultColumnDimension();
+ $width = $defaultColumnDimension->getWidth();
+ $pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
+ } else {
+ // we don't even have any default column dimension. Width depends on default font
+ $pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
+ }
+
+ // now find the effective column width in pixels
+ if (isset($columnDimensions[$col]) and !$columnDimensions[$col]->getVisible()) {
+ $effectivePixelWidth = 0;
+ } else {
+ $effectivePixelWidth = $pixelWidth;
+ }
+
+ return $effectivePixelWidth;
+ }
+
+ /**
+ * Convert the height of a cell from user's units to pixels. By interpolation
+ * the relationship is: y = 4/3x. If the height hasn't been set by the user we
+ * use the default value. If the row is hidden we use a value of zero.
+ *
+ * @param PHPExcel_Worksheet $sheet The sheet
+ * @param integer $row The row index (1-based)
+ * @return integer The width in pixels
+ */
+ public static function sizeRow($sheet, $row = 1)
+ {
+ // default font of the workbook
+ $font = $sheet->getParent()->getDefaultStyle()->getFont();
+
+ $rowDimensions = $sheet->getRowDimensions();
+
+ // first find the true row height in pixels (uncollapsed and unhidden)
+ if (isset($rowDimensions[$row]) and $rowDimensions[$row]->getRowHeight() != -1) {
+ // then we have a row dimension
+ $rowDimension = $rowDimensions[$row];
+ $rowHeight = $rowDimension->getRowHeight();
+ $pixelRowHeight = (int) ceil(4 * $rowHeight / 3); // here we assume Arial 10
+ } elseif ($sheet->getDefaultRowDimension()->getRowHeight() != -1) {
+ // then we have a default row dimension with explicit height
+ $defaultRowDimension = $sheet->getDefaultRowDimension();
+ $rowHeight = $defaultRowDimension->getRowHeight();
+ $pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
+ } else {
+ // we don't even have any default row dimension. Height depends on default font
+ $pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
+ $pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
+ }
+
+ // now find the effective row height in pixels
+ if (isset($rowDimensions[$row]) and !$rowDimensions[$row]->getVisible()) {
+ $effectivePixelRowHeight = 0;
+ } else {
+ $effectivePixelRowHeight = $pixelRowHeight;
+ }
+
+ return $effectivePixelRowHeight;
+ }
+
+ /**
+ * Get the horizontal distance in pixels between two anchors
+ * The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets
+ *
+ * @param PHPExcel_Worksheet $sheet
+ * @param string $startColumn
+ * @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
+ * @param string $endColumn
+ * @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
+ * @return integer Horizontal measured in pixels
+ */
+ public static function getDistanceX(PHPExcel_Worksheet $sheet, $startColumn = 'A', $startOffsetX = 0, $endColumn = 'A', $endOffsetX = 0)
+ {
+ $distanceX = 0;
+
+ // add the widths of the spanning columns
+ $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; // 1-based
+ $endColumnIndex = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; // 1-based
+ for ($i = $startColumnIndex; $i <= $endColumnIndex; ++$i) {
+ $distanceX += self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($i));
+ }
+
+ // correct for offsetX in startcell
+ $distanceX -= (int) floor(self::sizeCol($sheet, $startColumn) * $startOffsetX / 1024);
+
+ // correct for offsetX in endcell
+ $distanceX -= (int) floor(self::sizeCol($sheet, $endColumn) * (1 - $endOffsetX / 1024));
+
+ return $distanceX;
+ }
+
+ /**
+ * Get the vertical distance in pixels between two anchors
+ * The distanceY is found as sum of all the spanning rows minus two offsets
+ *
+ * @param PHPExcel_Worksheet $sheet
+ * @param integer $startRow (1-based)
+ * @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
+ * @param integer $endRow (1-based)
+ * @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
+ * @return integer Vertical distance measured in pixels
+ */
+ public static function getDistanceY(PHPExcel_Worksheet $sheet, $startRow = 1, $startOffsetY = 0, $endRow = 1, $endOffsetY = 0)
+ {
+ $distanceY = 0;
+
+ // add the widths of the spanning rows
+ for ($row = $startRow; $row <= $endRow; ++$row) {
+ $distanceY += self::sizeRow($sheet, $row);
+ }
+
+ // correct for offsetX in startcell
+ $distanceY -= (int) floor(self::sizeRow($sheet, $startRow) * $startOffsetY / 256);
+
+ // correct for offsetX in endcell
+ $distanceY -= (int) floor(self::sizeRow($sheet, $endRow) * (1 - $endOffsetY / 256));
+
+ return $distanceY;
+ }
+
+ /**
+ * Convert 1-cell anchor coordinates to 2-cell anchor coordinates
+ * This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications
+ *
+ * Calculate the vertices that define the position of the image as required by
+ * the OBJ record.
+ *
+ * +------------+------------+
+ * | A | B |
+ * +-----+------------+------------+
+ * | |(x1,y1) | |
+ * | 1 |(A1)._______|______ |
+ * | | | | |
+ * | | | | |
+ * +-----+----| BITMAP |-----+
+ * | | | | |
+ * | 2 | |______________. |
+ * | | | (B2)|
+ * | | | (x2,y2)|
+ * +---- +------------+------------+
+ *
+ * Example of a bitmap that covers some of the area from cell A1 to cell B2.
+ *
+ * Based on the width and height of the bitmap we need to calculate 8 vars:
+ * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
+ * The width and height of the cells are also variable and have to be taken into
+ * account.
+ * The values of $col_start and $row_start are passed in from the calling
+ * function. The values of $col_end and $row_end are calculated by subtracting
+ * the width and height of the bitmap from the width and height of the
+ * underlying cells.
+ * The vertices are expressed as a percentage of the underlying cell width as
+ * follows (rhs values are in pixels):
+ *
+ * x1 = X / W *1024
+ * y1 = Y / H *256
+ * x2 = (X-1) / W *1024
+ * y2 = (Y-1) / H *256
+ *
+ * Where: X is distance from the left side of the underlying cell
+ * Y is distance from the top of the underlying cell
+ * W is the width of the cell
+ * H is the height of the cell
+ *
+ * @param PHPExcel_Worksheet $sheet
+ * @param string $coordinates E.g. 'A1'
+ * @param integer $offsetX Horizontal offset in pixels
+ * @param integer $offsetY Vertical offset in pixels
+ * @param integer $width Width in pixels
+ * @param integer $height Height in pixels
+ * @return array
+ */
+ public static function oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height)
+ {
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinates);
+ $col_start = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ $row_start = $row - 1;
+
+ $x1 = $offsetX;
+ $y1 = $offsetY;
+
+ // Initialise end cell to the same as the start cell
+ $col_end = $col_start; // Col containing lower right corner of object
+ $row_end = $row_start; // Row containing bottom right corner of object
+
+ // Zero the specified offset if greater than the cell dimensions
+ if ($x1 >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
+ $x1 = 0;
+ }
+ if ($y1 >= self::sizeRow($sheet, $row_start + 1)) {
+ $y1 = 0;
+ }
+
+ $width = $width + $x1 -1;
+ $height = $height + $y1 -1;
+
+ // Subtract the underlying cell widths to find the end cell of the image
+ while ($width >= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
+ $width -= self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
+ ++$col_end;
+ }
+
+ // Subtract the underlying cell heights to find the end cell of the image
+ while ($height >= self::sizeRow($sheet, $row_end + 1)) {
+ $height -= self::sizeRow($sheet, $row_end + 1);
+ ++$row_end;
+ }
+
+ // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
+ // with zero height or width.
+ if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
+ return;
+ }
+ if (self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
+ return;
+ }
+ if (self::sizeRow($sheet, $row_start + 1) == 0) {
+ return;
+ }
+ if (self::sizeRow($sheet, $row_end + 1) == 0) {
+ return;
+ }
+
+ // Convert the pixel values to the percentage value expected by Excel
+ $x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
+ $y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
+ $x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
+ $y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object
+
+ $startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1);
+ $endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1);
+
+ $twoAnchor = array(
+ 'startCoordinates' => $startCoordinates,
+ 'startOffsetX' => $x1,
+ 'startOffsetY' => $y1,
+ 'endCoordinates' => $endCoordinates,
+ 'endOffsetX' => $x2,
+ 'endOffsetY' => $y2,
+ );
+
+ return $twoAnchor;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/File.php b/Classes/PHPExcel/Shared/File.php
new file mode 100644
index 0000000..a62df75
--- /dev/null
+++ b/Classes/PHPExcel/Shared/File.php
@@ -0,0 +1,180 @@
+open($zipFile) === true) {
+ $returnValue = ($zip->getFromName($archiveFile) !== false);
+ $zip->close();
+ return $returnValue;
+ } else {
+ return false;
+ }
+ } else {
+ // Regular file_exists
+ return file_exists($pFilename);
+ }
+ }
+
+ /**
+ * Returns canonicalized absolute pathname, also for ZIP archives
+ *
+ * @param string $pFilename
+ * @return string
+ */
+ public static function realpath($pFilename)
+ {
+ // Returnvalue
+ $returnValue = '';
+
+ // Try using realpath()
+ if (file_exists($pFilename)) {
+ $returnValue = realpath($pFilename);
+ }
+
+ // Found something?
+ if ($returnValue == '' || ($returnValue === null)) {
+ $pathArray = explode('/', $pFilename);
+ while (in_array('..', $pathArray) && $pathArray[0] != '..') {
+ for ($i = 0; $i < count($pathArray); ++$i) {
+ if ($pathArray[$i] == '..' && $i > 0) {
+ unset($pathArray[$i]);
+ unset($pathArray[$i - 1]);
+ break;
+ }
+ }
+ }
+ $returnValue = implode('/', $pathArray);
+ }
+
+ // Return
+ return $returnValue;
+ }
+
+ /**
+ * Get the systems temporary directory.
+ *
+ * @return string
+ */
+ public static function sys_get_temp_dir()
+ {
+ if (self::$useUploadTempDirectory) {
+ // use upload-directory when defined to allow running on environments having very restricted
+ // open_basedir configs
+ if (ini_get('upload_tmp_dir') !== false) {
+ if ($temp = ini_get('upload_tmp_dir')) {
+ if (file_exists($temp)) {
+ return realpath($temp);
+ }
+ }
+ }
+ }
+
+ // sys_get_temp_dir is only available since PHP 5.2.1
+ // http://php.net/manual/en/function.sys-get-temp-dir.php#94119
+ if (!function_exists('sys_get_temp_dir')) {
+ if ($temp = getenv('TMP')) {
+ if ((!empty($temp)) && (file_exists($temp))) {
+ return realpath($temp);
+ }
+ }
+ if ($temp = getenv('TEMP')) {
+ if ((!empty($temp)) && (file_exists($temp))) {
+ return realpath($temp);
+ }
+ }
+ if ($temp = getenv('TMPDIR')) {
+ if ((!empty($temp)) && (file_exists($temp))) {
+ return realpath($temp);
+ }
+ }
+
+ // trick for creating a file in system's temporary dir
+ // without knowing the path of the system's temporary dir
+ $temp = tempnam(__FILE__, '');
+ if (file_exists($temp)) {
+ unlink($temp);
+ return realpath(dirname($temp));
+ }
+
+ return null;
+ }
+
+ // use ordinary built-in PHP function
+ // There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
+ // be called if we're running 5.2.1 or earlier
+ return realpath(sys_get_temp_dir());
+ }
+}
diff --git a/Classes/PHPExcel/Shared/Font.php b/Classes/PHPExcel/Shared/Font.php
new file mode 100644
index 0000000..7efb3c9
--- /dev/null
+++ b/Classes/PHPExcel/Shared/Font.php
@@ -0,0 +1,741 @@
+ array(
+ 1 => array('px' => 24, 'width' => 12.00000000),
+ 2 => array('px' => 24, 'width' => 12.00000000),
+ 3 => array('px' => 32, 'width' => 10.66406250),
+ 4 => array('px' => 32, 'width' => 10.66406250),
+ 5 => array('px' => 40, 'width' => 10.00000000),
+ 6 => array('px' => 48, 'width' => 9.59765625),
+ 7 => array('px' => 48, 'width' => 9.59765625),
+ 8 => array('px' => 56, 'width' => 9.33203125),
+ 9 => array('px' => 64, 'width' => 9.14062500),
+ 10 => array('px' => 64, 'width' => 9.14062500),
+ ),
+ 'Calibri' => array(
+ 1 => array('px' => 24, 'width' => 12.00000000),
+ 2 => array('px' => 24, 'width' => 12.00000000),
+ 3 => array('px' => 32, 'width' => 10.66406250),
+ 4 => array('px' => 32, 'width' => 10.66406250),
+ 5 => array('px' => 40, 'width' => 10.00000000),
+ 6 => array('px' => 48, 'width' => 9.59765625),
+ 7 => array('px' => 48, 'width' => 9.59765625),
+ 8 => array('px' => 56, 'width' => 9.33203125),
+ 9 => array('px' => 56, 'width' => 9.33203125),
+ 10 => array('px' => 64, 'width' => 9.14062500),
+ 11 => array('px' => 64, 'width' => 9.14062500),
+ ),
+ 'Verdana' => array(
+ 1 => array('px' => 24, 'width' => 12.00000000),
+ 2 => array('px' => 24, 'width' => 12.00000000),
+ 3 => array('px' => 32, 'width' => 10.66406250),
+ 4 => array('px' => 32, 'width' => 10.66406250),
+ 5 => array('px' => 40, 'width' => 10.00000000),
+ 6 => array('px' => 48, 'width' => 9.59765625),
+ 7 => array('px' => 48, 'width' => 9.59765625),
+ 8 => array('px' => 64, 'width' => 9.14062500),
+ 9 => array('px' => 72, 'width' => 9.00000000),
+ 10 => array('px' => 72, 'width' => 9.00000000),
+ ),
+ );
+
+ /**
+ * Set autoSize method
+ *
+ * @param string $pValue
+ * @return boolean Success or failure
+ */
+ public static function setAutoSizeMethod($pValue = self::AUTOSIZE_METHOD_APPROX)
+ {
+ if (!in_array($pValue, self::$autoSizeMethods)) {
+ return false;
+ }
+ self::$autoSizeMethod = $pValue;
+
+ return true;
+ }
+
+ /**
+ * Get autoSize method
+ *
+ * @return string
+ */
+ public static function getAutoSizeMethod()
+ {
+ return self::$autoSizeMethod;
+ }
+
+ /**
+ * Set the path to the folder containing .ttf files. There should be a trailing slash.
+ * Typical locations on variout some platforms:
+ *
+ * - C:/Windows/Fonts/
+ * - /usr/share/fonts/truetype/
+ * - ~/.fonts/
+ *
+ *
+ * @param string $pValue
+ */
+ public static function setTrueTypeFontPath($pValue = '')
+ {
+ self::$trueTypeFontPath = $pValue;
+ }
+
+ /**
+ * Get the path to the folder containing .ttf files.
+ *
+ * @return string
+ */
+ public static function getTrueTypeFontPath()
+ {
+ return self::$trueTypeFontPath;
+ }
+
+ /**
+ * Calculate an (approximate) OpenXML column width, based on font size and text contained
+ *
+ * @param PHPExcel_Style_Font $font Font object
+ * @param PHPExcel_RichText|string $cellText Text to calculate width
+ * @param integer $rotation Rotation angle
+ * @param PHPExcel_Style_Font|NULL $defaultFont Font object
+ * @return integer Column width
+ */
+ public static function calculateColumnWidth(PHPExcel_Style_Font $font, $cellText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null)
+ {
+ // If it is rich text, use plain text
+ if ($cellText instanceof PHPExcel_RichText) {
+ $cellText = $cellText->getPlainText();
+ }
+
+ // Special case if there are one or more newline characters ("\n")
+ if (strpos($cellText, "\n") !== false) {
+ $lineTexts = explode("\n", $cellText);
+ $lineWidths = array();
+ foreach ($lineTexts as $lineText) {
+ $lineWidths[] = self::calculateColumnWidth($font, $lineText, $rotation = 0, $defaultFont);
+ }
+ return max($lineWidths); // width of longest line in cell
+ }
+
+ // Try to get the exact text width in pixels
+ $approximate = self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX;
+ if (!$approximate) {
+ $columnWidthAdjust = ceil(self::getTextWidthPixelsExact('n', $font, 0) * 1.07);
+ try {
+ // Width of text in pixels excl. padding
+ // and addition because Excel adds some padding, just use approx width of 'n' glyph
+ $columnWidth = self::getTextWidthPixelsExact($cellText, $font, $rotation) + $columnWidthAdjust;
+ } catch (PHPExcel_Exception $e) {
+ $approximate = true;
+ }
+ }
+
+ if ($approximate) {
+ $columnWidthAdjust = self::getTextWidthPixelsApprox('n', $font, 0);
+ // Width of text in pixels excl. padding, approximation
+ // and addition because Excel adds some padding, just use approx width of 'n' glyph
+ $columnWidth = self::getTextWidthPixelsApprox($cellText, $font, $rotation) + $columnWidthAdjust;
+ }
+
+ // Convert from pixel width to column width
+ $columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont);
+
+ // Return
+ return round($columnWidth, 6);
+ }
+
+ /**
+ * Get GD text width in pixels for a string of text in a certain font at a certain rotation angle
+ *
+ * @param string $text
+ * @param PHPExcel_Style_Font
+ * @param int $rotation
+ * @return int
+ * @throws PHPExcel_Exception
+ */
+ public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0)
+ {
+ if (!function_exists('imagettfbbox')) {
+ throw new PHPExcel_Exception('GD library needs to be enabled');
+ }
+
+ // font size should really be supplied in pixels in GD2,
+ // but since GD2 seems to assume 72dpi, pixels and points are the same
+ $fontFile = self::getTrueTypeFontFileFromFont($font);
+ $textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
+
+ // Get corners positions
+ $lowerLeftCornerX = $textBox[0];
+// $lowerLeftCornerY = $textBox[1];
+ $lowerRightCornerX = $textBox[2];
+// $lowerRightCornerY = $textBox[3];
+ $upperRightCornerX = $textBox[4];
+// $upperRightCornerY = $textBox[5];
+ $upperLeftCornerX = $textBox[6];
+// $upperLeftCornerY = $textBox[7];
+
+ // Consider the rotation when calculating the width
+ $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
+
+ return $textWidth;
+ }
+
+ /**
+ * Get approximate width in pixels for a string of text in a certain font at a certain rotation angle
+ *
+ * @param string $columnText
+ * @param PHPExcel_Style_Font $font
+ * @param int $rotation
+ * @return int Text width in pixels (no padding added)
+ */
+ public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0)
+ {
+ $fontName = $font->getName();
+ $fontSize = $font->getSize();
+
+ // Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
+ switch ($fontName) {
+ case 'Calibri':
+ // value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
+ $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
+ $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
+ break;
+
+ case 'Arial':
+ // value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
+// $columnWidth = (int) (7 * PHPExcel_Shared_String::CountCharacters($columnText));
+ // value 8 was set because of experience in different exports at Arial 10 font.
+ $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
+ $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
+ break;
+
+ case 'Verdana':
+ // value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
+ $columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
+ $columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
+ break;
+
+ default:
+ // just assume Calibri
+ $columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
+ $columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
+ break;
+ }
+
+ // Calculate approximate rotated column width
+ if ($rotation !== 0) {
+ if ($rotation == -165) {
+ // stacked text
+ $columnWidth = 4; // approximation
+ } else {
+ // rotated text
+ $columnWidth = $columnWidth * cos(deg2rad($rotation))
+ + $fontSize * abs(sin(deg2rad($rotation))) / 5; // approximation
+ }
+ }
+
+ // pixel width is an integer
+ return (int) $columnWidth;
+ }
+
+ /**
+ * Calculate an (approximate) pixel size, based on a font points size
+ *
+ * @param int $fontSizeInPoints Font size (in points)
+ * @return int Font size (in pixels)
+ */
+ public static function fontSizeToPixels($fontSizeInPoints = 11)
+ {
+ return (int) ((4 / 3) * $fontSizeInPoints);
+ }
+
+ /**
+ * Calculate an (approximate) pixel size, based on inch size
+ *
+ * @param int $sizeInInch Font size (in inch)
+ * @return int Size (in pixels)
+ */
+ public static function inchSizeToPixels($sizeInInch = 1)
+ {
+ return ($sizeInInch * 96);
+ }
+
+ /**
+ * Calculate an (approximate) pixel size, based on centimeter size
+ *
+ * @param int $sizeInCm Font size (in centimeters)
+ * @return int Size (in pixels)
+ */
+ public static function centimeterSizeToPixels($sizeInCm = 1)
+ {
+ return ($sizeInCm * 37.795275591);
+ }
+
+ /**
+ * Returns the font path given the font
+ *
+ * @param PHPExcel_Style_Font
+ * @return string Path to TrueType font file
+ */
+ public static function getTrueTypeFontFileFromFont($font)
+ {
+ if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
+ throw new PHPExcel_Exception('Valid directory to TrueType Font files not specified');
+ }
+
+ $name = $font->getName();
+ $bold = $font->getBold();
+ $italic = $font->getItalic();
+
+ // Check if we can map font to true type font file
+ switch ($name) {
+ case 'Arial':
+ $fontFile = (
+ $bold ? ($italic ? self::ARIAL_BOLD_ITALIC : self::ARIAL_BOLD)
+ : ($italic ? self::ARIAL_ITALIC : self::ARIAL)
+ );
+ break;
+ case 'Calibri':
+ $fontFile = (
+ $bold ? ($italic ? self::CALIBRI_BOLD_ITALIC : self::CALIBRI_BOLD)
+ : ($italic ? self::CALIBRI_ITALIC : self::CALIBRI)
+ );
+ break;
+ case 'Courier New':
+ $fontFile = (
+ $bold ? ($italic ? self::COURIER_NEW_BOLD_ITALIC : self::COURIER_NEW_BOLD)
+ : ($italic ? self::COURIER_NEW_ITALIC : self::COURIER_NEW)
+ );
+ break;
+ case 'Comic Sans MS':
+ $fontFile = (
+ $bold ? self::COMIC_SANS_MS_BOLD : self::COMIC_SANS_MS
+ );
+ break;
+ case 'Georgia':
+ $fontFile = (
+ $bold ? ($italic ? self::GEORGIA_BOLD_ITALIC : self::GEORGIA_BOLD)
+ : ($italic ? self::GEORGIA_ITALIC : self::GEORGIA)
+ );
+ break;
+ case 'Impact':
+ $fontFile = self::IMPACT;
+ break;
+ case 'Liberation Sans':
+ $fontFile = (
+ $bold ? ($italic ? self::LIBERATION_SANS_BOLD_ITALIC : self::LIBERATION_SANS_BOLD)
+ : ($italic ? self::LIBERATION_SANS_ITALIC : self::LIBERATION_SANS)
+ );
+ break;
+ case 'Lucida Console':
+ $fontFile = self::LUCIDA_CONSOLE;
+ break;
+ case 'Lucida Sans Unicode':
+ $fontFile = self::LUCIDA_SANS_UNICODE;
+ break;
+ case 'Microsoft Sans Serif':
+ $fontFile = self::MICROSOFT_SANS_SERIF;
+ break;
+ case 'Palatino Linotype':
+ $fontFile = (
+ $bold ? ($italic ? self::PALATINO_LINOTYPE_BOLD_ITALIC : self::PALATINO_LINOTYPE_BOLD)
+ : ($italic ? self::PALATINO_LINOTYPE_ITALIC : self::PALATINO_LINOTYPE)
+ );
+ break;
+ case 'Symbol':
+ $fontFile = self::SYMBOL;
+ break;
+ case 'Tahoma':
+ $fontFile = (
+ $bold ? self::TAHOMA_BOLD : self::TAHOMA
+ );
+ break;
+ case 'Times New Roman':
+ $fontFile = (
+ $bold ? ($italic ? self::TIMES_NEW_ROMAN_BOLD_ITALIC : self::TIMES_NEW_ROMAN_BOLD)
+ : ($italic ? self::TIMES_NEW_ROMAN_ITALIC : self::TIMES_NEW_ROMAN)
+ );
+ break;
+ case 'Trebuchet MS':
+ $fontFile = (
+ $bold ? ($italic ? self::TREBUCHET_MS_BOLD_ITALIC : self::TREBUCHET_MS_BOLD)
+ : ($italic ? self::TREBUCHET_MS_ITALIC : self::TREBUCHET_MS)
+ );
+ break;
+ case 'Verdana':
+ $fontFile = (
+ $bold ? ($italic ? self::VERDANA_BOLD_ITALIC : self::VERDANA_BOLD)
+ : ($italic ? self::VERDANA_ITALIC : self::VERDANA)
+ );
+ break;
+ default:
+ throw new PHPExcel_Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
+ break;
+ }
+
+ $fontFile = self::$trueTypeFontPath . $fontFile;
+
+ // Check if file actually exists
+ if (!file_exists($fontFile)) {
+ throw new PHPExcel_Exception('TrueType Font file not found');
+ }
+
+ return $fontFile;
+ }
+
+ /**
+ * Returns the associated charset for the font name.
+ *
+ * @param string $name Font name
+ * @return int Character set code
+ */
+ public static function getCharsetFromFontName($name)
+ {
+ switch ($name) {
+ // Add more cases. Check FONT records in real Excel files.
+ case 'EucrosiaUPC':
+ return self::CHARSET_ANSI_THAI;
+ case 'Wingdings':
+ return self::CHARSET_SYMBOL;
+ case 'Wingdings 2':
+ return self::CHARSET_SYMBOL;
+ case 'Wingdings 3':
+ return self::CHARSET_SYMBOL;
+ default:
+ return self::CHARSET_ANSI_LATIN;
+ }
+ }
+
+ /**
+ * Get the effective column width for columns without a column dimension or column with width -1
+ * For example, for Calibri 11 this is 9.140625 (64 px)
+ *
+ * @param PHPExcel_Style_Font $font The workbooks default font
+ * @param boolean $pPixels true = return column width in pixels, false = return in OOXML units
+ * @return mixed Column width
+ */
+ public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false)
+ {
+ if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
+ // Exact width can be determined
+ $columnWidth = $pPixels ?
+ self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
+ : self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
+
+ } else {
+ // We don't have data for this particular font and size, use approximation by
+ // extrapolating from Calibri 11
+ $columnWidth = $pPixels ?
+ self::$defaultColumnWidths['Calibri'][11]['px']
+ : self::$defaultColumnWidths['Calibri'][11]['width'];
+ $columnWidth = $columnWidth * $font->getSize() / 11;
+
+ // Round pixels to closest integer
+ if ($pPixels) {
+ $columnWidth = (int) round($columnWidth);
+ }
+ }
+
+ return $columnWidth;
+ }
+
+ /**
+ * Get the effective row height for rows without a row dimension or rows with height -1
+ * For example, for Calibri 11 this is 15 points
+ *
+ * @param PHPExcel_Style_Font $font The workbooks default font
+ * @return float Row height in points
+ */
+ public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
+ {
+ switch ($font->getName()) {
+ case 'Arial':
+ switch ($font->getSize()) {
+ case 10:
+ // inspection of Arial 10 workbook says 12.75pt ~17px
+ $rowHeight = 12.75;
+ break;
+ case 9:
+ // inspection of Arial 9 workbook says 12.00pt ~16px
+ $rowHeight = 12;
+ break;
+ case 8:
+ // inspection of Arial 8 workbook says 11.25pt ~15px
+ $rowHeight = 11.25;
+ break;
+ case 7:
+ // inspection of Arial 7 workbook says 9.00pt ~12px
+ $rowHeight = 9;
+ break;
+ case 6:
+ case 5:
+ // inspection of Arial 5,6 workbook says 8.25pt ~11px
+ $rowHeight = 8.25;
+ break;
+ case 4:
+ // inspection of Arial 4 workbook says 6.75pt ~9px
+ $rowHeight = 6.75;
+ break;
+ case 3:
+ // inspection of Arial 3 workbook says 6.00pt ~8px
+ $rowHeight = 6;
+ break;
+ case 2:
+ case 1:
+ // inspection of Arial 1,2 workbook says 5.25pt ~7px
+ $rowHeight = 5.25;
+ break;
+ default:
+ // use Arial 10 workbook as an approximation, extrapolation
+ $rowHeight = 12.75 * $font->getSize() / 10;
+ break;
+ }
+ break;
+
+ case 'Calibri':
+ switch ($font->getSize()) {
+ case 11:
+ // inspection of Calibri 11 workbook says 15.00pt ~20px
+ $rowHeight = 15;
+ break;
+ case 10:
+ // inspection of Calibri 10 workbook says 12.75pt ~17px
+ $rowHeight = 12.75;
+ break;
+ case 9:
+ // inspection of Calibri 9 workbook says 12.00pt ~16px
+ $rowHeight = 12;
+ break;
+ case 8:
+ // inspection of Calibri 8 workbook says 11.25pt ~15px
+ $rowHeight = 11.25;
+ break;
+ case 7:
+ // inspection of Calibri 7 workbook says 9.00pt ~12px
+ $rowHeight = 9;
+ break;
+ case 6:
+ case 5:
+ // inspection of Calibri 5,6 workbook says 8.25pt ~11px
+ $rowHeight = 8.25;
+ break;
+ case 4:
+ // inspection of Calibri 4 workbook says 6.75pt ~9px
+ $rowHeight = 6.75;
+ break;
+ case 3:
+ // inspection of Calibri 3 workbook says 6.00pt ~8px
+ $rowHeight = 6.00;
+ break;
+ case 2:
+ case 1:
+ // inspection of Calibri 1,2 workbook says 5.25pt ~7px
+ $rowHeight = 5.25;
+ break;
+ default:
+ // use Calibri 11 workbook as an approximation, extrapolation
+ $rowHeight = 15 * $font->getSize() / 11;
+ break;
+ }
+ break;
+
+ case 'Verdana':
+ switch ($font->getSize()) {
+ case 10:
+ // inspection of Verdana 10 workbook says 12.75pt ~17px
+ $rowHeight = 12.75;
+ break;
+ case 9:
+ // inspection of Verdana 9 workbook says 11.25pt ~15px
+ $rowHeight = 11.25;
+ break;
+ case 8:
+ // inspection of Verdana 8 workbook says 10.50pt ~14px
+ $rowHeight = 10.50;
+ break;
+ case 7:
+ // inspection of Verdana 7 workbook says 9.00pt ~12px
+ $rowHeight = 9.00;
+ break;
+ case 6:
+ case 5:
+ // inspection of Verdana 5,6 workbook says 8.25pt ~11px
+ $rowHeight = 8.25;
+ break;
+ case 4:
+ // inspection of Verdana 4 workbook says 6.75pt ~9px
+ $rowHeight = 6.75;
+ break;
+ case 3:
+ // inspection of Verdana 3 workbook says 6.00pt ~8px
+ $rowHeight = 6;
+ break;
+ case 2:
+ case 1:
+ // inspection of Verdana 1,2 workbook says 5.25pt ~7px
+ $rowHeight = 5.25;
+ break;
+ default:
+ // use Verdana 10 workbook as an approximation, extrapolation
+ $rowHeight = 12.75 * $font->getSize() / 10;
+ break;
+ }
+ break;
+ default:
+ // just use Calibri as an approximation
+ $rowHeight = 15 * $font->getSize() / 11;
+ break;
+ }
+
+ return $rowHeight;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/CHANGELOG.TXT b/Classes/PHPExcel/Shared/JAMA/CHANGELOG.TXT
new file mode 100644
index 0000000..1c18a5d
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/CHANGELOG.TXT
@@ -0,0 +1,16 @@
+Mar 1, 2005 11:15 AST by PM
+
++ For consistency, renamed Math.php to Maths.java, utils to util,
+ tests to test, docs to doc -
+
++ Removed conditional logic from top of Matrix class.
+
++ Switched to using hypo function in Maths.php for all php-hypot calls.
+ NOTE TO SELF: Need to make sure that all decompositions have been
+ switched over to using the bundled hypo.
+
+Feb 25, 2005 at 10:00 AST by PM
+
++ Recommend using simpler Error.php instead of JAMA_Error.php but
+ can be persuaded otherwise.
+
diff --git a/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php b/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php
new file mode 100644
index 0000000..d68109b
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/CholeskyDecomposition.php
@@ -0,0 +1,148 @@
+L = $A->getArray();
+ $this->m = $A->getRowDimension();
+
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = $i; $j < $this->m; ++$j) {
+ for ($sum = $this->L[$i][$j], $k = $i - 1; $k >= 0; --$k) {
+ $sum -= $this->L[$i][$k] * $this->L[$j][$k];
+ }
+ if ($i == $j) {
+ if ($sum >= 0) {
+ $this->L[$i][$i] = sqrt($sum);
+ } else {
+ $this->isspd = false;
+ }
+ } else {
+ if ($this->L[$i][$i] != 0) {
+ $this->L[$j][$i] = $sum / $this->L[$i][$i];
+ }
+ }
+ }
+
+ for ($k = $i+1; $k < $this->m; ++$k) {
+ $this->L[$i][$k] = 0.0;
+ }
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION));
+ }
+ } // function __construct()
+
+ /**
+ * Is the matrix symmetric and positive definite?
+ *
+ * @return boolean
+ */
+ public function isSPD()
+ {
+ return $this->isspd;
+ } // function isSPD()
+
+ /**
+ * getL
+ *
+ * Return triangular factor.
+ * @return Matrix Lower triangular matrix
+ */
+ public function getL()
+ {
+ return new Matrix($this->L);
+ } // function getL()
+
+ /**
+ * Solve A*X = B
+ *
+ * @param $B Row-equal matrix
+ * @return Matrix L * L' * X = B
+ */
+ public function solve($B = null)
+ {
+ if ($B instanceof Matrix) {
+ if ($B->getRowDimension() == $this->m) {
+ if ($this->isspd) {
+ $X = $B->getArrayCopy();
+ $nx = $B->getColumnDimension();
+
+ for ($k = 0; $k < $this->m; ++$k) {
+ for ($i = $k + 1; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$i][$j] -= $X[$k][$j] * $this->L[$i][$k];
+ }
+ }
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$k][$j] /= $this->L[$k][$k];
+ }
+ }
+
+ for ($k = $this->m - 1; $k >= 0; --$k) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$k][$j] /= $this->L[$k][$k];
+ }
+ for ($i = 0; $i < $k; ++$i) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$i][$j] -= $X[$k][$j] * $this->L[$k][$i];
+ }
+ }
+ }
+
+ return new Matrix($X, $this->m, $nx);
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(MatrixSPDException));
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(MATRIX_DIMENSION_EXCEPTION));
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION));
+ }
+ } // function solve()
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php b/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php
new file mode 100644
index 0000000..d4ae397
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/EigenvalueDecomposition.php
@@ -0,0 +1,864 @@
+d = $this->V[$this->n-1];
+ // Householder reduction to tridiagonal form.
+ for ($i = $this->n-1; $i > 0; --$i) {
+ $i_ = $i -1;
+ // Scale to avoid under/overflow.
+ $h = $scale = 0.0;
+ $scale += array_sum(array_map(abs, $this->d));
+ if ($scale == 0.0) {
+ $this->e[$i] = $this->d[$i_];
+ $this->d = array_slice($this->V[$i_], 0, $i_);
+ for ($j = 0; $j < $i; ++$j) {
+ $this->V[$j][$i] = $this->V[$i][$j] = 0.0;
+ }
+ } else {
+ // Generate Householder vector.
+ for ($k = 0; $k < $i; ++$k) {
+ $this->d[$k] /= $scale;
+ $h += pow($this->d[$k], 2);
+ }
+ $f = $this->d[$i_];
+ $g = sqrt($h);
+ if ($f > 0) {
+ $g = -$g;
+ }
+ $this->e[$i] = $scale * $g;
+ $h = $h - $f * $g;
+ $this->d[$i_] = $f - $g;
+ for ($j = 0; $j < $i; ++$j) {
+ $this->e[$j] = 0.0;
+ }
+ // Apply similarity transformation to remaining columns.
+ for ($j = 0; $j < $i; ++$j) {
+ $f = $this->d[$j];
+ $this->V[$j][$i] = $f;
+ $g = $this->e[$j] + $this->V[$j][$j] * $f;
+ for ($k = $j+1; $k <= $i_; ++$k) {
+ $g += $this->V[$k][$j] * $this->d[$k];
+ $this->e[$k] += $this->V[$k][$j] * $f;
+ }
+ $this->e[$j] = $g;
+ }
+ $f = 0.0;
+ for ($j = 0; $j < $i; ++$j) {
+ $this->e[$j] /= $h;
+ $f += $this->e[$j] * $this->d[$j];
+ }
+ $hh = $f / (2 * $h);
+ for ($j=0; $j < $i; ++$j) {
+ $this->e[$j] -= $hh * $this->d[$j];
+ }
+ for ($j = 0; $j < $i; ++$j) {
+ $f = $this->d[$j];
+ $g = $this->e[$j];
+ for ($k = $j; $k <= $i_; ++$k) {
+ $this->V[$k][$j] -= ($f * $this->e[$k] + $g * $this->d[$k]);
+ }
+ $this->d[$j] = $this->V[$i-1][$j];
+ $this->V[$i][$j] = 0.0;
+ }
+ }
+ $this->d[$i] = $h;
+ }
+
+ // Accumulate transformations.
+ for ($i = 0; $i < $this->n-1; ++$i) {
+ $this->V[$this->n-1][$i] = $this->V[$i][$i];
+ $this->V[$i][$i] = 1.0;
+ $h = $this->d[$i+1];
+ if ($h != 0.0) {
+ for ($k = 0; $k <= $i; ++$k) {
+ $this->d[$k] = $this->V[$k][$i+1] / $h;
+ }
+ for ($j = 0; $j <= $i; ++$j) {
+ $g = 0.0;
+ for ($k = 0; $k <= $i; ++$k) {
+ $g += $this->V[$k][$i+1] * $this->V[$k][$j];
+ }
+ for ($k = 0; $k <= $i; ++$k) {
+ $this->V[$k][$j] -= $g * $this->d[$k];
+ }
+ }
+ }
+ for ($k = 0; $k <= $i; ++$k) {
+ $this->V[$k][$i+1] = 0.0;
+ }
+ }
+
+ $this->d = $this->V[$this->n-1];
+ $this->V[$this->n-1] = array_fill(0, $j, 0.0);
+ $this->V[$this->n-1][$this->n-1] = 1.0;
+ $this->e[0] = 0.0;
+ }
+
+ /**
+ * Symmetric tridiagonal QL algorithm.
+ *
+ * This is derived from the Algol procedures tql2, by
+ * Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
+ * Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
+ * Fortran subroutine in EISPACK.
+ *
+ * @access private
+ */
+ private function tql2()
+ {
+ for ($i = 1; $i < $this->n; ++$i) {
+ $this->e[$i-1] = $this->e[$i];
+ }
+ $this->e[$this->n-1] = 0.0;
+ $f = 0.0;
+ $tst1 = 0.0;
+ $eps = pow(2.0, -52.0);
+
+ for ($l = 0; $l < $this->n; ++$l) {
+ // Find small subdiagonal element
+ $tst1 = max($tst1, abs($this->d[$l]) + abs($this->e[$l]));
+ $m = $l;
+ while ($m < $this->n) {
+ if (abs($this->e[$m]) <= $eps * $tst1) {
+ break;
+ }
+ ++$m;
+ }
+ // If m == l, $this->d[l] is an eigenvalue,
+ // otherwise, iterate.
+ if ($m > $l) {
+ $iter = 0;
+ do {
+ // Could check iteration count here.
+ $iter += 1;
+ // Compute implicit shift
+ $g = $this->d[$l];
+ $p = ($this->d[$l+1] - $g) / (2.0 * $this->e[$l]);
+ $r = hypo($p, 1.0);
+ if ($p < 0) {
+ $r *= -1;
+ }
+ $this->d[$l] = $this->e[$l] / ($p + $r);
+ $this->d[$l+1] = $this->e[$l] * ($p + $r);
+ $dl1 = $this->d[$l+1];
+ $h = $g - $this->d[$l];
+ for ($i = $l + 2; $i < $this->n; ++$i) {
+ $this->d[$i] -= $h;
+ }
+ $f += $h;
+ // Implicit QL transformation.
+ $p = $this->d[$m];
+ $c = 1.0;
+ $c2 = $c3 = $c;
+ $el1 = $this->e[$l + 1];
+ $s = $s2 = 0.0;
+ for ($i = $m-1; $i >= $l; --$i) {
+ $c3 = $c2;
+ $c2 = $c;
+ $s2 = $s;
+ $g = $c * $this->e[$i];
+ $h = $c * $p;
+ $r = hypo($p, $this->e[$i]);
+ $this->e[$i+1] = $s * $r;
+ $s = $this->e[$i] / $r;
+ $c = $p / $r;
+ $p = $c * $this->d[$i] - $s * $g;
+ $this->d[$i+1] = $h + $s * ($c * $g + $s * $this->d[$i]);
+ // Accumulate transformation.
+ for ($k = 0; $k < $this->n; ++$k) {
+ $h = $this->V[$k][$i+1];
+ $this->V[$k][$i+1] = $s * $this->V[$k][$i] + $c * $h;
+ $this->V[$k][$i] = $c * $this->V[$k][$i] - $s * $h;
+ }
+ }
+ $p = -$s * $s2 * $c3 * $el1 * $this->e[$l] / $dl1;
+ $this->e[$l] = $s * $p;
+ $this->d[$l] = $c * $p;
+ // Check for convergence.
+ } while (abs($this->e[$l]) > $eps * $tst1);
+ }
+ $this->d[$l] = $this->d[$l] + $f;
+ $this->e[$l] = 0.0;
+ }
+
+ // Sort eigenvalues and corresponding vectors.
+ for ($i = 0; $i < $this->n - 1; ++$i) {
+ $k = $i;
+ $p = $this->d[$i];
+ for ($j = $i+1; $j < $this->n; ++$j) {
+ if ($this->d[$j] < $p) {
+ $k = $j;
+ $p = $this->d[$j];
+ }
+ }
+ if ($k != $i) {
+ $this->d[$k] = $this->d[$i];
+ $this->d[$i] = $p;
+ for ($j = 0; $j < $this->n; ++$j) {
+ $p = $this->V[$j][$i];
+ $this->V[$j][$i] = $this->V[$j][$k];
+ $this->V[$j][$k] = $p;
+ }
+ }
+ }
+ }
+
+ /**
+ * Nonsymmetric reduction to Hessenberg form.
+ *
+ * This is derived from the Algol procedures orthes and ortran,
+ * by Martin and Wilkinson, Handbook for Auto. Comp.,
+ * Vol.ii-Linear Algebra, and the corresponding
+ * Fortran subroutines in EISPACK.
+ *
+ * @access private
+ */
+ private function orthes()
+ {
+ $low = 0;
+ $high = $this->n-1;
+
+ for ($m = $low+1; $m <= $high-1; ++$m) {
+ // Scale column.
+ $scale = 0.0;
+ for ($i = $m; $i <= $high; ++$i) {
+ $scale = $scale + abs($this->H[$i][$m-1]);
+ }
+ if ($scale != 0.0) {
+ // Compute Householder transformation.
+ $h = 0.0;
+ for ($i = $high; $i >= $m; --$i) {
+ $this->ort[$i] = $this->H[$i][$m-1] / $scale;
+ $h += $this->ort[$i] * $this->ort[$i];
+ }
+ $g = sqrt($h);
+ if ($this->ort[$m] > 0) {
+ $g *= -1;
+ }
+ $h -= $this->ort[$m] * $g;
+ $this->ort[$m] -= $g;
+ // Apply Householder similarity transformation
+ // H = (I -u * u' / h) * H * (I -u * u') / h)
+ for ($j = $m; $j < $this->n; ++$j) {
+ $f = 0.0;
+ for ($i = $high; $i >= $m; --$i) {
+ $f += $this->ort[$i] * $this->H[$i][$j];
+ }
+ $f /= $h;
+ for ($i = $m; $i <= $high; ++$i) {
+ $this->H[$i][$j] -= $f * $this->ort[$i];
+ }
+ }
+ for ($i = 0; $i <= $high; ++$i) {
+ $f = 0.0;
+ for ($j = $high; $j >= $m; --$j) {
+ $f += $this->ort[$j] * $this->H[$i][$j];
+ }
+ $f = $f / $h;
+ for ($j = $m; $j <= $high; ++$j) {
+ $this->H[$i][$j] -= $f * $this->ort[$j];
+ }
+ }
+ $this->ort[$m] = $scale * $this->ort[$m];
+ $this->H[$m][$m-1] = $scale * $g;
+ }
+ }
+
+ // Accumulate transformations (Algol's ortran).
+ for ($i = 0; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $this->V[$i][$j] = ($i == $j ? 1.0 : 0.0);
+ }
+ }
+ for ($m = $high-1; $m >= $low+1; --$m) {
+ if ($this->H[$m][$m-1] != 0.0) {
+ for ($i = $m+1; $i <= $high; ++$i) {
+ $this->ort[$i] = $this->H[$i][$m-1];
+ }
+ for ($j = $m; $j <= $high; ++$j) {
+ $g = 0.0;
+ for ($i = $m; $i <= $high; ++$i) {
+ $g += $this->ort[$i] * $this->V[$i][$j];
+ }
+ // Double division avoids possible underflow
+ $g = ($g / $this->ort[$m]) / $this->H[$m][$m-1];
+ for ($i = $m; $i <= $high; ++$i) {
+ $this->V[$i][$j] += $g * $this->ort[$i];
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Performs complex division.
+ *
+ * @access private
+ */
+ private function cdiv($xr, $xi, $yr, $yi)
+ {
+ if (abs($yr) > abs($yi)) {
+ $r = $yi / $yr;
+ $d = $yr + $r * $yi;
+ $this->cdivr = ($xr + $r * $xi) / $d;
+ $this->cdivi = ($xi - $r * $xr) / $d;
+ } else {
+ $r = $yr / $yi;
+ $d = $yi + $r * $yr;
+ $this->cdivr = ($r * $xr + $xi) / $d;
+ $this->cdivi = ($r * $xi - $xr) / $d;
+ }
+ }
+
+ /**
+ * Nonsymmetric reduction from Hessenberg to real Schur form.
+ *
+ * Code is derived from the Algol procedure hqr2,
+ * by Martin and Wilkinson, Handbook for Auto. Comp.,
+ * Vol.ii-Linear Algebra, and the corresponding
+ * Fortran subroutine in EISPACK.
+ *
+ * @access private
+ */
+ private function hqr2()
+ {
+ // Initialize
+ $nn = $this->n;
+ $n = $nn - 1;
+ $low = 0;
+ $high = $nn - 1;
+ $eps = pow(2.0, -52.0);
+ $exshift = 0.0;
+ $p = $q = $r = $s = $z = 0;
+ // Store roots isolated by balanc and compute matrix norm
+ $norm = 0.0;
+
+ for ($i = 0; $i < $nn; ++$i) {
+ if (($i < $low) or ($i > $high)) {
+ $this->d[$i] = $this->H[$i][$i];
+ $this->e[$i] = 0.0;
+ }
+ for ($j = max($i-1, 0); $j < $nn; ++$j) {
+ $norm = $norm + abs($this->H[$i][$j]);
+ }
+ }
+
+ // Outer loop over eigenvalue index
+ $iter = 0;
+ while ($n >= $low) {
+ // Look for single small sub-diagonal element
+ $l = $n;
+ while ($l > $low) {
+ $s = abs($this->H[$l-1][$l-1]) + abs($this->H[$l][$l]);
+ if ($s == 0.0) {
+ $s = $norm;
+ }
+ if (abs($this->H[$l][$l-1]) < $eps * $s) {
+ break;
+ }
+ --$l;
+ }
+ // Check for convergence
+ // One root found
+ if ($l == $n) {
+ $this->H[$n][$n] = $this->H[$n][$n] + $exshift;
+ $this->d[$n] = $this->H[$n][$n];
+ $this->e[$n] = 0.0;
+ --$n;
+ $iter = 0;
+ // Two roots found
+ } elseif ($l == $n-1) {
+ $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
+ $p = ($this->H[$n-1][$n-1] - $this->H[$n][$n]) / 2.0;
+ $q = $p * $p + $w;
+ $z = sqrt(abs($q));
+ $this->H[$n][$n] = $this->H[$n][$n] + $exshift;
+ $this->H[$n-1][$n-1] = $this->H[$n-1][$n-1] + $exshift;
+ $x = $this->H[$n][$n];
+ // Real pair
+ if ($q >= 0) {
+ if ($p >= 0) {
+ $z = $p + $z;
+ } else {
+ $z = $p - $z;
+ }
+ $this->d[$n-1] = $x + $z;
+ $this->d[$n] = $this->d[$n-1];
+ if ($z != 0.0) {
+ $this->d[$n] = $x - $w / $z;
+ }
+ $this->e[$n-1] = 0.0;
+ $this->e[$n] = 0.0;
+ $x = $this->H[$n][$n-1];
+ $s = abs($x) + abs($z);
+ $p = $x / $s;
+ $q = $z / $s;
+ $r = sqrt($p * $p + $q * $q);
+ $p = $p / $r;
+ $q = $q / $r;
+ // Row modification
+ for ($j = $n-1; $j < $nn; ++$j) {
+ $z = $this->H[$n-1][$j];
+ $this->H[$n-1][$j] = $q * $z + $p * $this->H[$n][$j];
+ $this->H[$n][$j] = $q * $this->H[$n][$j] - $p * $z;
+ }
+ // Column modification
+ for ($i = 0; $i <= $n; ++$i) {
+ $z = $this->H[$i][$n-1];
+ $this->H[$i][$n-1] = $q * $z + $p * $this->H[$i][$n];
+ $this->H[$i][$n] = $q * $this->H[$i][$n] - $p * $z;
+ }
+ // Accumulate transformations
+ for ($i = $low; $i <= $high; ++$i) {
+ $z = $this->V[$i][$n-1];
+ $this->V[$i][$n-1] = $q * $z + $p * $this->V[$i][$n];
+ $this->V[$i][$n] = $q * $this->V[$i][$n] - $p * $z;
+ }
+ // Complex pair
+ } else {
+ $this->d[$n-1] = $x + $p;
+ $this->d[$n] = $x + $p;
+ $this->e[$n-1] = $z;
+ $this->e[$n] = -$z;
+ }
+ $n = $n - 2;
+ $iter = 0;
+ // No convergence yet
+ } else {
+ // Form shift
+ $x = $this->H[$n][$n];
+ $y = 0.0;
+ $w = 0.0;
+ if ($l < $n) {
+ $y = $this->H[$n-1][$n-1];
+ $w = $this->H[$n][$n-1] * $this->H[$n-1][$n];
+ }
+ // Wilkinson's original ad hoc shift
+ if ($iter == 10) {
+ $exshift += $x;
+ for ($i = $low; $i <= $n; ++$i) {
+ $this->H[$i][$i] -= $x;
+ }
+ $s = abs($this->H[$n][$n-1]) + abs($this->H[$n-1][$n-2]);
+ $x = $y = 0.75 * $s;
+ $w = -0.4375 * $s * $s;
+ }
+ // MATLAB's new ad hoc shift
+ if ($iter == 30) {
+ $s = ($y - $x) / 2.0;
+ $s = $s * $s + $w;
+ if ($s > 0) {
+ $s = sqrt($s);
+ if ($y < $x) {
+ $s = -$s;
+ }
+ $s = $x - $w / (($y - $x) / 2.0 + $s);
+ for ($i = $low; $i <= $n; ++$i) {
+ $this->H[$i][$i] -= $s;
+ }
+ $exshift += $s;
+ $x = $y = $w = 0.964;
+ }
+ }
+ // Could check iteration count here.
+ $iter = $iter + 1;
+ // Look for two consecutive small sub-diagonal elements
+ $m = $n - 2;
+ while ($m >= $l) {
+ $z = $this->H[$m][$m];
+ $r = $x - $z;
+ $s = $y - $z;
+ $p = ($r * $s - $w) / $this->H[$m+1][$m] + $this->H[$m][$m+1];
+ $q = $this->H[$m+1][$m+1] - $z - $r - $s;
+ $r = $this->H[$m+2][$m+1];
+ $s = abs($p) + abs($q) + abs($r);
+ $p = $p / $s;
+ $q = $q / $s;
+ $r = $r / $s;
+ if ($m == $l) {
+ break;
+ }
+ if (abs($this->H[$m][$m-1]) * (abs($q) + abs($r)) <
+ $eps * (abs($p) * (abs($this->H[$m-1][$m-1]) + abs($z) + abs($this->H[$m+1][$m+1])))) {
+ break;
+ }
+ --$m;
+ }
+ for ($i = $m + 2; $i <= $n; ++$i) {
+ $this->H[$i][$i-2] = 0.0;
+ if ($i > $m+2) {
+ $this->H[$i][$i-3] = 0.0;
+ }
+ }
+ // Double QR step involving rows l:n and columns m:n
+ for ($k = $m; $k <= $n-1; ++$k) {
+ $notlast = ($k != $n-1);
+ if ($k != $m) {
+ $p = $this->H[$k][$k-1];
+ $q = $this->H[$k+1][$k-1];
+ $r = ($notlast ? $this->H[$k+2][$k-1] : 0.0);
+ $x = abs($p) + abs($q) + abs($r);
+ if ($x != 0.0) {
+ $p = $p / $x;
+ $q = $q / $x;
+ $r = $r / $x;
+ }
+ }
+ if ($x == 0.0) {
+ break;
+ }
+ $s = sqrt($p * $p + $q * $q + $r * $r);
+ if ($p < 0) {
+ $s = -$s;
+ }
+ if ($s != 0) {
+ if ($k != $m) {
+ $this->H[$k][$k-1] = -$s * $x;
+ } elseif ($l != $m) {
+ $this->H[$k][$k-1] = -$this->H[$k][$k-1];
+ }
+ $p = $p + $s;
+ $x = $p / $s;
+ $y = $q / $s;
+ $z = $r / $s;
+ $q = $q / $p;
+ $r = $r / $p;
+ // Row modification
+ for ($j = $k; $j < $nn; ++$j) {
+ $p = $this->H[$k][$j] + $q * $this->H[$k+1][$j];
+ if ($notlast) {
+ $p = $p + $r * $this->H[$k+2][$j];
+ $this->H[$k+2][$j] = $this->H[$k+2][$j] - $p * $z;
+ }
+ $this->H[$k][$j] = $this->H[$k][$j] - $p * $x;
+ $this->H[$k+1][$j] = $this->H[$k+1][$j] - $p * $y;
+ }
+ // Column modification
+ for ($i = 0; $i <= min($n, $k+3); ++$i) {
+ $p = $x * $this->H[$i][$k] + $y * $this->H[$i][$k+1];
+ if ($notlast) {
+ $p = $p + $z * $this->H[$i][$k+2];
+ $this->H[$i][$k+2] = $this->H[$i][$k+2] - $p * $r;
+ }
+ $this->H[$i][$k] = $this->H[$i][$k] - $p;
+ $this->H[$i][$k+1] = $this->H[$i][$k+1] - $p * $q;
+ }
+ // Accumulate transformations
+ for ($i = $low; $i <= $high; ++$i) {
+ $p = $x * $this->V[$i][$k] + $y * $this->V[$i][$k+1];
+ if ($notlast) {
+ $p = $p + $z * $this->V[$i][$k+2];
+ $this->V[$i][$k+2] = $this->V[$i][$k+2] - $p * $r;
+ }
+ $this->V[$i][$k] = $this->V[$i][$k] - $p;
+ $this->V[$i][$k+1] = $this->V[$i][$k+1] - $p * $q;
+ }
+ } // ($s != 0)
+ } // k loop
+ } // check convergence
+ } // while ($n >= $low)
+
+ // Backsubstitute to find vectors of upper triangular form
+ if ($norm == 0.0) {
+ return;
+ }
+
+ for ($n = $nn-1; $n >= 0; --$n) {
+ $p = $this->d[$n];
+ $q = $this->e[$n];
+ // Real vector
+ if ($q == 0) {
+ $l = $n;
+ $this->H[$n][$n] = 1.0;
+ for ($i = $n-1; $i >= 0; --$i) {
+ $w = $this->H[$i][$i] - $p;
+ $r = 0.0;
+ for ($j = $l; $j <= $n; ++$j) {
+ $r = $r + $this->H[$i][$j] * $this->H[$j][$n];
+ }
+ if ($this->e[$i] < 0.0) {
+ $z = $w;
+ $s = $r;
+ } else {
+ $l = $i;
+ if ($this->e[$i] == 0.0) {
+ if ($w != 0.0) {
+ $this->H[$i][$n] = -$r / $w;
+ } else {
+ $this->H[$i][$n] = -$r / ($eps * $norm);
+ }
+ // Solve real equations
+ } else {
+ $x = $this->H[$i][$i+1];
+ $y = $this->H[$i+1][$i];
+ $q = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i];
+ $t = ($x * $s - $z * $r) / $q;
+ $this->H[$i][$n] = $t;
+ if (abs($x) > abs($z)) {
+ $this->H[$i+1][$n] = (-$r - $w * $t) / $x;
+ } else {
+ $this->H[$i+1][$n] = (-$s - $y * $t) / $z;
+ }
+ }
+ // Overflow control
+ $t = abs($this->H[$i][$n]);
+ if (($eps * $t) * $t > 1) {
+ for ($j = $i; $j <= $n; ++$j) {
+ $this->H[$j][$n] = $this->H[$j][$n] / $t;
+ }
+ }
+ }
+ }
+ // Complex vector
+ } elseif ($q < 0) {
+ $l = $n-1;
+ // Last vector component imaginary so matrix is triangular
+ if (abs($this->H[$n][$n-1]) > abs($this->H[$n-1][$n])) {
+ $this->H[$n-1][$n-1] = $q / $this->H[$n][$n-1];
+ $this->H[$n-1][$n] = -($this->H[$n][$n] - $p) / $this->H[$n][$n-1];
+ } else {
+ $this->cdiv(0.0, -$this->H[$n-1][$n], $this->H[$n-1][$n-1] - $p, $q);
+ $this->H[$n-1][$n-1] = $this->cdivr;
+ $this->H[$n-1][$n] = $this->cdivi;
+ }
+ $this->H[$n][$n-1] = 0.0;
+ $this->H[$n][$n] = 1.0;
+ for ($i = $n-2; $i >= 0; --$i) {
+ // double ra,sa,vr,vi;
+ $ra = 0.0;
+ $sa = 0.0;
+ for ($j = $l; $j <= $n; ++$j) {
+ $ra = $ra + $this->H[$i][$j] * $this->H[$j][$n-1];
+ $sa = $sa + $this->H[$i][$j] * $this->H[$j][$n];
+ }
+ $w = $this->H[$i][$i] - $p;
+ if ($this->e[$i] < 0.0) {
+ $z = $w;
+ $r = $ra;
+ $s = $sa;
+ } else {
+ $l = $i;
+ if ($this->e[$i] == 0) {
+ $this->cdiv(-$ra, -$sa, $w, $q);
+ $this->H[$i][$n-1] = $this->cdivr;
+ $this->H[$i][$n] = $this->cdivi;
+ } else {
+ // Solve complex equations
+ $x = $this->H[$i][$i+1];
+ $y = $this->H[$i+1][$i];
+ $vr = ($this->d[$i] - $p) * ($this->d[$i] - $p) + $this->e[$i] * $this->e[$i] - $q * $q;
+ $vi = ($this->d[$i] - $p) * 2.0 * $q;
+ if ($vr == 0.0 & $vi == 0.0) {
+ $vr = $eps * $norm * (abs($w) + abs($q) + abs($x) + abs($y) + abs($z));
+ }
+ $this->cdiv($x * $r - $z * $ra + $q * $sa, $x * $s - $z * $sa - $q * $ra, $vr, $vi);
+ $this->H[$i][$n-1] = $this->cdivr;
+ $this->H[$i][$n] = $this->cdivi;
+ if (abs($x) > (abs($z) + abs($q))) {
+ $this->H[$i+1][$n-1] = (-$ra - $w * $this->H[$i][$n-1] + $q * $this->H[$i][$n]) / $x;
+ $this->H[$i+1][$n] = (-$sa - $w * $this->H[$i][$n] - $q * $this->H[$i][$n-1]) / $x;
+ } else {
+ $this->cdiv(-$r - $y * $this->H[$i][$n-1], -$s - $y * $this->H[$i][$n], $z, $q);
+ $this->H[$i+1][$n-1] = $this->cdivr;
+ $this->H[$i+1][$n] = $this->cdivi;
+ }
+ }
+ // Overflow control
+ $t = max(abs($this->H[$i][$n-1]), abs($this->H[$i][$n]));
+ if (($eps * $t) * $t > 1) {
+ for ($j = $i; $j <= $n; ++$j) {
+ $this->H[$j][$n-1] = $this->H[$j][$n-1] / $t;
+ $this->H[$j][$n] = $this->H[$j][$n] / $t;
+ }
+ }
+ } // end else
+ } // end for
+ } // end else for complex case
+ } // end for
+
+ // Vectors of isolated roots
+ for ($i = 0; $i < $nn; ++$i) {
+ if ($i < $low | $i > $high) {
+ for ($j = $i; $j < $nn; ++$j) {
+ $this->V[$i][$j] = $this->H[$i][$j];
+ }
+ }
+ }
+
+ // Back transformation to get eigenvectors of original matrix
+ for ($j = $nn-1; $j >= $low; --$j) {
+ for ($i = $low; $i <= $high; ++$i) {
+ $z = 0.0;
+ for ($k = $low; $k <= min($j, $high); ++$k) {
+ $z = $z + $this->V[$i][$k] * $this->H[$k][$j];
+ }
+ $this->V[$i][$j] = $z;
+ }
+ }
+ } // end hqr2
+
+ /**
+ * Constructor: Check for symmetry, then construct the eigenvalue decomposition
+ *
+ * @access public
+ * @param A Square matrix
+ * @return Structure to access D and V.
+ */
+ public function __construct($Arg)
+ {
+ $this->A = $Arg->getArray();
+ $this->n = $Arg->getColumnDimension();
+
+ $issymmetric = true;
+ for ($j = 0; ($j < $this->n) & $issymmetric; ++$j) {
+ for ($i = 0; ($i < $this->n) & $issymmetric; ++$i) {
+ $issymmetric = ($this->A[$i][$j] == $this->A[$j][$i]);
+ }
+ }
+
+ if ($issymmetric) {
+ $this->V = $this->A;
+ // Tridiagonalize.
+ $this->tred2();
+ // Diagonalize.
+ $this->tql2();
+ } else {
+ $this->H = $this->A;
+ $this->ort = array();
+ // Reduce to Hessenberg form.
+ $this->orthes();
+ // Reduce Hessenberg to real Schur form.
+ $this->hqr2();
+ }
+ }
+
+ /**
+ * Return the eigenvector matrix
+ *
+ * @access public
+ * @return V
+ */
+ public function getV()
+ {
+ return new Matrix($this->V, $this->n, $this->n);
+ }
+
+ /**
+ * Return the real parts of the eigenvalues
+ *
+ * @access public
+ * @return real(diag(D))
+ */
+ public function getRealEigenvalues()
+ {
+ return $this->d;
+ }
+
+ /**
+ * Return the imaginary parts of the eigenvalues
+ *
+ * @access public
+ * @return imag(diag(D))
+ */
+ public function getImagEigenvalues()
+ {
+ return $this->e;
+ }
+
+ /**
+ * Return the block diagonal eigenvalue matrix
+ *
+ * @access public
+ * @return D
+ */
+ public function getD()
+ {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $D[$i] = array_fill(0, $this->n, 0.0);
+ $D[$i][$i] = $this->d[$i];
+ if ($this->e[$i] == 0) {
+ continue;
+ }
+ $o = ($this->e[$i] > 0) ? $i + 1 : $i - 1;
+ $D[$i][$o] = $this->e[$i];
+ }
+ return new Matrix($D);
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/LUDecomposition.php b/Classes/PHPExcel/Shared/JAMA/LUDecomposition.php
new file mode 100644
index 0000000..2505d92
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/LUDecomposition.php
@@ -0,0 +1,257 @@
+= n, the LU decomposition is an m-by-n
+ * unit lower triangular matrix L, an n-by-n upper triangular matrix U,
+ * and a permutation vector piv of length m so that A(piv,:) = L*U.
+ * If m < n, then L is m-by-m and U is m-by-n.
+ *
+ * The LU decompostion with pivoting always exists, even if the matrix is
+ * singular, so the constructor will never fail. The primary use of the
+ * LU decomposition is in the solution of square systems of simultaneous
+ * linear equations. This will fail if isNonsingular() returns false.
+ *
+ * @author Paul Meagher
+ * @author Bartosz Matosiuk
+ * @author Michael Bommarito
+ * @version 1.1
+ * @license PHP v3.0
+ */
+class PHPExcel_Shared_JAMA_LUDecomposition
+{
+ const MATRIX_SINGULAR_EXCEPTION = "Can only perform operation on singular matrix.";
+ const MATRIX_SQUARE_EXCEPTION = "Mismatched Row dimension";
+
+ /**
+ * Decomposition storage
+ * @var array
+ */
+ private $LU = array();
+
+ /**
+ * Row dimension.
+ * @var int
+ */
+ private $m;
+
+ /**
+ * Column dimension.
+ * @var int
+ */
+ private $n;
+
+ /**
+ * Pivot sign.
+ * @var int
+ */
+ private $pivsign;
+
+ /**
+ * Internal storage of pivot vector.
+ * @var array
+ */
+ private $piv = array();
+
+ /**
+ * LU Decomposition constructor.
+ *
+ * @param $A Rectangular matrix
+ * @return Structure to access L, U and piv.
+ */
+ public function __construct($A)
+ {
+ if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
+ // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
+ $this->LU = $A->getArray();
+ $this->m = $A->getRowDimension();
+ $this->n = $A->getColumnDimension();
+ for ($i = 0; $i < $this->m; ++$i) {
+ $this->piv[$i] = $i;
+ }
+ $this->pivsign = 1;
+ $LUrowi = $LUcolj = array();
+
+ // Outer loop.
+ for ($j = 0; $j < $this->n; ++$j) {
+ // Make a copy of the j-th column to localize references.
+ for ($i = 0; $i < $this->m; ++$i) {
+ $LUcolj[$i] = &$this->LU[$i][$j];
+ }
+ // Apply previous transformations.
+ for ($i = 0; $i < $this->m; ++$i) {
+ $LUrowi = $this->LU[$i];
+ // Most of the time is spent in the following dot product.
+ $kmax = min($i, $j);
+ $s = 0.0;
+ for ($k = 0; $k < $kmax; ++$k) {
+ $s += $LUrowi[$k] * $LUcolj[$k];
+ }
+ $LUrowi[$j] = $LUcolj[$i] -= $s;
+ }
+ // Find pivot and exchange if necessary.
+ $p = $j;
+ for ($i = $j+1; $i < $this->m; ++$i) {
+ if (abs($LUcolj[$i]) > abs($LUcolj[$p])) {
+ $p = $i;
+ }
+ }
+ if ($p != $j) {
+ for ($k = 0; $k < $this->n; ++$k) {
+ $t = $this->LU[$p][$k];
+ $this->LU[$p][$k] = $this->LU[$j][$k];
+ $this->LU[$j][$k] = $t;
+ }
+ $k = $this->piv[$p];
+ $this->piv[$p] = $this->piv[$j];
+ $this->piv[$j] = $k;
+ $this->pivsign = $this->pivsign * -1;
+ }
+ // Compute multipliers.
+ if (($j < $this->m) && ($this->LU[$j][$j] != 0.0)) {
+ for ($i = $j+1; $i < $this->m; ++$i) {
+ $this->LU[$i][$j] /= $this->LU[$j][$j];
+ }
+ }
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ARGUMENT_TYPE_EXCEPTION);
+ }
+ } // function __construct()
+
+ /**
+ * Get lower triangular factor.
+ *
+ * @return array Lower triangular factor
+ */
+ public function getL()
+ {
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($i > $j) {
+ $L[$i][$j] = $this->LU[$i][$j];
+ } elseif ($i == $j) {
+ $L[$i][$j] = 1.0;
+ } else {
+ $L[$i][$j] = 0.0;
+ }
+ }
+ }
+ return new PHPExcel_Shared_JAMA_Matrix($L);
+ } // function getL()
+
+ /**
+ * Get upper triangular factor.
+ *
+ * @return array Upper triangular factor
+ */
+ public function getU()
+ {
+ for ($i = 0; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($i <= $j) {
+ $U[$i][$j] = $this->LU[$i][$j];
+ } else {
+ $U[$i][$j] = 0.0;
+ }
+ }
+ }
+ return new PHPExcel_Shared_JAMA_Matrix($U);
+ } // function getU()
+
+ /**
+ * Return pivot permutation vector.
+ *
+ * @return array Pivot vector
+ */
+ public function getPivot()
+ {
+ return $this->piv;
+ } // function getPivot()
+
+ /**
+ * Alias for getPivot
+ *
+ * @see getPivot
+ */
+ public function getDoublePivot()
+ {
+ return $this->getPivot();
+ } // function getDoublePivot()
+
+ /**
+ * Is the matrix nonsingular?
+ *
+ * @return true if U, and hence A, is nonsingular.
+ */
+ public function isNonsingular()
+ {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($this->LU[$j][$j] == 0) {
+ return false;
+ }
+ }
+ return true;
+ } // function isNonsingular()
+
+ /**
+ * Count determinants
+ *
+ * @return array d matrix deterninat
+ */
+ public function det()
+ {
+ if ($this->m == $this->n) {
+ $d = $this->pivsign;
+ for ($j = 0; $j < $this->n; ++$j) {
+ $d *= $this->LU[$j][$j];
+ }
+ return $d;
+ } else {
+ throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MATRIX_DIMENSION_EXCEPTION);
+ }
+ } // function det()
+
+ /**
+ * Solve A*X = B
+ *
+ * @param $B A Matrix with as many rows as A and any number of columns.
+ * @return X so that L*U*X = B(piv,:)
+ * @PHPExcel_Calculation_Exception IllegalArgumentException Matrix row dimensions must agree.
+ * @PHPExcel_Calculation_Exception RuntimeException Matrix is singular.
+ */
+ public function solve($B)
+ {
+ if ($B->getRowDimension() == $this->m) {
+ if ($this->isNonsingular()) {
+ // Copy right hand side with pivoting
+ $nx = $B->getColumnDimension();
+ $X = $B->getMatrix($this->piv, 0, $nx-1);
+ // Solve L*Y = B(piv,:)
+ for ($k = 0; $k < $this->n; ++$k) {
+ for ($i = $k+1; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
+ }
+ }
+ }
+ // Solve U*X = Y;
+ for ($k = $this->n-1; $k >= 0; --$k) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X->A[$k][$j] /= $this->LU[$k][$k];
+ }
+ for ($i = 0; $i < $k; ++$i) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X->A[$i][$j] -= $X->A[$k][$j] * $this->LU[$i][$k];
+ }
+ }
+ }
+ return $X;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::MATRIX_SINGULAR_EXCEPTION);
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::MATRIX_SQUARE_EXCEPTION);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/Matrix.php b/Classes/PHPExcel/Shared/JAMA/Matrix.php
new file mode 100644
index 0000000..82fb0fb
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/Matrix.php
@@ -0,0 +1,1159 @@
+ 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ //Rectangular matrix - m x n initialized from 2D array
+ case 'array':
+ $this->m = count($args[0]);
+ $this->n = count($args[0][0]);
+ $this->A = $args[0];
+ break;
+ //Square matrix - n x n
+ case 'integer':
+ $this->m = $args[0];
+ $this->n = $args[0];
+ $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0));
+ break;
+ //Rectangular matrix - m x n
+ case 'integer,integer':
+ $this->m = $args[0];
+ $this->n = $args[1];
+ $this->A = array_fill(0, $this->m, array_fill(0, $this->n, 0));
+ break;
+ //Rectangular matrix - m x n initialized from packed array
+ case 'array,integer':
+ $this->m = $args[1];
+ if ($this->m != 0) {
+ $this->n = count($args[0]) / $this->m;
+ } else {
+ $this->n = 0;
+ }
+ if (($this->m * $this->n) == count($args[0])) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $this->A[$i][$j] = $args[0][$i + $j * $this->m];
+ }
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARRAY_LENGTH_EXCEPTION);
+ }
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * getArray
+ *
+ * @return array Matrix array
+ */
+ public function getArray()
+ {
+ return $this->A;
+ }
+
+ /**
+ * getRowDimension
+ *
+ * @return int Row dimension
+ */
+ public function getRowDimension()
+ {
+ return $this->m;
+ }
+
+ /**
+ * getColumnDimension
+ *
+ * @return int Column dimension
+ */
+ public function getColumnDimension()
+ {
+ return $this->n;
+ }
+
+ /**
+ * get
+ *
+ * Get the i,j-th element of the matrix.
+ * @param int $i Row position
+ * @param int $j Column position
+ * @return mixed Element (int/float/double)
+ */
+ public function get($i = null, $j = null)
+ {
+ return $this->A[$i][$j];
+ }
+
+ /**
+ * getMatrix
+ *
+ * Get a submatrix
+ * @param int $i0 Initial row index
+ * @param int $iF Final row index
+ * @param int $j0 Initial column index
+ * @param int $jF Final column index
+ * @return Matrix Submatrix
+ */
+ public function getMatrix()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ //A($i0...; $j0...)
+ case 'integer,integer':
+ list($i0, $j0) = $args;
+ if ($i0 >= 0) {
+ $m = $this->m - $i0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if ($j0 >= 0) {
+ $n = $this->n - $j0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
+ for ($i = $i0; $i < $this->m; ++$i) {
+ for ($j = $j0; $j < $this->n; ++$j) {
+ $R->set($i, $j, $this->A[$i][$j]);
+ }
+ }
+ return $R;
+ break;
+ //A($i0...$iF; $j0...$jF)
+ case 'integer,integer,integer,integer':
+ list($i0, $iF, $j0, $jF) = $args;
+ if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
+ $m = $iF - $i0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if (($jF > $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
+ $n = $jF - $j0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m+1, $n+1);
+ for ($i = $i0; $i <= $iF; ++$i) {
+ for ($j = $j0; $j <= $jF; ++$j) {
+ $R->set($i - $i0, $j - $j0, $this->A[$i][$j]);
+ }
+ }
+ return $R;
+ break;
+ //$R = array of row indices; $C = array of column indices
+ case 'array,array':
+ list($RL, $CL) = $args;
+ if (count($RL) > 0) {
+ $m = count($RL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if (count($CL) > 0) {
+ $n = count($CL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
+ for ($i = 0; $i < $m; ++$i) {
+ for ($j = 0; $j < $n; ++$j) {
+ $R->set($i - $i0, $j - $j0, $this->A[$RL[$i]][$CL[$j]]);
+ }
+ }
+ return $R;
+ break;
+ //$RL = array of row indices; $CL = array of column indices
+ case 'array,array':
+ list($RL, $CL) = $args;
+ if (count($RL) > 0) {
+ $m = count($RL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if (count($CL) > 0) {
+ $n = count($CL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
+ for ($i = 0; $i < $m; ++$i) {
+ for ($j = 0; $j < $n; ++$j) {
+ $R->set($i, $j, $this->A[$RL[$i]][$CL[$j]]);
+ }
+ }
+ return $R;
+ break;
+ //A($i0...$iF); $CL = array of column indices
+ case 'integer,integer,array':
+ list($i0, $iF, $CL) = $args;
+ if (($iF > $i0) && ($this->m >= $iF) && ($i0 >= 0)) {
+ $m = $iF - $i0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if (count($CL) > 0) {
+ $n = count($CL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
+ for ($i = $i0; $i < $iF; ++$i) {
+ for ($j = 0; $j < $n; ++$j) {
+ $R->set($i - $i0, $j, $this->A[$RL[$i]][$j]);
+ }
+ }
+ return $R;
+ break;
+ //$RL = array of row indices
+ case 'array,integer,integer':
+ list($RL, $j0, $jF) = $args;
+ if (count($RL) > 0) {
+ $m = count($RL);
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ if (($jF >= $j0) && ($this->n >= $jF) && ($j0 >= 0)) {
+ $n = $jF - $j0;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_BOUNDS_EXCEPTION);
+ }
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n+1);
+ for ($i = 0; $i < $m; ++$i) {
+ for ($j = $j0; $j <= $jF; ++$j) {
+ $R->set($i, $j - $j0, $this->A[$RL[$i]][$j]);
+ }
+ }
+ return $R;
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * checkMatrixDimensions
+ *
+ * Is matrix B the same size?
+ * @param Matrix $B Matrix B
+ * @return boolean
+ */
+ public function checkMatrixDimensions($B = null)
+ {
+ if ($B instanceof PHPExcel_Shared_JAMA_Matrix) {
+ if (($this->m == $B->getRowDimension()) && ($this->n == $B->getColumnDimension())) {
+ return true;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::MATRIX_DIMENSION_EXCEPTION);
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ } // function checkMatrixDimensions()
+
+ /**
+ * set
+ *
+ * Set the i,j-th element of the matrix.
+ * @param int $i Row position
+ * @param int $j Column position
+ * @param mixed $c Int/float/double value
+ * @return mixed Element (int/float/double)
+ */
+ public function set($i = null, $j = null, $c = null)
+ {
+ // Optimized set version just has this
+ $this->A[$i][$j] = $c;
+ } // function set()
+
+ /**
+ * identity
+ *
+ * Generate an identity matrix.
+ * @param int $m Row dimension
+ * @param int $n Column dimension
+ * @return Matrix Identity matrix
+ */
+ public function identity($m = null, $n = null)
+ {
+ return $this->diagonal($m, $n, 1);
+ }
+
+ /**
+ * diagonal
+ *
+ * Generate a diagonal matrix
+ * @param int $m Row dimension
+ * @param int $n Column dimension
+ * @param mixed $c Diagonal value
+ * @return Matrix Diagonal matrix
+ */
+ public function diagonal($m = null, $n = null, $c = 1)
+ {
+ $R = new PHPExcel_Shared_JAMA_Matrix($m, $n);
+ for ($i = 0; $i < $m; ++$i) {
+ $R->set($i, $i, $c);
+ }
+ return $R;
+ }
+
+ /**
+ * getMatrixByRow
+ *
+ * Get a submatrix by row index/range
+ * @param int $i0 Initial row index
+ * @param int $iF Final row index
+ * @return Matrix Submatrix
+ */
+ public function getMatrixByRow($i0 = null, $iF = null)
+ {
+ if (is_int($i0)) {
+ if (is_int($iF)) {
+ return $this->getMatrix($i0, 0, $iF + 1, $this->n);
+ } else {
+ return $this->getMatrix($i0, 0, $i0 + 1, $this->n);
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ }
+
+ /**
+ * getMatrixByCol
+ *
+ * Get a submatrix by column index/range
+ * @param int $i0 Initial column index
+ * @param int $iF Final column index
+ * @return Matrix Submatrix
+ */
+ public function getMatrixByCol($j0 = null, $jF = null)
+ {
+ if (is_int($j0)) {
+ if (is_int($jF)) {
+ return $this->getMatrix(0, $j0, $this->m, $jF + 1);
+ } else {
+ return $this->getMatrix(0, $j0, $this->m, $j0 + 1);
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ }
+
+ /**
+ * transpose
+ *
+ * Tranpose matrix
+ * @return Matrix Transposed matrix
+ */
+ public function transpose()
+ {
+ $R = new PHPExcel_Shared_JAMA_Matrix($this->n, $this->m);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $R->set($j, $i, $this->A[$i][$j]);
+ }
+ }
+ return $R;
+ } // function transpose()
+
+ /**
+ * trace
+ *
+ * Sum of diagonal elements
+ * @return float Sum of diagonal elements
+ */
+ public function trace()
+ {
+ $s = 0;
+ $n = min($this->m, $this->n);
+ for ($i = 0; $i < $n; ++$i) {
+ $s += $this->A[$i][$i];
+ }
+ return $s;
+ }
+
+ /**
+ * uminus
+ *
+ * Unary minus matrix -A
+ * @return Matrix Unary minus matrix
+ */
+ public function uminus()
+ {
+ }
+
+ /**
+ * plus
+ *
+ * A + B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function plus()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $M->set($i, $j, $M->get($i, $j) + $this->A[$i][$j]);
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * plusEquals
+ *
+ * A = A + B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function plusEquals()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $validValues = true;
+ $value = $M->get($i, $j);
+ if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
+ }
+ if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
+ $value = trim($value, '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
+ }
+ if ($validValues) {
+ $this->A[$i][$j] += $value;
+ } else {
+ $this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
+ }
+ }
+ }
+ return $this;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * minus
+ *
+ * A - B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function minus()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $M->set($i, $j, $M->get($i, $j) - $this->A[$i][$j]);
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * minusEquals
+ *
+ * A = A - B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function minusEquals()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $validValues = true;
+ $value = $M->get($i, $j);
+ if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
+ }
+ if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
+ $value = trim($value, '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
+ }
+ if ($validValues) {
+ $this->A[$i][$j] -= $value;
+ } else {
+ $this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
+ }
+ }
+ }
+ return $this;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * arrayTimes
+ *
+ * Element-by-element multiplication
+ * Cij = Aij * Bij
+ * @param mixed $B Matrix/Array
+ * @return Matrix Matrix Cij
+ */
+ public function arrayTimes()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $M->set($i, $j, $M->get($i, $j) * $this->A[$i][$j]);
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * arrayTimesEquals
+ *
+ * Element-by-element multiplication
+ * Aij = Aij * Bij
+ * @param mixed $B Matrix/Array
+ * @return Matrix Matrix Aij
+ */
+ public function arrayTimesEquals()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $validValues = true;
+ $value = $M->get($i, $j);
+ if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
+ }
+ if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
+ $value = trim($value, '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
+ }
+ if ($validValues) {
+ $this->A[$i][$j] *= $value;
+ } else {
+ $this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
+ }
+ }
+ }
+ return $this;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * arrayRightDivide
+ *
+ * Element-by-element right division
+ * A / B
+ * @param Matrix $B Matrix B
+ * @return Matrix Division result
+ */
+ public function arrayRightDivide()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $validValues = true;
+ $value = $M->get($i, $j);
+ if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
+ }
+ if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
+ $value = trim($value, '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
+ }
+ if ($validValues) {
+ if ($value == 0) {
+ // Trap for Divide by Zero error
+ $M->set($i, $j, '#DIV/0!');
+ } else {
+ $M->set($i, $j, $this->A[$i][$j] / $value);
+ }
+ } else {
+ $M->set($i, $j, PHPExcel_Calculation_Functions::NaN());
+ }
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+
+ /**
+ * arrayRightDivideEquals
+ *
+ * Element-by-element right division
+ * Aij = Aij / Bij
+ * @param mixed $B Matrix/Array
+ * @return Matrix Matrix Aij
+ */
+ public function arrayRightDivideEquals()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $this->A[$i][$j] = $this->A[$i][$j] / $M->get($i, $j);
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+
+ /**
+ * arrayLeftDivide
+ *
+ * Element-by-element Left division
+ * A / B
+ * @param Matrix $B Matrix B
+ * @return Matrix Division result
+ */
+ public function arrayLeftDivide()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $M->set($i, $j, $M->get($i, $j) / $this->A[$i][$j]);
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+
+ /**
+ * arrayLeftDivideEquals
+ *
+ * Element-by-element Left division
+ * Aij = Aij / Bij
+ * @param mixed $B Matrix/Array
+ * @return Matrix Matrix Aij
+ */
+ public function arrayLeftDivideEquals()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $this->A[$i][$j] = $M->get($i, $j) / $this->A[$i][$j];
+ }
+ }
+ return $M;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+
+ /**
+ * times
+ *
+ * Matrix multiplication
+ * @param mixed $n Matrix/Array/Scalar
+ * @return Matrix Product
+ */
+ public function times()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $B = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ if ($this->n == $B->m) {
+ $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
+ for ($j = 0; $j < $B->n; ++$j) {
+ for ($k = 0; $k < $this->n; ++$k) {
+ $Bcolj[$k] = $B->A[$k][$j];
+ }
+ for ($i = 0; $i < $this->m; ++$i) {
+ $Arowi = $this->A[$i];
+ $s = 0;
+ for ($k = 0; $k < $this->n; ++$k) {
+ $s += $Arowi[$k] * $Bcolj[$k];
+ }
+ $C->A[$i][$j] = $s;
+ }
+ }
+ return $C;
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch));
+ }
+ break;
+ case 'array':
+ $B = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ if ($this->n == $B->m) {
+ $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $B->n);
+ for ($i = 0; $i < $C->m; ++$i) {
+ for ($j = 0; $j < $C->n; ++$j) {
+ $s = "0";
+ for ($k = 0; $k < $C->n; ++$k) {
+ $s += $this->A[$i][$k] * $B->A[$k][$j];
+ }
+ $C->A[$i][$j] = $s;
+ }
+ }
+ return $C;
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(MatrixDimensionMismatch));
+ }
+ return $M;
+ break;
+ case 'integer':
+ $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
+ for ($i = 0; $i < $C->m; ++$i) {
+ for ($j = 0; $j < $C->n; ++$j) {
+ $C->A[$i][$j] *= $args[0];
+ }
+ }
+ return $C;
+ break;
+ case 'double':
+ $C = new PHPExcel_Shared_JAMA_Matrix($this->m, $this->n);
+ for ($i = 0; $i < $C->m; ++$i) {
+ for ($j = 0; $j < $C->n; ++$j) {
+ $C->A[$i][$j] = $args[0] * $this->A[$i][$j];
+ }
+ }
+ return $C;
+ break;
+ case 'float':
+ $C = new PHPExcel_Shared_JAMA_Matrix($this->A);
+ for ($i = 0; $i < $C->m; ++$i) {
+ for ($j = 0; $j < $C->n; ++$j) {
+ $C->A[$i][$j] *= $args[0];
+ }
+ }
+ return $C;
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * power
+ *
+ * A = A ^ B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function power()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ break;
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $validValues = true;
+ $value = $M->get($i, $j);
+ if ((is_string($this->A[$i][$j])) && (strlen($this->A[$i][$j]) > 0) && (!is_numeric($this->A[$i][$j]))) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
+ }
+ if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
+ $value = trim($value, '"');
+ $validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
+ }
+ if ($validValues) {
+ $this->A[$i][$j] = pow($this->A[$i][$j], $value);
+ } else {
+ $this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
+ }
+ }
+ }
+ return $this;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * concat
+ *
+ * A = A & B
+ * @param mixed $B Matrix/Array
+ * @return Matrix Sum
+ */
+ public function concat()
+ {
+ if (func_num_args() > 0) {
+ $args = func_get_args();
+ $match = implode(",", array_map('gettype', $args));
+
+ switch ($match) {
+ case 'object':
+ if ($args[0] instanceof PHPExcel_Shared_JAMA_Matrix) {
+ $M = $args[0];
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::ARGUMENT_TYPE_EXCEPTION);
+ }
+ case 'array':
+ $M = new PHPExcel_Shared_JAMA_Matrix($args[0]);
+ break;
+ default:
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ break;
+ }
+ $this->checkMatrixDimensions($M);
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $this->A[$i][$j] = trim($this->A[$i][$j], '"').trim($M->get($i, $j), '"');
+ }
+ }
+ return $this;
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::POLYMORPHIC_ARGUMENT_EXCEPTION);
+ }
+ }
+
+ /**
+ * Solve A*X = B.
+ *
+ * @param Matrix $B Right hand side
+ * @return Matrix ... Solution if A is square, least squares solution otherwise
+ */
+ public function solve($B)
+ {
+ if ($this->m == $this->n) {
+ $LU = new PHPExcel_Shared_JAMA_LUDecomposition($this);
+ return $LU->solve($B);
+ } else {
+ $QR = new PHPExcel_Shared_JAMA_QRDecomposition($this);
+ return $QR->solve($B);
+ }
+ }
+
+ /**
+ * Matrix inverse or pseudoinverse.
+ *
+ * @return Matrix ... Inverse(A) if A is square, pseudoinverse otherwise.
+ */
+ public function inverse()
+ {
+ return $this->solve($this->identity($this->m, $this->m));
+ }
+
+ /**
+ * det
+ *
+ * Calculate determinant
+ * @return float Determinant
+ */
+ public function det()
+ {
+ $L = new PHPExcel_Shared_JAMA_LUDecomposition($this);
+ return $L->det();
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/QRDecomposition.php b/Classes/PHPExcel/Shared/JAMA/QRDecomposition.php
new file mode 100644
index 0000000..1e43c7c
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/QRDecomposition.php
@@ -0,0 +1,235 @@
+= n, the QR decomposition is an m-by-n
+ * orthogonal matrix Q and an n-by-n upper triangular matrix R so that
+ * A = Q*R.
+ *
+ * The QR decompostion always exists, even if the matrix does not have
+ * full rank, so the constructor will never fail. The primary use of the
+ * QR decomposition is in the least squares solution of nonsquare systems
+ * of simultaneous linear equations. This will fail if isFullRank()
+ * returns false.
+ *
+ * @author Paul Meagher
+ * @license PHP v3.0
+ * @version 1.1
+ */
+class PHPExcel_Shared_JAMA_QRDecomposition
+{
+ const MATRIX_RANK_EXCEPTION = "Can only perform operation on full-rank matrix.";
+
+ /**
+ * Array for internal storage of decomposition.
+ * @var array
+ */
+ private $QR = array();
+
+ /**
+ * Row dimension.
+ * @var integer
+ */
+ private $m;
+
+ /**
+ * Column dimension.
+ * @var integer
+ */
+ private $n;
+
+ /**
+ * Array for internal storage of diagonal of R.
+ * @var array
+ */
+ private $Rdiag = array();
+
+
+ /**
+ * QR Decomposition computed by Householder reflections.
+ *
+ * @param matrix $A Rectangular matrix
+ * @return Structure to access R and the Householder vectors and compute Q.
+ */
+ public function __construct($A)
+ {
+ if ($A instanceof PHPExcel_Shared_JAMA_Matrix) {
+ // Initialize.
+ $this->QR = $A->getArrayCopy();
+ $this->m = $A->getRowDimension();
+ $this->n = $A->getColumnDimension();
+ // Main loop.
+ for ($k = 0; $k < $this->n; ++$k) {
+ // Compute 2-norm of k-th column without under/overflow.
+ $nrm = 0.0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $nrm = hypo($nrm, $this->QR[$i][$k]);
+ }
+ if ($nrm != 0.0) {
+ // Form k-th Householder vector.
+ if ($this->QR[$k][$k] < 0) {
+ $nrm = -$nrm;
+ }
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->QR[$i][$k] /= $nrm;
+ }
+ $this->QR[$k][$k] += 1.0;
+ // Apply transformation to remaining columns.
+ for ($j = $k+1; $j < $this->n; ++$j) {
+ $s = 0.0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $s += $this->QR[$i][$k] * $this->QR[$i][$j];
+ }
+ $s = -$s/$this->QR[$k][$k];
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->QR[$i][$j] += $s * $this->QR[$i][$k];
+ }
+ }
+ }
+ $this->Rdiag[$k] = -$nrm;
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::ARGUMENT_TYPE_EXCEPTION);
+ }
+ } // function __construct()
+
+
+ /**
+ * Is the matrix full rank?
+ *
+ * @return boolean true if R, and hence A, has full rank, else false.
+ */
+ public function isFullRank()
+ {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($this->Rdiag[$j] == 0) {
+ return false;
+ }
+ }
+ return true;
+ } // function isFullRank()
+
+ /**
+ * Return the Householder vectors
+ *
+ * @return Matrix Lower trapezoidal matrix whose columns define the reflections
+ */
+ public function getH()
+ {
+ for ($i = 0; $i < $this->m; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($i >= $j) {
+ $H[$i][$j] = $this->QR[$i][$j];
+ } else {
+ $H[$i][$j] = 0.0;
+ }
+ }
+ }
+ return new PHPExcel_Shared_JAMA_Matrix($H);
+ } // function getH()
+
+ /**
+ * Return the upper triangular factor
+ *
+ * @return Matrix upper triangular factor
+ */
+ public function getR()
+ {
+ for ($i = 0; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ if ($i < $j) {
+ $R[$i][$j] = $this->QR[$i][$j];
+ } elseif ($i == $j) {
+ $R[$i][$j] = $this->Rdiag[$i];
+ } else {
+ $R[$i][$j] = 0.0;
+ }
+ }
+ }
+ return new PHPExcel_Shared_JAMA_Matrix($R);
+ } // function getR()
+
+ /**
+ * Generate and return the (economy-sized) orthogonal factor
+ *
+ * @return Matrix orthogonal factor
+ */
+ public function getQ()
+ {
+ for ($k = $this->n-1; $k >= 0; --$k) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $Q[$i][$k] = 0.0;
+ }
+ $Q[$k][$k] = 1.0;
+ for ($j = $k; $j < $this->n; ++$j) {
+ if ($this->QR[$k][$k] != 0) {
+ $s = 0.0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $s += $this->QR[$i][$k] * $Q[$i][$j];
+ }
+ $s = -$s/$this->QR[$k][$k];
+ for ($i = $k; $i < $this->m; ++$i) {
+ $Q[$i][$j] += $s * $this->QR[$i][$k];
+ }
+ }
+ }
+ }
+ /*
+ for($i = 0; $i < count($Q); ++$i) {
+ for($j = 0; $j < count($Q); ++$j) {
+ if (! isset($Q[$i][$j]) ) {
+ $Q[$i][$j] = 0;
+ }
+ }
+ }
+ */
+ return new PHPExcel_Shared_JAMA_Matrix($Q);
+ } // function getQ()
+
+ /**
+ * Least squares solution of A*X = B
+ *
+ * @param Matrix $B A Matrix with as many rows as A and any number of columns.
+ * @return Matrix Matrix that minimizes the two norm of Q*R*X-B.
+ */
+ public function solve($B)
+ {
+ if ($B->getRowDimension() == $this->m) {
+ if ($this->isFullRank()) {
+ // Copy right hand side
+ $nx = $B->getColumnDimension();
+ $X = $B->getArrayCopy();
+ // Compute Y = transpose(Q)*B
+ for ($k = 0; $k < $this->n; ++$k) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $s = 0.0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $s += $this->QR[$i][$k] * $X[$i][$j];
+ }
+ $s = -$s/$this->QR[$k][$k];
+ for ($i = $k; $i < $this->m; ++$i) {
+ $X[$i][$j] += $s * $this->QR[$i][$k];
+ }
+ }
+ }
+ // Solve R*X = Y;
+ for ($k = $this->n-1; $k >= 0; --$k) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$k][$j] /= $this->Rdiag[$k];
+ }
+ for ($i = 0; $i < $k; ++$i) {
+ for ($j = 0; $j < $nx; ++$j) {
+ $X[$i][$j] -= $X[$k][$j]* $this->QR[$i][$k];
+ }
+ }
+ }
+ $X = new PHPExcel_Shared_JAMA_Matrix($X);
+ return ($X->getMatrix(0, $this->n-1, 0, $nx));
+ } else {
+ throw new PHPExcel_Calculation_Exception(self::MATRIX_RANK_EXCEPTION);
+ }
+ } else {
+ throw new PHPExcel_Calculation_Exception(PHPExcel_Shared_JAMA_Matrix::MATRIX_DIMENSION_EXCEPTION);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php b/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php
new file mode 100644
index 0000000..f57d122
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/SingularValueDecomposition.php
@@ -0,0 +1,528 @@
+= n, the singular value decomposition is
+ * an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
+ * an n-by-n orthogonal matrix V so that A = U*S*V'.
+ *
+ * The singular values, sigma[$k] = S[$k][$k], are ordered so that
+ * sigma[0] >= sigma[1] >= ... >= sigma[n-1].
+ *
+ * The singular value decompostion always exists, so the constructor will
+ * never fail. The matrix condition number and the effective numerical
+ * rank can be computed from this decomposition.
+ *
+ * @author Paul Meagher
+ * @license PHP v3.0
+ * @version 1.1
+ */
+class SingularValueDecomposition
+{
+ /**
+ * Internal storage of U.
+ * @var array
+ */
+ private $U = array();
+
+ /**
+ * Internal storage of V.
+ * @var array
+ */
+ private $V = array();
+
+ /**
+ * Internal storage of singular values.
+ * @var array
+ */
+ private $s = array();
+
+ /**
+ * Row dimension.
+ * @var int
+ */
+ private $m;
+
+ /**
+ * Column dimension.
+ * @var int
+ */
+ private $n;
+
+ /**
+ * Construct the singular value decomposition
+ *
+ * Derived from LINPACK code.
+ *
+ * @param $A Rectangular matrix
+ * @return Structure to access U, S and V.
+ */
+ public function __construct($Arg)
+ {
+ // Initialize.
+ $A = $Arg->getArrayCopy();
+ $this->m = $Arg->getRowDimension();
+ $this->n = $Arg->getColumnDimension();
+ $nu = min($this->m, $this->n);
+ $e = array();
+ $work = array();
+ $wantu = true;
+ $wantv = true;
+ $nct = min($this->m - 1, $this->n);
+ $nrt = max(0, min($this->n - 2, $this->m));
+
+ // Reduce A to bidiagonal form, storing the diagonal elements
+ // in s and the super-diagonal elements in e.
+ for ($k = 0; $k < max($nct, $nrt); ++$k) {
+ if ($k < $nct) {
+ // Compute the transformation for the k-th column and
+ // place the k-th diagonal in s[$k].
+ // Compute 2-norm of k-th column without under/overflow.
+ $this->s[$k] = 0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->s[$k] = hypo($this->s[$k], $A[$i][$k]);
+ }
+ if ($this->s[$k] != 0.0) {
+ if ($A[$k][$k] < 0.0) {
+ $this->s[$k] = -$this->s[$k];
+ }
+ for ($i = $k; $i < $this->m; ++$i) {
+ $A[$i][$k] /= $this->s[$k];
+ }
+ $A[$k][$k] += 1.0;
+ }
+ $this->s[$k] = -$this->s[$k];
+ }
+
+ for ($j = $k + 1; $j < $this->n; ++$j) {
+ if (($k < $nct) & ($this->s[$k] != 0.0)) {
+ // Apply the transformation.
+ $t = 0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $t += $A[$i][$k] * $A[$i][$j];
+ }
+ $t = -$t / $A[$k][$k];
+ for ($i = $k; $i < $this->m; ++$i) {
+ $A[$i][$j] += $t * $A[$i][$k];
+ }
+ // Place the k-th row of A into e for the
+ // subsequent calculation of the row transformation.
+ $e[$j] = $A[$k][$j];
+ }
+ }
+
+ if ($wantu and ($k < $nct)) {
+ // Place the transformation in U for subsequent back
+ // multiplication.
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->U[$i][$k] = $A[$i][$k];
+ }
+ }
+
+ if ($k < $nrt) {
+ // Compute the k-th row transformation and place the
+ // k-th super-diagonal in e[$k].
+ // Compute 2-norm without under/overflow.
+ $e[$k] = 0;
+ for ($i = $k + 1; $i < $this->n; ++$i) {
+ $e[$k] = hypo($e[$k], $e[$i]);
+ }
+ if ($e[$k] != 0.0) {
+ if ($e[$k+1] < 0.0) {
+ $e[$k] = -$e[$k];
+ }
+ for ($i = $k + 1; $i < $this->n; ++$i) {
+ $e[$i] /= $e[$k];
+ }
+ $e[$k+1] += 1.0;
+ }
+ $e[$k] = -$e[$k];
+ if (($k+1 < $this->m) and ($e[$k] != 0.0)) {
+ // Apply the transformation.
+ for ($i = $k+1; $i < $this->m; ++$i) {
+ $work[$i] = 0.0;
+ }
+ for ($j = $k+1; $j < $this->n; ++$j) {
+ for ($i = $k+1; $i < $this->m; ++$i) {
+ $work[$i] += $e[$j] * $A[$i][$j];
+ }
+ }
+ for ($j = $k + 1; $j < $this->n; ++$j) {
+ $t = -$e[$j] / $e[$k+1];
+ for ($i = $k + 1; $i < $this->m; ++$i) {
+ $A[$i][$j] += $t * $work[$i];
+ }
+ }
+ }
+ if ($wantv) {
+ // Place the transformation in V for subsequent
+ // back multiplication.
+ for ($i = $k + 1; $i < $this->n; ++$i) {
+ $this->V[$i][$k] = $e[$i];
+ }
+ }
+ }
+ }
+
+ // Set up the final bidiagonal matrix or order p.
+ $p = min($this->n, $this->m + 1);
+ if ($nct < $this->n) {
+ $this->s[$nct] = $A[$nct][$nct];
+ }
+ if ($this->m < $p) {
+ $this->s[$p-1] = 0.0;
+ }
+ if ($nrt + 1 < $p) {
+ $e[$nrt] = $A[$nrt][$p-1];
+ }
+ $e[$p-1] = 0.0;
+ // If required, generate U.
+ if ($wantu) {
+ for ($j = $nct; $j < $nu; ++$j) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $this->U[$i][$j] = 0.0;
+ }
+ $this->U[$j][$j] = 1.0;
+ }
+ for ($k = $nct - 1; $k >= 0; --$k) {
+ if ($this->s[$k] != 0.0) {
+ for ($j = $k + 1; $j < $nu; ++$j) {
+ $t = 0;
+ for ($i = $k; $i < $this->m; ++$i) {
+ $t += $this->U[$i][$k] * $this->U[$i][$j];
+ }
+ $t = -$t / $this->U[$k][$k];
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->U[$i][$j] += $t * $this->U[$i][$k];
+ }
+ }
+ for ($i = $k; $i < $this->m; ++$i) {
+ $this->U[$i][$k] = -$this->U[$i][$k];
+ }
+ $this->U[$k][$k] = 1.0 + $this->U[$k][$k];
+ for ($i = 0; $i < $k - 1; ++$i) {
+ $this->U[$i][$k] = 0.0;
+ }
+ } else {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $this->U[$i][$k] = 0.0;
+ }
+ $this->U[$k][$k] = 1.0;
+ }
+ }
+ }
+
+ // If required, generate V.
+ if ($wantv) {
+ for ($k = $this->n - 1; $k >= 0; --$k) {
+ if (($k < $nrt) and ($e[$k] != 0.0)) {
+ for ($j = $k + 1; $j < $nu; ++$j) {
+ $t = 0;
+ for ($i = $k + 1; $i < $this->n; ++$i) {
+ $t += $this->V[$i][$k]* $this->V[$i][$j];
+ }
+ $t = -$t / $this->V[$k+1][$k];
+ for ($i = $k + 1; $i < $this->n; ++$i) {
+ $this->V[$i][$j] += $t * $this->V[$i][$k];
+ }
+ }
+ }
+ for ($i = 0; $i < $this->n; ++$i) {
+ $this->V[$i][$k] = 0.0;
+ }
+ $this->V[$k][$k] = 1.0;
+ }
+ }
+
+ // Main iteration loop for the singular values.
+ $pp = $p - 1;
+ $iter = 0;
+ $eps = pow(2.0, -52.0);
+
+ while ($p > 0) {
+ // Here is where a test for too many iterations would go.
+ // This section of the program inspects for negligible
+ // elements in the s and e arrays. On completion the
+ // variables kase and k are set as follows:
+ // kase = 1 if s(p) and e[k-1] are negligible and k= -1; --$k) {
+ if ($k == -1) {
+ break;
+ }
+ if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) {
+ $e[$k] = 0.0;
+ break;
+ }
+ }
+ if ($k == $p - 2) {
+ $kase = 4;
+ } else {
+ for ($ks = $p - 1; $ks >= $k; --$ks) {
+ if ($ks == $k) {
+ break;
+ }
+ $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
+ if (abs($this->s[$ks]) <= $eps * $t) {
+ $this->s[$ks] = 0.0;
+ break;
+ }
+ }
+ if ($ks == $k) {
+ $kase = 3;
+ } elseif ($ks == $p-1) {
+ $kase = 1;
+ } else {
+ $kase = 2;
+ $k = $ks;
+ }
+ }
+ ++$k;
+
+ // Perform the task indicated by kase.
+ switch ($kase) {
+ // Deflate negligible s(p).
+ case 1:
+ $f = $e[$p-2];
+ $e[$p-2] = 0.0;
+ for ($j = $p - 2; $j >= $k; --$j) {
+ $t = hypo($this->s[$j], $f);
+ $cs = $this->s[$j] / $t;
+ $sn = $f / $t;
+ $this->s[$j] = $t;
+ if ($j != $k) {
+ $f = -$sn * $e[$j-1];
+ $e[$j-1] = $cs * $e[$j-1];
+ }
+ if ($wantv) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
+ $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
+ $this->V[$i][$j] = $t;
+ }
+ }
+ }
+ break;
+ // Split at negligible s(k).
+ case 2:
+ $f = $e[$k-1];
+ $e[$k-1] = 0.0;
+ for ($j = $k; $j < $p; ++$j) {
+ $t = hypo($this->s[$j], $f);
+ $cs = $this->s[$j] / $t;
+ $sn = $f / $t;
+ $this->s[$j] = $t;
+ $f = -$sn * $e[$j];
+ $e[$j] = $cs * $e[$j];
+ if ($wantu) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
+ $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
+ $this->U[$i][$j] = $t;
+ }
+ }
+ }
+ break;
+ // Perform one qr step.
+ case 3:
+ // Calculate the shift.
+ $scale = max(max(max(max(abs($this->s[$p-1]), abs($this->s[$p-2])), abs($e[$p-2])), abs($this->s[$k])), abs($e[$k]));
+ $sp = $this->s[$p-1] / $scale;
+ $spm1 = $this->s[$p-2] / $scale;
+ $epm1 = $e[$p-2] / $scale;
+ $sk = $this->s[$k] / $scale;
+ $ek = $e[$k] / $scale;
+ $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
+ $c = ($sp * $epm1) * ($sp * $epm1);
+ $shift = 0.0;
+ if (($b != 0.0) || ($c != 0.0)) {
+ $shift = sqrt($b * $b + $c);
+ if ($b < 0.0) {
+ $shift = -$shift;
+ }
+ $shift = $c / ($b + $shift);
+ }
+ $f = ($sk + $sp) * ($sk - $sp) + $shift;
+ $g = $sk * $ek;
+ // Chase zeros.
+ for ($j = $k; $j < $p-1; ++$j) {
+ $t = hypo($f, $g);
+ $cs = $f/$t;
+ $sn = $g/$t;
+ if ($j != $k) {
+ $e[$j-1] = $t;
+ }
+ $f = $cs * $this->s[$j] + $sn * $e[$j];
+ $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
+ $g = $sn * $this->s[$j+1];
+ $this->s[$j+1] = $cs * $this->s[$j+1];
+ if ($wantv) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
+ $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
+ $this->V[$i][$j] = $t;
+ }
+ }
+ $t = hypo($f, $g);
+ $cs = $f/$t;
+ $sn = $g/$t;
+ $this->s[$j] = $t;
+ $f = $cs * $e[$j] + $sn * $this->s[$j+1];
+ $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
+ $g = $sn * $e[$j+1];
+ $e[$j+1] = $cs * $e[$j+1];
+ if ($wantu && ($j < $this->m - 1)) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
+ $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
+ $this->U[$i][$j] = $t;
+ }
+ }
+ }
+ $e[$p-2] = $f;
+ $iter = $iter + 1;
+ break;
+ // Convergence.
+ case 4:
+ // Make the singular values positive.
+ if ($this->s[$k] <= 0.0) {
+ $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0);
+ if ($wantv) {
+ for ($i = 0; $i <= $pp; ++$i) {
+ $this->V[$i][$k] = -$this->V[$i][$k];
+ }
+ }
+ }
+ // Order the singular values.
+ while ($k < $pp) {
+ if ($this->s[$k] >= $this->s[$k+1]) {
+ break;
+ }
+ $t = $this->s[$k];
+ $this->s[$k] = $this->s[$k+1];
+ $this->s[$k+1] = $t;
+ if ($wantv and ($k < $this->n - 1)) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $this->V[$i][$k+1];
+ $this->V[$i][$k+1] = $this->V[$i][$k];
+ $this->V[$i][$k] = $t;
+ }
+ }
+ if ($wantu and ($k < $this->m-1)) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $this->U[$i][$k+1];
+ $this->U[$i][$k+1] = $this->U[$i][$k];
+ $this->U[$i][$k] = $t;
+ }
+ }
+ ++$k;
+ }
+ $iter = 0;
+ --$p;
+ break;
+ } // end switch
+ } // end while
+
+ } // end constructor
+
+
+ /**
+ * Return the left singular vectors
+ *
+ * @access public
+ * @return U
+ */
+ public function getU()
+ {
+ return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
+ }
+
+
+ /**
+ * Return the right singular vectors
+ *
+ * @access public
+ * @return V
+ */
+ public function getV()
+ {
+ return new Matrix($this->V);
+ }
+
+
+ /**
+ * Return the one-dimensional array of singular values
+ *
+ * @access public
+ * @return diagonal of S.
+ */
+ public function getSingularValues()
+ {
+ return $this->s;
+ }
+
+
+ /**
+ * Return the diagonal matrix of singular values
+ *
+ * @access public
+ * @return S
+ */
+ public function getS()
+ {
+ for ($i = 0; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $S[$i][$j] = 0.0;
+ }
+ $S[$i][$i] = $this->s[$i];
+ }
+ return new Matrix($S);
+ }
+
+
+ /**
+ * Two norm
+ *
+ * @access public
+ * @return max(S)
+ */
+ public function norm2()
+ {
+ return $this->s[0];
+ }
+
+
+ /**
+ * Two norm condition number
+ *
+ * @access public
+ * @return max(S)/min(S)
+ */
+ public function cond()
+ {
+ return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
+ }
+
+
+ /**
+ * Effective numerical matrix rank
+ *
+ * @access public
+ * @return Number of nonnegligible singular values.
+ */
+ public function rank()
+ {
+ $eps = pow(2.0, -52.0);
+ $tol = max($this->m, $this->n) * $this->s[0] * $eps;
+ $r = 0;
+ for ($i = 0; $i < count($this->s); ++$i) {
+ if ($this->s[$i] > $tol) {
+ ++$r;
+ }
+ }
+ return $r;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/JAMA/utils/Error.php b/Classes/PHPExcel/Shared/JAMA/utils/Error.php
new file mode 100644
index 0000000..71b8c99
--- /dev/null
+++ b/Classes/PHPExcel/Shared/JAMA/utils/Error.php
@@ -0,0 +1,83 @@
+ abs($b)) {
+ $r = $b / $a;
+ $r = abs($a) * sqrt(1 + $r * $r);
+ } elseif ($b != 0) {
+ $r = $a / $b;
+ $r = abs($b) * sqrt(1 + $r * $r);
+ } else {
+ $r = 0.0;
+ }
+ return $r;
+} // function hypo()
+
+
+/**
+ * Mike Bommarito's version.
+ * Compute n-dimensional hyotheneuse.
+ *
+function hypot() {
+ $s = 0;
+ foreach (func_get_args() as $d) {
+ if (is_numeric($d)) {
+ $s += pow($d, 2);
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(ARGUMENT_TYPE_EXCEPTION));
+ }
+ }
+ return sqrt($s);
+}
+*/
diff --git a/Classes/PHPExcel/Shared/OLE.php b/Classes/PHPExcel/Shared/OLE.php
new file mode 100644
index 0000000..1d3532a
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE.php
@@ -0,0 +1,526 @@
+ |
+// | Based on OLE::Storage_Lite by Kawai, Takanori |
+// +----------------------------------------------------------------------+
+//
+// $Id: OLE.php,v 1.13 2007/03/07 14:38:25 schmidt Exp $
+
+
+/**
+* Array for storing OLE instances that are accessed from
+* OLE_ChainedBlockStream::stream_open().
+* @var array
+*/
+$GLOBALS['_OLE_INSTANCES'] = array();
+
+/**
+* OLE package base class.
+*
+* @author Xavier Noguer
+* @author Christian Schmidt
+* @category PHPExcel
+* @package PHPExcel_Shared_OLE
+*/
+class PHPExcel_Shared_OLE
+{
+ const OLE_PPS_TYPE_ROOT = 5;
+ const OLE_PPS_TYPE_DIR = 1;
+ const OLE_PPS_TYPE_FILE = 2;
+ const OLE_DATA_SIZE_SMALL = 0x1000;
+ const OLE_LONG_INT_SIZE = 4;
+ const OLE_PPS_SIZE = 0x80;
+
+ /**
+ * The file handle for reading an OLE container
+ * @var resource
+ */
+ public $_file_handle;
+
+ /**
+ * Array of PPS's found on the OLE container
+ * @var array
+ */
+ public $_list = array();
+
+ /**
+ * Root directory of OLE container
+ * @var OLE_PPS_Root
+ */
+ public $root;
+
+ /**
+ * Big Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $bbat;
+
+ /**
+ * Short Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $sbat;
+
+ /**
+ * Size of big blocks. This is usually 512.
+ * @var int number of octets per block.
+ */
+ public $bigBlockSize;
+
+ /**
+ * Size of small blocks. This is usually 64.
+ * @var int number of octets per block
+ */
+ public $smallBlockSize;
+
+ /**
+ * Reads an OLE container from the contents of the file given.
+ *
+ * @acces public
+ * @param string $file
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function read($file)
+ {
+ $fh = fopen($file, "r");
+ if (!$fh) {
+ throw new PHPExcel_Reader_Exception("Can't open file $file");
+ }
+ $this->_file_handle = $fh;
+
+ $signature = fread($fh, 8);
+ if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
+ throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
+ }
+ fseek($fh, 28);
+ if (fread($fh, 2) != "\xFE\xFF") {
+ // This shouldn't be a problem in practice
+ throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
+ }
+ // Size of blocks and short blocks in bytes
+ $this->bigBlockSize = pow(2, self::_readInt2($fh));
+ $this->smallBlockSize = pow(2, self::_readInt2($fh));
+
+ // Skip UID, revision number and version number
+ fseek($fh, 44);
+ // Number of blocks in Big Block Allocation Table
+ $bbatBlockCount = self::_readInt4($fh);
+
+ // Root chain 1st block
+ $directoryFirstBlockId = self::_readInt4($fh);
+
+ // Skip unused bytes
+ fseek($fh, 56);
+ // Streams shorter than this are stored using small blocks
+ $this->bigBlockThreshold = self::_readInt4($fh);
+ // Block id of first sector in Short Block Allocation Table
+ $sbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Short Block Allocation Table
+ $sbbatBlockCount = self::_readInt4($fh);
+ // Block id of first sector in Master Block Allocation Table
+ $mbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Master Block Allocation Table
+ $mbbatBlockCount = self::_readInt4($fh);
+ $this->bbat = array();
+
+ // Remaining 4 * 109 bytes of current block is beginning of Master
+ // Block Allocation Table
+ $mbatBlocks = array();
+ for ($i = 0; $i < 109; ++$i) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
+
+ // Read rest of Master Block Allocation Table (if any is left)
+ $pos = $this->_getBlockOffset($mbatFirstBlockId);
+ for ($i = 0; $i < $mbbatBlockCount; ++$i) {
+ fseek($fh, $pos);
+ for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
+ // Last block id in each block points to next block
+ $pos = $this->_getBlockOffset(self::_readInt4($fh));
+ }
+
+ // Read Big Block Allocation Table according to chain specified by
+ // $mbatBlocks
+ for ($i = 0; $i < $bbatBlockCount; ++$i) {
+ $pos = $this->_getBlockOffset($mbatBlocks[$i]);
+ fseek($fh, $pos);
+ for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
+ $this->bbat[] = self::_readInt4($fh);
+ }
+ }
+
+ // Read short block allocation table (SBAT)
+ $this->sbat = array();
+ $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
+ $sbatFh = $this->getStream($sbatFirstBlockId);
+ for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
+ $this->sbat[$blockId] = self::_readInt4($sbatFh);
+ }
+ fclose($sbatFh);
+
+ $this->_readPpsWks($directoryFirstBlockId);
+
+ return true;
+ }
+
+ /**
+ * @param int block id
+ * @param int byte offset from beginning of file
+ * @access public
+ */
+ public function _getBlockOffset($blockId)
+ {
+ return 512 + $blockId * $this->bigBlockSize;
+ }
+
+ /**
+ * Returns a stream for use with fread() etc. External callers should
+ * use PHPExcel_Shared_OLE_PPS_File::getStream().
+ * @param int|PPS block id or PPS
+ * @return resource read-only stream
+ */
+ public function getStream($blockIdOrPps)
+ {
+ static $isRegistered = false;
+ if (!$isRegistered) {
+ stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
+ $isRegistered = true;
+ }
+
+ // Store current instance in global array, so that it can be accessed
+ // in OLE_ChainedBlockStream::stream_open().
+ // Object is removed from self::$instances in OLE_Stream::close().
+ $GLOBALS['_OLE_INSTANCES'][] = $this;
+ $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
+
+ $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
+ if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
+ $path .= '&blockId=' . $blockIdOrPps->_StartBlock;
+ $path .= '&size=' . $blockIdOrPps->Size;
+ } else {
+ $path .= '&blockId=' . $blockIdOrPps;
+ }
+ return fopen($path, 'r');
+ }
+
+ /**
+ * Reads a signed char.
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt1($fh)
+ {
+ list(, $tmp) = unpack("c", fread($fh, 1));
+ return $tmp;
+ }
+
+ /**
+ * Reads an unsigned short (2 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt2($fh)
+ {
+ list(, $tmp) = unpack("v", fread($fh, 2));
+ return $tmp;
+ }
+
+ /**
+ * Reads an unsigned long (4 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt4($fh)
+ {
+ list(, $tmp) = unpack("V", fread($fh, 4));
+ return $tmp;
+ }
+
+ /**
+ * Gets information about all PPS's on the OLE container from the PPS WK's
+ * creates an OLE_PPS object for each one.
+ *
+ * @access public
+ * @param integer the block id of the first block
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function _readPpsWks($blockId)
+ {
+ $fh = $this->getStream($blockId);
+ for ($pos = 0;; $pos += 128) {
+ fseek($fh, $pos, SEEK_SET);
+ $nameUtf16 = fread($fh, 64);
+ $nameLength = self::_readInt2($fh);
+ $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
+ // Simple conversion from UTF-16LE to ISO-8859-1
+ $name = str_replace("\x00", "", $nameUtf16);
+ $type = self::_readInt1($fh);
+ switch ($type) {
+ case self::OLE_PPS_TYPE_ROOT:
+ $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
+ $this->root = $pps;
+ break;
+ case self::OLE_PPS_TYPE_DIR:
+ $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
+ break;
+ case self::OLE_PPS_TYPE_FILE:
+ $pps = new PHPExcel_Shared_OLE_PPS_File($name);
+ break;
+ default:
+ continue 2;
+ }
+ fseek($fh, 1, SEEK_CUR);
+ $pps->Type = $type;
+ $pps->Name = $name;
+ $pps->PrevPps = self::_readInt4($fh);
+ $pps->NextPps = self::_readInt4($fh);
+ $pps->DirPps = self::_readInt4($fh);
+ fseek($fh, 20, SEEK_CUR);
+ $pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
+ $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
+ $pps->_StartBlock = self::_readInt4($fh);
+ $pps->Size = self::_readInt4($fh);
+ $pps->No = count($this->_list);
+ $this->_list[] = $pps;
+
+ // check if the PPS tree (starting from root) is complete
+ if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
+ break;
+ }
+ }
+ fclose($fh);
+
+ // Initialize $pps->children on directories
+ foreach ($this->_list as $pps) {
+ if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
+ $nos = array($pps->DirPps);
+ $pps->children = array();
+ while ($nos) {
+ $no = array_pop($nos);
+ if ($no != -1) {
+ $childPps = $this->_list[$no];
+ $nos[] = $childPps->PrevPps;
+ $nos[] = $childPps->NextPps;
+ $pps->children[] = $childPps;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * It checks whether the PPS tree is complete (all PPS's read)
+ * starting with the given PPS (not necessarily root)
+ *
+ * @access public
+ * @param integer $index The index of the PPS from which we are checking
+ * @return boolean Whether the PPS tree for the given PPS is complete
+ */
+ public function _ppsTreeComplete($index)
+ {
+ return isset($this->_list[$index]) &&
+ ($pps = $this->_list[$index]) &&
+ ($pps->PrevPps == -1 ||
+ $this->_ppsTreeComplete($pps->PrevPps)) &&
+ ($pps->NextPps == -1 ||
+ $this->_ppsTreeComplete($pps->NextPps)) &&
+ ($pps->DirPps == -1 ||
+ $this->_ppsTreeComplete($pps->DirPps));
+ }
+
+ /**
+ * Checks whether a PPS is a File PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return bool true if it's a File PPS, false otherwise
+ */
+ public function isFile($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether a PPS is a Root PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS.
+ * @return bool true if it's a Root PPS, false otherwise
+ */
+ public function isRoot($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
+ }
+ return false;
+ }
+
+ /**
+ * Gives the total number of PPS's found in the OLE container.
+ *
+ * @access public
+ * @return integer The total number of PPS's found in the OLE container
+ */
+ public function ppsTotal()
+ {
+ return count($this->_list);
+ }
+
+ /**
+ * Gets data from a PPS
+ * If there is no PPS for the index given, it will return an empty string.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @param integer $position The position from which to start reading
+ * (relative to the PPS)
+ * @param integer $length The amount of bytes to read (at most)
+ * @return string The binary string containing the data requested
+ * @see OLE_PPS_File::getStream()
+ */
+ public function getData($index, $position, $length)
+ {
+ // if position is not valid return empty string
+ if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
+ return '';
+ }
+ $fh = $this->getStream($this->_list[$index]);
+ $data = stream_get_contents($fh, $length, $position);
+ fclose($fh);
+ return $data;
+ }
+
+ /**
+ * Gets the data length from a PPS
+ * If there is no PPS for the index given, it will return 0.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return integer The amount of bytes in data the PPS has
+ */
+ public function getDataLength($index)
+ {
+ if (isset($this->_list[$index])) {
+ return $this->_list[$index]->Size;
+ }
+ return 0;
+ }
+
+ /**
+ * Utility function to transform ASCII text to Unicode
+ *
+ * @access public
+ * @static
+ * @param string $ascii The ASCII string to transform
+ * @return string The string in Unicode
+ */
+ public static function Asc2Ucs($ascii)
+ {
+ $rawname = '';
+ for ($i = 0; $i < strlen($ascii); ++$i) {
+ $rawname .= $ascii[$i] . "\x00";
+ }
+ return $rawname;
+ }
+
+ /**
+ * Utility function
+ * Returns a string for the OLE container with the date given
+ *
+ * @access public
+ * @static
+ * @param integer $date A timestamp
+ * @return string The string for the OLE container
+ */
+ public static function LocalDate2OLE($date = null)
+ {
+ if (!isset($date)) {
+ return "\x00\x00\x00\x00\x00\x00\x00\x00";
+ }
+
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2, 32);
+
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
+ // calculate seconds
+ $big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
+ // multiply just to make MS happy
+ $big_date *= 10000000;
+
+ $high_part = floor($big_date / $factor);
+ // lower 4 bytes
+ $low_part = floor((($big_date / $factor) - $high_part) * $factor);
+
+ // Make HEX string
+ $res = '';
+
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $low_part % 0x100;
+ $res .= pack('c', $hex);
+ $low_part /= 0x100;
+ }
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $high_part % 0x100;
+ $res .= pack('c', $hex);
+ $high_part /= 0x100;
+ }
+ return $res;
+ }
+
+ /**
+ * Returns a timestamp from an OLE container's date
+ *
+ * @access public
+ * @static
+ * @param integer $string A binary string with the encoded date
+ * @return string The timestamp corresponding to the string
+ */
+ public static function OLE2LocalDate($string)
+ {
+ if (strlen($string) != 8) {
+ return new PEAR_Error("Expecting 8 byte string");
+ }
+
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2, 32);
+ list(, $high_part) = unpack('V', substr($string, 4, 4));
+ list(, $low_part) = unpack('V', substr($string, 0, 4));
+
+ $big_date = ($high_part * $factor) + $low_part;
+ // translate to seconds
+ $big_date /= 10000000;
+
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
+
+ // translate to seconds from beggining of UNIX era
+ $big_date -= $days * 24 * 3600;
+ return floor($big_date);
+ }
+}
diff --git a/Classes/PHPExcel/Shared/OLE.php.bk-aleluya b/Classes/PHPExcel/Shared/OLE.php.bk-aleluya
new file mode 100644
index 0000000..5f985f2
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE.php.bk-aleluya
@@ -0,0 +1,526 @@
+ |
+// | Based on OLE::Storage_Lite by Kawai, Takanori |
+// +----------------------------------------------------------------------+
+//
+// $Id: OLE.php,v 1.13 2007/03/07 14:38:25 schmidt Exp $
+
+
+/**
+* Array for storing OLE instances that are accessed from
+* OLE_ChainedBlockStream::stream_open().
+* @var array
+*/
+$GLOBALS['_OLE_INSTANCES'] = array();
+
+/**
+* OLE package base class.
+*
+* @author Xavier Noguer
+* @author Christian Schmidt
+* @category PHPExcel
+* @package PHPExcel_Shared_OLE
+*/
+class PHPExcel_Shared_OLE
+{
+ const OLE_PPS_TYPE_ROOT = 5;
+ const OLE_PPS_TYPE_DIR = 1;
+ const OLE_PPS_TYPE_FILE = 2;
+ const OLE_DATA_SIZE_SMALL = 0x1000;
+ const OLE_LONG_INT_SIZE = 4;
+ const OLE_PPS_SIZE = 0x80;
+
+ /**
+ * The file handle for reading an OLE container
+ * @var resource
+ */
+ public $_file_handle;
+
+ /**
+ * Array of PPS's found on the OLE container
+ * @var array
+ */
+ public $_list = array();
+
+ /**
+ * Root directory of OLE container
+ * @var OLE_PPS_Root
+ */
+ public $root;
+
+ /**
+ * Big Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $bbat;
+
+ /**
+ * Short Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $sbat;
+
+ /**
+ * Size of big blocks. This is usually 512.
+ * @var int number of octets per block.
+ */
+ public $bigBlockSize;
+
+ /**
+ * Size of small blocks. This is usually 64.
+ * @var int number of octets per block
+ */
+ public $smallBlockSize;
+
+ /**
+ * Reads an OLE container from the contents of the file given.
+ *
+ * @acces public
+ * @param string $file
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function read($file)
+ {
+ $fh = fopen($file, "r");
+ if (!$fh) {
+ throw new PHPExcel_Reader_Exception("Can't open file $file");
+ }
+ $this->_file_handle = $fh;
+
+ $signature = fread($fh, 8);
+ if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
+ throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
+ }
+ fseek($fh, 28);
+ if (fread($fh, 2) != "\xFE\xFF") {
+ // This shouldn't be a problem in practice
+ throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
+ }
+ // Size of blocks and short blocks in bytes
+ $this->bigBlockSize = pow(2, self::_readInt2($fh));
+ $this->smallBlockSize = pow(2, self::_readInt2($fh));
+
+ // Skip UID, revision number and version number
+ fseek($fh, 44);
+ // Number of blocks in Big Block Allocation Table
+ $bbatBlockCount = self::_readInt4($fh);
+
+ // Root chain 1st block
+ $directoryFirstBlockId = self::_readInt4($fh);
+
+ // Skip unused bytes
+ fseek($fh, 56);
+ // Streams shorter than this are stored using small blocks
+ $this->bigBlockThreshold = self::_readInt4($fh);
+ // Block id of first sector in Short Block Allocation Table
+ $sbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Short Block Allocation Table
+ $sbbatBlockCount = self::_readInt4($fh);
+ // Block id of first sector in Master Block Allocation Table
+ $mbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Master Block Allocation Table
+ $mbbatBlockCount = self::_readInt4($fh);
+ $this->bbat = array();
+
+ // Remaining 4 * 109 bytes of current block is beginning of Master
+ // Block Allocation Table
+ $mbatBlocks = array();
+ for ($i = 0; $i < 109; ++$i) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
+
+ // Read rest of Master Block Allocation Table (if any is left)
+ $pos = $this->_getBlockOffset($mbatFirstBlockId);
+ for ($i = 0; $i < $mbbatBlockCount; ++$i) {
+ fseek($fh, $pos);
+ for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
+ // Last block id in each block points to next block
+ $pos = $this->_getBlockOffset(self::_readInt4($fh));
+ }
+
+ // Read Big Block Allocation Table according to chain specified by
+ // $mbatBlocks
+ for ($i = 0; $i < $bbatBlockCount; ++$i) {
+ $pos = $this->_getBlockOffset($mbatBlocks[$i]);
+ fseek($fh, $pos);
+ for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
+ $this->bbat[] = self::_readInt4($fh);
+ }
+ }
+
+ // Read short block allocation table (SBAT)
+ $this->sbat = array();
+ $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
+ $sbatFh = $this->getStream($sbatFirstBlockId);
+ for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
+ $this->sbat[$blockId] = self::_readInt4($sbatFh);
+ }
+ fclose($sbatFh);
+
+ $this->_readPpsWks($directoryFirstBlockId);
+
+ return true;
+ }
+
+ /**
+ * @param int block id
+ * @param int byte offset from beginning of file
+ * @access public
+ */
+ public function _getBlockOffset($blockId)
+ {
+ return 512 + $blockId * $this->bigBlockSize;
+ }
+
+ /**
+ * Returns a stream for use with fread() etc. External callers should
+ * use PHPExcel_Shared_OLE_PPS_File::getStream().
+ * @param int|PPS block id or PPS
+ * @return resource read-only stream
+ */
+ public function getStream($blockIdOrPps)
+ {
+ static $isRegistered = false;
+ if (!$isRegistered) {
+ stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
+ $isRegistered = true;
+ }
+
+ // Store current instance in global array, so that it can be accessed
+ // in OLE_ChainedBlockStream::stream_open().
+ // Object is removed from self::$instances in OLE_Stream::close().
+ $GLOBALS['_OLE_INSTANCES'][] = $this;
+ $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
+
+ $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
+ if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
+ $path .= '&blockId=' . $blockIdOrPps->_StartBlock;
+ $path .= '&size=' . $blockIdOrPps->Size;
+ } else {
+ $path .= '&blockId=' . $blockIdOrPps;
+ }
+ return fopen($path, 'r');
+ }
+
+ /**
+ * Reads a signed char.
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt1($fh)
+ {
+ list(, $tmp) = unpack("c", fread($fh, 1));
+ return $tmp;
+ }
+
+ /**
+ * Reads an unsigned short (2 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt2($fh)
+ {
+ list(, $tmp) = unpack("v", fread($fh, 2));
+ return $tmp;
+ }
+
+ /**
+ * Reads an unsigned long (4 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt4($fh)
+ {
+ list(, $tmp) = unpack("V", fread($fh, 4));
+ return $tmp;
+ }
+
+ /**
+ * Gets information about all PPS's on the OLE container from the PPS WK's
+ * creates an OLE_PPS object for each one.
+ *
+ * @access public
+ * @param integer the block id of the first block
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function _readPpsWks($blockId)
+ {
+ $fh = $this->getStream($blockId);
+ for ($pos = 0;; $pos += 128) {
+ fseek($fh, $pos, SEEK_SET);
+ $nameUtf16 = fread($fh, 64);
+ $nameLength = self::_readInt2($fh);
+ $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
+ // Simple conversion from UTF-16LE to ISO-8859-1
+ $name = str_replace("\x00", "", $nameUtf16);
+ $type = self::_readInt1($fh);
+ switch ($type) {
+ case self::OLE_PPS_TYPE_ROOT:
+ $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
+ $this->root = $pps;
+ break;
+ case self::OLE_PPS_TYPE_DIR:
+ $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
+ break;
+ case self::OLE_PPS_TYPE_FILE:
+ $pps = new PHPExcel_Shared_OLE_PPS_File($name);
+ break;
+ default:
+ continue 2;
+ }
+ fseek($fh, 1, SEEK_CUR);
+ $pps->Type = $type;
+ $pps->Name = $name;
+ $pps->PrevPps = self::_readInt4($fh);
+ $pps->NextPps = self::_readInt4($fh);
+ $pps->DirPps = self::_readInt4($fh);
+ fseek($fh, 20, SEEK_CUR);
+ $pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
+ $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
+ $pps->_StartBlock = self::_readInt4($fh);
+ $pps->Size = self::_readInt4($fh);
+ $pps->No = count($this->_list);
+ $this->_list[] = $pps;
+
+ // check if the PPS tree (starting from root) is complete
+ if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
+ break;
+ }
+ }
+ fclose($fh);
+
+ // Initialize $pps->children on directories
+ foreach ($this->_list as $pps) {
+ if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
+ $nos = array($pps->DirPps);
+ $pps->children = array();
+ while ($nos) {
+ $no = array_pop($nos);
+ if ($no != -1) {
+ $childPps = $this->_list[$no];
+ $nos[] = $childPps->PrevPps;
+ $nos[] = $childPps->NextPps;
+ $pps->children[] = $childPps;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * It checks whether the PPS tree is complete (all PPS's read)
+ * starting with the given PPS (not necessarily root)
+ *
+ * @access public
+ * @param integer $index The index of the PPS from which we are checking
+ * @return boolean Whether the PPS tree for the given PPS is complete
+ */
+ public function _ppsTreeComplete($index)
+ {
+ return isset($this->_list[$index]) &&
+ ($pps = $this->_list[$index]) &&
+ ($pps->PrevPps == -1 ||
+ $this->_ppsTreeComplete($pps->PrevPps)) &&
+ ($pps->NextPps == -1 ||
+ $this->_ppsTreeComplete($pps->NextPps)) &&
+ ($pps->DirPps == -1 ||
+ $this->_ppsTreeComplete($pps->DirPps));
+ }
+
+ /**
+ * Checks whether a PPS is a File PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return bool true if it's a File PPS, false otherwise
+ */
+ public function isFile($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
+ }
+ return false;
+ }
+
+ /**
+ * Checks whether a PPS is a Root PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS.
+ * @return bool true if it's a Root PPS, false otherwise
+ */
+ public function isRoot($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
+ }
+ return false;
+ }
+
+ /**
+ * Gives the total number of PPS's found in the OLE container.
+ *
+ * @access public
+ * @return integer The total number of PPS's found in the OLE container
+ */
+ public function ppsTotal()
+ {
+ return count($this->_list);
+ }
+
+ /**
+ * Gets data from a PPS
+ * If there is no PPS for the index given, it will return an empty string.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @param integer $position The position from which to start reading
+ * (relative to the PPS)
+ * @param integer $length The amount of bytes to read (at most)
+ * @return string The binary string containing the data requested
+ * @see OLE_PPS_File::getStream()
+ */
+ public function getData($index, $position, $length)
+ {
+ // if position is not valid return empty string
+ if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
+ return '';
+ }
+ $fh = $this->getStream($this->_list[$index]);
+ $data = stream_get_contents($fh, $length, $position);
+ fclose($fh);
+ return $data;
+ }
+
+ /**
+ * Gets the data length from a PPS
+ * If there is no PPS for the index given, it will return 0.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return integer The amount of bytes in data the PPS has
+ */
+ public function getDataLength($index)
+ {
+ if (isset($this->_list[$index])) {
+ return $this->_list[$index]->Size;
+ }
+ return 0;
+ }
+
+ /**
+ * Utility function to transform ASCII text to Unicode
+ *
+ * @access public
+ * @static
+ * @param string $ascii The ASCII string to transform
+ * @return string The string in Unicode
+ */
+ public static function Asc2Ucs($ascii)
+ {
+ $rawname = '';
+ for ($i = 0; $i < strlen($ascii); ++$i) {
+ $rawname .= $ascii{$i} . "\x00";
+ }
+ return $rawname;
+ }
+
+ /**
+ * Utility function
+ * Returns a string for the OLE container with the date given
+ *
+ * @access public
+ * @static
+ * @param integer $date A timestamp
+ * @return string The string for the OLE container
+ */
+ public static function LocalDate2OLE($date = null)
+ {
+ if (!isset($date)) {
+ return "\x00\x00\x00\x00\x00\x00\x00\x00";
+ }
+
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2, 32);
+
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
+ // calculate seconds
+ $big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
+ // multiply just to make MS happy
+ $big_date *= 10000000;
+
+ $high_part = floor($big_date / $factor);
+ // lower 4 bytes
+ $low_part = floor((($big_date / $factor) - $high_part) * $factor);
+
+ // Make HEX string
+ $res = '';
+
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $low_part % 0x100;
+ $res .= pack('c', $hex);
+ $low_part /= 0x100;
+ }
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $high_part % 0x100;
+ $res .= pack('c', $hex);
+ $high_part /= 0x100;
+ }
+ return $res;
+ }
+
+ /**
+ * Returns a timestamp from an OLE container's date
+ *
+ * @access public
+ * @static
+ * @param integer $string A binary string with the encoded date
+ * @return string The timestamp corresponding to the string
+ */
+ public static function OLE2LocalDate($string)
+ {
+ if (strlen($string) != 8) {
+ return new PEAR_Error("Expecting 8 byte string");
+ }
+
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2, 32);
+ list(, $high_part) = unpack('V', substr($string, 4, 4));
+ list(, $low_part) = unpack('V', substr($string, 0, 4));
+
+ $big_date = ($high_part * $factor) + $low_part;
+ // translate to seconds
+ $big_date /= 10000000;
+
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
+
+ // translate to seconds from beggining of UNIX era
+ $big_date -= $days * 24 * 3600;
+ return floor($big_date);
+ }
+}
diff --git a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php
new file mode 100644
index 0000000..84d2cc5
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php
@@ -0,0 +1,206 @@
+params);
+ if (!isset($this->params['oleInstanceId'], $this->params['blockId'], $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
+ if ($options & STREAM_REPORT_ERRORS) {
+ trigger_error('OLE stream not found', E_USER_WARNING);
+ }
+ return false;
+ }
+ $this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']];
+
+ $blockId = $this->params['blockId'];
+ $this->data = '';
+ if (isset($this->params['size']) && $this->params['size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->_StartBlock) {
+ // Block id refers to small blocks
+ $rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
+ while ($blockId != -2) {
+ $pos = $rootPos + $blockId * $this->ole->bigBlockSize;
+ $blockId = $this->ole->sbat[$blockId];
+ fseek($this->ole->_file_handle, $pos);
+ $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
+ }
+ } else {
+ // Block id refers to big blocks
+ while ($blockId != -2) {
+ $pos = $this->ole->_getBlockOffset($blockId);
+ fseek($this->ole->_file_handle, $pos);
+ $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
+ $blockId = $this->ole->bbat[$blockId];
+ }
+ }
+ if (isset($this->params['size'])) {
+ $this->data = substr($this->data, 0, $this->params['size']);
+ }
+
+ if ($options & STREAM_USE_PATH) {
+ $openedPath = $path;
+ }
+
+ return true;
+ }
+
+ /**
+ * Implements support for fclose().
+ *
+ */
+ public function stream_close()
+ {
+ $this->ole = null;
+ unset($GLOBALS['_OLE_INSTANCES']);
+ }
+
+ /**
+ * Implements support for fread(), fgets() etc.
+ *
+ * @param int $count maximum number of bytes to read
+ * @return string
+ */
+ public function stream_read($count)
+ {
+ if ($this->stream_eof()) {
+ return false;
+ }
+ $s = substr($this->data, $this->pos, $count);
+ $this->pos += $count;
+ return $s;
+ }
+
+ /**
+ * Implements support for feof().
+ *
+ * @return bool TRUE if the file pointer is at EOF; otherwise FALSE
+ */
+ public function stream_eof()
+ {
+ return $this->pos >= strlen($this->data);
+ }
+
+ /**
+ * Returns the position of the file pointer, i.e. its offset into the file
+ * stream. Implements support for ftell().
+ *
+ * @return int
+ */
+ public function stream_tell()
+ {
+ return $this->pos;
+ }
+
+ /**
+ * Implements support for fseek().
+ *
+ * @param int $offset byte offset
+ * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
+ * @return bool
+ */
+ public function stream_seek($offset, $whence)
+ {
+ if ($whence == SEEK_SET && $offset >= 0) {
+ $this->pos = $offset;
+ } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
+ $this->pos += $offset;
+ } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
+ $this->pos = strlen($this->data) + $offset;
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Implements support for fstat(). Currently the only supported field is
+ * "size".
+ * @return array
+ */
+ public function stream_stat()
+ {
+ return array(
+ 'size' => strlen($this->data),
+ );
+ }
+
+ // Methods used by stream_wrapper_register() that are not implemented:
+ // bool stream_flush ( void )
+ // int stream_write ( string data )
+ // bool rename ( string path_from, string path_to )
+ // bool mkdir ( string path, int mode, int options )
+ // bool rmdir ( string path, int options )
+ // bool dir_opendir ( string path, int options )
+ // array url_stat ( string path, int flags )
+ // string dir_readdir ( void )
+ // bool dir_rewinddir ( void )
+ // bool dir_closedir ( void )
+}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS.php b/Classes/PHPExcel/Shared/OLE/PPS.php
new file mode 100644
index 0000000..608a892
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE/PPS.php
@@ -0,0 +1,230 @@
+ |
+// | Based on OLE::Storage_Lite by Kawai, Takanori |
+// +----------------------------------------------------------------------+
+//
+// $Id: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $
+
+
+/**
+* Class for creating PPS's for OLE containers
+*
+* @author Xavier Noguer
+* @category PHPExcel
+* @package PHPExcel_Shared_OLE
+*/
+class PHPExcel_Shared_OLE_PPS
+{
+ /**
+ * The PPS index
+ * @var integer
+ */
+ public $No;
+
+ /**
+ * The PPS name (in Unicode)
+ * @var string
+ */
+ public $Name;
+
+ /**
+ * The PPS type. Dir, Root or File
+ * @var integer
+ */
+ public $Type;
+
+ /**
+ * The index of the previous PPS
+ * @var integer
+ */
+ public $PrevPps;
+
+ /**
+ * The index of the next PPS
+ * @var integer
+ */
+ public $NextPps;
+
+ /**
+ * The index of it's first child if this is a Dir or Root PPS
+ * @var integer
+ */
+ public $DirPps;
+
+ /**
+ * A timestamp
+ * @var integer
+ */
+ public $Time1st;
+
+ /**
+ * A timestamp
+ * @var integer
+ */
+ public $Time2nd;
+
+ /**
+ * Starting block (small or big) for this PPS's data inside the container
+ * @var integer
+ */
+ public $_StartBlock;
+
+ /**
+ * The size of the PPS's data (in bytes)
+ * @var integer
+ */
+ public $Size;
+
+ /**
+ * The PPS's data (only used if it's not using a temporary file)
+ * @var string
+ */
+ public $_data;
+
+ /**
+ * Array of child PPS's (only used by Root and Dir PPS's)
+ * @var array
+ */
+ public $children = array();
+
+ /**
+ * Pointer to OLE container
+ * @var OLE
+ */
+ public $ole;
+
+ /**
+ * The constructor
+ *
+ * @access public
+ * @param integer $No The PPS index
+ * @param string $name The PPS name
+ * @param integer $type The PPS type. Dir, Root or File
+ * @param integer $prev The index of the previous PPS
+ * @param integer $next The index of the next PPS
+ * @param integer $dir The index of it's first child if this is a Dir or Root PPS
+ * @param integer $time_1st A timestamp
+ * @param integer $time_2nd A timestamp
+ * @param string $data The (usually binary) source data of the PPS
+ * @param array $children Array containing children PPS for this PPS
+ */
+ public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
+ {
+ $this->No = $No;
+ $this->Name = $name;
+ $this->Type = $type;
+ $this->PrevPps = $prev;
+ $this->NextPps = $next;
+ $this->DirPps = $dir;
+ $this->Time1st = $time_1st;
+ $this->Time2nd = $time_2nd;
+ $this->_data = $data;
+ $this->children = $children;
+ if ($data != '') {
+ $this->Size = strlen($data);
+ } else {
+ $this->Size = 0;
+ }
+ }
+
+ /**
+ * Returns the amount of data saved for this PPS
+ *
+ * @access public
+ * @return integer The amount of data (in bytes)
+ */
+ public function _DataLen()
+ {
+ if (!isset($this->_data)) {
+ return 0;
+ }
+ //if (isset($this->_PPS_FILE)) {
+ // fseek($this->_PPS_FILE, 0);
+ // $stats = fstat($this->_PPS_FILE);
+ // return $stats[7];
+ //} else {
+ return strlen($this->_data);
+ //}
+ }
+
+ /**
+ * Returns a string with the PPS's WK (What is a WK?)
+ *
+ * @access public
+ * @return string The binary string
+ */
+ public function _getPpsWk()
+ {
+ $ret = str_pad($this->Name, 64, "\x00");
+
+ $ret .= pack("v", strlen($this->Name) + 2) // 66
+ . pack("c", $this->Type) // 67
+ . pack("c", 0x00) //UK // 68
+ . pack("V", $this->PrevPps) //Prev // 72
+ . pack("V", $this->NextPps) //Next // 76
+ . pack("V", $this->DirPps) //Dir // 80
+ . "\x00\x09\x02\x00" // 84
+ . "\x00\x00\x00\x00" // 88
+ . "\xc0\x00\x00\x00" // 92
+ . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
+ . "\x00\x00\x00\x00" // 100
+ . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
+ . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
+ . pack("V", isset($this->_StartBlock)?
+ $this->_StartBlock:0) // 120
+ . pack("V", $this->Size) // 124
+ . pack("V", 0); // 128
+ return $ret;
+ }
+
+ /**
+ * Updates index and pointers to previous, next and children PPS's for this
+ * PPS. I don't think it'll work with Dir PPS's.
+ *
+ * @access public
+ * @param array &$raList Reference to the array of PPS's for the whole OLE
+ * container
+ * @return integer The index for this PPS
+ */
+ public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
+ {
+ if (!is_array($to_save) || (empty($to_save))) {
+ return 0xFFFFFFFF;
+ } elseif (count($to_save) == 1) {
+ $cnt = count($raList);
+ // If the first entry, it's the root... Don't clone it!
+ $raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
+ $raList[$cnt]->No = $cnt;
+ $raList[$cnt]->PrevPps = 0xFFFFFFFF;
+ $raList[$cnt]->NextPps = 0xFFFFFFFF;
+ $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
+ } else {
+ $iPos = floor(count($to_save) / 2);
+ $aPrev = array_slice($to_save, 0, $iPos);
+ $aNext = array_slice($to_save, $iPos + 1);
+ $cnt = count($raList);
+ // If the first entry, it's the root... Don't clone it!
+ $raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
+ $raList[$cnt]->No = $cnt;
+ $raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
+ $raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
+ $raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
+
+ }
+ return $cnt;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS/File.php b/Classes/PHPExcel/Shared/OLE/PPS/File.php
new file mode 100644
index 0000000..1ca337c
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE/PPS/File.php
@@ -0,0 +1,74 @@
+ |
+// | Based on OLE::Storage_Lite by Kawai, Takanori |
+// +----------------------------------------------------------------------+
+//
+// $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $
+
+
+/**
+* Class for creating File PPS's for OLE containers
+*
+* @author Xavier Noguer
+* @category PHPExcel
+* @package PHPExcel_Shared_OLE
+*/
+class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
+{
+ /**
+ * The constructor
+ *
+ * @access public
+ * @param string $name The name of the file (in Unicode)
+ * @see OLE::Asc2Ucs()
+ */
+ public function __construct($name)
+ {
+ parent::__construct(null, $name, PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE, null, null, null, null, null, '', array());
+ }
+
+ /**
+ * Initialization method. Has to be called right after OLE_PPS_File().
+ *
+ * @access public
+ * @return mixed true on success
+ */
+ public function init()
+ {
+ return true;
+ }
+
+ /**
+ * Append data to PPS
+ *
+ * @access public
+ * @param string $data The data to append
+ */
+ public function append($data)
+ {
+ $this->_data .= $data;
+ }
+
+ /**
+ * Returns a stream for reading this file using fread() etc.
+ * @return resource a read-only stream
+ */
+ public function getStream()
+ {
+ $this->ole->getStream($this);
+ }
+}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php
new file mode 100644
index 0000000..5d4052f
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php
@@ -0,0 +1,462 @@
+ |
+// | Based on OLE::Storage_Lite by Kawai, Takanori |
+// +----------------------------------------------------------------------+
+//
+// $Id: Root.php,v 1.9 2005/04/23 21:53:49 dufuz Exp $
+
+
+/**
+* Class for creating Root PPS's for OLE containers
+*
+* @author Xavier Noguer
+* @category PHPExcel
+* @package PHPExcel_Shared_OLE
+*/
+class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
+{
+
+ /**
+ * Directory for temporary files
+ * @var string
+ */
+ protected $tempDirectory = null;
+
+ /**
+ * @param integer $time_1st A timestamp
+ * @param integer $time_2nd A timestamp
+ */
+ public function __construct($time_1st, $time_2nd, $raChild)
+ {
+ $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
+
+ parent::__construct(null, PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'), PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT, null, null, null, $time_1st, $time_2nd, null, $raChild);
+ }
+
+ /**
+ * Method for saving the whole OLE container (including files).
+ * In fact, if called with an empty argument (or '-'), it saves to a
+ * temporary file and then outputs it's contents to stdout.
+ * If a resource pointer to a stream created by fopen() is passed
+ * it will be used, but you have to close such stream by yourself.
+ *
+ * @param string|resource $filename The name of the file or stream where to save the OLE container.
+ * @access public
+ * @return mixed true on success
+ */
+ public function save($filename)
+ {
+ // Initial Setting for saving
+ $this->_BIG_BLOCK_SIZE = pow(
+ 2,
+ (isset($this->_BIG_BLOCK_SIZE))? self::adjust2($this->_BIG_BLOCK_SIZE) : 9
+ );
+ $this->_SMALL_BLOCK_SIZE= pow(
+ 2,
+ (isset($this->_SMALL_BLOCK_SIZE))? self::adjust2($this->_SMALL_BLOCK_SIZE) : 6
+ );
+
+ if (is_resource($filename)) {
+ $this->_FILEH_ = $filename;
+ } elseif ($filename == '-' || $filename == '') {
+ if ($this->tempDirectory === null) {
+ $this->tempDirectory = PHPExcel_Shared_File::sys_get_temp_dir();
+ }
+ $this->_tmp_filename = tempnam($this->tempDirectory, "OLE_PPS_Root");
+ $this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
+ if ($this->_FILEH_ == false) {
+ throw new PHPExcel_Writer_Exception("Can't create temporary file.");
+ }
+ } else {
+ $this->_FILEH_ = fopen($filename, "wb");
+ }
+ if ($this->_FILEH_ == false) {
+ throw new PHPExcel_Writer_Exception("Can't open $filename. It may be in use or protected.");
+ }
+ // Make an array of PPS's (for Save)
+ $aList = array();
+ PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this));
+ // calculate values for header
+ list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
+ // Save Header
+ $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
+
+ // Make Small Data string (write SBD)
+ $this->_data = $this->_makeSmallData($aList);
+
+ // Write BB
+ $this->_saveBigData($iSBDcnt, $aList);
+ // Write PPS
+ $this->_savePps($aList);
+ // Write Big Block Depot and BDList and Adding Header informations
+ $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
+
+ if (!is_resource($filename)) {
+ fclose($this->_FILEH_);
+ }
+
+ return true;
+ }
+
+ /**
+ * Calculate some numbers
+ *
+ * @access public
+ * @param array $raList Reference to an array of PPS's
+ * @return array The array of numbers
+ */
+ public function _calcSize(&$raList)
+ {
+ // Calculate Basic Setting
+ list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
+ $iSmallLen = 0;
+ $iSBcnt = 0;
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
+ $raList[$i]->Size = $raList[$i]->_DataLen();
+ if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
+ $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
+ + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
+ } else {
+ $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
+ (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ }
+ }
+ }
+ $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
+ $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
+ $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
+ $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
+ (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ $iCnt = count($raList);
+ $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
+ $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
+
+ return array($iSBDcnt, $iBBcnt, $iPPScnt);
+ }
+
+ /**
+ * Helper function for caculating a magic value for block sizes
+ *
+ * @access public
+ * @param integer $i2 The argument
+ * @see save()
+ * @return integer
+ */
+ private static function adjust2($i2)
+ {
+ $iWk = log($i2)/log(2);
+ return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
+ }
+
+ /**
+ * Save OLE header
+ *
+ * @access public
+ * @param integer $iSBDcnt
+ * @param integer $iBBcnt
+ * @param integer $iPPScnt
+ */
+ public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
+ {
+ $FILE = $this->_FILEH_;
+
+ // Calculate Basic Setting
+ $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+
+ $iBdExL = 0;
+ $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
+ $iAllW = $iAll;
+ $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
+ $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
+
+ // Calculate BD count
+ if ($iBdCnt > $i1stBdL) {
+ while (1) {
+ ++$iBdExL;
+ ++$iAllW;
+ $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
+ $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
+ if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
+ break;
+ }
+ }
+ }
+
+ // Save Header
+ fwrite(
+ $FILE,
+ "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . pack("v", 0x3b)
+ . pack("v", 0x03)
+ . pack("v", -2)
+ . pack("v", 9)
+ . pack("v", 6)
+ . pack("v", 0)
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . pack("V", $iBdCnt)
+ . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
+ . pack("V", 0)
+ . pack("V", 0x1000)
+ . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
+ . pack("V", $iSBDcnt)
+ );
+ // Extra BDList Start, Count
+ if ($iBdCnt < $i1stBdL) {
+ fwrite(
+ $FILE,
+ pack("V", -2) // Extra BDList Start
+ . pack("V", 0)// Extra BDList Count
+ );
+ } else {
+ fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
+ }
+
+ // BDList
+ for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
+ fwrite($FILE, pack("V", $iAll+$i));
+ }
+ if ($i < $i1stBdL) {
+ $jB = $i1stBdL - $i;
+ for ($j = 0; $j < $jB; ++$j) {
+ fwrite($FILE, (pack("V", -1)));
+ }
+ }
+ }
+
+ /**
+ * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
+ *
+ * @access public
+ * @param integer $iStBlk
+ * @param array &$raList Reference to array of PPS's
+ */
+ public function _saveBigData($iStBlk, &$raList)
+ {
+ $FILE = $this->_FILEH_;
+
+ // cycle through PPS's
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
+ $raList[$i]->Size = $raList[$i]->_DataLen();
+ if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) || (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data))) {
+ // Write Data
+ //if (isset($raList[$i]->_PPS_FILE)) {
+ // $iLen = 0;
+ // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
+ // while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
+ // $iLen += strlen($sBuff);
+ // fwrite($FILE, $sBuff);
+ // }
+ //} else {
+ fwrite($FILE, $raList[$i]->_data);
+ //}
+
+ if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
+ fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
+ }
+ // Set For PPS
+ $raList[$i]->_StartBlock = $iStBlk;
+ $iStBlk +=
+ (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
+ (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ }
+ // Close file for each PPS, and unlink it
+ //if (isset($raList[$i]->_PPS_FILE)) {
+ // fclose($raList[$i]->_PPS_FILE);
+ // $raList[$i]->_PPS_FILE = null;
+ // unlink($raList[$i]->_tmp_filename);
+ //}
+ }
+ }
+ }
+
+ /**
+ * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
+ *
+ * @access public
+ * @param array &$raList Reference to array of PPS's
+ */
+ public function _makeSmallData(&$raList)
+ {
+ $sRes = '';
+ $FILE = $this->_FILEH_;
+ $iSmBlk = 0;
+
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ // Make SBD, small data string
+ if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
+ if ($raList[$i]->Size <= 0) {
+ continue;
+ }
+ if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
+ $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
+ + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
+ // Add to SBD
+ $jB = $iSmbCnt - 1;
+ for ($j = 0; $j < $jB; ++$j) {
+ fwrite($FILE, pack("V", $j+$iSmBlk+1));
+ }
+ fwrite($FILE, pack("V", -2));
+
+ //// Add to Data String(this will be written for RootEntry)
+ //if ($raList[$i]->_PPS_FILE) {
+ // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
+ // while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
+ // $sRes .= $sBuff;
+ // }
+ //} else {
+ $sRes .= $raList[$i]->_data;
+ //}
+ if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
+ $sRes .= str_repeat("\x00", $this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
+ }
+ // Set for PPS
+ $raList[$i]->_StartBlock = $iSmBlk;
+ $iSmBlk += $iSmbCnt;
+ }
+ }
+ }
+ $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
+ if ($iSmBlk % $iSbCnt) {
+ $iB = $iSbCnt - ($iSmBlk % $iSbCnt);
+ for ($i = 0; $i < $iB; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ return $sRes;
+ }
+
+ /**
+ * Saves all the PPS's WKs
+ *
+ * @access public
+ * @param array $raList Reference to an array with all PPS's
+ */
+ public function _savePps(&$raList)
+ {
+ // Save each PPS WK
+ $iC = count($raList);
+ for ($i = 0; $i < $iC; ++$i) {
+ fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
+ }
+ // Adjust for Block
+ $iCnt = count($raList);
+ $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
+ if ($iCnt % $iBCnt) {
+ fwrite($this->_FILEH_, str_repeat("\x00", ($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
+ }
+ }
+
+ /**
+ * Saving Big Block Depot
+ *
+ * @access public
+ * @param integer $iSbdSize
+ * @param integer $iBsize
+ * @param integer $iPpsCnt
+ */
+ public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
+ {
+ $FILE = $this->_FILEH_;
+ // Calculate Basic Setting
+ $iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+
+ $iBdExL = 0;
+ $iAll = $iBsize + $iPpsCnt + $iSbdSize;
+ $iAllW = $iAll;
+ $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
+ $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
+ // Calculate BD count
+ if ($iBdCnt >$i1stBdL) {
+ while (1) {
+ ++$iBdExL;
+ ++$iAllW;
+ $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
+ $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
+ if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
+ break;
+ }
+ }
+ }
+
+ // Making BD
+ // Set for SBD
+ if ($iSbdSize > 0) {
+ for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+1));
+ }
+ fwrite($FILE, pack("V", -2));
+ }
+ // Set for B
+ for ($i = 0; $i < ($iBsize - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+$iSbdSize+1));
+ }
+ fwrite($FILE, pack("V", -2));
+
+ // Set for PPS
+ for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
+ }
+ fwrite($FILE, pack("V", -2));
+ // Set for BBD itself ( 0xFFFFFFFD : BBD)
+ for ($i = 0; $i < $iBdCnt; ++$i) {
+ fwrite($FILE, pack("V", 0xFFFFFFFD));
+ }
+ // Set for ExtraBDList
+ for ($i = 0; $i < $iBdExL; ++$i) {
+ fwrite($FILE, pack("V", 0xFFFFFFFC));
+ }
+ // Adjust for Block
+ if (($iAllW + $iBdCnt) % $iBbCnt) {
+ $iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
+ for ($i = 0; $i < $iBlock; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ // Extra BDList
+ if ($iBdCnt > $i1stBdL) {
+ $iN=0;
+ $iNb=0;
+ for ($i = $i1stBdL; $i < $iBdCnt; $i++, ++$iN) {
+ if ($iN >= ($iBbCnt - 1)) {
+ $iN = 0;
+ ++$iNb;
+ fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
+ }
+ fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
+ }
+ if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
+ $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
+ for ($i = 0; $i < $iB; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ fwrite($FILE, pack("V", -2));
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php
new file mode 100644
index 0000000..6b15d97
--- /dev/null
+++ b/Classes/PHPExcel/Shared/OLERead.php
@@ -0,0 +1,318 @@
+data = file_get_contents($sFileName, false, null, 0, 8);
+
+ // Check OLE identifier
+ if ($this->data != self::IDENTIFIER_OLE) {
+ throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
+ }
+
+ // Get the file data
+ $this->data = file_get_contents($sFileName);
+
+ // Total number of sectors used for the SAT
+ $this->numBigBlockDepotBlocks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
+
+ // SecID of the first sector of the directory stream
+ $this->rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS);
+
+ // SecID of the first sector of the SSAT (or -2 if not extant)
+ $this->sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
+
+ // SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
+ $this->extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS);
+
+ // Total number of sectors used by MSAT
+ $this->numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
+
+ $bigBlockDepotBlocks = array();
+ $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
+
+ $bbdBlocks = $this->numBigBlockDepotBlocks;
+
+ if ($this->numExtensionBlocks != 0) {
+ $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
+ }
+
+ for ($i = 0; $i < $bbdBlocks; ++$i) {
+ $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos);
+ $pos += 4;
+ }
+
+ for ($j = 0; $j < $this->numExtensionBlocks; ++$j) {
+ $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE;
+ $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
+
+ for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
+ $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos);
+ $pos += 4;
+ }
+
+ $bbdBlocks += $blocksToRead;
+ if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
+ $this->extensionBlock = self::getInt4d($this->data, $pos);
+ }
+ }
+
+ $pos = 0;
+ $this->bigBlockChain = '';
+ $bbs = self::BIG_BLOCK_SIZE / 4;
+ for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
+ $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
+
+ $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
+ $pos += 4*$bbs;
+ }
+
+ $pos = 0;
+ $sbdBlock = $this->sbdStartBlock;
+ $this->smallBlockChain = '';
+ while ($sbdBlock != -2) {
+ $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
+
+ $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
+ $pos += 4*$bbs;
+
+ $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4);
+ }
+
+ // read the directory stream
+ $block = $this->rootStartBlock;
+ $this->entry = $this->_readData($block);
+
+ $this->readPropertySets();
+ }
+
+ /**
+ * Extract binary stream data
+ *
+ * @return string
+ */
+ public function getStream($stream)
+ {
+ if ($stream === null) {
+ return null;
+ }
+
+ $streamData = '';
+
+ if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
+ $rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
+
+ $block = $this->props[$stream]['startBlock'];
+
+ while ($block != -2) {
+ $pos = $block * self::SMALL_BLOCK_SIZE;
+ $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
+
+ $block = self::getInt4d($this->smallBlockChain, $block*4);
+ }
+
+ return $streamData;
+ } else {
+ $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
+ if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
+ ++$numBlocks;
+ }
+
+ if ($numBlocks == 0) {
+ return '';
+ }
+
+ $block = $this->props[$stream]['startBlock'];
+
+ while ($block != -2) {
+ $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
+ $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
+ $block = self::getInt4d($this->bigBlockChain, $block*4);
+ }
+
+ return $streamData;
+ }
+ }
+
+ /**
+ * Read a standard stream (by joining sectors using information from SAT)
+ *
+ * @param int $bl Sector ID where the stream starts
+ * @return string Data for standard stream
+ */
+ private function _readData($bl)
+ {
+ $block = $bl;
+ $data = '';
+
+ while ($block != -2) {
+ $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
+ $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
+ $block = self::getInt4d($this->bigBlockChain, $block*4);
+ }
+ return $data;
+ }
+
+ /**
+ * Read entries in the directory stream.
+ */
+ private function readPropertySets()
+ {
+ $offset = 0;
+
+ // loop through entires, each entry is 128 bytes
+ $entryLen = strlen($this->entry);
+ while ($offset < $entryLen) {
+ // entry data (128 bytes)
+ $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
+
+ // size in bytes of name
+ $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8);
+
+ // type of entry
+ $type = ord($d[self::TYPE_POS]);
+
+ // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
+ // sectorID of first sector of the short-stream container stream, if this entry is root entry
+ $startBlock = self::getInt4d($d, self::START_BLOCK_POS);
+
+ $size = self::getInt4d($d, self::SIZE_POS);
+
+ $name = str_replace("\x00", "", substr($d, 0, $nameSize));
+
+ $this->props[] = array(
+ 'name' => $name,
+ 'type' => $type,
+ 'startBlock' => $startBlock,
+ 'size' => $size
+ );
+
+ // tmp helper to simplify checks
+ $upName = strtoupper($name);
+
+ // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
+ if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
+ $this->wrkbook = count($this->props) - 1;
+ } elseif ($upName === 'ROOT ENTRY' || $upName === 'R') {
+ // Root entry
+ $this->rootentry = count($this->props) - 1;
+ }
+
+ // Summary information
+ if ($name == chr(5) . 'SummaryInformation') {
+// echo 'Summary Information
';
+ $this->summaryInformation = count($this->props) - 1;
+ }
+
+ // Additional Document Summary information
+ if ($name == chr(5) . 'DocumentSummaryInformation') {
+// echo 'Document Summary Information
';
+ $this->documentSummaryInformation = count($this->props) - 1;
+ }
+
+ $offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
+ }
+ }
+
+ /**
+ * Read 4 bytes of data at specified position
+ *
+ * @param string $data
+ * @param int $pos
+ * @return int
+ */
+ private static function getInt4d($data, $pos)
+ {
+ // FIX: represent numbers correctly on 64-bit system
+ // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
+ // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
+ $_or_24 = ord($data[$pos + 3]);
+ if ($_or_24 >= 128) {
+ // negative number
+ $_ord_24 = -abs((256 - $_or_24) << 24);
+ } else {
+ $_ord_24 = ($_or_24 & 127) << 24;
+ }
+ return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/PCLZip/gnu-lgpl.txt b/Classes/PHPExcel/Shared/PCLZip/gnu-lgpl.txt
new file mode 100644
index 0000000..cbee875
--- /dev/null
+++ b/Classes/PHPExcel/Shared/PCLZip/gnu-lgpl.txt
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php
new file mode 100644
index 0000000..a5a9b0a
--- /dev/null
+++ b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php
@@ -0,0 +1,5173 @@
+zipname = $p_zipname;
+ $this->zip_fd = 0;
+ $this->magic_quotes_status = -1;
+
+ // ----- Return
+ return;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // create($p_filelist, $p_add_dir="", $p_remove_dir="")
+ // create($p_filelist, $p_option, $p_option_value, ...)
+ // Description :
+ // This method supports two different synopsis. The first one is historical.
+ // This method creates a Zip Archive. The Zip file is created in the
+ // filesystem. The files and directories indicated in $p_filelist
+ // are added in the archive. See the parameters description for the
+ // supported format of $p_filelist.
+ // When a directory is in the list, the directory and its content is added
+ // in the archive.
+ // In this synopsis, the function takes an optional variable list of
+ // options. See bellow the supported options.
+ // Parameters :
+ // $p_filelist : An array containing file or directory names, or
+ // a string containing one filename or one directory name, or
+ // a string containing a list of filenames and/or directory
+ // names separated by spaces.
+ // $p_add_dir : A path to add before the real path of the archived file,
+ // in order to have it memorized in the archive.
+ // $p_remove_dir : A path to remove from the real path of the file to archive,
+ // in order to have a shorter path memorized in the archive.
+ // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+ // is removed first, before $p_add_dir is added.
+ // Options :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_COMMENT :
+ // PCLZIP_CB_PRE_ADD :
+ // PCLZIP_CB_POST_ADD :
+ // Return Values :
+ // 0 on failure,
+ // The list of the added files, with a status of the add action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ public function create($p_filelist)
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Set default values
+ $v_options = array();
+ $v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove from the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_ADD => 'optional',
+ PCLZIP_CB_POST_ADD => 'optional',
+ PCLZIP_OPT_NO_COMPRESSION => 'optional',
+ PCLZIP_OPT_COMMENT => 'optional',
+ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+ PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+ PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+ //, PCLZIP_OPT_CRYPT => 'optional'
+ ));
+ if ($v_result != 1) {
+ return 0;
+ }
+ } else {
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ // ----- Get the first argument
+ $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+ } elseif ($v_size > 2) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+ return 0;
+ }
+ }
+ }
+
+ // ----- Look for default option values
+ $this->privOptionDefaultThreshold($v_options);
+
+ // ----- Init
+ $v_string_list = array();
+ $v_att_list = array();
+ $v_filedescr_list = array();
+ $p_result_list = array();
+
+ // ----- Look if the $p_filelist is really an array
+ if (is_array($p_filelist)) {
+ // ----- Look if the first element is also an array
+ // This will mean that this is a file description entry
+ if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+ $v_att_list = $p_filelist;
+ } else {
+ // ----- The list is a list of string names
+ $v_string_list = $p_filelist;
+ }
+ } elseif (is_string($p_filelist)) {
+ // ----- Look if the $p_filelist is a string
+ // ----- Create a list from the string
+ $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+ } else {
+ // ----- Invalid variable type for $p_filelist
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
+ return 0;
+ }
+
+ // ----- Reformat the string list
+ if (sizeof($v_string_list) != 0) {
+ foreach ($v_string_list as $v_string) {
+ if ($v_string != '') {
+ $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+ } else {
+ }
+ }
+ }
+
+ // ----- For each file in the list check the attributes
+ $v_supported_attributes = array(
+ PCLZIP_ATT_FILE_NAME => 'mandatory',
+ PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional',
+ PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional',
+ PCLZIP_ATT_FILE_MTIME => 'optional',
+ PCLZIP_ATT_FILE_CONTENT => 'optional',
+ PCLZIP_ATT_FILE_COMMENT => 'optional'
+ );
+ foreach ($v_att_list as $v_entry) {
+ $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes);
+ if ($v_result != 1) {
+ return 0;
+ }
+ }
+
+ // ----- Expand the filelist (expand directories)
+ $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Call the create fct
+ $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Return
+ return $p_result_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // add($p_filelist, $p_add_dir="", $p_remove_dir="")
+ // add($p_filelist, $p_option, $p_option_value, ...)
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This methods add the list of files in an existing archive.
+ // If a file with the same name already exists, it is added at the end of the
+ // archive, the first one is still present.
+ // If the archive does not exist, it is created.
+ // Parameters :
+ // $p_filelist : An array containing file or directory names, or
+ // a string containing one filename or one directory name, or
+ // a string containing a list of filenames and/or directory
+ // names separated by spaces.
+ // $p_add_dir : A path to add before the real path of the archived file,
+ // in order to have it memorized in the archive.
+ // $p_remove_dir : A path to remove from the real path of the file to archive,
+ // in order to have a shorter path memorized in the archive.
+ // When $p_add_dir and $p_remove_dir are set, $p_remove_dir
+ // is removed first, before $p_add_dir is added.
+ // Options :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_COMMENT :
+ // PCLZIP_OPT_ADD_COMMENT :
+ // PCLZIP_OPT_PREPEND_COMMENT :
+ // PCLZIP_CB_PRE_ADD :
+ // PCLZIP_CB_POST_ADD :
+ // Return Values :
+ // 0 on failure,
+ // The list of the added files, with a status of the add action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ public function add($p_filelist)
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Set default values
+ $v_options = array();
+ $v_options[PCLZIP_OPT_NO_COMPRESSION] = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove form the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_ADD => 'optional',
+ PCLZIP_CB_POST_ADD => 'optional',
+ PCLZIP_OPT_NO_COMPRESSION => 'optional',
+ PCLZIP_OPT_COMMENT => 'optional',
+ PCLZIP_OPT_ADD_COMMENT => 'optional',
+ PCLZIP_OPT_PREPEND_COMMENT => 'optional',
+ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+ PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+ PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+ //, PCLZIP_OPT_CRYPT => 'optional'
+ ));
+ if ($v_result != 1) {
+ return 0;
+ }
+ } else {
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ // ----- Get the first argument
+ $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
+ } elseif ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ return 0;
+ }
+ }
+ }
+
+ // ----- Look for default option values
+ $this->privOptionDefaultThreshold($v_options);
+
+ // ----- Init
+ $v_string_list = array();
+ $v_att_list = array();
+ $v_filedescr_list = array();
+ $p_result_list = array();
+
+ // ----- Look if the $p_filelist is really an array
+ if (is_array($p_filelist)) {
+ // ----- Look if the first element is also an array
+ // This will mean that this is a file description entry
+ if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
+ $v_att_list = $p_filelist;
+ } else {
+ // ----- The list is a list of string names
+ $v_string_list = $p_filelist;
+ }
+ } elseif (is_string($p_filelist)) {
+ // ----- Look if the $p_filelist is a string
+ // ----- Create a list from the string
+ $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
+ } else {
+ // ----- Invalid variable type for $p_filelist
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
+ return 0;
+ }
+
+ // ----- Reformat the string list
+ if (sizeof($v_string_list) != 0) {
+ foreach ($v_string_list as $v_string) {
+ $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
+ }
+ }
+
+ // ----- For each file in the list check the attributes
+ $v_supported_attributes = array(
+ PCLZIP_ATT_FILE_NAME => 'mandatory',
+ PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional',
+ PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional',
+ PCLZIP_ATT_FILE_MTIME => 'optional',
+ PCLZIP_ATT_FILE_CONTENT => 'optional',
+ PCLZIP_ATT_FILE_COMMENT => 'optional',
+ );
+ foreach ($v_att_list as $v_entry) {
+ $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes);
+ if ($v_result != 1) {
+ return 0;
+ }
+ }
+
+ // ----- Expand the filelist (expand directories)
+ $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Call the create fct
+ $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Return
+ return $p_result_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : listContent()
+ // Description :
+ // This public method, gives the list of the files and directories, with their
+ // properties.
+ // The properties of each entries in the list are (used also in other functions) :
+ // filename : Name of the file. For a create or add action it is the filename
+ // given by the user. For an extract function it is the filename
+ // of the extracted file.
+ // stored_filename : Name of the file / directory stored in the archive.
+ // size : Size of the stored file.
+ // compressed_size : Size of the file's data compressed in the archive
+ // (without the headers overhead)
+ // mtime : Last known modification date of the file (UNIX timestamp)
+ // comment : Comment associated with the file
+ // folder : true | false
+ // index : index of the file in the archive
+ // status : status of the action (depending of the action) :
+ // Values are :
+ // ok : OK !
+ // filtered : the file / dir is not extracted (filtered by user)
+ // already_a_directory : the file can not be extracted because a
+ // directory with the same name already exists
+ // write_protected : the file can not be extracted because a file
+ // with the same name already exists and is
+ // write protected
+ // newer_exist : the file was not extracted because a newer file exists
+ // path_creation_fail : the file is not extracted because the folder
+ // does not exist and can not be created
+ // write_error : the file was not extracted because there was a
+ // error while writing the file
+ // read_error : the file was not extracted because there was a error
+ // while reading the file
+ // invalid_header : the file was not extracted because of an archive
+ // format error (bad file header)
+ // Note that each time a method can continue operating when there
+ // is an action error on a file, the error is only logged in the file status.
+ // Return Values :
+ // 0 on an unrecoverable failure,
+ // The list of the files in the archive.
+ // --------------------------------------------------------------------------------
+ public function listContent()
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ return(0);
+ }
+
+ // ----- Call the extracting fct
+ $p_list = array();
+ if (($v_result = $this->privList($p_list)) != 1) {
+ unset($p_list);
+ return(0);
+ }
+
+ // ----- Return
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // extract($p_path="./", $p_remove_path="")
+ // extract([$p_option, $p_option_value, ...])
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This method extract all the files / directories from the archive to the
+ // folder indicated in $p_path.
+ // If you want to ignore the 'root' part of path of the memorized files
+ // you can indicate this in the optional $p_remove_path parameter.
+ // By default, if a newer file with the same name already exists, the
+ // file is not extracted.
+ //
+ // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
+ // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
+ // at the end of the path value of PCLZIP_OPT_PATH.
+ // Parameters :
+ // $p_path : Path where the files and directories are to be extracted
+ // $p_remove_path : First part ('root' part) of the memorized path
+ // (if any similar) to remove while extracting.
+ // Options :
+ // PCLZIP_OPT_PATH :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_CB_PRE_EXTRACT :
+ // PCLZIP_CB_POST_EXTRACT :
+ // Return Values :
+ // 0 or a negative value on failure,
+ // The list of the extracted files, with a status of the action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ public function extract()
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+ // $v_path = "./";
+ $v_path = '';
+ $v_remove_path = "";
+ $v_remove_all_path = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+
+ // ----- Default values for option
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
+
+ // ----- Look for arguments
+ if ($v_size > 0) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (
+ PCLZIP_OPT_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_EXTRACT => 'optional',
+ PCLZIP_CB_POST_EXTRACT => 'optional',
+ PCLZIP_OPT_SET_CHMOD => 'optional',
+ PCLZIP_OPT_BY_NAME => 'optional',
+ PCLZIP_OPT_BY_EREG => 'optional',
+ PCLZIP_OPT_BY_PREG => 'optional',
+ PCLZIP_OPT_BY_INDEX => 'optional',
+ PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+ PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
+ PCLZIP_OPT_REPLACE_NEWER => 'optional',
+ PCLZIP_OPT_STOP_ON_ERROR => 'optional',
+ PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+ PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+ PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+ ));
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Set the arguments
+ if (isset($v_options[PCLZIP_OPT_PATH])) {
+ $v_path = $v_options[PCLZIP_OPT_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+ // ----- Check for '/' in last path char
+ if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+ $v_path .= '/';
+ }
+ $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+ }
+ } else {
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+ // ----- Get the first argument
+ $v_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_remove_path = $v_arg_list[1];
+ } elseif ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ return 0;
+ }
+ }
+ }
+
+ // ----- Look for default option values
+ $this->privOptionDefaultThreshold($v_options);
+
+ // ----- Trace
+
+ // ----- Call the extracting fct
+ $p_list = array();
+ $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options);
+ if ($v_result < 1) {
+ unset($p_list);
+ return(0);
+ }
+
+ // ----- Return
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // extractByIndex($p_index, $p_path="./", $p_remove_path="")
+ // extractByIndex($p_index, [$p_option, $p_option_value, ...])
+ // Description :
+ // This method supports two synopsis. The first one is historical.
+ // This method is doing a partial extract of the archive.
+ // The extracted files or folders are identified by their index in the
+ // archive (from 0 to n).
+ // Note that if the index identify a folder, only the folder entry is
+ // extracted, not all the files included in the archive.
+ // Parameters :
+ // $p_index : A single index (integer) or a string of indexes of files to
+ // extract. The form of the string is "0,4-6,8-12" with only numbers
+ // and '-' for range or ',' to separate ranges. No spaces or ';'
+ // are allowed.
+ // $p_path : Path where the files and directories are to be extracted
+ // $p_remove_path : First part ('root' part) of the memorized path
+ // (if any similar) to remove while extracting.
+ // Options :
+ // PCLZIP_OPT_PATH :
+ // PCLZIP_OPT_ADD_PATH :
+ // PCLZIP_OPT_REMOVE_PATH :
+ // PCLZIP_OPT_REMOVE_ALL_PATH :
+ // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
+ // not as files.
+ // The resulting content is in a new field 'content' in the file
+ // structure.
+ // This option must be used alone (any other options are ignored).
+ // PCLZIP_CB_PRE_EXTRACT :
+ // PCLZIP_CB_POST_EXTRACT :
+ // Return Values :
+ // 0 on failure,
+ // The list of the extracted files, with a status of the action.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ //function extractByIndex($p_index, options...)
+ public function extractByIndex($p_index)
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+ // $v_path = "./";
+ $v_path = '';
+ $v_remove_path = "";
+ $v_remove_all_path = false;
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+
+ // ----- Default values for option
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
+
+ // ----- Look for arguments
+ if ($v_size > 1) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Remove form the options list the first argument
+ array_shift($v_arg_list);
+ $v_size--;
+
+ // ----- Look for first arg
+ if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array(
+ PCLZIP_OPT_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_PATH => 'optional',
+ PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
+ PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
+ PCLZIP_OPT_ADD_PATH => 'optional',
+ PCLZIP_CB_PRE_EXTRACT => 'optional',
+ PCLZIP_CB_POST_EXTRACT => 'optional',
+ PCLZIP_OPT_SET_CHMOD => 'optional',
+ PCLZIP_OPT_REPLACE_NEWER => 'optional',
+ PCLZIP_OPT_STOP_ON_ERROR => 'optional',
+ PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
+ PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
+ PCLZIP_OPT_TEMP_FILE_ON => 'optional',
+ PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
+ ));
+ if ($v_result != 1) {
+ return 0;
+ }
+
+ // ----- Set the arguments
+ if (isset($v_options[PCLZIP_OPT_PATH])) {
+ $v_path = $v_options[PCLZIP_OPT_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ }
+ if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
+ // ----- Check for '/' in last path char
+ if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
+ $v_path .= '/';
+ }
+ $v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
+ }
+ if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
+ $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false;
+ } else {
+ }
+ } else {
+ // ----- Look for 2 args
+ // Here we need to support the first historic synopsis of the
+ // method.
+
+ // ----- Get the first argument
+ $v_path = $v_arg_list[0];
+
+ // ----- Look for the optional second argument
+ if ($v_size == 2) {
+ $v_remove_path = $v_arg_list[1];
+ } elseif ($v_size > 2) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
+
+ // ----- Return
+ return 0;
+ }
+ }
+ }
+
+ // ----- Trace
+
+ // ----- Trick
+ // Here I want to reuse extractByRule(), so I need to parse the $p_index
+ // with privParseOptions()
+ $v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
+ $v_options_trick = array();
+ $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array (PCLZIP_OPT_BY_INDEX => 'optional'));
+ if ($v_result != 1) {
+ return 0;
+ }
+ $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
+
+ // ----- Look for default option values
+ $this->privOptionDefaultThreshold($v_options);
+
+ // ----- Call the extracting fct
+ if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
+ return(0);
+ }
+
+ // ----- Return
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function :
+ // delete([$p_option, $p_option_value, ...])
+ // Description :
+ // This method removes files from the archive.
+ // If no parameters are given, then all the archive is emptied.
+ // Parameters :
+ // None or optional arguments.
+ // Options :
+ // PCLZIP_OPT_BY_INDEX :
+ // PCLZIP_OPT_BY_NAME :
+ // PCLZIP_OPT_BY_EREG :
+ // PCLZIP_OPT_BY_PREG :
+ // Return Values :
+ // 0 on failure,
+ // The list of the files which are still present in the archive.
+ // (see PclZip::listContent() for list entry format)
+ // --------------------------------------------------------------------------------
+ public function delete()
+ {
+ $v_result=1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ return(0);
+ }
+
+ // ----- Set default values
+ $v_options = array();
+
+ // ----- Look for variable options arguments
+ $v_size = func_num_args();
+
+ // ----- Look for arguments
+ if ($v_size > 0) {
+ // ----- Get the arguments
+ $v_arg_list = func_get_args();
+
+ // ----- Parse the options
+ $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array (
+ PCLZIP_OPT_BY_NAME => 'optional',
+ PCLZIP_OPT_BY_EREG => 'optional',
+ PCLZIP_OPT_BY_PREG => 'optional',
+ PCLZIP_OPT_BY_INDEX => 'optional'
+ ));
+ if ($v_result != 1) {
+ return 0;
+ }
+ }
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Call the delete fct
+ $v_list = array();
+ if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
+ $this->privSwapBackMagicQuotes();
+ unset($v_list);
+ return(0);
+ }
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : deleteByIndex()
+ // Description :
+ // ***** Deprecated *****
+ // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
+ // --------------------------------------------------------------------------------
+ public function deleteByIndex($p_index)
+ {
+
+ $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
+
+ // ----- Return
+ return $p_list;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : properties()
+ // Description :
+ // This method gives the properties of the archive.
+ // The properties are :
+ // nb : Number of files in the archive
+ // comment : Comment associated with the archive file
+ // status : not_exist, ok
+ // Parameters :
+ // None
+ // Return Values :
+ // 0 on failure,
+ // An array with the archive properties.
+ // --------------------------------------------------------------------------------
+ public function properties()
+ {
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ $this->privSwapBackMagicQuotes();
+ return(0);
+ }
+
+ // ----- Default properties
+ $v_prop = array();
+ $v_prop['comment'] = '';
+ $v_prop['nb'] = 0;
+ $v_prop['status'] = 'not_exist';
+
+ // ----- Look if file exists
+ if (@is_file($this->zipname)) {
+ // ----- Open the zip file
+ if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) {
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+ // ----- Return
+ return 0;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ $this->privSwapBackMagicQuotes();
+ return 0;
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Set the user attributes
+ $v_prop['comment'] = $v_central_dir['comment'];
+ $v_prop['nb'] = $v_central_dir['entries'];
+ $v_prop['status'] = 'ok';
+ }
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_prop;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : duplicate()
+ // Description :
+ // This method creates an archive by copying the content of an other one. If
+ // the archive already exist, it is replaced by the new one without any warning.
+ // Parameters :
+ // $p_archive : The filename of a valid archive, or
+ // a valid PclZip object.
+ // Return Values :
+ // 1 on success.
+ // 0 or a negative value on error (error code).
+ // --------------------------------------------------------------------------------
+ public function duplicate($p_archive)
+ {
+ $v_result = 1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Look if the $p_archive is a PclZip object
+ if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) {
+ // ----- Duplicate the archive
+ $v_result = $this->privDuplicate($p_archive->zipname);
+ } elseif (is_string($p_archive)) {
+ // ----- Look if the $p_archive is a string (so a filename)
+ // ----- Check that $p_archive is a valid zip file
+ // TBC : Should also check the archive format
+ if (!is_file($p_archive)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
+ $v_result = PCLZIP_ERR_MISSING_FILE;
+ } else {
+ // ----- Duplicate the archive
+ $v_result = $this->privDuplicate($p_archive);
+ }
+ } else {
+ // ----- Invalid variable
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+ $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : merge()
+ // Description :
+ // This method merge the $p_archive_to_add archive at the end of the current
+ // one ($this).
+ // If the archive ($this) does not exist, the merge becomes a duplicate.
+ // If the $p_archive_to_add archive does not exist, the merge is a success.
+ // Parameters :
+ // $p_archive_to_add : It can be directly the filename of a valid zip archive,
+ // or a PclZip object archive.
+ // Return Values :
+ // 1 on success,
+ // 0 or negative values on error (see below).
+ // --------------------------------------------------------------------------------
+ public function merge($p_archive_to_add)
+ {
+ $v_result = 1;
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Check archive
+ if (!$this->privCheckFormat()) {
+ return(0);
+ }
+
+ // ----- Look if the $p_archive_to_add is a PclZip object
+ if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) {
+ // ----- Merge the archive
+ $v_result = $this->privMerge($p_archive_to_add);
+ } elseif (is_string($p_archive_to_add)) {
+ // ----- Look if the $p_archive_to_add is a string (so a filename)
+ // ----- Create a temporary archive
+ $v_object_archive = new PclZip($p_archive_to_add);
+
+ // ----- Merge the archive
+ $v_result = $this->privMerge($v_object_archive);
+ } else {
+ // ----- Invalid variable
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
+ $v_result = PCLZIP_ERR_INVALID_PARAMETER;
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+
+
+ // --------------------------------------------------------------------------------
+ // Function : errorCode()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function errorCode()
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ return(PclErrorCode());
+ } else {
+ return($this->error_code);
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : errorName()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function errorName($p_with_code = false)
+ {
+ $v_name = array(
+ PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
+ PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
+ PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
+ PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
+ PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
+ PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
+ PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
+ PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
+ PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
+ PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
+ PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
+ PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
+ PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
+ PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
+ PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
+ PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
+ PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
+ PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
+ PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION',
+ PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE',
+ PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION',
+ );
+
+ if (isset($v_name[$this->error_code])) {
+ $v_value = $v_name[$this->error_code];
+ } else {
+ $v_value = 'NoName';
+ }
+
+ if ($p_with_code) {
+ return($v_value.' ('.$this->error_code.')');
+ } else {
+ return($v_value);
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : errorInfo()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function errorInfo($p_full = false)
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ return(PclErrorString());
+ } else {
+ if ($p_full) {
+ return($this->errorName(true)." : ".$this->error_string);
+ } else {
+ return($this->error_string." [code ".$this->error_code."]");
+ }
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+
+ // --------------------------------------------------------------------------------
+ // ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
+ // ***** *****
+ // ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
+ // --------------------------------------------------------------------------------
+
+
+
+ // --------------------------------------------------------------------------------
+ // Function : privCheckFormat()
+ // Description :
+ // This method check that the archive exists and is a valid zip archive.
+ // Several level of check exists. (futur)
+ // Parameters :
+ // $p_level : Level of check. Default 0.
+ // 0 : Check the first bytes (magic codes) (default value))
+ // 1 : 0 + Check the central directory (futur)
+ // 2 : 1 + Check each file header (futur)
+ // Return Values :
+ // true on success,
+ // false on error, the error code is set.
+ // --------------------------------------------------------------------------------
+ public function privCheckFormat($p_level = 0)
+ {
+ $v_result = true;
+
+ // ----- Reset the file system cache
+ clearstatcache();
+
+ // ----- Reset the error handler
+ $this->privErrorReset();
+
+ // ----- Look if the file exits
+ if (!is_file($this->zipname)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
+ return(false);
+ }
+
+ // ----- Check that the file is readeable
+ if (!is_readable($this->zipname)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
+ return(false);
+ }
+
+ // ----- Check the magic code
+ // TBC
+
+ // ----- Check the central header
+ // TBC
+
+ // ----- Check each file header
+ // TBC
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privParseOptions()
+ // Description :
+ // This internal methods reads the variable list of arguments ($p_options_list,
+ // $p_size) and generate an array with the options and values ($v_result_list).
+ // $v_requested_options contains the options that can be present and those that
+ // must be present.
+ // $v_requested_options is an array, with the option value as key, and 'optional',
+ // or 'mandatory' as value.
+ // Parameters :
+ // See above.
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ public function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false)
+ {
+ $v_result=1;
+
+ // ----- Read the options
+ $i=0;
+ while ($i<$p_size) {
+ // ----- Check if the option is supported
+ if (!isset($v_requested_options[$p_options_list[$i]])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for next option
+ switch ($p_options_list[$i]) {
+ // ----- Look for options that request a path value
+ case PCLZIP_OPT_PATH:
+ case PCLZIP_OPT_REMOVE_PATH:
+ case PCLZIP_OPT_ADD_PATH:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+ $i++;
+ break;
+
+ case PCLZIP_OPT_TEMP_FILE_THRESHOLD:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ return PclZip::errorCode();
+ }
+
+ // ----- Check for incompatible options
+ if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+ return PclZip::errorCode();
+ }
+
+ // ----- Check the value
+ $v_value = $p_options_list[$i+1];
+ if ((!is_integer($v_value)) || ($v_value<0)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value (and convert it in bytes)
+ $v_result_list[$p_options_list[$i]] = $v_value*1048576;
+ $i++;
+ break;
+
+ case PCLZIP_OPT_TEMP_FILE_ON:
+ // ----- Check for incompatible options
+ if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
+ return PclZip::errorCode();
+ }
+
+ $v_result_list[$p_options_list[$i]] = true;
+ break;
+
+ case PCLZIP_OPT_TEMP_FILE_OFF:
+ // ----- Check for incompatible options
+ if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
+ return PclZip::errorCode();
+ }
+ // ----- Check for incompatible options
+ if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
+ return PclZip::errorCode();
+ }
+ $v_result_list[$p_options_list[$i]] = true;
+ break;
+
+ case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1]) && ($p_options_list[$i+1] != '')) {
+ $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
+ $i++;
+ } else {
+ }
+ break;
+ // ----- Look for options that request an array of string for value
+ case PCLZIP_OPT_BY_NAME:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
+ } elseif (is_array($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ } else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ $i++;
+ break;
+ // ----- Look for options that request an EREG or PREG expression
+ case PCLZIP_OPT_BY_EREG:
+ // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG
+ // to PCLZIP_OPT_BY_PREG
+ $p_options_list[$i] = PCLZIP_OPT_BY_PREG;
+ case PCLZIP_OPT_BY_PREG:
+ //case PCLZIP_OPT_CRYPT :
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ } else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ $i++;
+ break;
+
+ // ----- Look for options that takes a string
+ case PCLZIP_OPT_COMMENT:
+ case PCLZIP_OPT_ADD_COMMENT:
+ case PCLZIP_OPT_PREPEND_COMMENT:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ if (is_string($p_options_list[$i+1])) {
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ } else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" .PclZipUtilOptionText($p_options_list[$i]) ."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ $i++;
+ break;
+
+ // ----- Look for options that request an array of index
+ case PCLZIP_OPT_BY_INDEX:
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_work_list = array();
+ if (is_string($p_options_list[$i+1])) {
+ // ----- Remove spaces
+ $p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
+
+ // ----- Parse items
+ $v_work_list = explode(",", $p_options_list[$i+1]);
+ } elseif (is_integer($p_options_list[$i+1])) {
+ $v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
+ } elseif (is_array($p_options_list[$i+1])) {
+ $v_work_list = $p_options_list[$i+1];
+ } else {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Reduce the index list
+ // each index item in the list must be a couple with a start and
+ // an end value : [0,3], [5-5], [8-10], ...
+ // ----- Check the format of each item
+ $v_sort_flag=false;
+ $v_sort_value=0;
+ for ($j=0; $j= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ // ----- Get the value
+ $v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
+ $i++;
+ break;
+
+ // ----- Look for options that request a call-back
+ case PCLZIP_CB_PRE_EXTRACT:
+ case PCLZIP_CB_POST_EXTRACT:
+ case PCLZIP_CB_PRE_ADD:
+ case PCLZIP_CB_POST_ADD:
+ /* for futur use
+ case PCLZIP_CB_PRE_DELETE :
+ case PCLZIP_CB_POST_DELETE :
+ case PCLZIP_CB_PRE_LIST :
+ case PCLZIP_CB_POST_LIST :
+ */
+ // ----- Check the number of parameters
+ if (($i+1) >= $p_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Get the value
+ $v_function_name = $p_options_list[$i+1];
+
+ // ----- Check that the value is a valid existing function
+ if (!function_exists($v_function_name)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Set the attribute
+ $v_result_list[$p_options_list[$i]] = $v_function_name;
+ $i++;
+ break;
+ default:
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" .$p_options_list[$i]."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Next options
+ $i++;
+ }
+
+ // ----- Look for mandatory options
+ if ($v_requested_options !== false) {
+ for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
+ // ----- Look for mandatory option
+ if ($v_requested_options[$key] == 'mandatory') {
+ // ----- Look if present
+ if (!isset($v_result_list[$key])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ }
+ }
+ }
+
+ // ----- Look for default values
+ if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privOptionDefaultThreshold()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privOptionDefaultThreshold(&$p_options)
+ {
+ $v_result=1;
+
+ if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
+ return $v_result;
+ }
+
+ // ----- Get 'memory_limit' configuration value
+ $v_memory_limit = ini_get('memory_limit');
+ $v_memory_limit = trim($v_memory_limit);
+ $last = strtolower(substr($v_memory_limit, -1));
+
+ if ($last == 'g') {
+ //$v_memory_limit = $v_memory_limit*1024*1024*1024;
+ $v_memory_limit = $v_memory_limit*1073741824;
+ }
+ if ($last == 'm') {
+ //$v_memory_limit = $v_memory_limit*1024*1024;
+ $v_memory_limit = $v_memory_limit*1048576;
+ }
+ if ($last == 'k') {
+ $v_memory_limit = $v_memory_limit*1024;
+ }
+
+ $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
+
+ // ----- Sanity check : No threshold if value lower than 1M
+ if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
+ unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privFileDescrParseAtt()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ public function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false)
+ {
+ $v_result=1;
+
+ // ----- For each file in the list check the attributes
+ foreach ($p_file_list as $v_key => $v_value) {
+ // ----- Check if the option is supported
+ if (!isset($v_requested_options[$v_key])) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for attribute
+ switch ($v_key) {
+ case PCLZIP_ATT_FILE_NAME:
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
+
+ if ($p_filedescr['filename'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+ break;
+ case PCLZIP_ATT_FILE_NEW_SHORT_NAME:
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
+
+ if ($p_filedescr['new_short_name'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+ break;
+ case PCLZIP_ATT_FILE_NEW_FULL_NAME:
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+
+ $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
+
+ if ($p_filedescr['new_full_name'] == '') {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+ break;
+ // ----- Look for options that takes a string
+ case PCLZIP_ATT_FILE_COMMENT:
+ if (!is_string($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+ $p_filedescr['comment'] = $v_value;
+ break;
+ case PCLZIP_ATT_FILE_MTIME:
+ if (!is_integer($v_value)) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
+ return PclZip::errorCode();
+ }
+ $p_filedescr['mtime'] = $v_value;
+ break;
+ case PCLZIP_ATT_FILE_CONTENT:
+ $p_filedescr['content'] = $v_value;
+ break;
+ default:
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '".$v_key."'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for mandatory options
+ if ($v_requested_options !== false) {
+ for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) {
+ // ----- Look for mandatory option
+ if ($v_requested_options[$key] == 'mandatory') {
+ // ----- Look if present
+ if (!isset($p_file_list[$key])) {
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
+ return PclZip::errorCode();
+ }
+ }
+ }
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privFileDescrExpand()
+ // Description :
+ // This method look for each item of the list to see if its a file, a folder
+ // or a string to be added as file. For any other type of files (link, other)
+ // just ignore the item.
+ // Then prepare the information that will be stored for that file.
+ // When its a folder, expand the folder with all the files that are in that
+ // folder (recursively).
+ // Parameters :
+ // Return Values :
+ // 1 on success.
+ // 0 on failure.
+ // --------------------------------------------------------------------------------
+ public function privFileDescrExpand(&$p_filedescr_list, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Create a result list
+ $v_result_list = array();
+
+ // ----- Look each entry
+ for ($i=0; $iprivCalculateStoredFilename($v_descr, $p_options);
+
+ // ----- Add the descriptor in result list
+ $v_result_list[sizeof($v_result_list)] = $v_descr;
+
+ // ----- Look for folder
+ if ($v_descr['type'] == 'folder') {
+ // ----- List of items in folder
+ $v_dirlist_descr = array();
+ $v_dirlist_nb = 0;
+ if ($v_folder_handler = @opendir($v_descr['filename'])) {
+ while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
+ // ----- Skip '.' and '..'
+ if (($v_item_handler == '.') || ($v_item_handler == '..')) {
+ continue;
+ }
+
+ // ----- Compose the full filename
+ $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
+
+ // ----- Look for different stored filename
+ // Because the name of the folder was changed, the name of the
+ // files/sub-folders also change
+ if (($v_descr['stored_filename'] != $v_descr['filename'])
+ && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
+ if ($v_descr['stored_filename'] != '') {
+ $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
+ } else {
+ $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
+ }
+ }
+ $v_dirlist_nb++;
+ }
+
+ @closedir($v_folder_handler);
+ } else {
+ // TBC : unable to open folder in read mode
+ }
+
+ // ----- Expand each element of the list
+ if ($v_dirlist_nb != 0) {
+ // ----- Expand
+ if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
+ return $v_result;
+ }
+
+ // ----- Concat the resulting list
+ $v_result_list = array_merge($v_result_list, $v_dirlist_descr);
+ }
+
+ // ----- Free local array
+ unset($v_dirlist_descr);
+ }
+ }
+
+ // ----- Get the result list
+ $p_filedescr_list = $v_result_list;
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCreate()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the file in write mode
+ if (($v_result = $this->privOpenFd('wb')) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Add the list of files
+ $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAdd()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Look if the archive exists or is empty
+ if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) {
+ // ----- Do a create
+ $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
+
+ // ----- Return
+ return $v_result;
+ }
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the zip file
+ if (($v_result=$this->privOpenFd('rb')) != 1) {
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ @rewind($this->zip_fd);
+
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Open the temporary file in write mode
+ if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = $v_central_dir['offset'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Swap the file descriptor
+ // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+ // the following methods on the temporary fil and not the real archive
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Add the files
+ $v_header_list = array();
+ if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) {
+ fclose($v_zip_temp_fd);
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($this->zip_fd);
+
+ // ----- Copy the block of file headers from the old archive
+ $v_size = $v_central_dir['size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($v_zip_temp_fd, $v_read_size);
+ @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Create the Central Dir files header
+ for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ fclose($v_zip_temp_fd);
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+ $v_count++;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+ // ----- Zip file comment
+ $v_comment = $v_central_dir['comment'];
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+ if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
+ $v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
+ }
+ if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($this->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) {
+ // ----- Reset the file list
+ unset($v_header_list);
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Swap back the file descriptor
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privOpenFd()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function privOpenFd($p_mode)
+ {
+ $v_result=1;
+
+ // ----- Look if already open
+ if ($this->zip_fd != 0) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Open the zip file
+ if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCloseFd()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function privCloseFd()
+ {
+ $v_result=1;
+
+ if ($this->zip_fd != 0) {
+ @fclose($this->zip_fd);
+ }
+ $this->zip_fd = 0;
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddList()
+ // Description :
+ // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
+ // different from the real path of the file. This is usefull if you want to have PclTar
+ // running in any directory, and memorize relative path from an other directory.
+ // Parameters :
+ // $p_list : An array containing the file or directory names to add in the tar
+ // $p_result_list : list of added files with their properties (specially the status field)
+ // $p_add_dir : Path to add in the filename path archived
+ // $p_remove_dir : Path to remove in the filename path archived
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ // public function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
+ public function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Add the files
+ $v_header_list = array();
+ if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($this->zip_fd);
+
+ // ----- Create the Central Dir files header
+ for ($i=0, $v_count=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+ $v_count++;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+ // ----- Zip file comment
+ $v_comment = '';
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($this->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) {
+ // ----- Reset the file list
+ unset($v_header_list);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddFileList()
+ // Description :
+ // Parameters :
+ // $p_filedescr_list : An array containing the file description
+ // or directory names to add in the zip
+ // $p_result_list : list of added files with their properties (specially the status field)
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
+ {
+ $v_result=1;
+ $v_header = array();
+
+ // ----- Recuperate the current number of elt in list
+ $v_nb = sizeof($p_result_list);
+
+ // ----- Loop on the files
+ for ($j=0; ($jprivAddFile($p_filedescr_list[$j], $v_header, $p_options);
+ if ($v_result != 1) {
+ return $v_result;
+ }
+
+ // ----- Store the file infos
+ $p_result_list[$v_nb++] = $v_header;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privAddFile($p_filedescr, &$p_header, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Working variable
+ $p_filename = $p_filedescr['filename'];
+
+ // TBC : Already done in the fileAtt check ... ?
+ if ($p_filename == "") {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for a stored different filename
+ /* TBC : Removed
+ if (isset($p_filedescr['stored_filename'])) {
+ $v_stored_filename = $p_filedescr['stored_filename'];
+ }
+ else {
+ $v_stored_filename = $p_filedescr['stored_filename'];
+ }
+ */
+
+ // ----- Set the file properties
+ clearstatcache();
+ $p_header['version'] = 20;
+ $p_header['version_extracted'] = 10;
+ $p_header['flag'] = 0;
+ $p_header['compression'] = 0;
+ $p_header['crc'] = 0;
+ $p_header['compressed_size'] = 0;
+ $p_header['filename_len'] = strlen($p_filename);
+ $p_header['extra_len'] = 0;
+ $p_header['disk'] = 0;
+ $p_header['internal'] = 0;
+ $p_header['offset'] = 0;
+ $p_header['filename'] = $p_filename;
+ // TBC : Removed $p_header['stored_filename'] = $v_stored_filename;
+ $p_header['stored_filename'] = $p_filedescr['stored_filename'];
+ $p_header['extra'] = '';
+ $p_header['status'] = 'ok';
+ $p_header['index'] = -1;
+
+ // ----- Look for regular file
+ if ($p_filedescr['type']=='file') {
+ $p_header['external'] = 0x00000000;
+ $p_header['size'] = filesize($p_filename);
+ } elseif ($p_filedescr['type']=='folder') {
+ // ----- Look for regular folder
+ $p_header['external'] = 0x00000010;
+ $p_header['mtime'] = filemtime($p_filename);
+ $p_header['size'] = filesize($p_filename);
+ } elseif ($p_filedescr['type'] == 'virtual_file') {
+ // ----- Look for virtual file
+ $p_header['external'] = 0x00000000;
+ $p_header['size'] = strlen($p_filedescr['content']);
+ }
+
+ // ----- Look for filetime
+ if (isset($p_filedescr['mtime'])) {
+ $p_header['mtime'] = $p_filedescr['mtime'];
+ } elseif ($p_filedescr['type'] == 'virtual_file') {
+ $p_header['mtime'] = time();
+ } else {
+ $p_header['mtime'] = filemtime($p_filename);
+ }
+
+ // ------ Look for file comment
+ if (isset($p_filedescr['comment'])) {
+ $p_header['comment_len'] = strlen($p_filedescr['comment']);
+ $p_header['comment'] = $p_filedescr['comment'];
+ } else {
+ $p_header['comment_len'] = 0;
+ $p_header['comment'] = '';
+ }
+
+ // ----- Look for pre-add callback
+ if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_header['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
+ $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
+ }
+ }
+
+ // ----- Look for empty stored filename
+ if ($p_header['stored_filename'] == "") {
+ $p_header['status'] = "filtered";
+ }
+
+ // ----- Check the path length
+ if (strlen($p_header['stored_filename']) > 0xFF) {
+ $p_header['status'] = 'filename_too_long';
+ }
+
+ // ----- Look if no error, or file not skipped
+ if ($p_header['status'] == 'ok') {
+ // ----- Look for a file
+ if ($p_filedescr['type'] == 'file') {
+ // ----- Look for using temporary file to zip
+ if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) {
+ $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options);
+ if ($v_result < PCLZIP_ERR_NO_ERROR) {
+ return $v_result;
+ }
+ } else {
+ // ----- Use "in memory" zip algo
+ // ----- Open the source file
+ if (($v_file = @fopen($p_filename, "rb")) == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file content
+ $v_content = @fread($v_file, $p_header['size']);
+
+ // ----- Close the file
+ @fclose($v_file);
+
+ // ----- Calculate the CRC
+ $p_header['crc'] = @crc32($v_content);
+
+ // ----- Look for no compression
+ if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+ // ----- Set header parameters
+ $p_header['compressed_size'] = $p_header['size'];
+ $p_header['compression'] = 0;
+ } else {
+ // ----- Look for normal compression
+ // ----- Compress the content
+ $v_content = @gzdeflate($v_content);
+
+ // ----- Set header parameters
+ $p_header['compressed_size'] = strlen($v_content);
+ $p_header['compression'] = 8;
+ }
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+ @fclose($v_file);
+ return $v_result;
+ }
+
+ // ----- Write the compressed (or not) content
+ @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
+ }
+ } elseif ($p_filedescr['type'] == 'virtual_file') {
+ // ----- Look for a virtual file (a file from string)
+ $v_content = $p_filedescr['content'];
+
+ // ----- Calculate the CRC
+ $p_header['crc'] = @crc32($v_content);
+
+ // ----- Look for no compression
+ if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
+ // ----- Set header parameters
+ $p_header['compressed_size'] = $p_header['size'];
+ $p_header['compression'] = 0;
+ } else {
+ // ----- Look for normal compression
+ // ----- Compress the content
+ $v_content = @gzdeflate($v_content);
+
+ // ----- Set header parameters
+ $p_header['compressed_size'] = strlen($v_content);
+ $p_header['compression'] = 8;
+ }
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+ @fclose($v_file);
+ return $v_result;
+ }
+
+ // ----- Write the compressed (or not) content
+ @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']);
+ } elseif ($p_filedescr['type'] == 'folder') {
+ // ----- Look for a directory
+ // ----- Look for directory last '/'
+ if (@substr($p_header['stored_filename'], -1) != '/') {
+ $p_header['stored_filename'] .= '/';
+ }
+
+ // ----- Set the file properties
+ $p_header['size'] = 0;
+ //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
+ $p_header['external'] = 0x00000010; // Value for a folder : to be checked
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+ return $v_result;
+ }
+ }
+ }
+
+ // ----- Look for post-add callback
+ if (isset($p_options[PCLZIP_CB_POST_ADD])) {
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_header, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Ignored
+ $v_result = 1;
+ }
+
+ // ----- Update the informations
+ // Nothing can be modified
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privAddFileUsingTempFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options)
+ {
+ $v_result=PCLZIP_ERR_NO_ERROR;
+
+ // ----- Working variable
+ $p_filename = $p_filedescr['filename'];
+
+
+ // ----- Open the source file
+ if (($v_file = @fopen($p_filename, "rb")) == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
+ return PclZip::errorCode();
+ }
+
+ // ----- Creates a compressed temporary file
+ $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+ if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) {
+ fclose($v_file);
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ $v_size = filesize($p_filename);
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($v_file, $v_read_size);
+ //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @gzputs($v_file_compressed, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Close the file
+ @fclose($v_file);
+ @gzclose($v_file_compressed);
+
+ // ----- Check the minimum file size
+ if (filesize($v_gzip_temp_name) < 18) {
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \''.$v_gzip_temp_name.'\' has invalid filesize - should be minimum 18 bytes');
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the compressed attributes
+ if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the gzip file header
+ $v_binary_data = @fread($v_file_compressed, 10);
+ $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data);
+
+ // ----- Check some parameters
+ $v_data_header['os'] = bin2hex($v_data_header['os']);
+
+ // ----- Read the gzip file footer
+ @fseek($v_file_compressed, filesize($v_gzip_temp_name)-8);
+ $v_binary_data = @fread($v_file_compressed, 8);
+ $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data);
+
+ // ----- Set the attributes
+ $p_header['compression'] = ord($v_data_header['cm']);
+ //$p_header['mtime'] = $v_data_header['mtime'];
+ $p_header['crc'] = $v_data_footer['crc'];
+ $p_header['compressed_size'] = filesize($v_gzip_temp_name)-18;
+
+ // ----- Close the file
+ @fclose($v_file_compressed);
+
+ // ----- Call the header generation
+ if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
+ return $v_result;
+ }
+
+ // ----- Add the compressed data
+ if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ fseek($v_file_compressed, 10);
+ $v_size = $p_header['compressed_size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($v_file_compressed, $v_read_size);
+ //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Close the file
+ @fclose($v_file_compressed);
+
+ // ----- Unlink the temporary file
+ @unlink($v_gzip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCalculateStoredFilename()
+ // Description :
+ // Based on file descriptor properties and global options, this method
+ // calculate the filename that will be stored in the archive.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privCalculateStoredFilename(&$p_filedescr, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Working variables
+ $p_filename = $p_filedescr['filename'];
+ if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
+ $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
+ } else {
+ $p_add_dir = '';
+ }
+ if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
+ $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
+ } else {
+ $p_remove_dir = '';
+ }
+ if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
+ $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
+ } else {
+ $p_remove_all_dir = 0;
+ }
+
+ // ----- Look for full name change
+ if (isset($p_filedescr['new_full_name'])) {
+ // ----- Remove drive letter if any
+ $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
+ } else {
+ // ----- Look for path and/or short name change
+ // ----- Look for short name change
+ // Its when we cahnge just the filename but not the path
+ if (isset($p_filedescr['new_short_name'])) {
+ $v_path_info = pathinfo($p_filename);
+ $v_dir = '';
+ if ($v_path_info['dirname'] != '') {
+ $v_dir = $v_path_info['dirname'].'/';
+ }
+ $v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
+ } else {
+ // ----- Calculate the stored filename
+ $v_stored_filename = $p_filename;
+ }
+
+ // ----- Look for all path to remove
+ if ($p_remove_all_dir) {
+ $v_stored_filename = basename($p_filename);
+ } elseif ($p_remove_dir != "") {
+ // ----- Look for partial path remove
+ if (substr($p_remove_dir, -1) != '/') {
+ $p_remove_dir .= "/";
+ }
+
+ if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) {
+ if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) {
+ $p_remove_dir = "./".$p_remove_dir;
+ }
+ if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) {
+ $p_remove_dir = substr($p_remove_dir, 2);
+ }
+ }
+
+ $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename);
+ if ($v_compare > 0) {
+ if ($v_compare == 2) {
+ $v_stored_filename = "";
+ } else {
+ $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir));
+ }
+ }
+ }
+
+ // ----- Remove drive letter if any
+ $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
+
+ // ----- Look for path to add
+ if ($p_add_dir != "") {
+ if (substr($p_add_dir, -1) == "/") {
+ $v_stored_filename = $p_add_dir.$v_stored_filename;
+ } else {
+ $v_stored_filename = $p_add_dir."/".$v_stored_filename;
+ }
+ }
+ }
+
+ // ----- Filename (reduce the path of stored name)
+ $v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
+ $p_filedescr['stored_filename'] = $v_stored_filename;
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privWriteFileHeader(&$p_header)
+ {
+ $v_result=1;
+
+ // ----- Store the offset position of the file
+ $p_header['offset'] = ftell($this->zip_fd);
+
+ // ----- Transform UNIX mtime to DOS format mdate/mtime
+ $v_date = getdate($p_header['mtime']);
+ $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+ $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']);
+
+ // ----- Write the first 148 bytes of the header in the archive
+ fputs($this->zip_fd, $v_binary_data, 30);
+
+ // ----- Write the variable fields
+ if (strlen($p_header['stored_filename']) != 0) {
+ fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+ }
+ if ($p_header['extra_len'] != 0) {
+ fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteCentralFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privWriteCentralFileHeader(&$p_header)
+ {
+ $v_result=1;
+
+ // TBC
+ //for(reset($p_header); $key = key($p_header); next($p_header)) {
+ //}
+
+ // ----- Transform UNIX mtime to DOS format mdate/mtime
+ $v_date = getdate($p_header['mtime']);
+ $v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
+ $v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
+
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']);
+
+ // ----- Write the 42 bytes of the header in the zip file
+ fputs($this->zip_fd, $v_binary_data, 46);
+
+ // ----- Write the variable fields
+ if (strlen($p_header['stored_filename']) != 0) {
+ fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
+ }
+ if ($p_header['extra_len'] != 0) {
+ fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
+ }
+ if ($p_header['comment_len'] != 0) {
+ fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privWriteCentralHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
+ {
+ $v_result = 1;
+
+ // ----- Packed data
+ $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment));
+
+ // ----- Write the 22 bytes of the header in the zip file
+ fputs($this->zip_fd, $v_binary_data, 22);
+
+ // ----- Write the variable fields
+ if (strlen($p_comment) != 0) {
+ fputs($this->zip_fd, $p_comment, strlen($p_comment));
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privList()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privList(&$p_list)
+ {
+ $v_result = 1;
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Open the zip file
+ if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) {
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+
+ // ----- Go to beginning of Central Dir
+ @rewind($this->zip_fd);
+ if (@fseek($this->zip_fd, $v_central_dir['offset'])) {
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read each entry
+ for ($i=0; $i<$v_central_dir['entries']; $i++) {
+ // ----- Read the file header
+ if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) {
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+ $v_header['index'] = $i;
+
+ // ----- Get the only interesting attributes
+ $this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
+ unset($v_header);
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Magic quotes trick
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privConvertHeader2FileInfo()
+ // Description :
+ // This function takes the file informations from the central directory
+ // entries and extract the interesting parameters that will be given back.
+ // The resulting file infos are set in the array $p_info
+ // $p_info['filename'] : Filename with full path. Given by user (add),
+ // extracted in the filesystem (extract).
+ // $p_info['stored_filename'] : Stored filename in the archive.
+ // $p_info['size'] = Size of the file.
+ // $p_info['compressed_size'] = Compressed size of the file.
+ // $p_info['mtime'] = Last modification date of the file.
+ // $p_info['comment'] = Comment associated with the file.
+ // $p_info['folder'] = true/false : indicates if the entry is a folder or not.
+ // $p_info['status'] = status of the action on the file.
+ // $p_info['crc'] = CRC of the file content.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privConvertHeader2FileInfo($p_header, &$p_info)
+ {
+ $v_result=1;
+
+ // ----- Get the interesting attributes
+ $v_temp_path = PclZipUtilPathReduction($p_header['filename']);
+ $p_info['filename'] = $v_temp_path;
+ $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']);
+ $p_info['stored_filename'] = $v_temp_path;
+ $p_info['size'] = $p_header['size'];
+ $p_info['compressed_size'] = $p_header['compressed_size'];
+ $p_info['mtime'] = $p_header['mtime'];
+ $p_info['comment'] = $p_header['comment'];
+ $p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
+ $p_info['index'] = $p_header['index'];
+ $p_info['status'] = $p_header['status'];
+ $p_info['crc'] = $p_header['crc'];
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractByRule()
+ // Description :
+ // Extract a file or directory depending of rules (by index, by name, ...)
+ // Parameters :
+ // $p_file_list : An array where will be placed the properties of each
+ // extracted file
+ // $p_path : Path to add while writing the extracted files
+ // $p_remove_path : Path to remove (from the file memorized path) while writing the
+ // extracted files. If the path does not match the file path,
+ // the file is extracted with its memorized path.
+ // $p_remove_path does not apply to 'list' mode.
+ // $p_path and $p_remove_path are commulative.
+ // Return Values :
+ // 1 on success,0 or less on error (see error code list)
+ // --------------------------------------------------------------------------------
+ public function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Magic quotes trick
+ $this->privDisableMagicQuotes();
+
+ // ----- Check the path
+ if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2)!=":/"))) {
+ $p_path = "./".$p_path;
+ }
+
+ // ----- Reduce the path last (and duplicated) '/'
+ if (($p_path != "./") && ($p_path != "/")) {
+ // ----- Look for the path end '/'
+ while (substr($p_path, -1) == "/") {
+ $p_path = substr($p_path, 0, strlen($p_path)-1);
+ }
+ }
+
+ // ----- Look for path to remove format (should end by /)
+ if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) {
+ $p_remove_path .= '/';
+ }
+ $p_remove_path_size = strlen($p_remove_path);
+
+ // ----- Open the zip file
+ if (($v_result = $this->privOpenFd('rb')) != 1) {
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ return $v_result;
+ }
+
+ // ----- Start at beginning of Central Dir
+ $v_pos_entry = $v_central_dir['offset'];
+
+ // ----- Read each entry
+ $j_start = 0;
+ for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
+ // ----- Read next Central dir entry
+ @rewind($this->zip_fd);
+ if (@fseek($this->zip_fd, $v_pos_entry)) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file header
+ $v_header = array();
+ if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ return $v_result;
+ }
+
+ // ----- Store the index
+ $v_header['index'] = $i;
+
+ // ----- Store the file position
+ $v_pos_entry = ftell($this->zip_fd);
+
+ // ----- Look for the specific extract rules
+ $v_extract = false;
+
+ // ----- Look for extract by name rule
+ if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+ // ----- Look if the filename is in the list
+ for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ $v_extract = true;
+ }
+ } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+ // ----- Look for a filename
+ $v_extract = true;
+ }
+ }
+ } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+ // ----- Look for extract by preg rule
+ if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
+ $v_extract = true;
+ }
+ } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+ // ----- Look for extract by index rule
+ // ----- Look if the index is in the list
+ for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+ $v_extract = true;
+ }
+ if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+ $j_start = $j+1;
+ }
+
+ if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+ break;
+ }
+ }
+ } else {
+ // ----- Look for no rule, which means extract all the archive
+ $v_extract = true;
+ }
+
+ // ----- Check compression method
+ if (($v_extract) && (($v_header['compression'] != 8) && ($v_header['compression'] != 0))) {
+ $v_header['status'] = 'unsupported_compression';
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '".$v_header['stored_filename']."' is compressed by an unsupported compression method (".$v_header['compression'].") ");
+
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Check encrypted files
+ if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
+ $v_header['status'] = 'unsupported_encryption';
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
+ $this->privSwapBackMagicQuotes();
+
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for filename '".$v_header['stored_filename']."'");
+
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Look for real extraction
+ if (($v_extract) && ($v_header['status'] != 'ok')) {
+ $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]);
+ if ($v_result != 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+
+ $v_extract = false;
+ }
+
+ // ----- Look for real extraction
+ if ($v_extract) {
+ // ----- Go to the file position
+ @rewind($this->zip_fd);
+ if (@fseek($this->zip_fd, $v_header['offset'])) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for extraction as string
+ if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
+ $v_string = '';
+
+ // ----- Extracting the file
+ $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ return $v_result;
+ }
+
+ // ----- Set the file content
+ $p_file_list[$v_nb_extracted]['content'] = $v_string;
+
+ // ----- Next extracted file
+ $v_nb_extracted++;
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
+ // ----- Look for extraction in standard output
+ // ----- Extracting the file in standard output
+ $v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result;
+ }
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ } else {
+ // ----- Look for normal extraction
+ // ----- Extracting the file
+ $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options);
+ if ($v_result1 < 1) {
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+ return $v_result1;
+ }
+
+ // ----- Get the only interesting attributes
+ if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ return $v_result;
+ }
+
+ // ----- Look for user callback abort
+ if ($v_result1 == 2) {
+ break;
+ }
+ }
+ }
+ }
+
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $this->privSwapBackMagicQuotes();
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ //
+ // 1 : ... ?
+ // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
+ // --------------------------------------------------------------------------------
+ public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Read the file header
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ // ----- Look for all path to remove
+ if ($p_remove_all_path == true) {
+ // ----- Look for folder entry that not need to be extracted
+ if (($p_entry['external']&0x00000010)==0x00000010) {
+ $p_entry['status'] = "filtered";
+
+ return $v_result;
+ }
+
+ // ----- Get the basename of the path
+ $p_entry['filename'] = basename($p_entry['filename']);
+ } elseif ($p_remove_path != "") {
+ // ----- Look for path to remove
+ if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) {
+ // ----- Change the file status
+ $p_entry['status'] = "filtered";
+
+ // ----- Return
+ return $v_result;
+ }
+
+ $p_remove_path_size = strlen($p_remove_path);
+ if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) {
+ // ----- Remove the path
+ $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
+ }
+ }
+
+ // ----- Add the path
+ if ($p_path != '') {
+ $p_entry['filename'] = $p_path."/".$p_entry['filename'];
+ }
+
+ // ----- Check a base_dir_restriction
+ if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
+ $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']);
+ if ($v_inclusion == 0) {
+ PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '".$p_entry['filename']."' is outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
+
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ }
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+ // ----- Look for specific actions while the file exist
+ if (file_exists($p_entry['filename'])) {
+ // ----- Look if file is a directory
+ if (is_dir($p_entry['filename'])) {
+ // ----- Change the file status
+ $p_entry['status'] = "already_a_directory";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '".$p_entry['filename']."' is already used by an existing directory");
+ return PclZip::errorCode();
+ }
+ } elseif (!is_writeable($p_entry['filename'])) {
+ // ----- Look if file is write protected
+ // ----- Change the file status
+ $p_entry['status'] = "write_protected";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '".$p_entry['filename']."' exists and is write protected");
+ return PclZip::errorCode();
+ }
+ } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) {
+ // ----- Look if the extracted file is older
+ // ----- Change the file status
+ if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) {
+ } else {
+ $p_entry['status'] = "newer_exist";
+
+ // ----- Look for PCLZIP_OPT_STOP_ON_ERROR
+ // For historical reason first PclZip implementation does not stop
+ // when this kind of error occurs.
+ if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) {
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '".$p_entry['filename']."' exists and option PCLZIP_OPT_REPLACE_NEWER is not selected");
+ return PclZip::errorCode();
+ }
+ }
+ } else {
+ }
+ } else {
+ // ----- Check the directory availability and create it if necessary
+ if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/')) {
+ $v_dir_to_check = $p_entry['filename'];
+ } elseif (!strstr($p_entry['filename'], "/")) {
+ $v_dir_to_check = "";
+ } else {
+ $v_dir_to_check = dirname($p_entry['filename']);
+ }
+
+ if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
+ // ----- Change the file status
+ $p_entry['status'] = "path_creation_fail";
+
+ // ----- Return
+ //return $v_result;
+ $v_result = 1;
+ }
+ }
+ }
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010) == 0x00000010)) {
+ // ----- Look for not compressed file
+ if ($p_entry['compression'] == 0) {
+ // ----- Opening destination file
+ if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "write_error";
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ $v_size = $p_entry['compressed_size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($this->zip_fd, $v_read_size);
+ /* Try to speed up the code
+ $v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @fwrite($v_dest_file, $v_binary_data, $v_read_size);
+ */
+ @fwrite($v_dest_file, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Closing the destination file
+ fclose($v_dest_file);
+
+ // ----- Change the file mtime
+ touch($p_entry['filename'], $p_entry['mtime']);
+ } else {
+ // ----- TBC
+ // Need to be finished
+ if (($p_entry['flag'] & 1) == 1) {
+ PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \''.$p_entry['filename'].'\' is encrypted. Encrypted files are not supported.');
+ return PclZip::errorCode();
+ }
+
+ // ----- Look for using temporary file to unzip
+ if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) {
+ $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options);
+ if ($v_result < PCLZIP_ERR_NO_ERROR) {
+ return $v_result;
+ }
+ } else {
+ // ----- Look for extract in memory
+ // ----- Read the compressed file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ $v_file_content = @gzinflate($v_buffer);
+ unset($v_buffer);
+ if ($v_file_content === false) {
+ // ----- Change the file status
+ // TBC
+ $p_entry['status'] = "error";
+
+ return $v_result;
+ }
+
+ // ----- Opening destination file
+ if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "write_error";
+
+ return $v_result;
+ }
+
+ // ----- Write the uncompressed data
+ @fwrite($v_dest_file, $v_file_content, $p_entry['size']);
+ unset($v_file_content);
+
+ // ----- Closing the destination file
+ @fclose($v_dest_file);
+ }
+
+ // ----- Change the file mtime
+ @touch($p_entry['filename'], $p_entry['mtime']);
+ }
+
+ // ----- Look for chmod option
+ if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
+ // ----- Change the mode of the file
+ @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
+ }
+ }
+ }
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+ // ----- Look for post-extract callback
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFileUsingTempFile()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privExtractFileUsingTempFile(&$p_entry, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Creates a temporary file
+ $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
+ if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
+ fclose($v_file);
+ PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary write mode');
+ return PclZip::errorCode();
+ }
+
+ // ----- Write gz file format header
+ $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3));
+ @fwrite($v_dest_file, $v_binary_data, 10);
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ $v_size = $p_entry['compressed_size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($this->zip_fd, $v_read_size);
+ //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @fwrite($v_dest_file, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Write gz file format footer
+ $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']);
+ @fwrite($v_dest_file, $v_binary_data, 8);
+
+ // ----- Close the temporary file
+ @fclose($v_dest_file);
+
+ // ----- Opening destination file
+ if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
+ $p_entry['status'] = "write_error";
+ return $v_result;
+ }
+
+ // ----- Open the temporary gz file
+ if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) {
+ @fclose($v_dest_file);
+ $p_entry['status'] = "read_error";
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_gzip_temp_name.'\' in binary read mode');
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
+ $v_size = $p_entry['size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @gzread($v_src_file, $v_read_size);
+ //$v_binary_data = pack('a'.$v_read_size, $v_buffer);
+ @fwrite($v_dest_file, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+ @fclose($v_dest_file);
+ @gzclose($v_src_file);
+
+ // ----- Delete the temporary file
+ @unlink($v_gzip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFileInOutput()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privExtractFileInOutput(&$p_entry, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Read the file header
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+ return $v_result;
+ }
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ }
+
+ // ----- Trace
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+ // ----- Look for not compressed file
+ if ($p_entry['compressed_size'] == $p_entry['size']) {
+ // ----- Read the file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Send the file to the output
+ echo $v_buffer;
+ unset($v_buffer);
+ } else {
+ // ----- Read the compressed file in a buffer (one shot)
+ $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ $v_file_content = gzinflate($v_buffer);
+ unset($v_buffer);
+
+ // ----- Send the file to the output
+ echo $v_file_content;
+ unset($v_file_content);
+ }
+ }
+ }
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+ // ----- Look for post-extract callback
+
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+ }
+
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privExtractFileAsString()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options)
+ {
+ $v_result=1;
+
+ // ----- Read the file header
+ $v_header = array();
+ if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Check that the file header is coherent with $p_entry info
+ if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
+ // TBC
+ }
+
+ // ----- Look for pre-extract callback
+ if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header);
+ if ($v_result == 0) {
+ // ----- Change the file status
+ $p_entry['status'] = "skipped";
+ $v_result = 1;
+ }
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ // ----- This status is internal and will be changed in 'skipped'
+ $p_entry['status'] = "aborted";
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+
+ // ----- Update the informations
+ // Only some fields can be modified
+ $p_entry['filename'] = $v_local_header['filename'];
+ }
+
+ // ----- Look if extraction should be done
+ if ($p_entry['status'] == 'ok') {
+ // ----- Do the extraction (if not a folder)
+ if (!(($p_entry['external']&0x00000010)==0x00000010)) {
+ // ----- Look for not compressed file
+ // if ($p_entry['compressed_size'] == $p_entry['size'])
+ if ($p_entry['compression'] == 0) {
+ // ----- Reading the file
+ $p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
+ } else {
+ // ----- Reading the file
+ $v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
+
+ // ----- Decompress the file
+ if (($p_string = @gzinflate($v_data)) === false) {
+ // TBC
+ }
+ }
+ // ----- Trace
+ } else {
+ // TBC : error : can not extract a folder in a string
+ }
+ }
+
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
+ $p_entry['status'] = "skipped";
+ } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
+ // ----- Look for post-extract callback
+ // ----- Generate a local information
+ $v_local_header = array();
+ $this->privConvertHeader2FileInfo($p_entry, $v_local_header);
+
+ // ----- Swap the content to header
+ $v_local_header['content'] = $p_string;
+ $p_string = '';
+
+ // ----- Call the callback
+ // Here I do not use call_user_func() because I need to send a reference to the
+ // header.
+ // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
+ $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header);
+
+ // ----- Swap back the content to header
+ $p_string = $v_local_header['content'];
+ unset($v_local_header['content']);
+
+ // ----- Look for abort result
+ if ($v_result == 2) {
+ $v_result = PCLZIP_ERR_USER_ABORTED;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privReadFileHeader(&$p_header)
+ {
+ $v_result=1;
+
+ // ----- Read the 4 bytes signature
+ $v_binary_data = @fread($this->zip_fd, 4);
+ $v_data = unpack('Vid', $v_binary_data);
+
+ // ----- Check signature
+ if ($v_data['id'] != 0x04034b50) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the first 42 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 26);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 26) {
+ $p_header['filename'] = "";
+ $p_header['status'] = "invalid_header";
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
+
+ // ----- Get filename
+ $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
+
+ // ----- Get extra_fields
+ if ($v_data['extra_len'] != 0) {
+ $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
+ } else {
+ $p_header['extra'] = '';
+ }
+
+ // ----- Extract properties
+ $p_header['version_extracted'] = $v_data['version'];
+ $p_header['compression'] = $v_data['compression'];
+ $p_header['size'] = $v_data['size'];
+ $p_header['compressed_size'] = $v_data['compressed_size'];
+ $p_header['crc'] = $v_data['crc'];
+ $p_header['flag'] = $v_data['flag'];
+ $p_header['filename_len'] = $v_data['filename_len'];
+
+ // ----- Recuperate date in UNIX format
+ $p_header['mdate'] = $v_data['mdate'];
+ $p_header['mtime'] = $v_data['mtime'];
+ if ($p_header['mdate'] && $p_header['mtime']) {
+ // ----- Extract time
+ $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+ $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+ $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+ // ----- Extract date
+ $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+ $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+ $v_day = $p_header['mdate'] & 0x001F;
+
+ // ----- Get UNIX date format
+ $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+ } else {
+ $p_header['mtime'] = time();
+ }
+
+ // TBC
+ //for(reset($v_data); $key = key($v_data); next($v_data)) {
+ //}
+
+ // ----- Set the stored filename
+ $p_header['stored_filename'] = $p_header['filename'];
+
+ // ----- Set the status field
+ $p_header['status'] = "ok";
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadCentralFileHeader()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privReadCentralFileHeader(&$p_header)
+ {
+ $v_result = 1;
+
+ // ----- Read the 4 bytes signature
+ $v_binary_data = @fread($this->zip_fd, 4);
+ $v_data = unpack('Vid', $v_binary_data);
+
+ // ----- Check signature
+ if ($v_data['id'] != 0x02014b50) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the first 42 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 42);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 42) {
+ $p_header['filename'] = "";
+ $p_header['status'] = "invalid_header";
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
+
+ // ----- Get filename
+ if ($p_header['filename_len'] != 0) {
+ $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
+ } else {
+ $p_header['filename'] = '';
+ }
+
+ // ----- Get extra
+ if ($p_header['extra_len'] != 0) {
+ $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
+ } else {
+ $p_header['extra'] = '';
+ }
+
+ // ----- Get comment
+ if ($p_header['comment_len'] != 0) {
+ $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
+ } else {
+ $p_header['comment'] = '';
+ }
+
+ // ----- Extract properties
+
+ // ----- Recuperate date in UNIX format
+ //if ($p_header['mdate'] && $p_header['mtime'])
+ // TBC : bug : this was ignoring time with 0/0/0
+ if (1) {
+ // ----- Extract time
+ $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
+ $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
+ $v_seconde = ($p_header['mtime'] & 0x001F)*2;
+
+ // ----- Extract date
+ $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
+ $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
+ $v_day = $p_header['mdate'] & 0x001F;
+
+ // ----- Get UNIX date format
+ $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
+
+ } else {
+ $p_header['mtime'] = time();
+ }
+
+ // ----- Set the stored filename
+ $p_header['stored_filename'] = $p_header['filename'];
+
+ // ----- Set default status to ok
+ $p_header['status'] = 'ok';
+
+ // ----- Look if it is a directory
+ if (substr($p_header['filename'], -1) == '/') {
+ //$p_header['external'] = 0x41FF0010;
+ $p_header['external'] = 0x00000010;
+ }
+
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privCheckFileHeaders()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // 1 on success,
+ // 0 on error;
+ // --------------------------------------------------------------------------------
+ public function privCheckFileHeaders(&$p_local_header, &$p_central_header)
+ {
+ $v_result=1;
+
+ // ----- Check the static values
+ // TBC
+ if ($p_local_header['filename'] != $p_central_header['filename']) {
+ }
+ if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
+ }
+ if ($p_local_header['flag'] != $p_central_header['flag']) {
+ }
+ if ($p_local_header['compression'] != $p_central_header['compression']) {
+ }
+ if ($p_local_header['mtime'] != $p_central_header['mtime']) {
+ }
+ if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
+ }
+
+ // ----- Look for flag bit 3
+ if (($p_local_header['flag'] & 8) == 8) {
+ $p_local_header['size'] = $p_central_header['size'];
+ $p_local_header['compressed_size'] = $p_central_header['compressed_size'];
+ $p_local_header['crc'] = $p_central_header['crc'];
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privReadEndCentralDir()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privReadEndCentralDir(&$p_central_dir)
+ {
+ $v_result=1;
+
+ // ----- Go to the end of the zip file
+ $v_size = filesize($this->zipname);
+ @fseek($this->zip_fd, $v_size);
+ if (@ftell($this->zip_fd) != $v_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- First try : look if this is an archive with no commentaries (most of the time)
+ // in this case the end of central dir is at 22 bytes of the file end
+ $v_found = 0;
+ if ($v_size > 26) {
+ @fseek($this->zip_fd, $v_size-22);
+ if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read for bytes
+ $v_binary_data = @fread($this->zip_fd, 4);
+ $v_data = @unpack('Vid', $v_binary_data);
+
+ // ----- Check signature
+ if ($v_data['id'] == 0x06054b50) {
+ $v_found = 1;
+ }
+
+ $v_pos = ftell($this->zip_fd);
+ }
+
+ // ----- Go back to the maximum possible size of the Central Dir End Record
+ if (!$v_found) {
+ $v_maximum_size = 65557; // 0xFFFF + 22;
+ if ($v_maximum_size > $v_size) {
+ $v_maximum_size = $v_size;
+ }
+ @fseek($this->zip_fd, $v_size-$v_maximum_size);
+ if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read byte per byte in order to find the signature
+ $v_pos = ftell($this->zip_fd);
+ $v_bytes = 0x00000000;
+ while ($v_pos < $v_size) {
+ // ----- Read a byte
+ $v_byte = @fread($this->zip_fd, 1);
+
+ // ----- Add the byte
+ //$v_bytes = ($v_bytes << 8) | Ord($v_byte);
+ // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
+ // Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
+ $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
+
+ // ----- Compare the bytes
+ if ($v_bytes == 0x504b0506) {
+ $v_pos++;
+ break;
+ }
+
+ $v_pos++;
+ }
+
+ // ----- Look if not found end of central dir
+ if ($v_pos == $v_size) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Read the first 18 bytes of the header
+ $v_binary_data = fread($this->zip_fd, 18);
+
+ // ----- Look for invalid block size
+ if (strlen($v_binary_data) != 18) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Extract the values
+ $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
+
+ // ----- Check the global size
+ if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
+ // ----- Removed in release 2.2 see readme file
+ // The check of the file size is a little too strict.
+ // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
+ // While decrypted, zip has training 0 bytes
+ if (0) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive. Some trailing bytes exists after the archive.');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+ }
+
+ // ----- Get comment
+ if ($v_data['comment_size'] != 0) {
+ $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
+ } else {
+ $p_central_dir['comment'] = '';
+ }
+
+ $p_central_dir['entries'] = $v_data['entries'];
+ $p_central_dir['disk_entries'] = $v_data['disk_entries'];
+ $p_central_dir['offset'] = $v_data['offset'];
+ $p_central_dir['size'] = $v_data['size'];
+ $p_central_dir['disk'] = $v_data['disk'];
+ $p_central_dir['disk_start'] = $v_data['disk_start'];
+
+ // TBC
+ //for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
+ //}
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDeleteByRule()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privDeleteByRule(&$p_result_list, &$p_options)
+ {
+ $v_result=1;
+ $v_list_detail = array();
+
+ // ----- Open the zip file
+ if (($v_result=$this->privOpenFd('rb')) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ $this->privCloseFd();
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ @rewind($this->zip_fd);
+
+ // ----- Scan all the files
+ // ----- Start at beginning of Central Dir
+ $v_pos_entry = $v_central_dir['offset'];
+ @rewind($this->zip_fd);
+ if (@fseek($this->zip_fd, $v_pos_entry)) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read each entry
+ $v_header_list = array();
+ $j_start = 0;
+ for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++) {
+ // ----- Read the file header
+ $v_header_list[$v_nb_extracted] = array();
+ if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+
+ return $v_result;
+ }
+
+
+ // ----- Store the index
+ $v_header_list[$v_nb_extracted]['index'] = $i;
+
+ // ----- Look for the specific extract rules
+ $v_found = false;
+
+ // ----- Look for extract by name rule
+ if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
+ // ----- Look if the filename is in the list
+ for ($j=0; ($j strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ $v_found = true;
+ } elseif ((($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
+ $v_found = true;
+ }
+ } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
+ // ----- Look for a filename
+ $v_found = true;
+ }
+ }
+ } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
+ // ----- Look for extract by preg rule
+ if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
+ $v_found = true;
+ }
+ } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
+ // ----- Look for extract by index rule
+ // ----- Look if the index is in the list
+ for ($j=$j_start; ($j=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
+ $v_found = true;
+ }
+ if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
+ $j_start = $j+1;
+ }
+ if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
+ break;
+ }
+ }
+ } else {
+ $v_found = true;
+ }
+
+ // ----- Look for deletion
+ if ($v_found) {
+ unset($v_header_list[$v_nb_extracted]);
+ } else {
+ $v_nb_extracted++;
+ }
+ }
+
+ // ----- Look if something need to be deleted
+ if ($v_nb_extracted > 0) {
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Creates a temporary zip archive
+ $v_temp_zip = new PclZip($v_zip_temp_name);
+
+ // ----- Open the temporary zip file in write mode
+ if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
+ $this->privCloseFd();
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Look which file need to be kept
+ for ($i=0; $izip_fd);
+ if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Read the file header
+ $v_local_header = array();
+ if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Check that local file header is same as central file header
+ if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) {
+ // TBC
+ }
+ unset($v_local_header);
+
+ // ----- Write the file header
+ if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read/write the data block
+ if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
+ // ----- Close the zip file
+ $this->privCloseFd();
+ $v_temp_zip->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($v_temp_zip->zip_fd);
+
+ // ----- Re-Create the Central Dir files header
+ for ($i=0; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) {
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Transform the header to a 'usable' info
+ $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
+ }
+
+
+ // ----- Zip file comment
+ $v_comment = '';
+ if (isset($p_options[PCLZIP_OPT_COMMENT])) {
+ $v_comment = $p_options[PCLZIP_OPT_COMMENT];
+ }
+
+ // ----- Calculate the size of the central header
+ $v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
+
+ // ----- Create the central dir footer
+ if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
+ // ----- Reset the file list
+ unset($v_header_list);
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+ @unlink($v_zip_temp_name);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Close
+ $v_temp_zip->privCloseFd();
+ $this->privCloseFd();
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Destroy the temporary archive
+ unset($v_temp_zip);
+ } elseif ($v_central_dir['entries'] != 0) {
+ // ----- Remove every files : reset the file
+ $this->privCloseFd();
+
+ if (($v_result = $this->privOpenFd('wb')) != 1) {
+ return $v_result;
+ }
+
+ if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
+ return $v_result;
+ }
+
+ $this->privCloseFd();
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDirCheck()
+ // Description :
+ // Check if a directory exists, if not it creates it and all the parents directory
+ // which may be useful.
+ // Parameters :
+ // $p_dir : Directory path to check.
+ // Return Values :
+ // 1 : OK
+ // -1 : Unable to create directory
+ // --------------------------------------------------------------------------------
+ public function privDirCheck($p_dir, $p_is_dir = false)
+ {
+ $v_result = 1;
+
+ // ----- Remove the final '/'
+ if (($p_is_dir) && (substr($p_dir, -1)=='/')) {
+ $p_dir = substr($p_dir, 0, strlen($p_dir)-1);
+ }
+
+ // ----- Check the directory availability
+ if ((is_dir($p_dir)) || ($p_dir == "")) {
+ return 1;
+ }
+
+ // ----- Extract parent directory
+ $p_parent_dir = dirname($p_dir);
+
+ // ----- Just a check
+ if ($p_parent_dir != $p_dir) {
+ // ----- Look for parent directory
+ if ($p_parent_dir != "") {
+ if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) {
+ return $v_result;
+ }
+ }
+ }
+
+ // ----- Create the directory
+ if (!@mkdir($p_dir, 0777)) {
+ // ----- Error log
+ PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privMerge()
+ // Description :
+ // If $p_archive_to_add does not exist, the function exit with a success result.
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privMerge(&$p_archive_to_add)
+ {
+ $v_result=1;
+
+ // ----- Look if the archive_to_add exists
+ if (!is_file($p_archive_to_add->zipname)) {
+ // ----- Nothing to merge, so merge is a success
+ $v_result = 1;
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Look if the archive exists
+ if (!is_file($this->zipname)) {
+ // ----- Do a duplicate
+ $v_result = $this->privDuplicate($p_archive_to_add->zipname);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Open the zip file
+ if (($v_result=$this->privOpenFd('rb')) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir = array();
+ if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) {
+ $this->privCloseFd();
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ @rewind($this->zip_fd);
+
+ // ----- Open the archive_to_add file
+ if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1) {
+ $this->privCloseFd();
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Read the central directory informations
+ $v_central_dir_to_add = array();
+ if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ return $v_result;
+ }
+
+ // ----- Go to beginning of File
+ @rewind($p_archive_to_add->zip_fd);
+
+ // ----- Creates a temporay file
+ $v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
+
+ // ----- Open the temporary file in write mode
+ if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = $v_central_dir['offset'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Copy the files from the archive_to_add into the temporary file
+ $v_size = $v_central_dir_to_add['offset'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Store the offset of the central dir
+ $v_offset = @ftell($v_zip_temp_fd);
+
+ // ----- Copy the block of file headers from the old archive
+ $v_size = $v_central_dir['size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($this->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Copy the block of file headers from the archive_to_add
+ $v_size = $v_central_dir_to_add['size'];
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
+ @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Merge the file comments
+ $v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
+
+ // ----- Calculate the size of the (new) central header
+ $v_size = @ftell($v_zip_temp_fd)-$v_offset;
+
+ // ----- Swap the file descriptor
+ // Here is a trick : I swap the temporary fd with the zip fd, in order to use
+ // the following methods on the temporary fil and not the real archive fd
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Create the central dir footer
+ if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) {
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+ @fclose($v_zip_temp_fd);
+ $this->zip_fd = null;
+
+ // ----- Reset the file list
+ unset($v_header_list);
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Swap back the file descriptor
+ $v_swap = $this->zip_fd;
+ $this->zip_fd = $v_zip_temp_fd;
+ $v_zip_temp_fd = $v_swap;
+
+ // ----- Close
+ $this->privCloseFd();
+ $p_archive_to_add->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Delete the zip file
+ // TBC : I should test the result ...
+ @unlink($this->zipname);
+
+ // ----- Rename the temporary file
+ // TBC : I should test the result ...
+ //@rename($v_zip_temp_name, $this->zipname);
+ PclZipUtilRename($v_zip_temp_name, $this->zipname);
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDuplicate()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privDuplicate($p_archive_filename)
+ {
+ $v_result=1;
+
+ // ----- Look if the $p_archive_filename exists
+ if (!is_file($p_archive_filename)) {
+ // ----- Nothing to duplicate, so duplicate is a success.
+ $v_result = 1;
+
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Open the zip file
+ if (($v_result=$this->privOpenFd('wb')) != 1) {
+ // ----- Return
+ return $v_result;
+ }
+
+ // ----- Open the temporary file in write mode
+ if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) {
+ $this->privCloseFd();
+
+ PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
+
+ // ----- Return
+ return PclZip::errorCode();
+ }
+
+ // ----- Copy the files from the archive to the temporary file
+ // TBC : Here I should better append the file and go back to erase the central dir
+ $v_size = filesize($p_archive_filename);
+ while ($v_size != 0) {
+ $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = fread($v_zip_temp_fd, $v_read_size);
+ @fwrite($this->zip_fd, $v_buffer, $v_read_size);
+ $v_size -= $v_read_size;
+ }
+
+ // ----- Close
+ $this->privCloseFd();
+
+ // ----- Close the temporary file
+ @fclose($v_zip_temp_fd);
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privErrorLog()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function privErrorLog($p_error_code = 0, $p_error_string = '')
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ PclError($p_error_code, $p_error_string);
+ } else {
+ $this->error_code = $p_error_code;
+ $this->error_string = $p_error_string;
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privErrorReset()
+ // Description :
+ // Parameters :
+ // --------------------------------------------------------------------------------
+ public function privErrorReset()
+ {
+ if (PCLZIP_ERROR_EXTERNAL == 1) {
+ PclErrorReset();
+ } else {
+ $this->error_code = 0;
+ $this->error_string = '';
+ }
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privDisableMagicQuotes()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privDisableMagicQuotes()
+ {
+ $v_result=1;
+
+ // ----- Look if function exists
+ if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) {
+ return $v_result;
+ }
+
+ // ----- Look if already done
+ if ($this->magic_quotes_status != -1) {
+ return $v_result;
+ }
+
+ // ----- Get and memorize the magic_quote value
+ $this->magic_quotes_status = @get_magic_quotes_runtime();
+
+ // ----- Disable magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ @set_magic_quotes_runtime(0);
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------
+ // Function : privSwapBackMagicQuotes()
+ // Description :
+ // Parameters :
+ // Return Values :
+ // --------------------------------------------------------------------------------
+ public function privSwapBackMagicQuotes()
+ {
+ $v_result=1;
+
+ // ----- Look if function exists
+ if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) {
+ return $v_result;
+ }
+
+ // ----- Look if something to do
+ if ($this->magic_quotes_status != -1) {
+ return $v_result;
+ }
+
+ // ----- Swap back magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ @set_magic_quotes_runtime($this->magic_quotes_status);
+ }
+
+ // ----- Return
+ return $v_result;
+ }
+ // --------------------------------------------------------------------------------
+}
+// End of class
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilPathReduction()
+// Description :
+// Parameters :
+// Return Values :
+// --------------------------------------------------------------------------------
+function PclZipUtilPathReduction($p_dir)
+{
+ $v_result = "";
+
+ // ----- Look for not empty path
+ if ($p_dir != "") {
+ // ----- Explode path by directory names
+ $v_list = explode("/", $p_dir);
+
+ // ----- Study directories from last to first
+ $v_skip = 0;
+ for ($i=sizeof($v_list)-1; $i>=0; $i--) {
+ // ----- Look for current path
+ if ($v_list[$i] == ".") {
+ // ----- Ignore this directory
+ // Should be the first $i=0, but no check is done
+ } elseif ($v_list[$i] == "..") {
+ $v_skip++;
+ } elseif ($v_list[$i] == "") {
+ // ----- First '/' i.e. root slash
+ if ($i == 0) {
+ $v_result = "/".$v_result;
+ if ($v_skip > 0) {
+ // ----- It is an invalid path, so the path is not modified
+ // TBC
+ $v_result = $p_dir;
+ $v_skip = 0;
+ }
+ } elseif ($i == (sizeof($v_list)-1)) {
+ // ----- Last '/' i.e. indicates a directory
+ $v_result = $v_list[$i];
+ } else {
+ // ----- Double '/' inside the path
+ // ----- Ignore only the double '//' in path,
+ // but not the first and last '/'
+ }
+ } else {
+ // ----- Look for item to skip
+ if ($v_skip > 0) {
+ $v_skip--;
+ } else {
+ $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
+ }
+ }
+ }
+
+ // ----- Look for skip
+ if ($v_skip > 0) {
+ while ($v_skip > 0) {
+ $v_result = '../'.$v_result;
+ $v_skip--;
+ }
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+}
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilPathInclusion()
+// Description :
+// This function indicates if the path $p_path is under the $p_dir tree. Or,
+// said in an other way, if the file or sub-dir $p_path is inside the dir
+// $p_dir.
+// The function indicates also if the path is exactly the same as the dir.
+// This function supports path with duplicated '/' like '//', but does not
+// support '.' or '..' statements.
+// Parameters :
+// Return Values :
+// 0 if $p_path is not inside directory $p_dir
+// 1 if $p_path is inside directory $p_dir
+// 2 if $p_path is exactly the same as $p_dir
+// --------------------------------------------------------------------------------
+function PclZipUtilPathInclusion($p_dir, $p_path)
+{
+ $v_result = 1;
+
+ // ----- Look for path beginning by ./
+ if (($p_dir == '.') || ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
+ $p_dir = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_dir, 1);
+ }
+ if (($p_path == '.') || ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
+ $p_path = PclZipUtilTranslateWinPath(getcwd(), false).'/'.substr($p_path, 1);
+ }
+
+ // ----- Explode dir and path by directory separator
+ $v_list_dir = explode("/", $p_dir);
+ $v_list_dir_size = sizeof($v_list_dir);
+ $v_list_path = explode("/", $p_path);
+ $v_list_path_size = sizeof($v_list_path);
+
+ // ----- Study directories paths
+ $i = 0;
+ $j = 0;
+ while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
+ // ----- Look for empty dir (path reduction)
+ if ($v_list_dir[$i] == '') {
+ $i++;
+ continue;
+ }
+ if ($v_list_path[$j] == '') {
+ $j++;
+ continue;
+ }
+
+ // ----- Compare the items
+ if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) {
+ $v_result = 0;
+ }
+
+ // ----- Next items
+ $i++;
+ $j++;
+ }
+
+ // ----- Look if everything seems to be the same
+ if ($v_result) {
+ // ----- Skip all the empty items
+ while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) {
+ $j++;
+ }
+ while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) {
+ $i++;
+ }
+
+ if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
+ // ----- There are exactly the same
+ $v_result = 2;
+ } elseif ($i < $v_list_dir_size) {
+ // ----- The path is shorter than the dir
+ $v_result = 0;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+}
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilCopyBlock()
+// Description :
+// Parameters :
+// $p_mode : read/write compression mode
+// 0 : src & dest normal
+// 1 : src gzip, dest normal
+// 2 : src normal, dest gzip
+// 3 : src & dest gzip
+// Return Values :
+// --------------------------------------------------------------------------------
+function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0)
+{
+ $v_result = 1;
+
+ if ($p_mode==0) {
+ while ($p_size != 0) {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($p_src, $v_read_size);
+ @fwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ } elseif ($p_mode==1) {
+ while ($p_size != 0) {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @gzread($p_src, $v_read_size);
+ @fwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ } elseif ($p_mode==2) {
+ while ($p_size != 0) {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @fread($p_src, $v_read_size);
+ @gzwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ } elseif ($p_mode==3) {
+ while ($p_size != 0) {
+ $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
+ $v_buffer = @gzread($p_src, $v_read_size);
+ @gzwrite($p_dest, $v_buffer, $v_read_size);
+ $p_size -= $v_read_size;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+}
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilRename()
+// Description :
+// This function tries to do a simple rename() function. If it fails, it
+// tries to copy the $p_src file in a new $p_dest file and then unlink the
+// first one.
+// Parameters :
+// $p_src : Old filename
+// $p_dest : New filename
+// Return Values :
+// 1 on success, 0 on failure.
+// --------------------------------------------------------------------------------
+function PclZipUtilRename($p_src, $p_dest)
+{
+ $v_result = 1;
+
+ // ----- Try to rename the files
+ if (!@rename($p_src, $p_dest)) {
+ // ----- Try to copy & unlink the src
+ if (!@copy($p_src, $p_dest)) {
+ $v_result = 0;
+ } elseif (!@unlink($p_src)) {
+ $v_result = 0;
+ }
+ }
+
+ // ----- Return
+ return $v_result;
+}
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilOptionText()
+// Description :
+// Translate option value in text. Mainly for debug purpose.
+// Parameters :
+// $p_option : the option value.
+// Return Values :
+// The option text value.
+// --------------------------------------------------------------------------------
+function PclZipUtilOptionText($p_option)
+{
+ $v_list = get_defined_constants();
+ for (reset($v_list); $v_key = key($v_list); next($v_list)) {
+ $v_prefix = substr($v_key, 0, 10);
+ if ((($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) {
+ return $v_key;
+ }
+ }
+
+ $v_result = 'Unknown';
+
+ return $v_result;
+}
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// Function : PclZipUtilTranslateWinPath()
+// Description :
+// Translate windows path by replacing '\' by '/' and optionally removing
+// drive letter.
+// Parameters :
+// $p_path : path to translate.
+// $p_remove_disk_letter : true | false
+// Return Values :
+// The path translated.
+// --------------------------------------------------------------------------------
+function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true)
+{
+ if (stristr(php_uname(), 'windows')) {
+ // ----- Look for potential disk letter
+ if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
+ $p_path = substr($p_path, $v_position+1);
+ }
+ // ----- Change potential windows directory separator
+ if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) {
+ $p_path = strtr($p_path, '\\', '/');
+ }
+ }
+ return $p_path;
+}
diff --git a/Classes/PHPExcel/Shared/PCLZip/readme.txt b/Classes/PHPExcel/Shared/PCLZip/readme.txt
new file mode 100644
index 0000000..6ed8839
--- /dev/null
+++ b/Classes/PHPExcel/Shared/PCLZip/readme.txt
@@ -0,0 +1,421 @@
+// --------------------------------------------------------------------------------
+// PclZip 2.8.2 - readme.txt
+// --------------------------------------------------------------------------------
+// License GNU/LGPL - August 2009
+// Vincent Blavet - vincent@phpconcept.net
+// http://www.phpconcept.net
+// --------------------------------------------------------------------------------
+// $Id: readme.txt,v 1.60 2009/09/30 20:35:21 vblavet Exp $
+// --------------------------------------------------------------------------------
+
+
+
+0 - Sommaire
+============
+ 1 - Introduction
+ 2 - What's new
+ 3 - Corrected bugs
+ 4 - Known bugs or limitations
+ 5 - License
+ 6 - Warning
+ 7 - Documentation
+ 8 - Author
+ 9 - Contribute
+
+1 - Introduction
+================
+
+ PclZip is a library that allow you to manage a Zip archive.
+
+ Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip
+
+2 - What's new
+==============
+
+ Version 2.8.2 :
+ - PCLZIP_CB_PRE_EXTRACT and PCLZIP_CB_POST_EXTRACT are now supported with
+ extraction as a string (PCLZIP_OPT_EXTRACT_AS_STRING). The string
+ can also be modified in the post-extract call back.
+ **Bugs correction :
+ - PCLZIP_OPT_REMOVE_ALL_PATH was not working correctly
+ - Remove use of eval() and do direct call to callback functions
+ - Correct support of 64bits systems (Thanks to WordPress team)
+
+ Version 2.8.1 :
+ - Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is
+ deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will
+ automatically replace it by PCLZIP_OPT_BY_PREG.
+
+ Version 2.8 :
+ - Improve extraction of zip archive for large files by using temporary files
+ This feature is working like the one defined in r2.7.
+ Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF,
+ PCLZIP_OPT_TEMP_FILE_THRESHOLD
+ - Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto
+ sense of temporary file use.
+ - Bug correction : Reduce filepath in returned file list to remove ennoying
+ './/' preambule in file path.
+
+ Version 2.7 :
+ - Improve creation of zip archive for large files :
+ PclZip will now autosense the configured memory and use temporary files
+ when large file is suspected.
+ This feature can also ne triggered by manual options in create() and add()
+ methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files,
+ 'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic,
+ 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size
+ threshold to use temporary files.
+ Using "temporary files" rather than "memory" might take more time, but
+ might give the ability to zip very large files :
+ Tested on my win laptop with a 88Mo file :
+ Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo)
+ Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo)
+ - Replace use of mktime() by time() to limit the E_STRICT error messages.
+ - Bug correction : When adding files with full windows path (drive letter)
+ PclZip is now working. Before, if the drive letter is not the default
+ path, PclZip was not able to add the file.
+
+ Version 2.6 :
+ - Code optimisation
+ - New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to
+ add a comment for a specific file. (Don't really know if this is usefull)
+ - New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string
+ as a file.
+ - New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with
+ a file.
+ - Correct a bug. Files archived with a timestamp with 0h0m0s were extracted
+ with current time
+ - Add CRC value in the informations returned back for each file after an
+ action.
+ - Add missing closedir() statement.
+ - When adding a folder, and removing the path of this folder, files were
+ incorrectly added with a '/' at the beginning. Which means files are
+ related to root in unix systems. Corrected.
+ - Add conditional if before constant definition. This will allow users
+ to redefine constants without changing the file, and then improve
+ upgrade of pclzip code for new versions.
+
+ Version 2.5 :
+ - Introduce the ability to add file/folder with individual properties (file descriptor).
+ This gives for example the ability to change the filename of a zipped file.
+ . Able to add files individually
+ . Able to change full name
+ . Able to change short name
+ . Compatible with global options
+ - New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME
+ - New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE
+ - Add a security control feature. PclZip can extract any file in any folder
+ of a system. People may use this to upload a zip file and try to override
+ a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the
+ ability to forgive any directory transversal behavior.
+ - New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path
+ - New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION
+ - Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend
+ by current path (getcwd())
+
+ Version 2.4 :
+ - Code improvment : try to speed up the code by removing unusefull call to pack()
+ - Correct bug in delete() : delete() should be called with no argument. This was not
+ the case in 2.3. This is corrected in 2.4.
+ - Correct a bug in path_inclusion function. When the path has several '../../', the
+ result was bad.
+ - Add a check for magic_quotes_runtime configuration. If enabled, PclZip will
+ disable it while working and det it back to its original value.
+ This resolve a lots of bad formated archive errors.
+ - Bug correction : PclZip now correctly unzip file in some specific situation,
+ when compressed content has same size as uncompressed content.
+ - Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH',
+ directories are not any more created.
+ - Code improvment : correct unclosed opendir(), better handling of . and .. in
+ loops.
+
+
+ Version 2.3 :
+ - Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not
+ give the same result in PHP4 and PHP5 ....
+
+ Version 2.2 :
+ - Try development of PCLZIP_OPT_CRYPT .....
+ However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers,
+ the result (greater than a long) is not supported by PHP. Even the use of bcmath
+ functions does not help. I did not find yet a solution ...;
+ - Add missing '/' at end of directory entries
+ - Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or
+ error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION.
+ - Corrected : Bad "version need to extract" field in local file header
+ - Add private method privCheckFileHeaders() in order to check local and central
+ file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives
+ the ability to have a local file header without size, compressed size and crc filled.
+ - Add a generic status 'error' for file status
+ - Add control of compression type. PclZip only support deflate compression method.
+ Before v2.2, PclZip does not check the compression method used in an archive while
+ extracting. With v2.2 PclZip returns a new error status for a file using an unsupported
+ compression method. New status is "unsupported_compression". New error code is
+ PCLZIP_ERR_UNSUPPORTED_COMPRESSION.
+ - Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files
+ when errors like 'a folder with same name exists' or 'a newer file exists' or
+ 'a write protected file' exists, rather than set a status for the concerning file
+ and resume the extract of the zip.
+ - Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the
+ replacement of the file, even if a newer version of the file exists.
+ Note that today if a file with the same name already exists but is older it will be
+ replaced by the extracted one.
+ - Improve PclZipUtilOption()
+ - Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central
+ directory structure is the last data in the archive. Crypt encryption/decryption of
+ zip archive put trailing 0 bytes after decryption. PclZip is now supporting this.
+
+ Version 2.1 :
+ - Add the ability to abort the extraction by using a user callback function.
+ The user can now return the value '2' in its callback which indicates to stop the
+ extraction. For a pre call-back extract is stopped before the extration of the current
+ file. For a post call back, the extraction is stopped after.
+ - Add the ability to extract a file (or several files) directly in the standard output.
+ This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract().
+ - Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT,
+ PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments
+ in the zip archive.
+ - When merging two archives, the comments are not any more lost, but merged, with a
+ blank space separator.
+ - Corrected bug : Files are not deleted when all files are asked to be deleted.
+ - Corrected bug : Folders with name '0' made PclZip to abort the create or add feature.
+
+
+ Version 2.0 :
+ ***** Warning : Some new features may break the backward compatibility for your scripts.
+ Please carefully read the readme file.
+ - Add the ability to delete by Index, name and regular expression. This feature is
+ performed by the method delete(), which uses the optional parameters
+ PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG.
+ - Add the ability to extract by regular expression. To extract by regexp you must use the method
+ extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG
+ (depending if you want to use ereg() or preg_match() syntax) followed by the
+ regular expression pattern.
+ - Add the ability to extract by index, directly with the extract() method. This is a
+ code improvment of the extractByIndex() method.
+ - Add the ability to extract by name. To extract by name you must use the method
+ extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to
+ extract or an array of filenames to extract. To extract all a folder, use the folder
+ name rather than the filename with a '/' at the end.
+ - Add the ability to add files without compression. This is done with a new attribute
+ which is PCLZIP_OPT_NO_COMPRESSION.
+ - Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly
+ in a string without using any file (or temporary file).
+ - Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string.
+ The default separator is now a comma (,) and not any more a blank space.
+ THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with
+ your script.
+ - Improve algorythm performance by removing the use of temporary files when adding or
+ extracting files in an archive.
+ - Add (correct) detection of empty filename zipping. This can occurs when the removed
+ path is the same
+ as a zipped dir. The dir is not zipped (['status'] = filtered), only its content.
+ - Add better support for windows paths (thanks for help from manus@manusfreedom.com).
+ - Corrected bug : When the archive file already exists with size=0, the add() method
+ fails. Corrected in 2.0.
+ - Remove the use of OS_WINDOWS constant. Use php_uname() function rather.
+ - Control the order of index ranges in extract by index feature.
+ - Change the internal management of folders (better handling of internal flag).
+
+
+ Version 1.3 :
+ - Removing the double include check. This is now done by include_once() and require_once()
+ PHP directives.
+ - Changing the error handling mecanism : Remove the use of an external error library.
+ The former PclError...() functions are replaced by internal equivalent methods.
+ By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library.
+ Introducing the use of constants for error codes rather than integer values. This will help
+ in futur improvment.
+ Introduction of error handling functions like errorCode(), errorName() and errorInfo().
+ - Remove the deprecated use of calling function with arguments passed by reference.
+ - Add the calling of extract(), extractByIndex(), create() and add() functions
+ with variable options rather than fixed arguments.
+ - Add the ability to remove all the file path while extracting or adding,
+ without any need to specify the path to remove.
+ This is available for extract(), extractByIndex(), create() and add() functionS by using
+ the new variable options parameters :
+ - PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct.
+ - Ability to change the mode of a file after the extraction (chmod()).
+ This is available for extract() and extractByIndex() functionS by using
+ the new variable options parameters.
+ - PCLZIP_OPT_SET_CHMOD : by setting the value of this option.
+ - Ability to definition call-back options. These call-back will be called during the adding,
+ or the extracting of file (extract(), extractByIndex(), create() and add() functions) :
+ - PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user
+ can trigerred the change the filename of the extracted file. The user can triggered the
+ skip of the extraction. This is adding a 'skipped' status in the file list result value.
+ - PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file.
+ Nothing can be triggered from that point.
+ - PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user
+ can trigerred the change the stored filename of the added file. The user can triggered the
+ skip of the add. This is adding a 'skipped' status in the file list result value.
+ - PCLZIP_CB_POST_ADD : will be called after each add of a file.
+ Nothing can be triggered from that point.
+ - Two status are added in the file list returned as function result : skipped & filename_too_long
+ 'skipped' is used when a call-back function ask for skipping the file.
+ 'filename_too_long' is used while adding a file with a too long filename to archive (the file is
+ not added)
+ - Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into
+ a directory.
+ - Add a check of the presence of the archive file before some actions (like list, ...)
+ - Add the initialisation of field "index" in header array. This means that by
+ default index will be -1 when not explicitly set by the methods.
+
+ Version 1.2 :
+ - Adding a duplicate function.
+ - Adding a merge function. The merge function is a "quick merge" function,
+ it just append the content of an archive at the end of the first one. There
+ is no check for duplicate files or more recent files.
+ - Improve the search of the central directory end.
+
+ Version 1.1.2 :
+
+ - Changing the license of PclZip. PclZip is now released under the GNU / LGPL license
+ (see License section).
+ - Adding the optional support of a static temporary directory. You will need to configure
+ the constant PCLZIP_TEMPORARY_DIR if you want to use this feature.
+ - Improving the rename() function. In some cases rename() does not work (different
+ Filesystems), so it will be replaced by a copy() + unlink() functions.
+
+ Version 1.1.1 :
+
+ - Maintenance release, no new feature.
+
+ Version 1.1 :
+
+ - New method Add() : adding files in the archive
+ - New method ExtractByIndex() : partial extract of the archive, files are identified by
+ their index in the archive
+ - New method DeleteByIndex() : delete some files/folder entries from the archive,
+ files are identified by their index in the archive.
+ - Adding a test of the zlib extension presence. If not present abort the script.
+
+ Version 1.0.1 :
+
+ - No new feature
+
+
+3 - Corrected bugs
+==================
+
+ Corrected in Version 2.0 :
+ - Corrected : During an extraction, if a call-back fucntion is used and try to skip
+ a file, all the extraction process is stopped.
+
+ Corrected in Version 1.3 :
+ - Corrected : Support of static synopsis for method extract() is broken.
+ - Corrected : invalid size of archive content field (0xFF) should be (0xFFFF).
+ - Corrected : When an extract is done with a remove_path parameter, the entry for
+ the directory with exactly the same path is not skipped/filtered.
+ - Corrected : extractByIndex() and deleteByIndex() were not managing index in the
+ right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This
+ is due to a sort of the index resulting table that puts 11 before 3-5 (sort on
+ string and not interger). The sort is temporarilly removed, this means that
+ you must provide a sorted list of index ranges.
+
+ Corrected in Version 1.2 :
+
+ - Nothing.
+
+ Corrected in Version 1.1.2 :
+
+ - Corrected : Winzip is unable to delete or add new files in a PclZip created archives.
+
+ Corrected in Version 1.1.1 :
+
+ - Corrected : When archived file is not compressed (0% compression), the
+ extract method fails.
+
+ Corrected in Version 1.1 :
+
+ - Corrected : Adding a complete tree of folder may result in a bad archive
+ creation.
+
+ Corrected in Version 1.0.1 :
+
+ - Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
+
+
+4 - Known bugs or limitations
+=============================
+
+ Please publish bugs reports in SourceForge :
+ http://sourceforge.net/tracker/?group_id=40254&atid=427564
+
+ In Version 2.x :
+ - PclZip does only support file uncompressed or compressed with deflate (compression method 8)
+ - PclZip does not support password protected zip archive
+ - Some concern were seen when changing mtime of a file while archiving.
+ Seems to be linked to Daylight Saving Time (PclTest_changing_mtime).
+
+ In Version 1.2 :
+
+ - merge() methods does not check for duplicate files or last date of modifications.
+
+ In Version 1.1 :
+
+ - Limitation : Using 'extract' fields in the file header in the zip archive is not supported.
+ - WinZip is unable to delete a single file in a PclZip created archive. It is also unable to
+ add a file in a PclZip created archive. (Corrected in v.1.2)
+
+ In Version 1.0.1 :
+
+ - Adding a complete tree of folder may result in a bad archive
+ creation. (Corrected in V.1.1).
+ - Path given to methods must be in the unix format (/) and not the Windows format (\).
+ Workaround : Use only / directory separators.
+ - PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz
+ added suffix. Files with these names may already exist and may be overwritten.
+ Workaround : none.
+ - PclZip does not check if the zlib extension is present. If it is absent, the zip
+ file is not created and the lib abort without warning.
+ Workaround : enable the zlib extension on the php install
+
+ In Version 1.0 :
+
+ - Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024).
+ (Corrected in v.1.0.1)
+ - Limitation : Multi-disk zip archive are not supported.
+
+
+5 - License
+===========
+
+ Since version 1.1.2, PclZip Library is released under GNU/LGPL license.
+ This library is free, so you can use it at no cost.
+
+ HOWEVER, if you release a script, an application, a library or any kind of
+ code using PclZip library (or a part of it), YOU MUST :
+ - Indicate in the documentation (or a readme file), that your work
+ uses PclZip Library, and make a reference to the author and the web site
+ http://www.phpconcept.net
+ - Gives the ability to the final user to update the PclZip libary.
+
+ I will also appreciate that you send me a mail (vincent@phpconcept.net), just to
+ be aware that someone is using PclZip.
+
+ For more information about GNU/LGPL license : http://www.gnu.org
+
+6 - Warning
+=================
+
+ This library and the associated files are non commercial, non professional work.
+ It should not have unexpected results. However if any damage is caused by this software
+ the author can not be responsible.
+ The use of this software is at the risk of the user.
+
+7 - Documentation
+=================
+ PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php
+ A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/
+
+8 - Author
+==========
+
+ This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time.
+
+9 - Contribute
+==============
+ If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net.
+ If you can help in financing PhpConcept hosting service, please go to
+ http://www.phpconcept.net/soutien.php
diff --git a/Classes/PHPExcel/Shared/PasswordHasher.php b/Classes/PHPExcel/Shared/PasswordHasher.php
new file mode 100644
index 0000000..946742b
--- /dev/null
+++ b/Classes/PHPExcel/Shared/PasswordHasher.php
@@ -0,0 +1,67 @@
+.
+ *
+ * @param string $pPassword Password to hash
+ * @return string Hashed password
+ */
+ public static function hashPassword($pPassword = '')
+ {
+ $password = 0x0000;
+ $charPos = 1; // char position
+
+ // split the plain text password in its component characters
+ $chars = preg_split('//', $pPassword, -1, PREG_SPLIT_NO_EMPTY);
+ foreach ($chars as $char) {
+ $value = ord($char) << $charPos++; // shifted ASCII value
+ $rotated_bits = $value >> 15; // rotated bits beyond bit 15
+ $value &= 0x7fff; // first 15 bits
+ $password ^= ($value | $rotated_bits);
+ }
+
+ $password ^= strlen($pPassword);
+ $password ^= 0xCE4B;
+
+ return(strtoupper(dechex($password)));
+ }
+}
diff --git a/Classes/PHPExcel/Shared/String.php b/Classes/PHPExcel/Shared/String.php
new file mode 100644
index 0000000..10e38d2
--- /dev/null
+++ b/Classes/PHPExcel/Shared/String.php
@@ -0,0 +1,819 @@
+ chr(0),
+ "\x1B 1" => chr(1),
+ "\x1B 2" => chr(2),
+ "\x1B 3" => chr(3),
+ "\x1B 4" => chr(4),
+ "\x1B 5" => chr(5),
+ "\x1B 6" => chr(6),
+ "\x1B 7" => chr(7),
+ "\x1B 8" => chr(8),
+ "\x1B 9" => chr(9),
+ "\x1B :" => chr(10),
+ "\x1B ;" => chr(11),
+ "\x1B <" => chr(12),
+ "\x1B :" => chr(13),
+ "\x1B >" => chr(14),
+ "\x1B ?" => chr(15),
+ "\x1B!0" => chr(16),
+ "\x1B!1" => chr(17),
+ "\x1B!2" => chr(18),
+ "\x1B!3" => chr(19),
+ "\x1B!4" => chr(20),
+ "\x1B!5" => chr(21),
+ "\x1B!6" => chr(22),
+ "\x1B!7" => chr(23),
+ "\x1B!8" => chr(24),
+ "\x1B!9" => chr(25),
+ "\x1B!:" => chr(26),
+ "\x1B!;" => chr(27),
+ "\x1B!<" => chr(28),
+ "\x1B!=" => chr(29),
+ "\x1B!>" => chr(30),
+ "\x1B!?" => chr(31),
+ "\x1B'?" => chr(127),
+ "\x1B(0" => '€', // 128 in CP1252
+ "\x1B(2" => '‚', // 130 in CP1252
+ "\x1B(3" => 'Æ’', // 131 in CP1252
+ "\x1B(4" => '„', // 132 in CP1252
+ "\x1B(5" => '…', // 133 in CP1252
+ "\x1B(6" => '†', // 134 in CP1252
+ "\x1B(7" => '‡', // 135 in CP1252
+ "\x1B(8" => 'ˆ', // 136 in CP1252
+ "\x1B(9" => '‰', // 137 in CP1252
+ "\x1B(:" => 'Å ', // 138 in CP1252
+ "\x1B(;" => '‹', // 139 in CP1252
+ "\x1BNj" => 'Å’', // 140 in CP1252
+ "\x1B(>" => 'Ž', // 142 in CP1252
+ "\x1B)1" => '‘', // 145 in CP1252
+ "\x1B)2" => '’', // 146 in CP1252
+ "\x1B)3" => '“', // 147 in CP1252
+ "\x1B)4" => 'â€', // 148 in CP1252
+ "\x1B)5" => '•', // 149 in CP1252
+ "\x1B)6" => '–', // 150 in CP1252
+ "\x1B)7" => '—', // 151 in CP1252
+ "\x1B)8" => '˜', // 152 in CP1252
+ "\x1B)9" => 'â„¢', // 153 in CP1252
+ "\x1B):" => 'Å¡', // 154 in CP1252
+ "\x1B);" => '›', // 155 in CP1252
+ "\x1BNz" => 'Å“', // 156 in CP1252
+ "\x1B)>" => 'ž', // 158 in CP1252
+ "\x1B)?" => 'Ÿ', // 159 in CP1252
+ "\x1B*0" => 'Â ', // 160 in CP1252
+ "\x1BN!" => '¡', // 161 in CP1252
+ "\x1BN\"" => '¢', // 162 in CP1252
+ "\x1BN#" => '£', // 163 in CP1252
+ "\x1BN(" => '¤', // 164 in CP1252
+ "\x1BN%" => 'Â¥', // 165 in CP1252
+ "\x1B*6" => '¦', // 166 in CP1252
+ "\x1BN'" => '§', // 167 in CP1252
+ "\x1BNH " => '¨', // 168 in CP1252
+ "\x1BNS" => '©', // 169 in CP1252
+ "\x1BNc" => 'ª', // 170 in CP1252
+ "\x1BN+" => '«', // 171 in CP1252
+ "\x1B*<" => '¬', // 172 in CP1252
+ "\x1B*=" => 'Â', // 173 in CP1252
+ "\x1BNR" => '®', // 174 in CP1252
+ "\x1B*?" => '¯', // 175 in CP1252
+ "\x1BN0" => '°', // 176 in CP1252
+ "\x1BN1" => '±', // 177 in CP1252
+ "\x1BN2" => '²', // 178 in CP1252
+ "\x1BN3" => '³', // 179 in CP1252
+ "\x1BNB " => '´', // 180 in CP1252
+ "\x1BN5" => 'µ', // 181 in CP1252
+ "\x1BN6" => '¶', // 182 in CP1252
+ "\x1BN7" => '·', // 183 in CP1252
+ "\x1B+8" => '¸', // 184 in CP1252
+ "\x1BNQ" => '¹', // 185 in CP1252
+ "\x1BNk" => 'º', // 186 in CP1252
+ "\x1BN;" => '»', // 187 in CP1252
+ "\x1BN<" => '¼', // 188 in CP1252
+ "\x1BN=" => '½', // 189 in CP1252
+ "\x1BN>" => '¾', // 190 in CP1252
+ "\x1BN?" => '¿', // 191 in CP1252
+ "\x1BNAA" => 'À', // 192 in CP1252
+ "\x1BNBA" => 'Ã', // 193 in CP1252
+ "\x1BNCA" => 'Â', // 194 in CP1252
+ "\x1BNDA" => 'Ã', // 195 in CP1252
+ "\x1BNHA" => 'Ä', // 196 in CP1252
+ "\x1BNJA" => 'Ã…', // 197 in CP1252
+ "\x1BNa" => 'Æ', // 198 in CP1252
+ "\x1BNKC" => 'Ç', // 199 in CP1252
+ "\x1BNAE" => 'È', // 200 in CP1252
+ "\x1BNBE" => 'É', // 201 in CP1252
+ "\x1BNCE" => 'Ê', // 202 in CP1252
+ "\x1BNHE" => 'Ë', // 203 in CP1252
+ "\x1BNAI" => 'Ì', // 204 in CP1252
+ "\x1BNBI" => 'Ã', // 205 in CP1252
+ "\x1BNCI" => 'ÃŽ', // 206 in CP1252
+ "\x1BNHI" => 'Ã', // 207 in CP1252
+ "\x1BNb" => 'Ã', // 208 in CP1252
+ "\x1BNDN" => 'Ñ', // 209 in CP1252
+ "\x1BNAO" => 'Ã’', // 210 in CP1252
+ "\x1BNBO" => 'Ó', // 211 in CP1252
+ "\x1BNCO" => 'Ô', // 212 in CP1252
+ "\x1BNDO" => 'Õ', // 213 in CP1252
+ "\x1BNHO" => 'Ö', // 214 in CP1252
+ "\x1B-7" => '×', // 215 in CP1252
+ "\x1BNi" => 'Ø', // 216 in CP1252
+ "\x1BNAU" => 'Ù', // 217 in CP1252
+ "\x1BNBU" => 'Ú', // 218 in CP1252
+ "\x1BNCU" => 'Û', // 219 in CP1252
+ "\x1BNHU" => 'Ü', // 220 in CP1252
+ "\x1B-=" => 'Ã', // 221 in CP1252
+ "\x1BNl" => 'Þ', // 222 in CP1252
+ "\x1BN{" => 'ß', // 223 in CP1252
+ "\x1BNAa" => 'Ã ', // 224 in CP1252
+ "\x1BNBa" => 'á', // 225 in CP1252
+ "\x1BNCa" => 'â', // 226 in CP1252
+ "\x1BNDa" => 'ã', // 227 in CP1252
+ "\x1BNHa" => 'ä', // 228 in CP1252
+ "\x1BNJa" => 'Ã¥', // 229 in CP1252
+ "\x1BNq" => 'æ', // 230 in CP1252
+ "\x1BNKc" => 'ç', // 231 in CP1252
+ "\x1BNAe" => 'è', // 232 in CP1252
+ "\x1BNBe" => 'é', // 233 in CP1252
+ "\x1BNCe" => 'ê', // 234 in CP1252
+ "\x1BNHe" => 'ë', // 235 in CP1252
+ "\x1BNAi" => 'ì', // 236 in CP1252
+ "\x1BNBi" => 'Ã', // 237 in CP1252
+ "\x1BNCi" => 'î', // 238 in CP1252
+ "\x1BNHi" => 'ï', // 239 in CP1252
+ "\x1BNs" => 'ð', // 240 in CP1252
+ "\x1BNDn" => 'ñ', // 241 in CP1252
+ "\x1BNAo" => 'ò', // 242 in CP1252
+ "\x1BNBo" => 'ó', // 243 in CP1252
+ "\x1BNCo" => 'ô', // 244 in CP1252
+ "\x1BNDo" => 'õ', // 245 in CP1252
+ "\x1BNHo" => 'ö', // 246 in CP1252
+ "\x1B/7" => '÷', // 247 in CP1252
+ "\x1BNy" => 'ø', // 248 in CP1252
+ "\x1BNAu" => 'ù', // 249 in CP1252
+ "\x1BNBu" => 'ú', // 250 in CP1252
+ "\x1BNCu" => 'û', // 251 in CP1252
+ "\x1BNHu" => 'ü', // 252 in CP1252
+ "\x1B/=" => 'ý', // 253 in CP1252
+ "\x1BN|" => 'þ', // 254 in CP1252
+ "\x1BNHy" => 'ÿ', // 255 in CP1252
+ );
+ }
+
+ /**
+ * Get whether mbstring extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsMbstringEnabled()
+ {
+ if (isset(self::$isMbstringEnabled)) {
+ return self::$isMbstringEnabled;
+ }
+
+ self::$isMbstringEnabled = function_exists('mb_convert_encoding') ?
+ true : false;
+
+ return self::$isMbstringEnabled;
+ }
+
+ /**
+ * Get whether iconv extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsIconvEnabled()
+ {
+ if (isset(self::$isIconvEnabled)) {
+ return self::$isIconvEnabled;
+ }
+
+ // Fail if iconv doesn't exist
+ if (!function_exists('iconv')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
+ if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
+ // we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
+ if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // CUSTOM: IBM AIX iconv() does not work
+ if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // If we reach here no problems were detected with iconv
+ self::$isIconvEnabled = true;
+ return true;
+ }
+
+ public static function buildCharacterSets()
+ {
+ if (empty(self::$controlCharacters)) {
+ self::buildControlCharacters();
+ }
+ if (empty(self::$SYLKCharacters)) {
+ self::buildSYLKCharacters();
+ }
+ }
+
+ /**
+ * Convert from OpenXML escaped control character to PHP control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value ()
+ * element or in the shared string element.
+ *
+ * @param string $value Value to unescape
+ * @return string
+ */
+ public static function ControlCharacterOOXML2PHP($value = '')
+ {
+ return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
+ }
+
+ /**
+ * Convert from PHP control character to OpenXML escaped control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value ()
+ * element or in the shared string element.
+ *
+ * @param string $value Value to escape
+ * @return string
+ */
+ public static function ControlCharacterPHP2OOXML($value = '')
+ {
+ return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
+ }
+
+ /**
+ * Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.
+ *
+ * @param string $value
+ * @return string
+ */
+ public static function SanitizeUTF8($value)
+ {
+ if (self::getIsIconvEnabled()) {
+ $value = @iconv('UTF-8', 'UTF-8', $value);
+ return $value;
+ }
+
+ if (self::getIsMbstringEnabled()) {
+ $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
+ return $value;
+ }
+
+ // else, no conversion
+ return $value;
+ }
+
+ /**
+ * Check if a string contains UTF8 data
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public static function IsUTF8($value = '')
+ {
+ return $value === '' || preg_match('/^./su', $value) === 1;
+ }
+
+ /**
+ * Formats a numeric value as a string for output in various output writers forcing
+ * point as decimal separator in case locale is other than English.
+ *
+ * @param mixed $value
+ * @return string
+ */
+ public static function FormatNumber($value)
+ {
+ if (is_float($value)) {
+ return str_replace(',', '.', $value);
+ }
+ return (string) $value;
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @param mixed[] $arrcRuns Details of rich text runs in $value
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+ // option flags
+ if (empty($arrcRuns)) {
+ $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
+ 0x0001 : 0x0000;
+ $data = pack('CC', $ln, $opt);
+ // characters
+ $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+ } else {
+ $data = pack('vC', $ln, 0x09);
+ $data .= pack('v', count($arrcRuns));
+ // characters
+ $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+ foreach ($arrcRuns as $cRun) {
+ $data .= pack('v', $cRun['strlen']);
+ $data .= pack('v', $cRun['fontidx']);
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeLong($value)
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+
+ // option flags
+ $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
+ 0x0001 : 0x0000;
+
+ // characters
+ $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+
+ $data = pack('vC', $ln, $opt) . $chars;
+ return $data;
+ }
+
+ /**
+ * Convert string from one encoding to another. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $value
+ * @param string $to Encoding to convert to, e.g. 'UTF-8'
+ * @param string $from Encoding to convert from, e.g. 'UTF-16LE'
+ * @return string
+ */
+ public static function ConvertEncoding($value, $to, $from)
+ {
+ if (self::getIsIconvEnabled()) {
+ return iconv($from, $to, $value);
+ }
+
+ if (self::getIsMbstringEnabled()) {
+ return mb_convert_encoding($value, $to, $from);
+ }
+
+ if ($from == 'UTF-16LE') {
+ return self::utf16_decode($value, false);
+ } elseif ($from == 'UTF-16BE') {
+ return self::utf16_decode($value);
+ }
+ // else, no conversion
+ return $value;
+ }
+
+ /**
+ * Decode UTF-16 encoded strings.
+ *
+ * Can handle both BOM'ed data and un-BOM'ed data.
+ * Assumes Big-Endian byte order if no BOM is available.
+ * This function was taken from http://php.net/manual/en/function.utf8-decode.php
+ * and $bom_be parameter added.
+ *
+ * @param string $str UTF-16 encoded data to decode.
+ * @return string UTF-8 / ISO encoded data.
+ * @access public
+ * @version 0.2 / 2010-05-13
+ * @author Rasmus Andersson {@link http://rasmusandersson.se/}
+ * @author vadik56
+ */
+ public static function utf16_decode($str, $bom_be = true)
+ {
+ if (strlen($str) < 2) {
+ return $str;
+ }
+ $c0 = ord($str[0]);
+ $c1 = ord($str[1]);
+ if ($c0 == 0xfe && $c1 == 0xff) {
+ $str = substr($str, 2);
+ } elseif ($c0 == 0xff && $c1 == 0xfe) {
+ $str = substr($str, 2);
+ $bom_be = false;
+ }
+ $len = strlen($str);
+ $newstr = '';
+ for ($i=0; $i<$len; $i+=2) {
+ if ($bom_be) {
+ $val = ord($str[$i]) << 4;
+ $val += ord($str[$i+1]);
+ } else {
+ $val = ord($str[$i+1]) << 4;
+ $val += ord($str[$i]);
+ }
+ $newstr .= ($val == 0x228) ? "\n" : chr($val);
+ }
+ return $newstr;
+ }
+
+ /**
+ * Get character count. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $value
+ * @param string $enc Encoding
+ * @return int Character count
+ */
+ public static function CountCharacters($value, $enc = 'UTF-8')
+ {
+ if (self::getIsMbstringEnabled()) {
+ return mb_strlen($value, $enc);
+ }
+
+ if (self::getIsIconvEnabled()) {
+ return iconv_strlen($value, $enc);
+ }
+
+ // else strlen
+ return strlen($value);
+ }
+
+ /**
+ * Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @param int $pStart Start offset
+ * @param int $pLength Maximum number of characters in substring
+ * @return string
+ */
+ public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
+ {
+ if (self::getIsMbstringEnabled()) {
+ return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
+ }
+
+ if (self::getIsIconvEnabled()) {
+ return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
+ }
+
+ // else substr
+ return substr($pValue, $pStart, $pLength);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to upper case
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToUpper($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
+ }
+ return strtoupper($pValue);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to lower case
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToLower($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
+ }
+ return strtolower($pValue);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to title/proper case
+ * (uppercase every first character in each word, lower case all other characters)
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToTitle($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8");
+ }
+ return ucwords($pValue);
+ }
+
+ public static function mb_is_upper($char)
+ {
+ return mb_strtolower($char, "UTF-8") != $char;
+ }
+
+ public static function mb_str_split($string)
+ {
+ # Split at all position not after the start: ^
+ # and not before the end: $
+ return preg_split('/(?_calculateFormulaValue($fractionFormula);
+ return true;
+ }
+ return false;
+ } // function convertToNumberIfFraction()
+
+ /**
+ * Get the decimal separator. If it has not yet been set explicitly, try to obtain number
+ * formatting information from locale.
+ *
+ * @return string
+ */
+ public static function getDecimalSeparator()
+ {
+ if (!isset(self::$decimalSeparator)) {
+ $localeconv = localeconv();
+ self::$decimalSeparator = ($localeconv['decimal_point'] != '')
+ ? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
+
+ if (self::$decimalSeparator == '') {
+ // Default to .
+ self::$decimalSeparator = '.';
+ }
+ }
+ return self::$decimalSeparator;
+ }
+
+ /**
+ * Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for decimal separator
+ */
+ public static function setDecimalSeparator($pValue = '.')
+ {
+ self::$decimalSeparator = $pValue;
+ }
+
+ /**
+ * Get the thousands separator. If it has not yet been set explicitly, try to obtain number
+ * formatting information from locale.
+ *
+ * @return string
+ */
+ public static function getThousandsSeparator()
+ {
+ if (!isset(self::$thousandsSeparator)) {
+ $localeconv = localeconv();
+ self::$thousandsSeparator = ($localeconv['thousands_sep'] != '')
+ ? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
+
+ if (self::$thousandsSeparator == '') {
+ // Default to .
+ self::$thousandsSeparator = ',';
+ }
+ }
+ return self::$thousandsSeparator;
+ }
+
+ /**
+ * Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for thousands separator
+ */
+ public static function setThousandsSeparator($pValue = ',')
+ {
+ self::$thousandsSeparator = $pValue;
+ }
+
+ /**
+ * Get the currency code. If it has not yet been set explicitly, try to obtain the
+ * symbol information from locale.
+ *
+ * @return string
+ */
+ public static function getCurrencyCode()
+ {
+ if (!isset(self::$currencyCode)) {
+ $localeconv = localeconv();
+ self::$currencyCode = ($localeconv['currency_symbol'] != '')
+ ? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
+
+ if (self::$currencyCode == '') {
+ // Default to $
+ self::$currencyCode = '$';
+ }
+ }
+ return self::$currencyCode;
+ }
+
+ /**
+ * Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for currency code
+ */
+ public static function setCurrencyCode($pValue = '$')
+ {
+ self::$currencyCode = $pValue;
+ }
+
+ /**
+ * Convert SYLK encoded string to UTF-8
+ *
+ * @param string $pValue
+ * @return string UTF-8 encoded string
+ */
+ public static function SYLKtoUTF8($pValue = '')
+ {
+ // If there is no escape character in the string there is nothing to do
+ if (strpos($pValue, '') === false) {
+ return $pValue;
+ }
+
+ foreach (self::$SYLKCharacters as $k => $v) {
+ $pValue = str_replace($k, $v, $pValue);
+ }
+
+ return $pValue;
+ }
+
+ /**
+ * Retrieve any leading numeric part of a string, or return the full string if no leading numeric
+ * (handles basic integer or float, but not exponent or non decimal)
+ *
+ * @param string $value
+ * @return mixed string or only the leading numeric part of the string
+ */
+ public static function testStringAsNumeric($value)
+ {
+ if (is_numeric($value)) {
+ return $value;
+ }
+ $v = floatval($value);
+ return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/String.php.bk-aleluya b/Classes/PHPExcel/Shared/String.php.bk-aleluya
new file mode 100644
index 0000000..10e38d2
--- /dev/null
+++ b/Classes/PHPExcel/Shared/String.php.bk-aleluya
@@ -0,0 +1,819 @@
+ chr(0),
+ "\x1B 1" => chr(1),
+ "\x1B 2" => chr(2),
+ "\x1B 3" => chr(3),
+ "\x1B 4" => chr(4),
+ "\x1B 5" => chr(5),
+ "\x1B 6" => chr(6),
+ "\x1B 7" => chr(7),
+ "\x1B 8" => chr(8),
+ "\x1B 9" => chr(9),
+ "\x1B :" => chr(10),
+ "\x1B ;" => chr(11),
+ "\x1B <" => chr(12),
+ "\x1B :" => chr(13),
+ "\x1B >" => chr(14),
+ "\x1B ?" => chr(15),
+ "\x1B!0" => chr(16),
+ "\x1B!1" => chr(17),
+ "\x1B!2" => chr(18),
+ "\x1B!3" => chr(19),
+ "\x1B!4" => chr(20),
+ "\x1B!5" => chr(21),
+ "\x1B!6" => chr(22),
+ "\x1B!7" => chr(23),
+ "\x1B!8" => chr(24),
+ "\x1B!9" => chr(25),
+ "\x1B!:" => chr(26),
+ "\x1B!;" => chr(27),
+ "\x1B!<" => chr(28),
+ "\x1B!=" => chr(29),
+ "\x1B!>" => chr(30),
+ "\x1B!?" => chr(31),
+ "\x1B'?" => chr(127),
+ "\x1B(0" => '€', // 128 in CP1252
+ "\x1B(2" => '‚', // 130 in CP1252
+ "\x1B(3" => 'Æ’', // 131 in CP1252
+ "\x1B(4" => '„', // 132 in CP1252
+ "\x1B(5" => '…', // 133 in CP1252
+ "\x1B(6" => '†', // 134 in CP1252
+ "\x1B(7" => '‡', // 135 in CP1252
+ "\x1B(8" => 'ˆ', // 136 in CP1252
+ "\x1B(9" => '‰', // 137 in CP1252
+ "\x1B(:" => 'Å ', // 138 in CP1252
+ "\x1B(;" => '‹', // 139 in CP1252
+ "\x1BNj" => 'Å’', // 140 in CP1252
+ "\x1B(>" => 'Ž', // 142 in CP1252
+ "\x1B)1" => '‘', // 145 in CP1252
+ "\x1B)2" => '’', // 146 in CP1252
+ "\x1B)3" => '“', // 147 in CP1252
+ "\x1B)4" => 'â€', // 148 in CP1252
+ "\x1B)5" => '•', // 149 in CP1252
+ "\x1B)6" => '–', // 150 in CP1252
+ "\x1B)7" => '—', // 151 in CP1252
+ "\x1B)8" => '˜', // 152 in CP1252
+ "\x1B)9" => 'â„¢', // 153 in CP1252
+ "\x1B):" => 'Å¡', // 154 in CP1252
+ "\x1B);" => '›', // 155 in CP1252
+ "\x1BNz" => 'Å“', // 156 in CP1252
+ "\x1B)>" => 'ž', // 158 in CP1252
+ "\x1B)?" => 'Ÿ', // 159 in CP1252
+ "\x1B*0" => 'Â ', // 160 in CP1252
+ "\x1BN!" => '¡', // 161 in CP1252
+ "\x1BN\"" => '¢', // 162 in CP1252
+ "\x1BN#" => '£', // 163 in CP1252
+ "\x1BN(" => '¤', // 164 in CP1252
+ "\x1BN%" => 'Â¥', // 165 in CP1252
+ "\x1B*6" => '¦', // 166 in CP1252
+ "\x1BN'" => '§', // 167 in CP1252
+ "\x1BNH " => '¨', // 168 in CP1252
+ "\x1BNS" => '©', // 169 in CP1252
+ "\x1BNc" => 'ª', // 170 in CP1252
+ "\x1BN+" => '«', // 171 in CP1252
+ "\x1B*<" => '¬', // 172 in CP1252
+ "\x1B*=" => 'Â', // 173 in CP1252
+ "\x1BNR" => '®', // 174 in CP1252
+ "\x1B*?" => '¯', // 175 in CP1252
+ "\x1BN0" => '°', // 176 in CP1252
+ "\x1BN1" => '±', // 177 in CP1252
+ "\x1BN2" => '²', // 178 in CP1252
+ "\x1BN3" => '³', // 179 in CP1252
+ "\x1BNB " => '´', // 180 in CP1252
+ "\x1BN5" => 'µ', // 181 in CP1252
+ "\x1BN6" => '¶', // 182 in CP1252
+ "\x1BN7" => '·', // 183 in CP1252
+ "\x1B+8" => '¸', // 184 in CP1252
+ "\x1BNQ" => '¹', // 185 in CP1252
+ "\x1BNk" => 'º', // 186 in CP1252
+ "\x1BN;" => '»', // 187 in CP1252
+ "\x1BN<" => '¼', // 188 in CP1252
+ "\x1BN=" => '½', // 189 in CP1252
+ "\x1BN>" => '¾', // 190 in CP1252
+ "\x1BN?" => '¿', // 191 in CP1252
+ "\x1BNAA" => 'À', // 192 in CP1252
+ "\x1BNBA" => 'Ã', // 193 in CP1252
+ "\x1BNCA" => 'Â', // 194 in CP1252
+ "\x1BNDA" => 'Ã', // 195 in CP1252
+ "\x1BNHA" => 'Ä', // 196 in CP1252
+ "\x1BNJA" => 'Ã…', // 197 in CP1252
+ "\x1BNa" => 'Æ', // 198 in CP1252
+ "\x1BNKC" => 'Ç', // 199 in CP1252
+ "\x1BNAE" => 'È', // 200 in CP1252
+ "\x1BNBE" => 'É', // 201 in CP1252
+ "\x1BNCE" => 'Ê', // 202 in CP1252
+ "\x1BNHE" => 'Ë', // 203 in CP1252
+ "\x1BNAI" => 'Ì', // 204 in CP1252
+ "\x1BNBI" => 'Ã', // 205 in CP1252
+ "\x1BNCI" => 'ÃŽ', // 206 in CP1252
+ "\x1BNHI" => 'Ã', // 207 in CP1252
+ "\x1BNb" => 'Ã', // 208 in CP1252
+ "\x1BNDN" => 'Ñ', // 209 in CP1252
+ "\x1BNAO" => 'Ã’', // 210 in CP1252
+ "\x1BNBO" => 'Ó', // 211 in CP1252
+ "\x1BNCO" => 'Ô', // 212 in CP1252
+ "\x1BNDO" => 'Õ', // 213 in CP1252
+ "\x1BNHO" => 'Ö', // 214 in CP1252
+ "\x1B-7" => '×', // 215 in CP1252
+ "\x1BNi" => 'Ø', // 216 in CP1252
+ "\x1BNAU" => 'Ù', // 217 in CP1252
+ "\x1BNBU" => 'Ú', // 218 in CP1252
+ "\x1BNCU" => 'Û', // 219 in CP1252
+ "\x1BNHU" => 'Ü', // 220 in CP1252
+ "\x1B-=" => 'Ã', // 221 in CP1252
+ "\x1BNl" => 'Þ', // 222 in CP1252
+ "\x1BN{" => 'ß', // 223 in CP1252
+ "\x1BNAa" => 'Ã ', // 224 in CP1252
+ "\x1BNBa" => 'á', // 225 in CP1252
+ "\x1BNCa" => 'â', // 226 in CP1252
+ "\x1BNDa" => 'ã', // 227 in CP1252
+ "\x1BNHa" => 'ä', // 228 in CP1252
+ "\x1BNJa" => 'Ã¥', // 229 in CP1252
+ "\x1BNq" => 'æ', // 230 in CP1252
+ "\x1BNKc" => 'ç', // 231 in CP1252
+ "\x1BNAe" => 'è', // 232 in CP1252
+ "\x1BNBe" => 'é', // 233 in CP1252
+ "\x1BNCe" => 'ê', // 234 in CP1252
+ "\x1BNHe" => 'ë', // 235 in CP1252
+ "\x1BNAi" => 'ì', // 236 in CP1252
+ "\x1BNBi" => 'Ã', // 237 in CP1252
+ "\x1BNCi" => 'î', // 238 in CP1252
+ "\x1BNHi" => 'ï', // 239 in CP1252
+ "\x1BNs" => 'ð', // 240 in CP1252
+ "\x1BNDn" => 'ñ', // 241 in CP1252
+ "\x1BNAo" => 'ò', // 242 in CP1252
+ "\x1BNBo" => 'ó', // 243 in CP1252
+ "\x1BNCo" => 'ô', // 244 in CP1252
+ "\x1BNDo" => 'õ', // 245 in CP1252
+ "\x1BNHo" => 'ö', // 246 in CP1252
+ "\x1B/7" => '÷', // 247 in CP1252
+ "\x1BNy" => 'ø', // 248 in CP1252
+ "\x1BNAu" => 'ù', // 249 in CP1252
+ "\x1BNBu" => 'ú', // 250 in CP1252
+ "\x1BNCu" => 'û', // 251 in CP1252
+ "\x1BNHu" => 'ü', // 252 in CP1252
+ "\x1B/=" => 'ý', // 253 in CP1252
+ "\x1BN|" => 'þ', // 254 in CP1252
+ "\x1BNHy" => 'ÿ', // 255 in CP1252
+ );
+ }
+
+ /**
+ * Get whether mbstring extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsMbstringEnabled()
+ {
+ if (isset(self::$isMbstringEnabled)) {
+ return self::$isMbstringEnabled;
+ }
+
+ self::$isMbstringEnabled = function_exists('mb_convert_encoding') ?
+ true : false;
+
+ return self::$isMbstringEnabled;
+ }
+
+ /**
+ * Get whether iconv extension is available
+ *
+ * @return boolean
+ */
+ public static function getIsIconvEnabled()
+ {
+ if (isset(self::$isIconvEnabled)) {
+ return self::$isIconvEnabled;
+ }
+
+ // Fail if iconv doesn't exist
+ if (!function_exists('iconv')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
+ if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
+ // we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
+ if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // CUSTOM: IBM AIX iconv() does not work
+ if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION') && (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) {
+ self::$isIconvEnabled = false;
+ return false;
+ }
+
+ // If we reach here no problems were detected with iconv
+ self::$isIconvEnabled = true;
+ return true;
+ }
+
+ public static function buildCharacterSets()
+ {
+ if (empty(self::$controlCharacters)) {
+ self::buildControlCharacters();
+ }
+ if (empty(self::$SYLKCharacters)) {
+ self::buildSYLKCharacters();
+ }
+ }
+
+ /**
+ * Convert from OpenXML escaped control character to PHP control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value ()
+ * element or in the shared string element.
+ *
+ * @param string $value Value to unescape
+ * @return string
+ */
+ public static function ControlCharacterOOXML2PHP($value = '')
+ {
+ return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
+ }
+
+ /**
+ * Convert from PHP control character to OpenXML escaped control character
+ *
+ * Excel 2007 team:
+ * ----------------
+ * That's correct, control characters are stored directly in the shared-strings table.
+ * We do encode characters that cannot be represented in XML using the following escape sequence:
+ * _xHHHH_ where H represents a hexadecimal character in the character's value...
+ * So you could end up with something like _x0008_ in a string (either in a cell value ()
+ * element or in the shared string element.
+ *
+ * @param string $value Value to escape
+ * @return string
+ */
+ public static function ControlCharacterPHP2OOXML($value = '')
+ {
+ return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
+ }
+
+ /**
+ * Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters.
+ *
+ * @param string $value
+ * @return string
+ */
+ public static function SanitizeUTF8($value)
+ {
+ if (self::getIsIconvEnabled()) {
+ $value = @iconv('UTF-8', 'UTF-8', $value);
+ return $value;
+ }
+
+ if (self::getIsMbstringEnabled()) {
+ $value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
+ return $value;
+ }
+
+ // else, no conversion
+ return $value;
+ }
+
+ /**
+ * Check if a string contains UTF8 data
+ *
+ * @param string $value
+ * @return boolean
+ */
+ public static function IsUTF8($value = '')
+ {
+ return $value === '' || preg_match('/^./su', $value) === 1;
+ }
+
+ /**
+ * Formats a numeric value as a string for output in various output writers forcing
+ * point as decimal separator in case locale is other than English.
+ *
+ * @param mixed $value
+ * @return string
+ */
+ public static function FormatNumber($value)
+ {
+ if (is_float($value)) {
+ return str_replace(',', '.', $value);
+ }
+ return (string) $value;
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (8-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @param mixed[] $arrcRuns Details of rich text runs in $value
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeShort($value, $arrcRuns = array())
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+ // option flags
+ if (empty($arrcRuns)) {
+ $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
+ 0x0001 : 0x0000;
+ $data = pack('CC', $ln, $opt);
+ // characters
+ $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+ } else {
+ $data = pack('vC', $ln, 0x09);
+ $data .= pack('v', count($arrcRuns));
+ // characters
+ $data .= self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+ foreach ($arrcRuns as $cRun) {
+ $data .= pack('v', $cRun['strlen']);
+ $data .= pack('v', $cRun['fontidx']);
+ }
+ }
+ return $data;
+ }
+
+ /**
+ * Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length)
+ * Writes the string using uncompressed notation, no rich text, no Asian phonetics
+ * If mbstring extension is not available, ASCII is assumed, and compressed notation is used
+ * although this will give wrong results for non-ASCII strings
+ * see OpenOffice.org's Documentation of the Microsoft Excel File Format, sect. 2.5.3
+ *
+ * @param string $value UTF-8 encoded string
+ * @return string
+ */
+ public static function UTF8toBIFF8UnicodeLong($value)
+ {
+ // character count
+ $ln = self::CountCharacters($value, 'UTF-8');
+
+ // option flags
+ $opt = (self::getIsIconvEnabled() || self::getIsMbstringEnabled()) ?
+ 0x0001 : 0x0000;
+
+ // characters
+ $chars = self::ConvertEncoding($value, 'UTF-16LE', 'UTF-8');
+
+ $data = pack('vC', $ln, $opt) . $chars;
+ return $data;
+ }
+
+ /**
+ * Convert string from one encoding to another. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $value
+ * @param string $to Encoding to convert to, e.g. 'UTF-8'
+ * @param string $from Encoding to convert from, e.g. 'UTF-16LE'
+ * @return string
+ */
+ public static function ConvertEncoding($value, $to, $from)
+ {
+ if (self::getIsIconvEnabled()) {
+ return iconv($from, $to, $value);
+ }
+
+ if (self::getIsMbstringEnabled()) {
+ return mb_convert_encoding($value, $to, $from);
+ }
+
+ if ($from == 'UTF-16LE') {
+ return self::utf16_decode($value, false);
+ } elseif ($from == 'UTF-16BE') {
+ return self::utf16_decode($value);
+ }
+ // else, no conversion
+ return $value;
+ }
+
+ /**
+ * Decode UTF-16 encoded strings.
+ *
+ * Can handle both BOM'ed data and un-BOM'ed data.
+ * Assumes Big-Endian byte order if no BOM is available.
+ * This function was taken from http://php.net/manual/en/function.utf8-decode.php
+ * and $bom_be parameter added.
+ *
+ * @param string $str UTF-16 encoded data to decode.
+ * @return string UTF-8 / ISO encoded data.
+ * @access public
+ * @version 0.2 / 2010-05-13
+ * @author Rasmus Andersson {@link http://rasmusandersson.se/}
+ * @author vadik56
+ */
+ public static function utf16_decode($str, $bom_be = true)
+ {
+ if (strlen($str) < 2) {
+ return $str;
+ }
+ $c0 = ord($str[0]);
+ $c1 = ord($str[1]);
+ if ($c0 == 0xfe && $c1 == 0xff) {
+ $str = substr($str, 2);
+ } elseif ($c0 == 0xff && $c1 == 0xfe) {
+ $str = substr($str, 2);
+ $bom_be = false;
+ }
+ $len = strlen($str);
+ $newstr = '';
+ for ($i=0; $i<$len; $i+=2) {
+ if ($bom_be) {
+ $val = ord($str[$i]) << 4;
+ $val += ord($str[$i+1]);
+ } else {
+ $val = ord($str[$i+1]) << 4;
+ $val += ord($str[$i]);
+ }
+ $newstr .= ($val == 0x228) ? "\n" : chr($val);
+ }
+ return $newstr;
+ }
+
+ /**
+ * Get character count. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $value
+ * @param string $enc Encoding
+ * @return int Character count
+ */
+ public static function CountCharacters($value, $enc = 'UTF-8')
+ {
+ if (self::getIsMbstringEnabled()) {
+ return mb_strlen($value, $enc);
+ }
+
+ if (self::getIsIconvEnabled()) {
+ return iconv_strlen($value, $enc);
+ }
+
+ // else strlen
+ return strlen($value);
+ }
+
+ /**
+ * Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @param int $pStart Start offset
+ * @param int $pLength Maximum number of characters in substring
+ * @return string
+ */
+ public static function Substring($pValue = '', $pStart = 0, $pLength = 0)
+ {
+ if (self::getIsMbstringEnabled()) {
+ return mb_substr($pValue, $pStart, $pLength, 'UTF-8');
+ }
+
+ if (self::getIsIconvEnabled()) {
+ return iconv_substr($pValue, $pStart, $pLength, 'UTF-8');
+ }
+
+ // else substr
+ return substr($pValue, $pStart, $pLength);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to upper case
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToUpper($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_UPPER, "UTF-8");
+ }
+ return strtoupper($pValue);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to lower case
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToLower($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_LOWER, "UTF-8");
+ }
+ return strtolower($pValue);
+ }
+
+ /**
+ * Convert a UTF-8 encoded string to title/proper case
+ * (uppercase every first character in each word, lower case all other characters)
+ *
+ * @param string $pValue UTF-8 encoded string
+ * @return string
+ */
+ public static function StrToTitle($pValue = '')
+ {
+ if (function_exists('mb_convert_case')) {
+ return mb_convert_case($pValue, MB_CASE_TITLE, "UTF-8");
+ }
+ return ucwords($pValue);
+ }
+
+ public static function mb_is_upper($char)
+ {
+ return mb_strtolower($char, "UTF-8") != $char;
+ }
+
+ public static function mb_str_split($string)
+ {
+ # Split at all position not after the start: ^
+ # and not before the end: $
+ return preg_split('/(?_calculateFormulaValue($fractionFormula);
+ return true;
+ }
+ return false;
+ } // function convertToNumberIfFraction()
+
+ /**
+ * Get the decimal separator. If it has not yet been set explicitly, try to obtain number
+ * formatting information from locale.
+ *
+ * @return string
+ */
+ public static function getDecimalSeparator()
+ {
+ if (!isset(self::$decimalSeparator)) {
+ $localeconv = localeconv();
+ self::$decimalSeparator = ($localeconv['decimal_point'] != '')
+ ? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
+
+ if (self::$decimalSeparator == '') {
+ // Default to .
+ self::$decimalSeparator = '.';
+ }
+ }
+ return self::$decimalSeparator;
+ }
+
+ /**
+ * Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for decimal separator
+ */
+ public static function setDecimalSeparator($pValue = '.')
+ {
+ self::$decimalSeparator = $pValue;
+ }
+
+ /**
+ * Get the thousands separator. If it has not yet been set explicitly, try to obtain number
+ * formatting information from locale.
+ *
+ * @return string
+ */
+ public static function getThousandsSeparator()
+ {
+ if (!isset(self::$thousandsSeparator)) {
+ $localeconv = localeconv();
+ self::$thousandsSeparator = ($localeconv['thousands_sep'] != '')
+ ? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
+
+ if (self::$thousandsSeparator == '') {
+ // Default to .
+ self::$thousandsSeparator = ',';
+ }
+ }
+ return self::$thousandsSeparator;
+ }
+
+ /**
+ * Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for thousands separator
+ */
+ public static function setThousandsSeparator($pValue = ',')
+ {
+ self::$thousandsSeparator = $pValue;
+ }
+
+ /**
+ * Get the currency code. If it has not yet been set explicitly, try to obtain the
+ * symbol information from locale.
+ *
+ * @return string
+ */
+ public static function getCurrencyCode()
+ {
+ if (!isset(self::$currencyCode)) {
+ $localeconv = localeconv();
+ self::$currencyCode = ($localeconv['currency_symbol'] != '')
+ ? $localeconv['currency_symbol'] : $localeconv['int_curr_symbol'];
+
+ if (self::$currencyCode == '') {
+ // Default to $
+ self::$currencyCode = '$';
+ }
+ }
+ return self::$currencyCode;
+ }
+
+ /**
+ * Set the currency code. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
+ * to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+ *
+ * @param string $pValue Character for currency code
+ */
+ public static function setCurrencyCode($pValue = '$')
+ {
+ self::$currencyCode = $pValue;
+ }
+
+ /**
+ * Convert SYLK encoded string to UTF-8
+ *
+ * @param string $pValue
+ * @return string UTF-8 encoded string
+ */
+ public static function SYLKtoUTF8($pValue = '')
+ {
+ // If there is no escape character in the string there is nothing to do
+ if (strpos($pValue, '') === false) {
+ return $pValue;
+ }
+
+ foreach (self::$SYLKCharacters as $k => $v) {
+ $pValue = str_replace($k, $v, $pValue);
+ }
+
+ return $pValue;
+ }
+
+ /**
+ * Retrieve any leading numeric part of a string, or return the full string if no leading numeric
+ * (handles basic integer or float, but not exponent or non decimal)
+ *
+ * @param string $value
+ * @return mixed string or only the leading numeric part of the string
+ */
+ public static function testStringAsNumeric($value)
+ {
+ if (is_numeric($value)) {
+ return $value;
+ }
+ $v = floatval($value);
+ return (is_numeric(substr($value, 0, strlen($v)))) ? $v : $value;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/TimeZone.php b/Classes/PHPExcel/Shared/TimeZone.php
new file mode 100644
index 0000000..73373e0
--- /dev/null
+++ b/Classes/PHPExcel/Shared/TimeZone.php
@@ -0,0 +1,144 @@
+getTransitions();
+ $transitions = array();
+ foreach ($allTransitions as $key => $transition) {
+ if ($transition['ts'] > $timestamp) {
+ $transitions[] = ($key > 0) ? $allTransitions[$key - 1] : $transition;
+ break;
+ }
+ if (empty($transitions)) {
+ $transitions[] = end($allTransitions);
+ }
+ }
+
+ return $transitions;
+ }
+
+ /**
+ * Return the Timezone offset used for date/time conversions to/from UST
+ * This requires both the timezone and the calculated date/time to allow for local DST
+ *
+ * @param string $timezone The timezone for finding the adjustment to UST
+ * @param integer $timestamp PHP date/time value
+ * @return integer Number of seconds for timezone adjustment
+ * @throws PHPExcel_Exception
+ */
+ public static function getTimeZoneAdjustment($timezone, $timestamp)
+ {
+ if ($timezone !== null) {
+ if (!self::_validateTimezone($timezone)) {
+ throw new PHPExcel_Exception("Invalid timezone " . $timezone);
+ }
+ } else {
+ $timezone = self::$timezone;
+ }
+
+ if ($timezone == 'UST') {
+ return 0;
+ }
+
+ $objTimezone = new DateTimeZone($timezone);
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+ $transitions = $objTimezone->getTransitions($timestamp, $timestamp);
+ } else {
+ $transitions = self::getTimezoneTransitions($objTimezone, $timestamp);
+ }
+
+ return (count($transitions) > 0) ? $transitions[0]['offset'] : 0;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/XMLWriter.php b/Classes/PHPExcel/Shared/XMLWriter.php
new file mode 100644
index 0000000..1dc119b
--- /dev/null
+++ b/Classes/PHPExcel/Shared/XMLWriter.php
@@ -0,0 +1,124 @@
+openMemory();
+ } else {
+ // Create temporary filename
+ if ($pTemporaryStorageFolder === null) {
+ $pTemporaryStorageFolder = PHPExcel_Shared_File::sys_get_temp_dir();
+ }
+ $this->tempFileName = @tempnam($pTemporaryStorageFolder, 'xml');
+
+ // Open storage
+ if ($this->openUri($this->tempFileName) === false) {
+ // Fallback to memory...
+ $this->openMemory();
+ }
+ }
+
+ // Set default values
+ if (DEBUGMODE_ENABLED) {
+ $this->setIndent(true);
+ }
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ // Unlink temporary files
+ if ($this->tempFileName != '') {
+ @unlink($this->tempFileName);
+ }
+ }
+
+ /**
+ * Get written data
+ *
+ * @return $data
+ */
+ public function getData()
+ {
+ if ($this->tempFileName == '') {
+ return $this->outputMemory(true);
+ } else {
+ $this->flush();
+ return file_get_contents($this->tempFileName);
+ }
+ }
+
+ /**
+ * Fallback method for writeRaw, introduced in PHP 5.2
+ *
+ * @param string $text
+ * @return string
+ */
+ public function writeRawData($text)
+ {
+ if (is_array($text)) {
+ $text = implode("\n", $text);
+ }
+
+ if (method_exists($this, 'writeRaw')) {
+ return $this->writeRaw(htmlspecialchars($text));
+ }
+
+ return $this->text($text);
+ }
+}
diff --git a/Classes/PHPExcel/Shared/ZipArchive.php b/Classes/PHPExcel/Shared/ZipArchive.php
new file mode 100644
index 0000000..9eac8ca
--- /dev/null
+++ b/Classes/PHPExcel/Shared/ZipArchive.php
@@ -0,0 +1,163 @@
+tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
+ $this->zip = new PclZip($fileName);
+
+ return true;
+ }
+
+
+ /**
+ * Close this zip archive
+ *
+ */
+ public function close()
+ {
+ }
+
+
+ /**
+ * Add a new file to the zip archive from a string of raw data.
+ *
+ * @param string $localname Directory/Name of the file to add to the zip archive
+ * @param string $contents String of data to add to the zip archive
+ */
+ public function addFromString($localname, $contents)
+ {
+ $filenameParts = pathinfo($localname);
+
+ $handle = fopen($this->tempDir.'/'.$filenameParts["basename"], "wb");
+ fwrite($handle, $contents);
+ fclose($handle);
+
+ $res = $this->zip->add($this->tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
+ if ($res == 0) {
+ throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->zip->errorInfo(true));
+ }
+
+ unlink($this->tempDir.'/'.$filenameParts["basename"]);
+ }
+
+ /**
+ * Find if given fileName exist in archive (Emulate ZipArchive locateName())
+ *
+ * @param string $fileName Filename for the file in zip archive
+ * @return boolean
+ */
+ public function locateName($fileName)
+ {
+ $fileName = strtolower($fileName);
+
+ $list = $this->zip->listContent();
+ $listCount = count($list);
+ $index = -1;
+ for ($i = 0; $i < $listCount; ++$i) {
+ if (strtolower($list[$i]["filename"]) == $fileName ||
+ strtolower($list[$i]["stored_filename"]) == $fileName) {
+ $index = $i;
+ break;
+ }
+ }
+ return ($index > -1) ? $index : false;
+ }
+
+ /**
+ * Extract file from archive by given fileName (Emulate ZipArchive getFromName())
+ *
+ * @param string $fileName Filename for the file in zip archive
+ * @return string $contents File string contents
+ */
+ public function getFromName($fileName)
+ {
+ $index = $this->locateName($fileName);
+
+ if ($index !== false) {
+ $extracted = $this->getFromIndex($index);
+ } else {
+ $fileName = substr($fileName, 1);
+ $index = $this->locateName($fileName);
+ if ($index === false) {
+ return false;
+ }
+ $extracted = $this->zip->getFromIndex($index);
+ }
+
+ $contents = $extracted;
+ if ((is_array($extracted)) && ($extracted != 0)) {
+ $contents = $extracted[0]["content"];
+ }
+
+ return $contents;
+ }
+
+ public function getFromIndex($index) {
+ $extracted = $this->zip->extractByIndex($index, PCLZIP_OPT_EXTRACT_AS_STRING);
+ $contents = '';
+ if ((is_array($extracted)) && ($extracted != 0)) {
+ $contents = $extracted[0]["content"];
+ }
+
+ return $contents;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/ZipStreamWrapper.php b/Classes/PHPExcel/Shared/ZipStreamWrapper.php
new file mode 100644
index 0000000..c6cbd0d
--- /dev/null
+++ b/Classes/PHPExcel/Shared/ZipStreamWrapper.php
@@ -0,0 +1,200 @@
+archive = new ZipArchive();
+ $this->archive->open($url['host']);
+
+ $this->fileNameInArchive = $url['fragment'];
+ $this->position = 0;
+ $this->data = $this->archive->getFromName($this->fileNameInArchive);
+
+ return true;
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function statName()
+ {
+ return $this->fileNameInArchive;
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function url_stat()
+ {
+ return $this->statName($this->fileNameInArchive);
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function stream_stat()
+ {
+ return $this->archive->statName($this->fileNameInArchive);
+ }
+
+ /**
+ * Implements support for fread(), fgets() etc.
+ *
+ * @param int $count maximum number of bytes to read
+ * @return string
+ */
+ public function stream_read($count)
+ {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ /**
+ * Returns the position of the file pointer, i.e. its offset into the file
+ * stream. Implements support for ftell().
+ *
+ * @return int
+ */
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ /**
+ * EOF stream
+ *
+ * @return bool
+ */
+ public function stream_eof()
+ {
+ return $this->position >= strlen($this->data);
+ }
+
+ /**
+ * Seek stream
+ *
+ * @param int $offset byte offset
+ * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
+ * @return bool
+ */
+ public function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($this->data) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->position = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/ZipStreamWrapper.php.bk-aleluya b/Classes/PHPExcel/Shared/ZipStreamWrapper.php.bk-aleluya
new file mode 100644
index 0000000..2e0324c
--- /dev/null
+++ b/Classes/PHPExcel/Shared/ZipStreamWrapper.php.bk-aleluya
@@ -0,0 +1,200 @@
+archive = new ZipArchive();
+ $this->archive->open($url['host']);
+
+ $this->fileNameInArchive = $url['fragment'];
+ $this->position = 0;
+ $this->data = $this->archive->getFromName($this->fileNameInArchive);
+
+ return true;
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function statName()
+ {
+ return $this->fileNameInArchive;
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function url_stat()
+ {
+ return $this->statName($this->fileNameInArchive);
+ }
+
+ /**
+ * Implements support for fstat().
+ *
+ * @return boolean
+ */
+ public function stream_stat()
+ {
+ return $this->archive->statName($this->fileNameInArchive);
+ }
+
+ /**
+ * Implements support for fread(), fgets() etc.
+ *
+ * @param int $count maximum number of bytes to read
+ * @return string
+ */
+ public function stream_read($count)
+ {
+ $ret = substr($this->data, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ /**
+ * Returns the position of the file pointer, i.e. its offset into the file
+ * stream. Implements support for ftell().
+ *
+ * @return int
+ */
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ /**
+ * EOF stream
+ *
+ * @return bool
+ */
+ public function stream_eof()
+ {
+ return $this->position >= strlen($this->data);
+ }
+
+ /**
+ * Seek stream
+ *
+ * @param int $offset byte offset
+ * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
+ * @return bool
+ */
+ public function stream_seek($offset, $whence)
+ {
+ switch ($whence) {
+ case SEEK_SET:
+ if ($offset < strlen($this->data) && $offset >= 0) {
+ $this->position = $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_CUR:
+ if ($offset >= 0) {
+ $this->position += $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ case SEEK_END:
+ if (strlen($this->data) + $offset >= 0) {
+ $this->position = strlen($this->data) + $offset;
+ return true;
+ } else {
+ return false;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/bestFitClass.php b/Classes/PHPExcel/Shared/trend/bestFitClass.php
new file mode 100644
index 0000000..2de029f
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/bestFitClass.php
@@ -0,0 +1,425 @@
+error;
+ }
+
+
+ public function getBestFitType()
+ {
+ return $this->bestFitType;
+ }
+
+ /**
+ * Return the Y-Value for a specified value of X
+ *
+ * @param float $xValue X-Value
+ * @return float Y-Value
+ */
+ public function getValueOfYForX($xValue)
+ {
+ return false;
+ }
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ */
+ public function getValueOfXForY($yValue)
+ {
+ return false;
+ }
+
+ /**
+ * Return the original set of X-Values
+ *
+ * @return float[] X-Values
+ */
+ public function getXValues()
+ {
+ return $this->xValues;
+ }
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ */
+ public function getEquation($dp = 0)
+ {
+ return false;
+ }
+
+ /**
+ * Return the Slope of the line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ */
+ public function getSlope($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->slope, $dp);
+ }
+ return $this->slope;
+ }
+
+ /**
+ * Return the standard error of the Slope
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ */
+ public function getSlopeSE($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->slopeSE, $dp);
+ }
+ return $this->slopeSE;
+ }
+
+ /**
+ * Return the Value of X where it intersects Y = 0
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ */
+ public function getIntersect($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->intersect, $dp);
+ }
+ return $this->intersect;
+ }
+
+ /**
+ * Return the standard error of the Intersect
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ */
+ public function getIntersectSE($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->intersectSE, $dp);
+ }
+ return $this->intersectSE;
+ }
+
+ /**
+ * Return the goodness of fit for this regression
+ *
+ * @param int $dp Number of places of decimal precision to return
+ * @return float
+ */
+ public function getGoodnessOfFit($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->goodnessOfFit, $dp);
+ }
+ return $this->goodnessOfFit;
+ }
+
+ public function getGoodnessOfFitPercent($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->goodnessOfFit * 100, $dp);
+ }
+ return $this->goodnessOfFit * 100;
+ }
+
+ /**
+ * Return the standard deviation of the residuals for this regression
+ *
+ * @param int $dp Number of places of decimal precision to return
+ * @return float
+ */
+ public function getStdevOfResiduals($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->stdevOfResiduals, $dp);
+ }
+ return $this->stdevOfResiduals;
+ }
+
+ public function getSSRegression($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->SSRegression, $dp);
+ }
+ return $this->SSRegression;
+ }
+
+ public function getSSResiduals($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->SSResiduals, $dp);
+ }
+ return $this->SSResiduals;
+ }
+
+ public function getDFResiduals($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->DFResiduals, $dp);
+ }
+ return $this->DFResiduals;
+ }
+
+ public function getF($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->f, $dp);
+ }
+ return $this->f;
+ }
+
+ public function getCovariance($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->covariance, $dp);
+ }
+ return $this->covariance;
+ }
+
+ public function getCorrelation($dp = 0)
+ {
+ if ($dp != 0) {
+ return round($this->correlation, $dp);
+ }
+ return $this->correlation;
+ }
+
+ public function getYBestFitValues()
+ {
+ return $this->yBestFitValues;
+ }
+
+ protected function calculateGoodnessOfFit($sumX, $sumY, $sumX2, $sumY2, $sumXY, $meanX, $meanY, $const)
+ {
+ $SSres = $SScov = $SScor = $SStot = $SSsex = 0.0;
+ foreach ($this->xValues as $xKey => $xValue) {
+ $bestFitY = $this->yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
+
+ $SSres += ($this->yValues[$xKey] - $bestFitY) * ($this->yValues[$xKey] - $bestFitY);
+ if ($const) {
+ $SStot += ($this->yValues[$xKey] - $meanY) * ($this->yValues[$xKey] - $meanY);
+ } else {
+ $SStot += $this->yValues[$xKey] * $this->yValues[$xKey];
+ }
+ $SScov += ($this->xValues[$xKey] - $meanX) * ($this->yValues[$xKey] - $meanY);
+ if ($const) {
+ $SSsex += ($this->xValues[$xKey] - $meanX) * ($this->xValues[$xKey] - $meanX);
+ } else {
+ $SSsex += $this->xValues[$xKey] * $this->xValues[$xKey];
+ }
+ }
+
+ $this->SSResiduals = $SSres;
+ $this->DFResiduals = $this->valueCount - 1 - $const;
+
+ if ($this->DFResiduals == 0.0) {
+ $this->stdevOfResiduals = 0.0;
+ } else {
+ $this->stdevOfResiduals = sqrt($SSres / $this->DFResiduals);
+ }
+ if (($SStot == 0.0) || ($SSres == $SStot)) {
+ $this->goodnessOfFit = 1;
+ } else {
+ $this->goodnessOfFit = 1 - ($SSres / $SStot);
+ }
+
+ $this->SSRegression = $this->goodnessOfFit * $SStot;
+ $this->covariance = $SScov / $this->valueCount;
+ $this->correlation = ($this->valueCount * $sumXY - $sumX * $sumY) / sqrt(($this->valueCount * $sumX2 - pow($sumX, 2)) * ($this->valueCount * $sumY2 - pow($sumY, 2)));
+ $this->slopeSE = $this->stdevOfResiduals / sqrt($SSsex);
+ $this->intersectSE = $this->stdevOfResiduals * sqrt(1 / ($this->valueCount - ($sumX * $sumX) / $sumX2));
+ if ($this->SSResiduals != 0.0) {
+ if ($this->DFResiduals == 0.0) {
+ $this->f = 0.0;
+ } else {
+ $this->f = $this->SSRegression / ($this->SSResiduals / $this->DFResiduals);
+ }
+ } else {
+ if ($this->DFResiduals == 0.0) {
+ $this->f = 0.0;
+ } else {
+ $this->f = $this->SSRegression / $this->DFResiduals;
+ }
+ }
+ }
+
+ protected function leastSquareFit($yValues, $xValues, $const)
+ {
+ // calculate sums
+ $x_sum = array_sum($xValues);
+ $y_sum = array_sum($yValues);
+ $meanX = $x_sum / $this->valueCount;
+ $meanY = $y_sum / $this->valueCount;
+ $mBase = $mDivisor = $xx_sum = $xy_sum = $yy_sum = 0.0;
+ for ($i = 0; $i < $this->valueCount; ++$i) {
+ $xy_sum += $xValues[$i] * $yValues[$i];
+ $xx_sum += $xValues[$i] * $xValues[$i];
+ $yy_sum += $yValues[$i] * $yValues[$i];
+
+ if ($const) {
+ $mBase += ($xValues[$i] - $meanX) * ($yValues[$i] - $meanY);
+ $mDivisor += ($xValues[$i] - $meanX) * ($xValues[$i] - $meanX);
+ } else {
+ $mBase += $xValues[$i] * $yValues[$i];
+ $mDivisor += $xValues[$i] * $xValues[$i];
+ }
+ }
+
+ // calculate slope
+// $this->slope = (($this->valueCount * $xy_sum) - ($x_sum * $y_sum)) / (($this->valueCount * $xx_sum) - ($x_sum * $x_sum));
+ $this->slope = $mBase / $mDivisor;
+
+ // calculate intersect
+// $this->intersect = ($y_sum - ($this->slope * $x_sum)) / $this->valueCount;
+ if ($const) {
+ $this->intersect = $meanY - ($this->slope * $meanX);
+ } else {
+ $this->intersect = 0;
+ }
+
+ $this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum, $meanX, $meanY, $const);
+ }
+
+ /**
+ * Define the regression
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($yValues, $xValues = array(), $const = true)
+ {
+ // Calculate number of points
+ $nY = count($yValues);
+ $nX = count($xValues);
+
+ // Define X Values if necessary
+ if ($nX == 0) {
+ $xValues = range(1, $nY);
+ $nX = $nY;
+ } elseif ($nY != $nX) {
+ // Ensure both arrays of points are the same size
+ $this->error = true;
+ return false;
+ }
+
+ $this->valueCount = $nY;
+ $this->xValues = $xValues;
+ $this->yValues = $yValues;
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php b/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php
new file mode 100644
index 0000000..4448735
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/exponentialBestFitClass.php
@@ -0,0 +1,138 @@
+getIntersect() * pow($this->getSlope(), ($xValue - $this->xOffset));
+ }
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ **/
+ public function getValueOfXForY($yValue)
+ {
+ return log(($yValue + $this->yOffset) / $this->getIntersect()) / log($this->getSlope());
+ }
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getEquation($dp = 0)
+ {
+ $slope = $this->getSlope($dp);
+ $intersect = $this->getIntersect($dp);
+
+ return 'Y = ' . $intersect . ' * ' . $slope . '^X';
+ }
+
+ /**
+ * Return the Slope of the line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getSlope($dp = 0)
+ {
+ if ($dp != 0) {
+ return round(exp($this->_slope), $dp);
+ }
+ return exp($this->_slope);
+ }
+
+ /**
+ * Return the Value of X where it intersects Y = 0
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getIntersect($dp = 0)
+ {
+ if ($dp != 0) {
+ return round(exp($this->intersect), $dp);
+ }
+ return exp($this->intersect);
+ }
+
+ /**
+ * Execute the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ private function exponentialRegression($yValues, $xValues, $const)
+ {
+ foreach ($yValues as &$value) {
+ if ($value < 0.0) {
+ $value = 0 - log(abs($value));
+ } elseif ($value > 0.0) {
+ $value = log($value);
+ }
+ }
+ unset($value);
+
+ $this->leastSquareFit($yValues, $xValues, $const);
+ }
+
+ /**
+ * Define the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($yValues, $xValues = array(), $const = true)
+ {
+ if (parent::__construct($yValues, $xValues) !== false) {
+ $this->exponentialRegression($yValues, $xValues, $const);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/linearBestFitClass.php b/Classes/PHPExcel/Shared/trend/linearBestFitClass.php
new file mode 100644
index 0000000..76b55b3
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/linearBestFitClass.php
@@ -0,0 +1,102 @@
+getIntersect() + $this->getSlope() * $xValue;
+ }
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ **/
+ public function getValueOfXForY($yValue)
+ {
+ return ($yValue - $this->getIntersect()) / $this->getSlope();
+ }
+
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getEquation($dp = 0)
+ {
+ $slope = $this->getSlope($dp);
+ $intersect = $this->getIntersect($dp);
+
+ return 'Y = ' . $intersect . ' + ' . $slope . ' * X';
+ }
+
+ /**
+ * Execute the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ private function linearRegression($yValues, $xValues, $const)
+ {
+ $this->leastSquareFit($yValues, $xValues, $const);
+ }
+
+ /**
+ * Define the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($yValues, $xValues = array(), $const = true)
+ {
+ if (parent::__construct($yValues, $xValues) !== false) {
+ $this->linearRegression($yValues, $xValues, $const);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php b/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php
new file mode 100644
index 0000000..221c538
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/logarithmicBestFitClass.php
@@ -0,0 +1,110 @@
+getIntersect() + $this->getSlope() * log($xValue - $this->xOffset);
+ }
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ **/
+ public function getValueOfXForY($yValue)
+ {
+ return exp(($yValue - $this->getIntersect()) / $this->getSlope());
+ }
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getEquation($dp = 0)
+ {
+ $slope = $this->getSlope($dp);
+ $intersect = $this->getIntersect($dp);
+
+ return 'Y = '.$intersect.' + '.$slope.' * log(X)';
+ }
+
+ /**
+ * Execute the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ private function logarithmicRegression($yValues, $xValues, $const)
+ {
+ foreach ($xValues as &$value) {
+ if ($value < 0.0) {
+ $value = 0 - log(abs($value));
+ } elseif ($value > 0.0) {
+ $value = log($value);
+ }
+ }
+ unset($value);
+
+ $this->leastSquareFit($yValues, $xValues, $const);
+ }
+
+ /**
+ * Define the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($yValues, $xValues = array(), $const = true)
+ {
+ if (parent::__construct($yValues, $xValues) !== false) {
+ $this->logarithmicRegression($yValues, $xValues, $const);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php b/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php
new file mode 100644
index 0000000..8a882b7
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/polynomialBestFitClass.php
@@ -0,0 +1,222 @@
+order;
+ }
+
+
+ /**
+ * Return the Y-Value for a specified value of X
+ *
+ * @param float $xValue X-Value
+ * @return float Y-Value
+ **/
+ public function getValueOfYForX($xValue)
+ {
+ $retVal = $this->getIntersect();
+ $slope = $this->getSlope();
+ foreach ($slope as $key => $value) {
+ if ($value != 0.0) {
+ $retVal += $value * pow($xValue, $key + 1);
+ }
+ }
+ return $retVal;
+ }
+
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ **/
+ public function getValueOfXForY($yValue)
+ {
+ return ($yValue - $this->getIntersect()) / $this->getSlope();
+ }
+
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getEquation($dp = 0)
+ {
+ $slope = $this->getSlope($dp);
+ $intersect = $this->getIntersect($dp);
+
+ $equation = 'Y = ' . $intersect;
+ foreach ($slope as $key => $value) {
+ if ($value != 0.0) {
+ $equation .= ' + ' . $value . ' * X';
+ if ($key > 0) {
+ $equation .= '^' . ($key + 1);
+ }
+ }
+ }
+ return $equation;
+ }
+
+
+ /**
+ * Return the Slope of the line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getSlope($dp = 0)
+ {
+ if ($dp != 0) {
+ $coefficients = array();
+ foreach ($this->_slope as $coefficient) {
+ $coefficients[] = round($coefficient, $dp);
+ }
+ return $coefficients;
+ }
+ return $this->_slope;
+ }
+
+
+ public function getCoefficients($dp = 0)
+ {
+ return array_merge(array($this->getIntersect($dp)), $this->getSlope($dp));
+ }
+
+
+ /**
+ * Execute the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param int $order Order of Polynomial for this regression
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ private function polynomialRegression($order, $yValues, $xValues, $const)
+ {
+ // calculate sums
+ $x_sum = array_sum($xValues);
+ $y_sum = array_sum($yValues);
+ $xx_sum = $xy_sum = 0;
+ for ($i = 0; $i < $this->valueCount; ++$i) {
+ $xy_sum += $xValues[$i] * $yValues[$i];
+ $xx_sum += $xValues[$i] * $xValues[$i];
+ $yy_sum += $yValues[$i] * $yValues[$i];
+ }
+ /*
+ * This routine uses logic from the PHP port of polyfit version 0.1
+ * written by Michael Bommarito and Paul Meagher
+ *
+ * The function fits a polynomial function of order $order through
+ * a series of x-y data points using least squares.
+ *
+ */
+ for ($i = 0; $i < $this->valueCount; ++$i) {
+ for ($j = 0; $j <= $order; ++$j) {
+ $A[$i][$j] = pow($xValues[$i], $j);
+ }
+ }
+ for ($i=0; $i < $this->valueCount; ++$i) {
+ $B[$i] = array($yValues[$i]);
+ }
+ $matrixA = new Matrix($A);
+ $matrixB = new Matrix($B);
+ $C = $matrixA->solve($matrixB);
+
+ $coefficients = array();
+ for ($i = 0; $i < $C->m; ++$i) {
+ $r = $C->get($i, 0);
+ if (abs($r) <= pow(10, -9)) {
+ $r = 0;
+ }
+ $coefficients[] = $r;
+ }
+
+ $this->intersect = array_shift($coefficients);
+ $this->_slope = $coefficients;
+
+ $this->calculateGoodnessOfFit($x_sum, $y_sum, $xx_sum, $yy_sum, $xy_sum);
+ foreach ($this->xValues as $xKey => $xValue) {
+ $this->yBestFitValues[$xKey] = $this->getValueOfYForX($xValue);
+ }
+ }
+
+
+ /**
+ * Define the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param int $order Order of Polynomial for this regression
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($order, $yValues, $xValues = array(), $const = true)
+ {
+ if (parent::__construct($yValues, $xValues) !== false) {
+ if ($order < $this->valueCount) {
+ $this->bestFitType .= '_'.$order;
+ $this->order = $order;
+ $this->polynomialRegression($order, $yValues, $xValues, $const);
+ if (($this->getGoodnessOfFit() < 0.0) || ($this->getGoodnessOfFit() > 1.0)) {
+ $this->_error = true;
+ }
+ } else {
+ $this->_error = true;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/powerBestFitClass.php b/Classes/PHPExcel/Shared/trend/powerBestFitClass.php
new file mode 100644
index 0000000..77c4734
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/powerBestFitClass.php
@@ -0,0 +1,138 @@
+getIntersect() * pow(($xValue - $this->xOffset), $this->getSlope());
+ }
+
+
+ /**
+ * Return the X-Value for a specified value of Y
+ *
+ * @param float $yValue Y-Value
+ * @return float X-Value
+ **/
+ public function getValueOfXForY($yValue)
+ {
+ return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope()));
+ }
+
+
+ /**
+ * Return the Equation of the best-fit line
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getEquation($dp = 0)
+ {
+ $slope = $this->getSlope($dp);
+ $intersect = $this->getIntersect($dp);
+
+ return 'Y = ' . $intersect . ' * X^' . $slope;
+ }
+
+
+ /**
+ * Return the Value of X where it intersects Y = 0
+ *
+ * @param int $dp Number of places of decimal precision to display
+ * @return string
+ **/
+ public function getIntersect($dp = 0)
+ {
+ if ($dp != 0) {
+ return round(exp($this->intersect), $dp);
+ }
+ return exp($this->intersect);
+ }
+
+
+ /**
+ * Execute the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ private function powerRegression($yValues, $xValues, $const)
+ {
+ foreach ($xValues as &$value) {
+ if ($value < 0.0) {
+ $value = 0 - log(abs($value));
+ } elseif ($value > 0.0) {
+ $value = log($value);
+ }
+ }
+ unset($value);
+ foreach ($yValues as &$value) {
+ if ($value < 0.0) {
+ $value = 0 - log(abs($value));
+ } elseif ($value > 0.0) {
+ $value = log($value);
+ }
+ }
+ unset($value);
+
+ $this->leastSquareFit($yValues, $xValues, $const);
+ }
+
+
+ /**
+ * Define the regression and calculate the goodness of fit for a set of X and Y data values
+ *
+ * @param float[] $yValues The set of Y-values for this regression
+ * @param float[] $xValues The set of X-values for this regression
+ * @param boolean $const
+ */
+ public function __construct($yValues, $xValues = array(), $const = true)
+ {
+ if (parent::__construct($yValues, $xValues) !== false) {
+ $this->powerRegression($yValues, $xValues, $const);
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Shared/trend/trendClass.php b/Classes/PHPExcel/Shared/trend/trendClass.php
new file mode 100644
index 0000000..715cd41
--- /dev/null
+++ b/Classes/PHPExcel/Shared/trend/trendClass.php
@@ -0,0 +1,147 @@
+getGoodnessOfFit();
+ }
+ if ($trendType != self::TREND_BEST_FIT_NO_POLY) {
+ foreach (self::$trendTypePolynomialOrders as $trendMethod) {
+ $order = substr($trendMethod, -1);
+ $bestFit[$trendMethod] = new PHPExcel_Polynomial_Best_Fit($order, $yValues, $xValues, $const);
+ if ($bestFit[$trendMethod]->getError()) {
+ unset($bestFit[$trendMethod]);
+ } else {
+ $bestFitValue[$trendMethod] = $bestFit[$trendMethod]->getGoodnessOfFit();
+ }
+ }
+ }
+ // Determine which of our trend lines is the best fit, and then we return the instance of that trend class
+ arsort($bestFitValue);
+ $bestFitType = key($bestFitValue);
+ return $bestFit[$bestFitType];
+ default:
+ return false;
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Style.php b/Classes/PHPExcel/Style.php
new file mode 100644
index 0000000..6b952ef
--- /dev/null
+++ b/Classes/PHPExcel/Style.php
@@ -0,0 +1,644 @@
+isSupervisor = $isSupervisor;
+
+ // Initialise values
+ $this->conditionalStyles = array();
+ $this->font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
+ $this->fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
+ $this->borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
+ $this->alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
+ $this->numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
+ $this->protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
+
+ // bind parent if we are a supervisor
+ if ($isSupervisor) {
+ $this->font->bindParent($this);
+ $this->fill->bindParent($this);
+ $this->borders->bindParent($this);
+ $this->alignment->bindParent($this);
+ $this->numberFormat->bindParent($this);
+ $this->protection->bindParent($this);
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style
+ */
+ public function getSharedComponent()
+ {
+ $activeSheet = $this->getActiveSheet();
+ $selectedCell = $this->getActiveCell(); // e.g. 'A1'
+
+ if ($activeSheet->cellExists($selectedCell)) {
+ $xfIndex = $activeSheet->getCell($selectedCell)->getXfIndex();
+ } else {
+ $xfIndex = 0;
+ }
+
+ return $this->parent->getCellXfByIndex($xfIndex);
+ }
+
+ /**
+ * Get parent. Only used for style supervisor
+ *
+ * @return PHPExcel
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('quotePrefix' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray(
+ * array(
+ * 'font' => array(
+ * 'name' => 'Arial',
+ * 'bold' => true,
+ * 'italic' => false,
+ * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE,
+ * 'strike' => false,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * ),
+ * 'borders' => array(
+ * 'bottom' => array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * ),
+ * 'top' => array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * )
+ * ),
+ * 'quotePrefix' => true
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @param boolean $pAdvanced Advanced mode for setting borders.
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style
+ */
+ public function applyFromArray($pStyles = null, $pAdvanced = true)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $pRange = $this->getSelectedCells();
+
+ // Uppercase coordinate
+ $pRange = strtoupper($pRange);
+
+ // Is it a cell range or a single cell?
+ if (strpos($pRange, ':') === false) {
+ $rangeA = $pRange;
+ $rangeB = $pRange;
+ } else {
+ list($rangeA, $rangeB) = explode(':', $pRange);
+ }
+
+ // Calculate range outer borders
+ $rangeStart = PHPExcel_Cell::coordinateFromString($rangeA);
+ $rangeEnd = PHPExcel_Cell::coordinateFromString($rangeB);
+
+ // Translate column into index
+ $rangeStart[0] = PHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
+ $rangeEnd[0] = PHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1;
+
+ // Make sure we can loop upwards on rows and columns
+ if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
+ $tmp = $rangeStart;
+ $rangeStart = $rangeEnd;
+ $rangeEnd = $tmp;
+ }
+
+ // ADVANCED MODE:
+ if ($pAdvanced && isset($pStyles['borders'])) {
+ // 'allborders' is a shorthand property for 'outline' and 'inside' and
+ // it applies to components that have not been set explicitly
+ if (isset($pStyles['borders']['allborders'])) {
+ foreach (array('outline', 'inside') as $component) {
+ if (!isset($pStyles['borders'][$component])) {
+ $pStyles['borders'][$component] = $pStyles['borders']['allborders'];
+ }
+ }
+ unset($pStyles['borders']['allborders']); // not needed any more
+ }
+ // 'outline' is a shorthand property for 'top', 'right', 'bottom', 'left'
+ // it applies to components that have not been set explicitly
+ if (isset($pStyles['borders']['outline'])) {
+ foreach (array('top', 'right', 'bottom', 'left') as $component) {
+ if (!isset($pStyles['borders'][$component])) {
+ $pStyles['borders'][$component] = $pStyles['borders']['outline'];
+ }
+ }
+ unset($pStyles['borders']['outline']); // not needed any more
+ }
+ // 'inside' is a shorthand property for 'vertical' and 'horizontal'
+ // it applies to components that have not been set explicitly
+ if (isset($pStyles['borders']['inside'])) {
+ foreach (array('vertical', 'horizontal') as $component) {
+ if (!isset($pStyles['borders'][$component])) {
+ $pStyles['borders'][$component] = $pStyles['borders']['inside'];
+ }
+ }
+ unset($pStyles['borders']['inside']); // not needed any more
+ }
+ // width and height characteristics of selection, 1, 2, or 3 (for 3 or more)
+ $xMax = min($rangeEnd[0] - $rangeStart[0] + 1, 3);
+ $yMax = min($rangeEnd[1] - $rangeStart[1] + 1, 3);
+
+ // loop through up to 3 x 3 = 9 regions
+ for ($x = 1; $x <= $xMax; ++$x) {
+ // start column index for region
+ $colStart = ($x == 3) ?
+ PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0])
+ : PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $x - 1);
+ // end column index for region
+ $colEnd = ($x == 1) ?
+ PHPExcel_Cell::stringFromColumnIndex($rangeStart[0])
+ : PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] - $xMax + $x);
+
+ for ($y = 1; $y <= $yMax; ++$y) {
+ // which edges are touching the region
+ $edges = array();
+ if ($x == 1) {
+ // are we at left edge
+ $edges[] = 'left';
+ }
+ if ($x == $xMax) {
+ // are we at right edge
+ $edges[] = 'right';
+ }
+ if ($y == 1) {
+ // are we at top edge?
+ $edges[] = 'top';
+ }
+ if ($y == $yMax) {
+ // are we at bottom edge?
+ $edges[] = 'bottom';
+ }
+
+ // start row index for region
+ $rowStart = ($y == 3) ?
+ $rangeEnd[1] : $rangeStart[1] + $y - 1;
+
+ // end row index for region
+ $rowEnd = ($y == 1) ?
+ $rangeStart[1] : $rangeEnd[1] - $yMax + $y;
+
+ // build range for region
+ $range = $colStart . $rowStart . ':' . $colEnd . $rowEnd;
+
+ // retrieve relevant style array for region
+ $regionStyles = $pStyles;
+ unset($regionStyles['borders']['inside']);
+
+ // what are the inner edges of the region when looking at the selection
+ $innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges);
+
+ // inner edges that are not touching the region should take the 'inside' border properties if they have been set
+ foreach ($innerEdges as $innerEdge) {
+ switch ($innerEdge) {
+ case 'top':
+ case 'bottom':
+ // should pick up 'horizontal' border property if set
+ if (isset($pStyles['borders']['horizontal'])) {
+ $regionStyles['borders'][$innerEdge] = $pStyles['borders']['horizontal'];
+ } else {
+ unset($regionStyles['borders'][$innerEdge]);
+ }
+ break;
+ case 'left':
+ case 'right':
+ // should pick up 'vertical' border property if set
+ if (isset($pStyles['borders']['vertical'])) {
+ $regionStyles['borders'][$innerEdge] = $pStyles['borders']['vertical'];
+ } else {
+ unset($regionStyles['borders'][$innerEdge]);
+ }
+ break;
+ }
+ }
+
+ // apply region style to region by calling applyFromArray() in simple mode
+ $this->getActiveSheet()->getStyle($range)->applyFromArray($regionStyles, false);
+ }
+ }
+ return $this;
+ }
+
+ // SIMPLE MODE:
+ // Selection type, inspect
+ if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
+ $selectionType = 'COLUMN';
+ } elseif (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
+ $selectionType = 'ROW';
+ } else {
+ $selectionType = 'CELL';
+ }
+
+ // First loop through columns, rows, or cells to find out which styles are affected by this operation
+ switch ($selectionType) {
+ case 'COLUMN':
+ $oldXfIndexes = array();
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ $oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true;
+ }
+ break;
+ case 'ROW':
+ $oldXfIndexes = array();
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) {
+ $oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style
+ } else {
+ $oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true;
+ }
+ }
+ break;
+ case 'CELL':
+ $oldXfIndexes = array();
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ $oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true;
+ }
+ }
+ break;
+ }
+
+ // clone each of the affected styles, apply the style array, and add the new styles to the workbook
+ $workbook = $this->getActiveSheet()->getParent();
+ foreach ($oldXfIndexes as $oldXfIndex => $dummy) {
+ $style = $workbook->getCellXfByIndex($oldXfIndex);
+ $newStyle = clone $style;
+ $newStyle->applyFromArray($pStyles);
+
+ if ($existingStyle = $workbook->getCellXfByHashCode($newStyle->getHashCode())) {
+ // there is already such cell Xf in our collection
+ $newXfIndexes[$oldXfIndex] = $existingStyle->getIndex();
+ } else {
+ // we don't have such a cell Xf, need to add
+ $workbook->addCellXf($newStyle);
+ $newXfIndexes[$oldXfIndex] = $newStyle->getIndex();
+ }
+ }
+
+ // Loop through columns, rows, or cells again and update the XF index
+ switch ($selectionType) {
+ case 'COLUMN':
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ $columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col);
+ $oldXfIndex = $columnDimension->getXfIndex();
+ $columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]);
+ }
+ break;
+
+ case 'ROW':
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ $rowDimension = $this->getActiveSheet()->getRowDimension($row);
+ $oldXfIndex = $rowDimension->getXfIndex() === null ?
+ 0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style
+ $rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]);
+ }
+ break;
+
+ case 'CELL':
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ $cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row);
+ $oldXfIndex = $cell->getXfIndex();
+ $cell->setXfIndex($newXfIndexes[$oldXfIndex]);
+ }
+ }
+ break;
+ }
+
+ } else {
+ // not a supervisor, just apply the style array directly on style object
+ if (array_key_exists('fill', $pStyles)) {
+ $this->getFill()->applyFromArray($pStyles['fill']);
+ }
+ if (array_key_exists('font', $pStyles)) {
+ $this->getFont()->applyFromArray($pStyles['font']);
+ }
+ if (array_key_exists('borders', $pStyles)) {
+ $this->getBorders()->applyFromArray($pStyles['borders']);
+ }
+ if (array_key_exists('alignment', $pStyles)) {
+ $this->getAlignment()->applyFromArray($pStyles['alignment']);
+ }
+ if (array_key_exists('numberformat', $pStyles)) {
+ $this->getNumberFormat()->applyFromArray($pStyles['numberformat']);
+ }
+ if (array_key_exists('protection', $pStyles)) {
+ $this->getProtection()->applyFromArray($pStyles['protection']);
+ }
+ if (array_key_exists('quotePrefix', $pStyles)) {
+ $this->quotePrefix = $pStyles['quotePrefix'];
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Fill
+ *
+ * @return PHPExcel_Style_Fill
+ */
+ public function getFill()
+ {
+ return $this->fill;
+ }
+
+ /**
+ * Get Font
+ *
+ * @return PHPExcel_Style_Font
+ */
+ public function getFont()
+ {
+ return $this->font;
+ }
+
+ /**
+ * Set font
+ *
+ * @param PHPExcel_Style_Font $font
+ * @return PHPExcel_Style
+ */
+ public function setFont(PHPExcel_Style_Font $font)
+ {
+ $this->font = $font;
+ return $this;
+ }
+
+ /**
+ * Get Borders
+ *
+ * @return PHPExcel_Style_Borders
+ */
+ public function getBorders()
+ {
+ return $this->borders;
+ }
+
+ /**
+ * Get Alignment
+ *
+ * @return PHPExcel_Style_Alignment
+ */
+ public function getAlignment()
+ {
+ return $this->alignment;
+ }
+
+ /**
+ * Get Number Format
+ *
+ * @return PHPExcel_Style_NumberFormat
+ */
+ public function getNumberFormat()
+ {
+ return $this->numberFormat;
+ }
+
+ /**
+ * Get Conditional Styles. Only used on supervisor.
+ *
+ * @return PHPExcel_Style_Conditional[]
+ */
+ public function getConditionalStyles()
+ {
+ return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell());
+ }
+
+ /**
+ * Set Conditional Styles. Only used on supervisor.
+ *
+ * @param PHPExcel_Style_Conditional[] $pValue Array of condtional styles
+ * @return PHPExcel_Style
+ */
+ public function setConditionalStyles($pValue = null)
+ {
+ if (is_array($pValue)) {
+ $this->getActiveSheet()->setConditionalStyles($this->getSelectedCells(), $pValue);
+ }
+ return $this;
+ }
+
+ /**
+ * Get Protection
+ *
+ * @return PHPExcel_Style_Protection
+ */
+ public function getProtection()
+ {
+ return $this->protection;
+ }
+
+ /**
+ * Get quote prefix
+ *
+ * @return boolean
+ */
+ public function getQuotePrefix()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getQuotePrefix();
+ }
+ return $this->quotePrefix;
+ }
+
+ /**
+ * Set quote prefix
+ *
+ * @param boolean $pValue
+ */
+ public function setQuotePrefix($pValue)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = array('quotePrefix' => $pValue);
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->quotePrefix = (boolean) $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ $hashConditionals = '';
+ foreach ($this->conditionalStyles as $conditional) {
+ $hashConditionals .= $conditional->getHashCode();
+ }
+
+ return md5(
+ $this->fill->getHashCode() .
+ $this->font->getHashCode() .
+ $this->borders->getHashCode() .
+ $this->alignment->getHashCode() .
+ $this->numberFormat->getHashCode() .
+ $hashConditionals .
+ $this->protection->getHashCode() .
+ ($this->quotePrefix ? 't' : 'f') .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Get own index in style collection
+ *
+ * @return int
+ */
+ public function getIndex()
+ {
+ return $this->index;
+ }
+
+ /**
+ * Set own index in style collection
+ *
+ * @param int $pValue
+ */
+ public function setIndex($pValue)
+ {
+ $this->index = $pValue;
+ }
+}
diff --git a/Classes/PHPExcel/Style/Alignment.php b/Classes/PHPExcel/Style/Alignment.php
new file mode 100644
index 0000000..bfc4947
--- /dev/null
+++ b/Classes/PHPExcel/Style/Alignment.php
@@ -0,0 +1,464 @@
+horizontal = null;
+ $this->vertical = null;
+ $this->textRotation = null;
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Alignment
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getAlignment();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('alignment' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray(
+ * array(
+ * 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+ * 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER,
+ * 'rotation' => 0,
+ * 'wrap' => TRUE
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Alignment
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())
+ ->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (isset($pStyles['horizontal'])) {
+ $this->setHorizontal($pStyles['horizontal']);
+ }
+ if (isset($pStyles['vertical'])) {
+ $this->setVertical($pStyles['vertical']);
+ }
+ if (isset($pStyles['rotation'])) {
+ $this->setTextRotation($pStyles['rotation']);
+ }
+ if (isset($pStyles['wrap'])) {
+ $this->setWrapText($pStyles['wrap']);
+ }
+ if (isset($pStyles['shrinkToFit'])) {
+ $this->setShrinkToFit($pStyles['shrinkToFit']);
+ }
+ if (isset($pStyles['indent'])) {
+ $this->setIndent($pStyles['indent']);
+ }
+ if (isset($pStyles['readorder'])) {
+ $this->setReadorder($pStyles['readorder']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Horizontal
+ *
+ * @return string
+ */
+ public function getHorizontal()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHorizontal();
+ }
+ return $this->horizontal;
+ }
+
+ /**
+ * Set Horizontal
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setHorizontal($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
+ {
+ if ($pValue == '') {
+ $pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
+ }
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('horizontal' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->horizontal = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Vertical
+ *
+ * @return string
+ */
+ public function getVertical()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getVertical();
+ }
+ return $this->vertical;
+ }
+
+ /**
+ * Set Vertical
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setVertical($pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM)
+ {
+ if ($pValue == '') {
+ $pValue = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
+ }
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('vertical' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->vertical = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get TextRotation
+ *
+ * @return int
+ */
+ public function getTextRotation()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getTextRotation();
+ }
+ return $this->textRotation;
+ }
+
+ /**
+ * Set TextRotation
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setTextRotation($pValue = 0)
+ {
+ // Excel2007 value 255 => PHPExcel value -165
+ if ($pValue == 255) {
+ $pValue = -165;
+ }
+
+ // Set rotation
+ if (($pValue >= -90 && $pValue <= 90) || $pValue == -165) {
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('rotation' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->textRotation = $pValue;
+ }
+ } else {
+ throw new PHPExcel_Exception("Text rotation should be a value between -90 and 90.");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get Wrap Text
+ *
+ * @return boolean
+ */
+ public function getWrapText()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getWrapText();
+ }
+ return $this->wrapText;
+ }
+
+ /**
+ * Set Wrap Text
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setWrapText($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('wrap' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->wrapText = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Shrink to fit
+ *
+ * @return boolean
+ */
+ public function getShrinkToFit()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getShrinkToFit();
+ }
+ return $this->shrinkToFit;
+ }
+
+ /**
+ * Set Shrink to fit
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setShrinkToFit($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->shrinkToFit = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get indent
+ *
+ * @return int
+ */
+ public function getIndent()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getIndent();
+ }
+ return $this->indent;
+ }
+
+ /**
+ * Set indent
+ *
+ * @param int $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setIndent($pValue = 0)
+ {
+ if ($pValue > 0) {
+ if ($this->getHorizontal() != self::HORIZONTAL_GENERAL &&
+ $this->getHorizontal() != self::HORIZONTAL_LEFT &&
+ $this->getHorizontal() != self::HORIZONTAL_RIGHT) {
+ $pValue = 0; // indent not supported
+ }
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('indent' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->indent = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get read order
+ *
+ * @return integer
+ */
+ public function getReadorder()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getReadorder();
+ }
+ return $this->readorder;
+ }
+
+ /**
+ * Set read order
+ *
+ * @param int $pValue
+ * @return PHPExcel_Style_Alignment
+ */
+ public function setReadorder($pValue = 0)
+ {
+ if ($pValue < 0 || $pValue > 2) {
+ $pValue = 0;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('readorder' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->readorder = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->horizontal .
+ $this->vertical .
+ $this->textRotation .
+ ($this->wrapText ? 't' : 'f') .
+ ($this->shrinkToFit ? 't' : 'f') .
+ $this->indent .
+ $this->readorder .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Border.php b/Classes/PHPExcel/Style/Border.php
new file mode 100644
index 0000000..55efc50
--- /dev/null
+++ b/Classes/PHPExcel/Style/Border.php
@@ -0,0 +1,282 @@
+color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
+
+ // bind parent if we are a supervisor
+ if ($isSupervisor) {
+ $this->color->bindParent($this, 'color');
+ }
+ }
+
+ /**
+ * Bind parent. Only used for supervisor
+ *
+ * @param PHPExcel_Style_Borders $parent
+ * @param string $parentPropertyName
+ * @return PHPExcel_Style_Border
+ */
+ public function bindParent($parent, $parentPropertyName = null)
+ {
+ $this->parent = $parent;
+ $this->parentPropertyName = $parentPropertyName;
+ return $this;
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Border
+ * @throws PHPExcel_Exception
+ */
+ public function getSharedComponent()
+ {
+ switch ($this->parentPropertyName) {
+ case 'allBorders':
+ case 'horizontal':
+ case 'inside':
+ case 'outline':
+ case 'vertical':
+ throw new PHPExcel_Exception('Cannot get shared component for a pseudo-border.');
+ break;
+ case 'bottom':
+ return $this->parent->getSharedComponent()->getBottom();
+ case 'diagonal':
+ return $this->parent->getSharedComponent()->getDiagonal();
+ case 'left':
+ return $this->parent->getSharedComponent()->getLeft();
+ case 'right':
+ return $this->parent->getSharedComponent()->getRight();
+ case 'top':
+ return $this->parent->getSharedComponent()->getTop();
+ }
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ switch ($this->parentPropertyName) {
+ case 'allBorders':
+ case 'bottom':
+ case 'diagonal':
+ case 'horizontal':
+ case 'inside':
+ case 'left':
+ case 'outline':
+ case 'right':
+ case 'top':
+ case 'vertical':
+ $key = strtolower('vertical');
+ break;
+ }
+ return $this->parent->getStyleArray(array($key => $array));
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray(
+ * array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Border
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (isset($pStyles['style'])) {
+ $this->setBorderStyle($pStyles['style']);
+ }
+ if (isset($pStyles['color'])) {
+ $this->getColor()->applyFromArray($pStyles['color']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Border style
+ *
+ * @return string
+ */
+ public function getBorderStyle()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getBorderStyle();
+ }
+ return $this->borderStyle;
+ }
+
+ /**
+ * Set Border style
+ *
+ * @param string|boolean $pValue
+ * When passing a boolean, FALSE equates PHPExcel_Style_Border::BORDER_NONE
+ * and TRUE to PHPExcel_Style_Border::BORDER_MEDIUM
+ * @return PHPExcel_Style_Border
+ */
+ public function setBorderStyle($pValue = PHPExcel_Style_Border::BORDER_NONE)
+ {
+
+ if (empty($pValue)) {
+ $pValue = PHPExcel_Style_Border::BORDER_NONE;
+ } elseif (is_bool($pValue) && $pValue) {
+ $pValue = PHPExcel_Style_Border::BORDER_MEDIUM;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('style' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->borderStyle = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Border Color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * Set Border Color
+ *
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Border
+ */
+ public function setColor(PHPExcel_Style_Color $pValue = null)
+ {
+ // make sure parameter is a real color and not a supervisor
+ $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->color = $color;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->borderStyle .
+ $this->color->getHashCode() .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Borders.php b/Classes/PHPExcel/Style/Borders.php
new file mode 100644
index 0000000..27c40a4
--- /dev/null
+++ b/Classes/PHPExcel/Style/Borders.php
@@ -0,0 +1,429 @@
+left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
+ $this->right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
+ $this->top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
+ $this->bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
+ $this->diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
+ $this->diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
+
+ // Specially for supervisor
+ if ($isSupervisor) {
+ // Initialize pseudo-borders
+ $this->allBorders = new PHPExcel_Style_Border(true);
+ $this->outline = new PHPExcel_Style_Border(true);
+ $this->inside = new PHPExcel_Style_Border(true);
+ $this->vertical = new PHPExcel_Style_Border(true);
+ $this->horizontal = new PHPExcel_Style_Border(true);
+
+ // bind parent if we are a supervisor
+ $this->left->bindParent($this, 'left');
+ $this->right->bindParent($this, 'right');
+ $this->top->bindParent($this, 'top');
+ $this->bottom->bindParent($this, 'bottom');
+ $this->diagonal->bindParent($this, 'diagonal');
+ $this->allBorders->bindParent($this, 'allBorders');
+ $this->outline->bindParent($this, 'outline');
+ $this->inside->bindParent($this, 'inside');
+ $this->vertical->bindParent($this, 'vertical');
+ $this->horizontal->bindParent($this, 'horizontal');
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Borders
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getBorders();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('borders' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
+ * array(
+ * 'bottom' => array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * ),
+ * 'top' => array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * )
+ * )
+ * );
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->applyFromArray(
+ * array(
+ * 'allborders' => array(
+ * 'style' => PHPExcel_Style_Border::BORDER_DASHDOT,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * )
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Borders
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (array_key_exists('left', $pStyles)) {
+ $this->getLeft()->applyFromArray($pStyles['left']);
+ }
+ if (array_key_exists('right', $pStyles)) {
+ $this->getRight()->applyFromArray($pStyles['right']);
+ }
+ if (array_key_exists('top', $pStyles)) {
+ $this->getTop()->applyFromArray($pStyles['top']);
+ }
+ if (array_key_exists('bottom', $pStyles)) {
+ $this->getBottom()->applyFromArray($pStyles['bottom']);
+ }
+ if (array_key_exists('diagonal', $pStyles)) {
+ $this->getDiagonal()->applyFromArray($pStyles['diagonal']);
+ }
+ if (array_key_exists('diagonaldirection', $pStyles)) {
+ $this->setDiagonalDirection($pStyles['diagonaldirection']);
+ }
+ if (array_key_exists('allborders', $pStyles)) {
+ $this->getLeft()->applyFromArray($pStyles['allborders']);
+ $this->getRight()->applyFromArray($pStyles['allborders']);
+ $this->getTop()->applyFromArray($pStyles['allborders']);
+ $this->getBottom()->applyFromArray($pStyles['allborders']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Left
+ *
+ * @return PHPExcel_Style_Border
+ */
+ public function getLeft()
+ {
+ return $this->left;
+ }
+
+ /**
+ * Get Right
+ *
+ * @return PHPExcel_Style_Border
+ */
+ public function getRight()
+ {
+ return $this->right;
+ }
+
+ /**
+ * Get Top
+ *
+ * @return PHPExcel_Style_Border
+ */
+ public function getTop()
+ {
+ return $this->top;
+ }
+
+ /**
+ * Get Bottom
+ *
+ * @return PHPExcel_Style_Border
+ */
+ public function getBottom()
+ {
+ return $this->bottom;
+ }
+
+ /**
+ * Get Diagonal
+ *
+ * @return PHPExcel_Style_Border
+ */
+ public function getDiagonal()
+ {
+ return $this->diagonal;
+ }
+
+ /**
+ * Get AllBorders (pseudo-border). Only applies to supervisor.
+ *
+ * @return PHPExcel_Style_Border
+ * @throws PHPExcel_Exception
+ */
+ public function getAllBorders()
+ {
+ if (!$this->isSupervisor) {
+ throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
+ }
+ return $this->allBorders;
+ }
+
+ /**
+ * Get Outline (pseudo-border). Only applies to supervisor.
+ *
+ * @return boolean
+ * @throws PHPExcel_Exception
+ */
+ public function getOutline()
+ {
+ if (!$this->isSupervisor) {
+ throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
+ }
+ return $this->outline;
+ }
+
+ /**
+ * Get Inside (pseudo-border). Only applies to supervisor.
+ *
+ * @return boolean
+ * @throws PHPExcel_Exception
+ */
+ public function getInside()
+ {
+ if (!$this->isSupervisor) {
+ throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
+ }
+ return $this->inside;
+ }
+
+ /**
+ * Get Vertical (pseudo-border). Only applies to supervisor.
+ *
+ * @return PHPExcel_Style_Border
+ * @throws PHPExcel_Exception
+ */
+ public function getVertical()
+ {
+ if (!$this->isSupervisor) {
+ throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
+ }
+ return $this->vertical;
+ }
+
+ /**
+ * Get Horizontal (pseudo-border). Only applies to supervisor.
+ *
+ * @return PHPExcel_Style_Border
+ * @throws PHPExcel_Exception
+ */
+ public function getHorizontal()
+ {
+ if (!$this->isSupervisor) {
+ throw new PHPExcel_Exception('Can only get pseudo-border for supervisor.');
+ }
+ return $this->horizontal;
+ }
+
+ /**
+ * Get DiagonalDirection
+ *
+ * @return int
+ */
+ public function getDiagonalDirection()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getDiagonalDirection();
+ }
+ return $this->diagonalDirection;
+ }
+
+ /**
+ * Set DiagonalDirection
+ *
+ * @param int $pValue
+ * @return PHPExcel_Style_Borders
+ */
+ public function setDiagonalDirection($pValue = PHPExcel_Style_Borders::DIAGONAL_NONE)
+ {
+ if ($pValue == '') {
+ $pValue = PHPExcel_Style_Borders::DIAGONAL_NONE;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->diagonalDirection = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashcode();
+ }
+ return md5(
+ $this->getLeft()->getHashCode() .
+ $this->getRight()->getHashCode() .
+ $this->getTop()->getHashCode() .
+ $this->getBottom()->getHashCode() .
+ $this->getDiagonal()->getHashCode() .
+ $this->getDiagonalDirection() .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Color.php b/Classes/PHPExcel/Style/Color.php
new file mode 100644
index 0000000..9c7790f
--- /dev/null
+++ b/Classes/PHPExcel/Style/Color.php
@@ -0,0 +1,443 @@
+argb = $pARGB;
+ }
+ }
+
+ /**
+ * Bind parent. Only used for supervisor
+ *
+ * @param mixed $parent
+ * @param string $parentPropertyName
+ * @return PHPExcel_Style_Color
+ */
+ public function bindParent($parent, $parentPropertyName = null)
+ {
+ $this->parent = $parent;
+ $this->parentPropertyName = $parentPropertyName;
+ return $this;
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getSharedComponent()
+ {
+ switch ($this->parentPropertyName) {
+ case 'endColor':
+ return $this->parent->getSharedComponent()->getEndColor();
+ case 'color':
+ return $this->parent->getSharedComponent()->getColor();
+ case 'startColor':
+ return $this->parent->getSharedComponent()->getStartColor();
+ }
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ switch ($this->parentPropertyName) {
+ case 'endColor':
+ $key = 'endcolor';
+ break;
+ case 'color':
+ $key = 'color';
+ break;
+ case 'startColor':
+ $key = 'startcolor';
+ break;
+
+ }
+ return $this->parent->getStyleArray(array($key => $array));
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Color
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (array_key_exists('rgb', $pStyles)) {
+ $this->setRGB($pStyles['rgb']);
+ }
+ if (array_key_exists('argb', $pStyles)) {
+ $this->setARGB($pStyles['argb']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get ARGB
+ *
+ * @return string
+ */
+ public function getARGB()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getARGB();
+ }
+ return $this->argb;
+ }
+
+ /**
+ * Set ARGB
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Color
+ */
+ public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK)
+ {
+ if ($pValue == '') {
+ $pValue = PHPExcel_Style_Color::COLOR_BLACK;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('argb' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->argb = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get RGB
+ *
+ * @return string
+ */
+ public function getRGB()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getRGB();
+ }
+ return substr($this->argb, 2);
+ }
+
+ /**
+ * Set RGB
+ *
+ * @param string $pValue RGB value
+ * @return PHPExcel_Style_Color
+ */
+ public function setRGB($pValue = '000000')
+ {
+ if ($pValue == '') {
+ $pValue = '000000';
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->argb = 'FF' . $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get a specified colour component of an RGB value
+ *
+ * @private
+ * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
+ * @param int $offset Position within the RGB value to extract
+ * @param boolean $hex Flag indicating whether the component should be returned as a hex or a
+ * decimal value
+ * @return string The extracted colour component
+ */
+ private static function getColourComponent($RGB, $offset, $hex = true)
+ {
+ $colour = substr($RGB, $offset, 2);
+ if (!$hex) {
+ $colour = hexdec($colour);
+ }
+ return $colour;
+ }
+
+ /**
+ * Get the red colour component of an RGB value
+ *
+ * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
+ * @param boolean $hex Flag indicating whether the component should be returned as a hex or a
+ * decimal value
+ * @return string The red colour component
+ */
+ public static function getRed($RGB, $hex = true)
+ {
+ return self::getColourComponent($RGB, strlen($RGB) - 6, $hex);
+ }
+
+ /**
+ * Get the green colour component of an RGB value
+ *
+ * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
+ * @param boolean $hex Flag indicating whether the component should be returned as a hex or a
+ * decimal value
+ * @return string The green colour component
+ */
+ public static function getGreen($RGB, $hex = true)
+ {
+ return self::getColourComponent($RGB, strlen($RGB) - 4, $hex);
+ }
+
+ /**
+ * Get the blue colour component of an RGB value
+ *
+ * @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE
+ * @param boolean $hex Flag indicating whether the component should be returned as a hex or a
+ * decimal value
+ * @return string The blue colour component
+ */
+ public static function getBlue($RGB, $hex = true)
+ {
+ return self::getColourComponent($RGB, strlen($RGB) - 2, $hex);
+ }
+
+ /**
+ * Adjust the brightness of a color
+ *
+ * @param string $hex The colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE)
+ * @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1
+ * @return string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE)
+ */
+ public static function changeBrightness($hex, $adjustPercentage)
+ {
+ $rgba = (strlen($hex) == 8);
+
+ $red = self::getRed($hex, false);
+ $green = self::getGreen($hex, false);
+ $blue = self::getBlue($hex, false);
+ if ($adjustPercentage > 0) {
+ $red += (255 - $red) * $adjustPercentage;
+ $green += (255 - $green) * $adjustPercentage;
+ $blue += (255 - $blue) * $adjustPercentage;
+ } else {
+ $red += $red * $adjustPercentage;
+ $green += $green * $adjustPercentage;
+ $blue += $blue * $adjustPercentage;
+ }
+
+ if ($red < 0) {
+ $red = 0;
+ } elseif ($red > 255) {
+ $red = 255;
+ }
+ if ($green < 0) {
+ $green = 0;
+ } elseif ($green > 255) {
+ $green = 255;
+ }
+ if ($blue < 0) {
+ $blue = 0;
+ } elseif ($blue > 255) {
+ $blue = 255;
+ }
+
+ $rgb = strtoupper(
+ str_pad(dechex($red), 2, '0', 0) .
+ str_pad(dechex($green), 2, '0', 0) .
+ str_pad(dechex($blue), 2, '0', 0)
+ );
+ return (($rgba) ? 'FF' : '') . $rgb;
+ }
+
+ /**
+ * Get indexed color
+ *
+ * @param int $pIndex Index entry point into the colour array
+ * @param boolean $background Flag to indicate whether default background or foreground colour
+ * should be returned if the indexed colour doesn't exist
+ * @return PHPExcel_Style_Color
+ */
+ public static function indexedColor($pIndex, $background = false)
+ {
+ // Clean parameter
+ $pIndex = intval($pIndex);
+
+ // Indexed colors
+ if (is_null(self::$indexedColors)) {
+ self::$indexedColors = array(
+ 1 => 'FF000000', // System Colour #1 - Black
+ 2 => 'FFFFFFFF', // System Colour #2 - White
+ 3 => 'FFFF0000', // System Colour #3 - Red
+ 4 => 'FF00FF00', // System Colour #4 - Green
+ 5 => 'FF0000FF', // System Colour #5 - Blue
+ 6 => 'FFFFFF00', // System Colour #6 - Yellow
+ 7 => 'FFFF00FF', // System Colour #7- Magenta
+ 8 => 'FF00FFFF', // System Colour #8- Cyan
+ 9 => 'FF800000', // Standard Colour #9
+ 10 => 'FF008000', // Standard Colour #10
+ 11 => 'FF000080', // Standard Colour #11
+ 12 => 'FF808000', // Standard Colour #12
+ 13 => 'FF800080', // Standard Colour #13
+ 14 => 'FF008080', // Standard Colour #14
+ 15 => 'FFC0C0C0', // Standard Colour #15
+ 16 => 'FF808080', // Standard Colour #16
+ 17 => 'FF9999FF', // Chart Fill Colour #17
+ 18 => 'FF993366', // Chart Fill Colour #18
+ 19 => 'FFFFFFCC', // Chart Fill Colour #19
+ 20 => 'FFCCFFFF', // Chart Fill Colour #20
+ 21 => 'FF660066', // Chart Fill Colour #21
+ 22 => 'FFFF8080', // Chart Fill Colour #22
+ 23 => 'FF0066CC', // Chart Fill Colour #23
+ 24 => 'FFCCCCFF', // Chart Fill Colour #24
+ 25 => 'FF000080', // Chart Line Colour #25
+ 26 => 'FFFF00FF', // Chart Line Colour #26
+ 27 => 'FFFFFF00', // Chart Line Colour #27
+ 28 => 'FF00FFFF', // Chart Line Colour #28
+ 29 => 'FF800080', // Chart Line Colour #29
+ 30 => 'FF800000', // Chart Line Colour #30
+ 31 => 'FF008080', // Chart Line Colour #31
+ 32 => 'FF0000FF', // Chart Line Colour #32
+ 33 => 'FF00CCFF', // Standard Colour #33
+ 34 => 'FFCCFFFF', // Standard Colour #34
+ 35 => 'FFCCFFCC', // Standard Colour #35
+ 36 => 'FFFFFF99', // Standard Colour #36
+ 37 => 'FF99CCFF', // Standard Colour #37
+ 38 => 'FFFF99CC', // Standard Colour #38
+ 39 => 'FFCC99FF', // Standard Colour #39
+ 40 => 'FFFFCC99', // Standard Colour #40
+ 41 => 'FF3366FF', // Standard Colour #41
+ 42 => 'FF33CCCC', // Standard Colour #42
+ 43 => 'FF99CC00', // Standard Colour #43
+ 44 => 'FFFFCC00', // Standard Colour #44
+ 45 => 'FFFF9900', // Standard Colour #45
+ 46 => 'FFFF6600', // Standard Colour #46
+ 47 => 'FF666699', // Standard Colour #47
+ 48 => 'FF969696', // Standard Colour #48
+ 49 => 'FF003366', // Standard Colour #49
+ 50 => 'FF339966', // Standard Colour #50
+ 51 => 'FF003300', // Standard Colour #51
+ 52 => 'FF333300', // Standard Colour #52
+ 53 => 'FF993300', // Standard Colour #53
+ 54 => 'FF993366', // Standard Colour #54
+ 55 => 'FF333399', // Standard Colour #55
+ 56 => 'FF333333' // Standard Colour #56
+ );
+ }
+
+ if (array_key_exists($pIndex, self::$indexedColors)) {
+ return new PHPExcel_Style_Color(self::$indexedColors[$pIndex]);
+ }
+
+ if ($background) {
+ return new PHPExcel_Style_Color(self::COLOR_WHITE);
+ }
+ return new PHPExcel_Style_Color(self::COLOR_BLACK);
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->argb .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Conditional.php b/Classes/PHPExcel/Style/Conditional.php
new file mode 100644
index 0000000..331362b
--- /dev/null
+++ b/Classes/PHPExcel/Style/Conditional.php
@@ -0,0 +1,293 @@
+conditionType = PHPExcel_Style_Conditional::CONDITION_NONE;
+ $this->operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
+ $this->text = null;
+ $this->condition = array();
+ $this->style = new PHPExcel_Style(false, true);
+ }
+
+ /**
+ * Get Condition type
+ *
+ * @return string
+ */
+ public function getConditionType()
+ {
+ return $this->conditionType;
+ }
+
+ /**
+ * Set Condition type
+ *
+ * @param string $pValue PHPExcel_Style_Conditional condition type
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE)
+ {
+ $this->conditionType = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Operator type
+ *
+ * @return string
+ */
+ public function getOperatorType()
+ {
+ return $this->operatorType;
+ }
+
+ /**
+ * Set Operator type
+ *
+ * @param string $pValue PHPExcel_Style_Conditional operator type
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE)
+ {
+ $this->operatorType = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get text
+ *
+ * @return string
+ */
+ public function getText()
+ {
+ return $this->text;
+ }
+
+ /**
+ * Set text
+ *
+ * @param string $value
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setText($value = null)
+ {
+ $this->text = $value;
+ return $this;
+ }
+
+ /**
+ * Get Condition
+ *
+ * @deprecated Deprecated, use getConditions instead
+ * @return string
+ */
+ public function getCondition()
+ {
+ if (isset($this->condition[0])) {
+ return $this->condition[0];
+ }
+
+ return '';
+ }
+
+ /**
+ * Set Condition
+ *
+ * @deprecated Deprecated, use setConditions instead
+ * @param string $pValue Condition
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setCondition($pValue = '')
+ {
+ if (!is_array($pValue)) {
+ $pValue = array($pValue);
+ }
+
+ return $this->setConditions($pValue);
+ }
+
+ /**
+ * Get Conditions
+ *
+ * @return string[]
+ */
+ public function getConditions()
+ {
+ return $this->condition;
+ }
+
+ /**
+ * Set Conditions
+ *
+ * @param string[] $pValue Condition
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setConditions($pValue)
+ {
+ if (!is_array($pValue)) {
+ $pValue = array($pValue);
+ }
+ $this->condition = $pValue;
+ return $this;
+ }
+
+ /**
+ * Add Condition
+ *
+ * @param string $pValue Condition
+ * @return PHPExcel_Style_Conditional
+ */
+ public function addCondition($pValue = '')
+ {
+ $this->condition[] = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Style
+ *
+ * @return PHPExcel_Style
+ */
+ public function getStyle()
+ {
+ return $this->style;
+ }
+
+ /**
+ * Set Style
+ *
+ * @param PHPExcel_Style $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Conditional
+ */
+ public function setStyle(PHPExcel_Style $pValue = null)
+ {
+ $this->style = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ $this->conditionType .
+ $this->operatorType .
+ implode(';', $this->condition) .
+ $this->style->getHashCode() .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Style/Fill.php b/Classes/PHPExcel/Style/Fill.php
new file mode 100644
index 0000000..26343ff
--- /dev/null
+++ b/Classes/PHPExcel/Style/Fill.php
@@ -0,0 +1,322 @@
+fillType = null;
+ }
+ $this->startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional);
+ $this->endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
+
+ // bind parent if we are a supervisor
+ if ($isSupervisor) {
+ $this->startColor->bindParent($this, 'startColor');
+ $this->endColor->bindParent($this, 'endColor');
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Fill
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getFill();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('fill' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFill()->applyFromArray(
+ * array(
+ * 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
+ * 'rotation' => 0,
+ * 'startcolor' => array(
+ * 'rgb' => '000000'
+ * ),
+ * 'endcolor' => array(
+ * 'argb' => 'FFFFFFFF'
+ * )
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Fill
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (array_key_exists('type', $pStyles)) {
+ $this->setFillType($pStyles['type']);
+ }
+ if (array_key_exists('rotation', $pStyles)) {
+ $this->setRotation($pStyles['rotation']);
+ }
+ if (array_key_exists('startcolor', $pStyles)) {
+ $this->getStartColor()->applyFromArray($pStyles['startcolor']);
+ }
+ if (array_key_exists('endcolor', $pStyles)) {
+ $this->getEndColor()->applyFromArray($pStyles['endcolor']);
+ }
+ if (array_key_exists('color', $pStyles)) {
+ $this->getStartColor()->applyFromArray($pStyles['color']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Fill Type
+ *
+ * @return string
+ */
+ public function getFillType()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getFillType();
+ }
+ return $this->fillType;
+ }
+
+ /**
+ * Set Fill Type
+ *
+ * @param string $pValue PHPExcel_Style_Fill fill type
+ * @return PHPExcel_Style_Fill
+ */
+ public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE)
+ {
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('type' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->fillType = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Rotation
+ *
+ * @return double
+ */
+ public function getRotation()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getRotation();
+ }
+ return $this->rotation;
+ }
+
+ /**
+ * Set Rotation
+ *
+ * @param double $pValue
+ * @return PHPExcel_Style_Fill
+ */
+ public function setRotation($pValue = 0)
+ {
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('rotation' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->rotation = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Start Color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getStartColor()
+ {
+ return $this->startColor;
+ }
+
+ /**
+ * Set Start Color
+ *
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Fill
+ */
+ public function setStartColor(PHPExcel_Style_Color $pValue = null)
+ {
+ // make sure parameter is a real color and not a supervisor
+ $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB()));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->startColor = $color;
+ }
+ return $this;
+ }
+
+ /**
+ * Get End Color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getEndColor()
+ {
+ return $this->endColor;
+ }
+
+ /**
+ * Set End Color
+ *
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Fill
+ */
+ public function setEndColor(PHPExcel_Style_Color $pValue = null)
+ {
+ // make sure parameter is a real color and not a supervisor
+ $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB()));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->endColor = $color;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->getFillType() .
+ $this->getRotation() .
+ $this->getStartColor()->getHashCode() .
+ $this->getEndColor()->getHashCode() .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Font.php b/Classes/PHPExcel/Style/Font.php
new file mode 100644
index 0000000..9566e1d
--- /dev/null
+++ b/Classes/PHPExcel/Style/Font.php
@@ -0,0 +1,543 @@
+name = null;
+ $this->size = null;
+ $this->bold = null;
+ $this->italic = null;
+ $this->superScript = null;
+ $this->subScript = null;
+ $this->underline = null;
+ $this->strikethrough = null;
+ $this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
+ } else {
+ $this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
+ }
+ // bind parent if we are a supervisor
+ if ($isSupervisor) {
+ $this->color->bindParent($this, 'color');
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Font
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getFont();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('font' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
+ * array(
+ * 'name' => 'Arial',
+ * 'bold' => TRUE,
+ * 'italic' => FALSE,
+ * 'underline' => PHPExcel_Style_Font::UNDERLINE_DOUBLE,
+ * 'strike' => FALSE,
+ * 'color' => array(
+ * 'rgb' => '808080'
+ * )
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Font
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (array_key_exists('name', $pStyles)) {
+ $this->setName($pStyles['name']);
+ }
+ if (array_key_exists('bold', $pStyles)) {
+ $this->setBold($pStyles['bold']);
+ }
+ if (array_key_exists('italic', $pStyles)) {
+ $this->setItalic($pStyles['italic']);
+ }
+ if (array_key_exists('superScript', $pStyles)) {
+ $this->setSuperScript($pStyles['superScript']);
+ }
+ if (array_key_exists('subScript', $pStyles)) {
+ $this->setSubScript($pStyles['subScript']);
+ }
+ if (array_key_exists('underline', $pStyles)) {
+ $this->setUnderline($pStyles['underline']);
+ }
+ if (array_key_exists('strike', $pStyles)) {
+ $this->setStrikethrough($pStyles['strike']);
+ }
+ if (array_key_exists('color', $pStyles)) {
+ $this->getColor()->applyFromArray($pStyles['color']);
+ }
+ if (array_key_exists('size', $pStyles)) {
+ $this->setSize($pStyles['size']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getName();
+ }
+ return $this->name;
+ }
+
+ /**
+ * Set Name
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setName($pValue = 'Calibri')
+ {
+ if ($pValue == '') {
+ $pValue = 'Calibri';
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('name' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->name = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Size
+ *
+ * @return double
+ */
+ public function getSize()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getSize();
+ }
+ return $this->size;
+ }
+
+ /**
+ * Set Size
+ *
+ * @param double $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setSize($pValue = 10)
+ {
+ if ($pValue == '') {
+ $pValue = 10;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('size' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->size = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Bold
+ *
+ * @return boolean
+ */
+ public function getBold()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getBold();
+ }
+ return $this->bold;
+ }
+
+ /**
+ * Set Bold
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setBold($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('bold' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->bold = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Italic
+ *
+ * @return boolean
+ */
+ public function getItalic()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getItalic();
+ }
+ return $this->italic;
+ }
+
+ /**
+ * Set Italic
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setItalic($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('italic' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->italic = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get SuperScript
+ *
+ * @return boolean
+ */
+ public function getSuperScript()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getSuperScript();
+ }
+ return $this->superScript;
+ }
+
+ /**
+ * Set SuperScript
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setSuperScript($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('superScript' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->superScript = $pValue;
+ $this->subScript = !$pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get SubScript
+ *
+ * @return boolean
+ */
+ public function getSubScript()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getSubScript();
+ }
+ return $this->subScript;
+ }
+
+ /**
+ * Set SubScript
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setSubScript($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('subScript' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->subScript = $pValue;
+ $this->superScript = !$pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Underline
+ *
+ * @return string
+ */
+ public function getUnderline()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getUnderline();
+ }
+ return $this->underline;
+ }
+
+ /**
+ * Set Underline
+ *
+ * @param string|boolean $pValue PHPExcel_Style_Font underline type
+ * If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE,
+ * false equates to UNDERLINE_NONE
+ * @return PHPExcel_Style_Font
+ */
+ public function setUnderline($pValue = self::UNDERLINE_NONE)
+ {
+ if (is_bool($pValue)) {
+ $pValue = ($pValue) ? self::UNDERLINE_SINGLE : self::UNDERLINE_NONE;
+ } elseif ($pValue == '') {
+ $pValue = self::UNDERLINE_NONE;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('underline' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->underline = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Strikethrough
+ *
+ * @return boolean
+ */
+ public function getStrikethrough()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getStrikethrough();
+ }
+ return $this->strikethrough;
+ }
+
+ /**
+ * Set Strikethrough
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Style_Font
+ */
+ public function setStrikethrough($pValue = false)
+ {
+ if ($pValue == '') {
+ $pValue = false;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('strike' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->strikethrough = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * Set Color
+ *
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Font
+ */
+ public function setColor(PHPExcel_Style_Color $pValue = null)
+ {
+ // make sure parameter is a real color and not a supervisor
+ $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->color = $color;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->name .
+ $this->size .
+ ($this->bold ? 't' : 'f') .
+ ($this->italic ? 't' : 'f') .
+ ($this->superScript ? 't' : 'f') .
+ ($this->subScript ? 't' : 'f') .
+ $this->underline .
+ ($this->strikethrough ? 't' : 'f') .
+ $this->color->getHashCode() .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/NumberFormat.php b/Classes/PHPExcel/Style/NumberFormat.php
new file mode 100644
index 0000000..1b72cda
--- /dev/null
+++ b/Classes/PHPExcel/Style/NumberFormat.php
@@ -0,0 +1,751 @@
+formatCode = null;
+ $this->builtInFormatCode = false;
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_NumberFormat
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getNumberFormat();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('numberformat' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getNumberFormat()->applyFromArray(
+ * array(
+ * 'code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_NumberFormat
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (array_key_exists('code', $pStyles)) {
+ $this->setFormatCode($pStyles['code']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Format Code
+ *
+ * @return string
+ */
+ public function getFormatCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getFormatCode();
+ }
+ if ($this->builtInFormatCode !== false) {
+ return self::builtInFormatCode($this->builtInFormatCode);
+ }
+ return $this->formatCode;
+ }
+
+ /**
+ * Set Format Code
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_NumberFormat
+ */
+ public function setFormatCode($pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL)
+ {
+ if ($pValue == '') {
+ $pValue = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
+ }
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('code' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->formatCode = $pValue;
+ $this->builtInFormatCode = self::builtInFormatCodeIndex($pValue);
+ }
+ return $this;
+ }
+
+ /**
+ * Get Built-In Format Code
+ *
+ * @return int
+ */
+ public function getBuiltInFormatCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getBuiltInFormatCode();
+ }
+ return $this->builtInFormatCode;
+ }
+
+ /**
+ * Set Built-In Format Code
+ *
+ * @param int $pValue
+ * @return PHPExcel_Style_NumberFormat
+ */
+ public function setBuiltInFormatCode($pValue = 0)
+ {
+
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->builtInFormatCode = $pValue;
+ $this->formatCode = self::builtInFormatCode($pValue);
+ }
+ return $this;
+ }
+
+ /**
+ * Fill built-in format codes
+ */
+ private static function fillBuiltInFormatCodes()
+ {
+ // [MS-OI29500: Microsoft Office Implementation Information for ISO/IEC-29500 Standard Compliance]
+ // 18.8.30. numFmt (Number Format)
+ //
+ // The ECMA standard defines built-in format IDs
+ // 14: "mm-dd-yy"
+ // 22: "m/d/yy h:mm"
+ // 37: "#,##0 ;(#,##0)"
+ // 38: "#,##0 ;[Red](#,##0)"
+ // 39: "#,##0.00;(#,##0.00)"
+ // 40: "#,##0.00;[Red](#,##0.00)"
+ // 47: "mmss.0"
+ // KOR fmt 55: "yyyy-mm-dd"
+ // Excel defines built-in format IDs
+ // 14: "m/d/yyyy"
+ // 22: "m/d/yyyy h:mm"
+ // 37: "#,##0_);(#,##0)"
+ // 38: "#,##0_);[Red](#,##0)"
+ // 39: "#,##0.00_);(#,##0.00)"
+ // 40: "#,##0.00_);[Red](#,##0.00)"
+ // 47: "mm:ss.0"
+ // KOR fmt 55: "yyyy/mm/dd"
+
+ // Built-in format codes
+ if (is_null(self::$builtInFormats)) {
+ self::$builtInFormats = array();
+
+ // General
+ self::$builtInFormats[0] = PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
+ self::$builtInFormats[1] = '0';
+ self::$builtInFormats[2] = '0.00';
+ self::$builtInFormats[3] = '#,##0';
+ self::$builtInFormats[4] = '#,##0.00';
+
+ self::$builtInFormats[9] = '0%';
+ self::$builtInFormats[10] = '0.00%';
+ self::$builtInFormats[11] = '0.00E+00';
+ self::$builtInFormats[12] = '# ?/?';
+ self::$builtInFormats[13] = '# ??/??';
+ self::$builtInFormats[14] = 'm/d/yyyy'; // Despite ECMA 'mm-dd-yy';
+ self::$builtInFormats[15] = 'd-mmm-yy';
+ self::$builtInFormats[16] = 'd-mmm';
+ self::$builtInFormats[17] = 'mmm-yy';
+ self::$builtInFormats[18] = 'h:mm AM/PM';
+ self::$builtInFormats[19] = 'h:mm:ss AM/PM';
+ self::$builtInFormats[20] = 'h:mm';
+ self::$builtInFormats[21] = 'h:mm:ss';
+ self::$builtInFormats[22] = 'm/d/yyyy h:mm'; // Despite ECMA 'm/d/yy h:mm';
+
+ self::$builtInFormats[37] = '#,##0_);(#,##0)'; // Despite ECMA '#,##0 ;(#,##0)';
+ self::$builtInFormats[38] = '#,##0_);[Red](#,##0)'; // Despite ECMA '#,##0 ;[Red](#,##0)';
+ self::$builtInFormats[39] = '#,##0.00_);(#,##0.00)'; // Despite ECMA '#,##0.00;(#,##0.00)';
+ self::$builtInFormats[40] = '#,##0.00_);[Red](#,##0.00)'; // Despite ECMA '#,##0.00;[Red](#,##0.00)';
+
+ self::$builtInFormats[44] = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
+ self::$builtInFormats[45] = 'mm:ss';
+ self::$builtInFormats[46] = '[h]:mm:ss';
+ self::$builtInFormats[47] = 'mm:ss.0'; // Despite ECMA 'mmss.0';
+ self::$builtInFormats[48] = '##0.0E+0';
+ self::$builtInFormats[49] = '@';
+
+ // CHT
+ self::$builtInFormats[27] = '[$-404]e/m/d';
+ self::$builtInFormats[30] = 'm/d/yy';
+ self::$builtInFormats[36] = '[$-404]e/m/d';
+ self::$builtInFormats[50] = '[$-404]e/m/d';
+ self::$builtInFormats[57] = '[$-404]e/m/d';
+
+ // THA
+ self::$builtInFormats[59] = 't0';
+ self::$builtInFormats[60] = 't0.00';
+ self::$builtInFormats[61] = 't#,##0';
+ self::$builtInFormats[62] = 't#,##0.00';
+ self::$builtInFormats[67] = 't0%';
+ self::$builtInFormats[68] = 't0.00%';
+ self::$builtInFormats[69] = 't# ?/?';
+ self::$builtInFormats[70] = 't# ??/??';
+
+ // Flip array (for faster lookups)
+ self::$flippedBuiltInFormats = array_flip(self::$builtInFormats);
+ }
+ }
+
+ /**
+ * Get built-in format code
+ *
+ * @param int $pIndex
+ * @return string
+ */
+ public static function builtInFormatCode($pIndex)
+ {
+ // Clean parameter
+ $pIndex = intval($pIndex);
+
+ // Ensure built-in format codes are available
+ self::fillBuiltInFormatCodes();
+ // Lookup format code
+ if (isset(self::$builtInFormats[$pIndex])) {
+ return self::$builtInFormats[$pIndex];
+ }
+
+ return '';
+ }
+
+ /**
+ * Get built-in format code index
+ *
+ * @param string $formatCode
+ * @return int|boolean
+ */
+ public static function builtInFormatCodeIndex($formatCode)
+ {
+ // Ensure built-in format codes are available
+ self::fillBuiltInFormatCodes();
+
+ // Lookup format code
+ if (isset(self::$flippedBuiltInFormats[$formatCode])) {
+ return self::$flippedBuiltInFormats[$formatCode];
+ }
+
+ return false;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->formatCode .
+ $this->builtInFormatCode .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Search/replace values to convert Excel date/time format masks to PHP format masks
+ *
+ * @var array
+ */
+ private static $dateFormatReplacements = array(
+ // first remove escapes related to non-format characters
+ '\\' => '',
+ // 12-hour suffix
+ 'am/pm' => 'A',
+ // 4-digit year
+ 'e' => 'Y',
+ 'yyyy' => 'Y',
+ // 2-digit year
+ 'yy' => 'y',
+ // first letter of month - no php equivalent
+ 'mmmmm' => 'M',
+ // full month name
+ 'mmmm' => 'F',
+ // short month name
+ 'mmm' => 'M',
+ // mm is minutes if time, but can also be month w/leading zero
+ // so we try to identify times be the inclusion of a : separator in the mask
+ // It isn't perfect, but the best way I know how
+ ':mm' => ':i',
+ 'mm:' => 'i:',
+ // month leading zero
+ 'mm' => 'm',
+ // month no leading zero
+ 'm' => 'n',
+ // full day of week name
+ 'dddd' => 'l',
+ // short day of week name
+ 'ddd' => 'D',
+ // days leading zero
+ 'dd' => 'd',
+ // days no leading zero
+ 'd' => 'j',
+ // seconds
+ 'ss' => 's',
+ // fractional seconds - no php equivalent
+ '.s' => ''
+ );
+ /**
+ * Search/replace values to convert Excel date/time format masks hours to PHP format masks (24 hr clock)
+ *
+ * @var array
+ */
+ private static $dateFormatReplacements24 = array(
+ 'hh' => 'H',
+ 'h' => 'G'
+ );
+ /**
+ * Search/replace values to convert Excel date/time format masks hours to PHP format masks (12 hr clock)
+ *
+ * @var array
+ */
+ private static $dateFormatReplacements12 = array(
+ 'hh' => 'h',
+ 'h' => 'g'
+ );
+
+ private static function setLowercaseCallback($matches) {
+ return mb_strtolower($matches[0]);
+ }
+
+ private static function escapeQuotesCallback($matches) {
+ return '\\' . implode('\\', str_split($matches[1]));
+ }
+
+ private static function formatAsDate(&$value, &$format)
+ {
+ // strip off first part containing e.g. [$-F800] or [$USD-409]
+ // general syntax: [$-]
+ // language info is in hexadecimal
+ $format = preg_replace('/^(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format);
+
+ // OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case;
+ // but we don't want to change any quoted strings
+ $format = preg_replace_callback('/(?:^|")([^"]*)(?:$|")/', array('self', 'setLowercaseCallback'), $format);
+
+ // Only process the non-quoted blocks for date format characters
+ $blocks = explode('"', $format);
+ foreach($blocks as $key => &$block) {
+ if ($key % 2 == 0) {
+ $block = strtr($block, self::$dateFormatReplacements);
+ if (!strpos($block, 'A')) {
+ // 24-hour time format
+ $block = strtr($block, self::$dateFormatReplacements24);
+ } else {
+ // 12-hour time format
+ $block = strtr($block, self::$dateFormatReplacements12);
+ }
+ }
+ }
+ $format = implode('"', $blocks);
+
+ // escape any quoted characters so that DateTime format() will render them correctly
+ $format = preg_replace_callback('/"(.*)"/U', array('self', 'escapeQuotesCallback'), $format);
+
+ $dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($value);
+ $value = $dateObj->format($format);
+ }
+
+ private static function formatAsPercentage(&$value, &$format)
+ {
+ if ($format === self::FORMAT_PERCENTAGE) {
+ $value = round((100 * $value), 0) . '%';
+ } else {
+ if (preg_match('/\.[#0]+/i', $format, $m)) {
+ $s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
+ $format = str_replace($m[0], $s, $format);
+ }
+ if (preg_match('/^[#0]+/', $format, $m)) {
+ $format = str_replace($m[0], strlen($m[0]), $format);
+ }
+ $format = '%' . str_replace('%', 'f%%', $format);
+
+ $value = sprintf($format, 100 * $value);
+ }
+ }
+
+ private static function formatAsFraction(&$value, &$format)
+ {
+ $sign = ($value < 0) ? '-' : '';
+
+ $integerPart = floor(abs($value));
+ $decimalPart = trim(fmod(abs($value), 1), '0.');
+ $decimalLength = strlen($decimalPart);
+ $decimalDivisor = pow(10, $decimalLength);
+
+ $GCD = PHPExcel_Calculation_MathTrig::GCD($decimalPart, $decimalDivisor);
+
+ $adjustedDecimalPart = $decimalPart/$GCD;
+ $adjustedDecimalDivisor = $decimalDivisor/$GCD;
+
+ if ((strpos($format, '0') !== false) || (strpos($format, '#') !== false) || (substr($format, 0, 3) == '? ?')) {
+ if ($integerPart == 0) {
+ $integerPart = '';
+ }
+ $value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor";
+ } else {
+ $adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor;
+ $value = "$sign$adjustedDecimalPart/$adjustedDecimalDivisor";
+ }
+ }
+
+ private static function complexNumberFormatMask($number, $mask, $level = 0)
+ {
+ $sign = ($number < 0.0);
+ $number = abs($number);
+ if (strpos($mask, '.') !== false) {
+ $numbers = explode('.', $number . '.0');
+ $masks = explode('.', $mask . '.0');
+ $result1 = self::complexNumberFormatMask($numbers[0], $masks[0], 1);
+ $result2 = strrev(self::complexNumberFormatMask(strrev($numbers[1]), strrev($masks[1]), 1));
+ return (($sign) ? '-' : '') . $result1 . '.' . $result2;
+ }
+
+ $r = preg_match_all('/0+/', $mask, $result, PREG_OFFSET_CAPTURE);
+ if ($r > 1) {
+ $result = array_reverse($result[0]);
+
+ foreach ($result as $block) {
+ $divisor = 1 . $block[0];
+ $size = strlen($block[0]);
+ $offset = $block[1];
+
+ $blockValue = sprintf(
+ '%0' . $size . 'd',
+ fmod($number, $divisor)
+ );
+ $number = floor($number / $divisor);
+ $mask = substr_replace($mask, $blockValue, $offset, $size);
+ }
+ if ($number > 0) {
+ $mask = substr_replace($mask, $number, $offset, 0);
+ }
+ $result = $mask;
+ } else {
+ $result = $number;
+ }
+
+ return (($sign) ? '-' : '') . $result;
+ }
+
+ /**
+ * Convert a value in a pre-defined format to a PHP string
+ *
+ * @param mixed $value Value to format
+ * @param string $format Format code
+ * @param array $callBack Callback function for additional formatting of string
+ * @return string Formatted string
+ */
+ public static function toFormattedString($value = '0', $format = PHPExcel_Style_NumberFormat::FORMAT_GENERAL, $callBack = null)
+ {
+ // For now we do not treat strings although section 4 of a format code affects strings
+ if (!is_numeric($value)) {
+ return $value;
+ }
+
+ // For 'General' format code, we just pass the value although this is not entirely the way Excel does it,
+ // it seems to round numbers to a total of 10 digits.
+ if (($format === PHPExcel_Style_NumberFormat::FORMAT_GENERAL) || ($format === PHPExcel_Style_NumberFormat::FORMAT_TEXT)) {
+ return $value;
+ }
+
+ // Convert any other escaped characters to quoted strings, e.g. (\T to "T")
+ $format = preg_replace('/(\\\(.))(?=(?:[^"]|"[^"]*")*$)/u', '"${2}"', $format);
+
+ // Get the sections, there can be up to four sections, separated with a semi-colon (but only if not a quoted literal)
+ $sections = preg_split('/(;)(?=(?:[^"]|"[^"]*")*$)/u', $format);
+
+ // Extract the relevant section depending on whether number is positive, negative, or zero?
+ // Text not supported yet.
+ // Here is how the sections apply to various values in Excel:
+ // 1 section: [POSITIVE/NEGATIVE/ZERO/TEXT]
+ // 2 sections: [POSITIVE/ZERO/TEXT] [NEGATIVE]
+ // 3 sections: [POSITIVE/TEXT] [NEGATIVE] [ZERO]
+ // 4 sections: [POSITIVE] [NEGATIVE] [ZERO] [TEXT]
+ switch (count($sections)) {
+ case 1:
+ $format = $sections[0];
+ break;
+ case 2:
+ $format = ($value >= 0) ? $sections[0] : $sections[1];
+ $value = abs($value); // Use the absolute value
+ break;
+ case 3:
+ $format = ($value > 0) ?
+ $sections[0] : ( ($value < 0) ?
+ $sections[1] : $sections[2]);
+ $value = abs($value); // Use the absolute value
+ break;
+ case 4:
+ $format = ($value > 0) ?
+ $sections[0] : ( ($value < 0) ?
+ $sections[1] : $sections[2]);
+ $value = abs($value); // Use the absolute value
+ break;
+ default:
+ // something is wrong, just use first section
+ $format = $sections[0];
+ break;
+ }
+
+ // In Excel formats, "_" is used to add spacing,
+ // The following character indicates the size of the spacing, which we can't do in HTML, so we just use a standard space
+ $format = preg_replace('/_./', ' ', $format);
+
+ // Save format with color information for later use below
+ $formatColor = $format;
+
+ // Strip color information
+ $color_regex = '/^\\[[a-zA-Z]+\\]/';
+ $format = preg_replace($color_regex, '', $format);
+
+ // Let's begin inspecting the format and converting the value to a formatted string
+
+ // Check for date/time characters (not inside quotes)
+ if (preg_match('/(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy](?=(?:[^"]|"[^"]*")*$)/miu', $format, $matches)) {
+ // datetime format
+ self::formatAsDate($value, $format);
+ } elseif (preg_match('/%$/', $format)) {
+ // % number format
+ self::formatAsPercentage($value, $format);
+ } else {
+ if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
+ $value = 'EUR ' . sprintf('%1.2f', $value);
+ } else {
+ // Some non-number strings are quoted, so we'll get rid of the quotes, likewise any positional * symbols
+ $format = str_replace(array('"', '*'), '', $format);
+
+ // Find out if we need thousands separator
+ // This is indicated by a comma enclosed by a digit placeholder:
+ // #,# or 0,0
+ $useThousands = preg_match('/(#,#|0,0)/', $format);
+ if ($useThousands) {
+ $format = preg_replace('/0,0/', '00', $format);
+ $format = preg_replace('/#,#/', '##', $format);
+ }
+
+ // Scale thousands, millions,...
+ // This is indicated by a number of commas after a digit placeholder:
+ // #, or 0.0,,
+ $scale = 1; // same as no scale
+ $matches = array();
+ if (preg_match('/(#|0)(,+)/', $format, $matches)) {
+ $scale = pow(1000, strlen($matches[2]));
+
+ // strip the commas
+ $format = preg_replace('/0,+/', '0', $format);
+ $format = preg_replace('/#,+/', '#', $format);
+ }
+
+ if (preg_match('/#?.*\?\/\?/', $format, $m)) {
+ //echo 'Format mask is fractional '.$format.'
';
+ if ($value != (int)$value) {
+ self::formatAsFraction($value, $format);
+ }
+
+ } else {
+ // Handle the number itself
+
+ // scale number
+ $value = $value / $scale;
+
+ // Strip #
+ $format = preg_replace('/\\#/', '0', $format);
+
+ $n = "/\[[^\]]+\]/";
+ $m = preg_replace($n, '', $format);
+ $number_regex = "/(0+)(\.?)(0*)/";
+ if (preg_match($number_regex, $m, $matches)) {
+ $left = $matches[1];
+ $dec = $matches[2];
+ $right = $matches[3];
+
+ // minimun width of formatted number (including dot)
+ $minWidth = strlen($left) + strlen($dec) + strlen($right);
+ if ($useThousands) {
+ $value = number_format(
+ $value,
+ strlen($right),
+ PHPExcel_Shared_String::getDecimalSeparator(),
+ PHPExcel_Shared_String::getThousandsSeparator()
+ );
+ $value = preg_replace($number_regex, $value, $format);
+ } else {
+ if (preg_match('/[0#]E[+-]0/i', $format)) {
+ // Scientific format
+ $value = sprintf('%5.2E', $value);
+ } elseif (preg_match('/0([^\d\.]+)0/', $format)) {
+ $value = self::complexNumberFormatMask($value, $format);
+ } else {
+ $sprintf_pattern = "%0$minWidth." . strlen($right) . "f";
+ $value = sprintf($sprintf_pattern, $value);
+ $value = preg_replace($number_regex, $value, $format);
+ }
+ }
+ }
+ }
+ if (preg_match('/\[\$(.*)\]/u', $format, $m)) {
+ // Currency or Accounting
+ $currencyFormat = $m[0];
+ $currencyCode = $m[1];
+ list($currencyCode) = explode('-', $currencyCode);
+ if ($currencyCode == '') {
+ $currencyCode = PHPExcel_Shared_String::getCurrencyCode();
+ }
+ $value = preg_replace('/\[\$([^\]]*)\]/u', $currencyCode, $value);
+ }
+ }
+ }
+
+ // Escape any escaped slashes to a single slash
+ $format = preg_replace("/\\\\/u", '\\', $format);
+
+ // Additional formatting provided by callback function
+ if ($callBack !== null) {
+ list($writerInstance, $function) = $callBack;
+ $value = $writerInstance->$function($value, $formatColor);
+ }
+
+ return $value;
+ }
+}
diff --git a/Classes/PHPExcel/Style/Protection.php b/Classes/PHPExcel/Style/Protection.php
new file mode 100644
index 0000000..d5568f6
--- /dev/null
+++ b/Classes/PHPExcel/Style/Protection.php
@@ -0,0 +1,204 @@
+locked = self::PROTECTION_INHERIT;
+ $this->hidden = self::PROTECTION_INHERIT;
+ }
+ }
+
+ /**
+ * Get the shared style component for the currently active cell in currently active sheet.
+ * Only used for style supervisor
+ *
+ * @return PHPExcel_Style_Protection
+ */
+ public function getSharedComponent()
+ {
+ return $this->parent->getSharedComponent()->getProtection();
+ }
+
+ /**
+ * Build style array from subcomponents
+ *
+ * @param array $array
+ * @return array
+ */
+ public function getStyleArray($array)
+ {
+ return array('protection' => $array);
+ }
+
+ /**
+ * Apply styles from array
+ *
+ *
+ * $objPHPExcel->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
+ * array(
+ * 'locked' => TRUE,
+ * 'hidden' => FALSE
+ * )
+ * );
+ *
+ *
+ * @param array $pStyles Array containing style information
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Style_Protection
+ */
+ public function applyFromArray($pStyles = null)
+ {
+ if (is_array($pStyles)) {
+ if ($this->isSupervisor) {
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
+ } else {
+ if (isset($pStyles['locked'])) {
+ $this->setLocked($pStyles['locked']);
+ }
+ if (isset($pStyles['hidden'])) {
+ $this->setHidden($pStyles['hidden']);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception("Invalid style array passed.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get locked
+ *
+ * @return string
+ */
+ public function getLocked()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getLocked();
+ }
+ return $this->locked;
+ }
+
+ /**
+ * Set locked
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Protection
+ */
+ public function setLocked($pValue = self::PROTECTION_INHERIT)
+ {
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('locked' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->locked = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hidden
+ *
+ * @return string
+ */
+ public function getHidden()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHidden();
+ }
+ return $this->hidden;
+ }
+
+ /**
+ * Set hidden
+ *
+ * @param string $pValue
+ * @return PHPExcel_Style_Protection
+ */
+ public function setHidden($pValue = self::PROTECTION_INHERIT)
+ {
+ if ($this->isSupervisor) {
+ $styleArray = $this->getStyleArray(array('hidden' => $pValue));
+ $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
+ } else {
+ $this->hidden = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->isSupervisor) {
+ return $this->getSharedComponent()->getHashCode();
+ }
+ return md5(
+ $this->locked .
+ $this->hidden .
+ __CLASS__
+ );
+ }
+}
diff --git a/Classes/PHPExcel/Style/Supervisor.php b/Classes/PHPExcel/Style/Supervisor.php
new file mode 100644
index 0000000..a90e1c6
--- /dev/null
+++ b/Classes/PHPExcel/Style/Supervisor.php
@@ -0,0 +1,125 @@
+isSupervisor = $isSupervisor;
+ }
+
+ /**
+ * Bind parent. Only used for supervisor
+ *
+ * @param PHPExcel $parent
+ * @return PHPExcel_Style_Supervisor
+ */
+ public function bindParent($parent, $parentPropertyName = null)
+ {
+ $this->parent = $parent;
+ return $this;
+ }
+
+ /**
+ * Is this a supervisor or a cell style component?
+ *
+ * @return boolean
+ */
+ public function getIsSupervisor()
+ {
+ return $this->isSupervisor;
+ }
+
+ /**
+ * Get the currently active sheet. Only used for supervisor
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function getActiveSheet()
+ {
+ return $this->parent->getActiveSheet();
+ }
+
+ /**
+ * Get the currently active cell coordinate in currently active sheet.
+ * Only used for supervisor
+ *
+ * @return string E.g. 'A1'
+ */
+ public function getSelectedCells()
+ {
+ return $this->getActiveSheet()->getSelectedCells();
+ }
+
+ /**
+ * Get the currently active cell coordinate in currently active sheet.
+ * Only used for supervisor
+ *
+ * @return string E.g. 'A1'
+ */
+ public function getActiveCell()
+ {
+ return $this->getActiveSheet()->getActiveCell();
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if ((is_object($value)) && ($key != 'parent')) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php
new file mode 100644
index 0000000..3705334
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet.php
@@ -0,0 +1,2968 @@
+parent = $pParent;
+ $this->setTitle($pTitle, false);
+ // setTitle can change $pTitle
+ $this->setCodeName($this->getTitle());
+ $this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE);
+
+ $this->cellCollection = PHPExcel_CachedObjectStorageFactory::getInstance($this);
+ // Set page setup
+ $this->pageSetup = new PHPExcel_Worksheet_PageSetup();
+ // Set page margins
+ $this->pageMargins = new PHPExcel_Worksheet_PageMargins();
+ // Set page header/footer
+ $this->headerFooter = new PHPExcel_Worksheet_HeaderFooter();
+ // Set sheet view
+ $this->sheetView = new PHPExcel_Worksheet_SheetView();
+ // Drawing collection
+ $this->drawingCollection = new ArrayObject();
+ // Chart collection
+ $this->chartCollection = new ArrayObject();
+ // Protection
+ $this->protection = new PHPExcel_Worksheet_Protection();
+ // Default row dimension
+ $this->defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null);
+ // Default column dimension
+ $this->defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null);
+ $this->autoFilter = new PHPExcel_Worksheet_AutoFilter(null, $this);
+ }
+
+
+ /**
+ * Disconnect all cells from this PHPExcel_Worksheet object,
+ * typically so that the worksheet object can be unset
+ *
+ */
+ public function disconnectCells()
+ {
+ if ($this->cellCollection !== null) {
+ $this->cellCollection->unsetWorksheetCells();
+ $this->cellCollection = null;
+ }
+ // detach ourself from the workbook, so that it can then delete this worksheet successfully
+ $this->parent = null;
+ }
+
+ /**
+ * Code to execute when this worksheet is unset()
+ *
+ */
+ public function __destruct()
+ {
+ PHPExcel_Calculation::getInstance($this->parent)->clearCalculationCacheForWorksheet($this->title);
+
+ $this->disconnectCells();
+ }
+
+ /**
+ * Return the cache controller for the cell collection
+ *
+ * @return PHPExcel_CachedObjectStorage_xxx
+ */
+ public function getCellCacheController()
+ {
+ return $this->cellCollection;
+ }
+
+
+ /**
+ * Get array of invalid characters for sheet title
+ *
+ * @return array
+ */
+ public static function getInvalidCharacters()
+ {
+ return self::$invalidCharacters;
+ }
+
+ /**
+ * Check sheet code name for valid Excel syntax
+ *
+ * @param string $pValue The string to check
+ * @return string The valid string
+ * @throws Exception
+ */
+ private static function checkSheetCodeName($pValue)
+ {
+ $CharCount = PHPExcel_Shared_String::CountCharacters($pValue);
+ if ($CharCount == 0) {
+ throw new PHPExcel_Exception('Sheet code name cannot be empty.');
+ }
+ // Some of the printable ASCII characters are invalid: * : / \ ? [ ] and first and last characters cannot be a "'"
+ if ((str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) ||
+ (PHPExcel_Shared_String::Substring($pValue, -1, 1)=='\'') ||
+ (PHPExcel_Shared_String::Substring($pValue, 0, 1)=='\'')) {
+ throw new PHPExcel_Exception('Invalid character found in sheet code name');
+ }
+
+ // Maximum 31 characters allowed for sheet title
+ if ($CharCount > 31) {
+ throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet code name.');
+ }
+
+ return $pValue;
+ }
+
+ /**
+ * Check sheet title for valid Excel syntax
+ *
+ * @param string $pValue The string to check
+ * @return string The valid string
+ * @throws PHPExcel_Exception
+ */
+ private static function checkSheetTitle($pValue)
+ {
+ // Some of the printable ASCII characters are invalid: * : / \ ? [ ]
+ if (str_replace(self::$invalidCharacters, '', $pValue) !== $pValue) {
+ throw new PHPExcel_Exception('Invalid character found in sheet title');
+ }
+
+ // Maximum 31 characters allowed for sheet title
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
+ throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet title.');
+ }
+
+ return $pValue;
+ }
+
+ /**
+ * Get collection of cells
+ *
+ * @param boolean $pSorted Also sort the cell collection?
+ * @return PHPExcel_Cell[]
+ */
+ public function getCellCollection($pSorted = true)
+ {
+ if ($pSorted) {
+ // Re-order cell collection
+ return $this->sortCellCollection();
+ }
+ if ($this->cellCollection !== null) {
+ return $this->cellCollection->getCellList();
+ }
+ return array();
+ }
+
+ /**
+ * Sort collection of cells
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function sortCellCollection()
+ {
+ if ($this->cellCollection !== null) {
+ return $this->cellCollection->getSortedCellList();
+ }
+ return array();
+ }
+
+ /**
+ * Get collection of row dimensions
+ *
+ * @return PHPExcel_Worksheet_RowDimension[]
+ */
+ public function getRowDimensions()
+ {
+ return $this->rowDimensions;
+ }
+
+ /**
+ * Get default row dimension
+ *
+ * @return PHPExcel_Worksheet_RowDimension
+ */
+ public function getDefaultRowDimension()
+ {
+ return $this->defaultRowDimension;
+ }
+
+ /**
+ * Get collection of column dimensions
+ *
+ * @return PHPExcel_Worksheet_ColumnDimension[]
+ */
+ public function getColumnDimensions()
+ {
+ return $this->columnDimensions;
+ }
+
+ /**
+ * Get default column dimension
+ *
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function getDefaultColumnDimension()
+ {
+ return $this->defaultColumnDimension;
+ }
+
+ /**
+ * Get collection of drawings
+ *
+ * @return PHPExcel_Worksheet_BaseDrawing[]
+ */
+ public function getDrawingCollection()
+ {
+ return $this->drawingCollection;
+ }
+
+ /**
+ * Get collection of charts
+ *
+ * @return PHPExcel_Chart[]
+ */
+ public function getChartCollection()
+ {
+ return $this->chartCollection;
+ }
+
+ /**
+ * Add chart
+ *
+ * @param PHPExcel_Chart $pChart
+ * @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last)
+ * @return PHPExcel_Chart
+ */
+ public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null)
+ {
+ $pChart->setWorksheet($this);
+ if (is_null($iChartIndex)) {
+ $this->chartCollection[] = $pChart;
+ } else {
+ // Insert the chart at the requested index
+ array_splice($this->chartCollection, $iChartIndex, 0, array($pChart));
+ }
+
+ return $pChart;
+ }
+
+ /**
+ * Return the count of charts on this worksheet
+ *
+ * @return int The number of charts
+ */
+ public function getChartCount()
+ {
+ return count($this->chartCollection);
+ }
+
+ /**
+ * Get a chart by its index position
+ *
+ * @param string $index Chart index position
+ * @return false|PHPExcel_Chart
+ * @throws PHPExcel_Exception
+ */
+ public function getChartByIndex($index = null)
+ {
+ $chartCount = count($this->chartCollection);
+ if ($chartCount == 0) {
+ return false;
+ }
+ if (is_null($index)) {
+ $index = --$chartCount;
+ }
+ if (!isset($this->chartCollection[$index])) {
+ return false;
+ }
+
+ return $this->chartCollection[$index];
+ }
+
+ /**
+ * Return an array of the names of charts on this worksheet
+ *
+ * @return string[] The names of charts
+ * @throws PHPExcel_Exception
+ */
+ public function getChartNames()
+ {
+ $chartNames = array();
+ foreach ($this->chartCollection as $chart) {
+ $chartNames[] = $chart->getName();
+ }
+ return $chartNames;
+ }
+
+ /**
+ * Get a chart by name
+ *
+ * @param string $chartName Chart name
+ * @return false|PHPExcel_Chart
+ * @throws PHPExcel_Exception
+ */
+ public function getChartByName($chartName = '')
+ {
+ $chartCount = count($this->chartCollection);
+ if ($chartCount == 0) {
+ return false;
+ }
+ foreach ($this->chartCollection as $index => $chart) {
+ if ($chart->getName() == $chartName) {
+ return $this->chartCollection[$index];
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Refresh column dimensions
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function refreshColumnDimensions()
+ {
+ $currentColumnDimensions = $this->getColumnDimensions();
+ $newColumnDimensions = array();
+
+ foreach ($currentColumnDimensions as $objColumnDimension) {
+ $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension;
+ }
+
+ $this->columnDimensions = $newColumnDimensions;
+
+ return $this;
+ }
+
+ /**
+ * Refresh row dimensions
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function refreshRowDimensions()
+ {
+ $currentRowDimensions = $this->getRowDimensions();
+ $newRowDimensions = array();
+
+ foreach ($currentRowDimensions as $objRowDimension) {
+ $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension;
+ }
+
+ $this->rowDimensions = $newRowDimensions;
+
+ return $this;
+ }
+
+ /**
+ * Calculate worksheet dimension
+ *
+ * @return string String containing the dimension of this worksheet
+ */
+ public function calculateWorksheetDimension()
+ {
+ // Return
+ return 'A1' . ':' . $this->getHighestColumn() . $this->getHighestRow();
+ }
+
+ /**
+ * Calculate worksheet data dimension
+ *
+ * @return string String containing the dimension of this worksheet that actually contain data
+ */
+ public function calculateWorksheetDataDimension()
+ {
+ // Return
+ return 'A1' . ':' . $this->getHighestDataColumn() . $this->getHighestDataRow();
+ }
+
+ /**
+ * Calculate widths for auto-size columns
+ *
+ * @param boolean $calculateMergeCells Calculate merge cell width
+ * @return PHPExcel_Worksheet;
+ */
+ public function calculateColumnWidths($calculateMergeCells = false)
+ {
+ // initialize $autoSizes array
+ $autoSizes = array();
+ foreach ($this->getColumnDimensions() as $colDimension) {
+ if ($colDimension->getAutoSize()) {
+ $autoSizes[$colDimension->getColumnIndex()] = -1;
+ }
+ }
+
+ // There is only something to do if there are some auto-size columns
+ if (!empty($autoSizes)) {
+ // build list of cells references that participate in a merge
+ $isMergeCell = array();
+ foreach ($this->getMergeCells() as $cells) {
+ foreach (PHPExcel_Cell::extractAllCellReferencesInRange($cells) as $cellReference) {
+ $isMergeCell[$cellReference] = true;
+ }
+ }
+
+ // loop through all cells in the worksheet
+ foreach ($this->getCellCollection(false) as $cellID) {
+ $cell = $this->getCell($cellID, false);
+ if ($cell !== null && isset($autoSizes[$this->cellCollection->getCurrentColumn()])) {
+ // Determine width if cell does not participate in a merge
+ if (!isset($isMergeCell[$this->cellCollection->getCurrentAddress()])) {
+ // Calculated value
+ // To formatted string
+ $cellValue = PHPExcel_Style_NumberFormat::toFormattedString(
+ $cell->getCalculatedValue(),
+ $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()
+ );
+
+ $autoSizes[$this->cellCollection->getCurrentColumn()] = max(
+ (float) $autoSizes[$this->cellCollection->getCurrentColumn()],
+ (float)PHPExcel_Shared_Font::calculateColumnWidth(
+ $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(),
+ $cellValue,
+ $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(),
+ $this->getDefaultStyle()->getFont()
+ )
+ );
+ }
+ }
+ }
+
+ // adjust column widths
+ foreach ($autoSizes as $columnIndex => $width) {
+ if ($width == -1) {
+ $width = $this->getDefaultColumnDimension()->getWidth();
+ }
+ $this->getColumnDimension($columnIndex)->setWidth($width);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get parent
+ *
+ * @return PHPExcel
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Re-bind parent
+ *
+ * @param PHPExcel $parent
+ * @return PHPExcel_Worksheet
+ */
+ public function rebindParent(PHPExcel $parent)
+ {
+ if ($this->parent !== null) {
+ $namedRanges = $this->parent->getNamedRanges();
+ foreach ($namedRanges as $namedRange) {
+ $parent->addNamedRange($namedRange);
+ }
+
+ $this->parent->removeSheetByIndex(
+ $this->parent->getIndex($this)
+ );
+ }
+ $this->parent = $parent;
+
+ return $this;
+ }
+
+ /**
+ * Get title
+ *
+ * @return string
+ */
+ public function getTitle()
+ {
+ return $this->title;
+ }
+
+ /**
+ * Set title
+ *
+ * @param string $pValue String containing the dimension of this worksheet
+ * @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should
+ * be updated to reflect the new sheet name.
+ * This should be left as the default true, unless you are
+ * certain that no formula cells on any worksheet contain
+ * references to this worksheet
+ * @return PHPExcel_Worksheet
+ */
+ public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true)
+ {
+ // Is this a 'rename' or not?
+ if ($this->getTitle() == $pValue) {
+ return $this;
+ }
+
+ // Syntax check
+ self::checkSheetTitle($pValue);
+
+ // Old title
+ $oldTitle = $this->getTitle();
+
+ if ($this->parent) {
+ // Is there already such sheet name?
+ if ($this->parent->sheetNameExists($pValue)) {
+ // Use name, but append with lowest possible integer
+
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 29);
+ }
+ $i = 1;
+ while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
+ ++$i;
+ if ($i == 10) {
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 28);
+ }
+ } elseif ($i == 100) {
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 27);
+ }
+ }
+ }
+
+ $altTitle = $pValue . ' ' . $i;
+ return $this->setTitle($altTitle, $updateFormulaCellReferences);
+ }
+ }
+
+ // Set title
+ $this->title = $pValue;
+ $this->dirty = true;
+
+ if ($this->parent && $this->parent->getCalculationEngine()) {
+ // New title
+ $newTitle = $this->getTitle();
+ $this->parent->getCalculationEngine()
+ ->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
+ if ($updateFormulaCellReferences) {
+ PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->parent, $oldTitle, $newTitle);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get sheet state
+ *
+ * @return string Sheet state (visible, hidden, veryHidden)
+ */
+ public function getSheetState()
+ {
+ return $this->sheetState;
+ }
+
+ /**
+ * Set sheet state
+ *
+ * @param string $value Sheet state (visible, hidden, veryHidden)
+ * @return PHPExcel_Worksheet
+ */
+ public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE)
+ {
+ $this->sheetState = $value;
+ return $this;
+ }
+
+ /**
+ * Get page setup
+ *
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function getPageSetup()
+ {
+ return $this->pageSetup;
+ }
+
+ /**
+ * Set page setup
+ *
+ * @param PHPExcel_Worksheet_PageSetup $pValue
+ * @return PHPExcel_Worksheet
+ */
+ public function setPageSetup(PHPExcel_Worksheet_PageSetup $pValue)
+ {
+ $this->pageSetup = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get page margins
+ *
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function getPageMargins()
+ {
+ return $this->pageMargins;
+ }
+
+ /**
+ * Set page margins
+ *
+ * @param PHPExcel_Worksheet_PageMargins $pValue
+ * @return PHPExcel_Worksheet
+ */
+ public function setPageMargins(PHPExcel_Worksheet_PageMargins $pValue)
+ {
+ $this->pageMargins = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get page header/footer
+ *
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function getHeaderFooter()
+ {
+ return $this->headerFooter;
+ }
+
+ /**
+ * Set page header/footer
+ *
+ * @param PHPExcel_Worksheet_HeaderFooter $pValue
+ * @return PHPExcel_Worksheet
+ */
+ public function setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue)
+ {
+ $this->headerFooter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get sheet view
+ *
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function getSheetView()
+ {
+ return $this->sheetView;
+ }
+
+ /**
+ * Set sheet view
+ *
+ * @param PHPExcel_Worksheet_SheetView $pValue
+ * @return PHPExcel_Worksheet
+ */
+ public function setSheetView(PHPExcel_Worksheet_SheetView $pValue)
+ {
+ $this->sheetView = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Protection
+ *
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function getProtection()
+ {
+ return $this->protection;
+ }
+
+ /**
+ * Set Protection
+ *
+ * @param PHPExcel_Worksheet_Protection $pValue
+ * @return PHPExcel_Worksheet
+ */
+ public function setProtection(PHPExcel_Worksheet_Protection $pValue)
+ {
+ $this->protection = $pValue;
+ $this->dirty = true;
+
+ return $this;
+ }
+
+ /**
+ * Get highest worksheet column
+ *
+ * @param string $row Return the data highest column for the specified row,
+ * or the highest column of any row if no row number is passed
+ * @return string Highest column name
+ */
+ public function getHighestColumn($row = null)
+ {
+ if ($row == null) {
+ return $this->cachedHighestColumn;
+ }
+ return $this->getHighestDataColumn($row);
+ }
+
+ /**
+ * Get highest worksheet column that contains data
+ *
+ * @param string $row Return the highest data column for the specified row,
+ * or the highest data column of any row if no row number is passed
+ * @return string Highest column name that contains data
+ */
+ public function getHighestDataColumn($row = null)
+ {
+ return $this->cellCollection->getHighestColumn($row);
+ }
+
+ /**
+ * Get highest worksheet row
+ *
+ * @param string $column Return the highest data row for the specified column,
+ * or the highest row of any column if no column letter is passed
+ * @return int Highest row number
+ */
+ public function getHighestRow($column = null)
+ {
+ if ($column == null) {
+ return $this->cachedHighestRow;
+ }
+ return $this->getHighestDataRow($column);
+ }
+
+ /**
+ * Get highest worksheet row that contains data
+ *
+ * @param string $column Return the highest data row for the specified column,
+ * or the highest data row of any column if no column letter is passed
+ * @return string Highest row number that contains data
+ */
+ public function getHighestDataRow($column = null)
+ {
+ return $this->cellCollection->getHighestRow($column);
+ }
+
+ /**
+ * Get highest worksheet column and highest row that have cell records
+ *
+ * @return array Highest column name and highest row number
+ */
+ public function getHighestRowAndColumn()
+ {
+ return $this->cellCollection->getHighestRowAndColumn();
+ }
+
+ /**
+ * Set a cell value
+ *
+ * @param string $pCoordinate Coordinate of the cell
+ * @param mixed $pValue Value of the cell
+ * @param bool $returnCell Return the worksheet (false, default) or the cell (true)
+ * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified
+ */
+ public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false)
+ {
+ $cell = $this->getCell($pCoordinate)->setValue($pValue);
+ return ($returnCell) ? $cell : $this;
+ }
+
+ /**
+ * Set a cell value by using numeric cell coordinates
+ *
+ * @param string $pColumn Numeric column coordinate of the cell (A = 0)
+ * @param string $pRow Numeric row coordinate of the cell
+ * @param mixed $pValue Value of the cell
+ * @param bool $returnCell Return the worksheet (false, default) or the cell (true)
+ * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified
+ */
+ public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false)
+ {
+ $cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValue($pValue);
+ return ($returnCell) ? $cell : $this;
+ }
+
+ /**
+ * Set a cell value
+ *
+ * @param string $pCoordinate Coordinate of the cell
+ * @param mixed $pValue Value of the cell
+ * @param string $pDataType Explicit data type
+ * @param bool $returnCell Return the worksheet (false, default) or the cell (true)
+ * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified
+ */
+ public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false)
+ {
+ // Set value
+ $cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType);
+ return ($returnCell) ? $cell : $this;
+ }
+
+ /**
+ * Set a cell value by using numeric cell coordinates
+ *
+ * @param string $pColumn Numeric column coordinate of the cell
+ * @param string $pRow Numeric row coordinate of the cell
+ * @param mixed $pValue Value of the cell
+ * @param string $pDataType Explicit data type
+ * @param bool $returnCell Return the worksheet (false, default) or the cell (true)
+ * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified
+ */
+ public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false)
+ {
+ $cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValueExplicit($pValue, $pDataType);
+ return ($returnCell) ? $cell : $this;
+ }
+
+ /**
+ * Get cell at a specific coordinate
+ *
+ * @param string $pCoordinate Coordinate of the cell
+ * @param boolean $createIfNotExists Flag indicating whether a new cell should be created if it doesn't
+ * already exist, or a null should be returned instead
+ * @throws PHPExcel_Exception
+ * @return null|PHPExcel_Cell Cell that was found/created or null
+ */
+ public function getCell($pCoordinate = 'A1', $createIfNotExists = true)
+ {
+ // Check cell collection
+ if ($this->cellCollection->isDataSet($pCoordinate)) {
+ return $this->cellCollection->getCacheData($pCoordinate);
+ }
+
+ // Worksheet reference?
+ if (strpos($pCoordinate, '!') !== false) {
+ $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
+ return $this->parent->getSheetByName($worksheetReference[0])->getCell(strtoupper($worksheetReference[1]), $createIfNotExists);
+ }
+
+ // Named range?
+ if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
+ (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
+ $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
+ if ($namedRange !== null) {
+ $pCoordinate = $namedRange->getRange();
+ return $namedRange->getWorksheet()->getCell($pCoordinate, $createIfNotExists);
+ }
+ }
+
+ // Uppercase coordinate
+ $pCoordinate = strtoupper($pCoordinate);
+
+ if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
+ } elseif (strpos($pCoordinate, '$') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
+ }
+
+ // Create new cell object, if required
+ return $createIfNotExists ? $this->createNewCell($pCoordinate) : null;
+ }
+
+ /**
+ * Get cell at a specific coordinate by using numeric cell coordinates
+ *
+ * @param string $pColumn Numeric column coordinate of the cell (starting from 0)
+ * @param string $pRow Numeric row coordinate of the cell
+ * @param boolean $createIfNotExists Flag indicating whether a new cell should be created if it doesn't
+ * already exist, or a null should be returned instead
+ * @return null|PHPExcel_Cell Cell that was found/created or null
+ */
+ public function getCellByColumnAndRow($pColumn = 0, $pRow = 1, $createIfNotExists = true)
+ {
+ $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn);
+ $coordinate = $columnLetter . $pRow;
+
+ if ($this->cellCollection->isDataSet($coordinate)) {
+ return $this->cellCollection->getCacheData($coordinate);
+ }
+
+ // Create new cell object, if required
+ return $createIfNotExists ? $this->createNewCell($coordinate) : null;
+ }
+
+ /**
+ * Create a new cell at the specified coordinate
+ *
+ * @param string $pCoordinate Coordinate of the cell
+ * @return PHPExcel_Cell Cell that was created
+ */
+ private function createNewCell($pCoordinate)
+ {
+ $cell = $this->cellCollection->addCacheData(
+ $pCoordinate,
+ new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_NULL, $this)
+ );
+ $this->cellCollectionIsSorted = false;
+
+ // Coordinates
+ $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
+ if (PHPExcel_Cell::columnIndexFromString($this->cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0])) {
+ $this->cachedHighestColumn = $aCoordinates[0];
+ }
+ $this->cachedHighestRow = max($this->cachedHighestRow, $aCoordinates[1]);
+
+ // Cell needs appropriate xfIndex from dimensions records
+ // but don't create dimension records if they don't already exist
+ $rowDimension = $this->getRowDimension($aCoordinates[1], false);
+ $columnDimension = $this->getColumnDimension($aCoordinates[0], false);
+
+ if ($rowDimension !== null && $rowDimension->getXfIndex() > 0) {
+ // then there is a row dimension with explicit style, assign it to the cell
+ $cell->setXfIndex($rowDimension->getXfIndex());
+ } elseif ($columnDimension !== null && $columnDimension->getXfIndex() > 0) {
+ // then there is a column dimension, assign it to the cell
+ $cell->setXfIndex($columnDimension->getXfIndex());
+ }
+
+ return $cell;
+ }
+
+ /**
+ * Does the cell at a specific coordinate exist?
+ *
+ * @param string $pCoordinate Coordinate of the cell
+ * @throws PHPExcel_Exception
+ * @return boolean
+ */
+ public function cellExists($pCoordinate = 'A1')
+ {
+ // Worksheet reference?
+ if (strpos($pCoordinate, '!') !== false) {
+ $worksheetReference = PHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
+ return $this->parent->getSheetByName($worksheetReference[0])->cellExists(strtoupper($worksheetReference[1]));
+ }
+
+ // Named range?
+ if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
+ (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
+ $namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
+ if ($namedRange !== null) {
+ $pCoordinate = $namedRange->getRange();
+ if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
+ if (!$namedRange->getLocalOnly()) {
+ return $namedRange->getWorksheet()->cellExists($pCoordinate);
+ } else {
+ throw new PHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ // Uppercase coordinate
+ $pCoordinate = strtoupper($pCoordinate);
+
+ if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
+ } elseif (strpos($pCoordinate, '$') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
+ } else {
+ // Coordinates
+ $aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
+
+ // Cell exists?
+ return $this->cellCollection->isDataSet($pCoordinate);
+ }
+ }
+
+ /**
+ * Cell at a specific coordinate by using numeric cell coordinates exists?
+ *
+ * @param string $pColumn Numeric column coordinate of the cell
+ * @param string $pRow Numeric row coordinate of the cell
+ * @return boolean
+ */
+ public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1)
+ {
+ return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
+ }
+
+ /**
+ * Get row dimension at a specific row
+ *
+ * @param int $pRow Numeric index of the row
+ * @return PHPExcel_Worksheet_RowDimension
+ */
+ public function getRowDimension($pRow = 1, $create = true)
+ {
+ // Found
+ $found = null;
+
+ // Get row dimension
+ if (!isset($this->rowDimensions[$pRow])) {
+ if (!$create) {
+ return null;
+ }
+ $this->rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
+
+ $this->cachedHighestRow = max($this->cachedHighestRow, $pRow);
+ }
+ return $this->rowDimensions[$pRow];
+ }
+
+ /**
+ * Get column dimension at a specific column
+ *
+ * @param string $pColumn String index of the column
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function getColumnDimension($pColumn = 'A', $create = true)
+ {
+ // Uppercase coordinate
+ $pColumn = strtoupper($pColumn);
+
+ // Fetch dimensions
+ if (!isset($this->columnDimensions[$pColumn])) {
+ if (!$create) {
+ return null;
+ }
+ $this->columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
+
+ if (PHPExcel_Cell::columnIndexFromString($this->cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn)) {
+ $this->cachedHighestColumn = $pColumn;
+ }
+ }
+ return $this->columnDimensions[$pColumn];
+ }
+
+ /**
+ * Get column dimension at a specific column by using numeric cell coordinates
+ *
+ * @param string $pColumn Numeric column coordinate of the cell
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function getColumnDimensionByColumn($pColumn = 0)
+ {
+ return $this->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($pColumn));
+ }
+
+ /**
+ * Get styles
+ *
+ * @return PHPExcel_Style[]
+ */
+ public function getStyles()
+ {
+ return $this->styles;
+ }
+
+ /**
+ * Get default style of workbook.
+ *
+ * @deprecated
+ * @return PHPExcel_Style
+ * @throws PHPExcel_Exception
+ */
+ public function getDefaultStyle()
+ {
+ return $this->parent->getDefaultStyle();
+ }
+
+ /**
+ * Set default style - should only be used by PHPExcel_IReader implementations!
+ *
+ * @deprecated
+ * @param PHPExcel_Style $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setDefaultStyle(PHPExcel_Style $pValue)
+ {
+ $this->parent->getDefaultStyle()->applyFromArray(array(
+ 'font' => array(
+ 'name' => $pValue->getFont()->getName(),
+ 'size' => $pValue->getFont()->getSize(),
+ ),
+ ));
+ return $this;
+ }
+
+ /**
+ * Get style for cell
+ *
+ * @param string $pCellCoordinate Cell coordinate (or range) to get style for
+ * @return PHPExcel_Style
+ * @throws PHPExcel_Exception
+ */
+ public function getStyle($pCellCoordinate = 'A1')
+ {
+ // set this sheet as active
+ $this->parent->setActiveSheetIndex($this->parent->getIndex($this));
+
+ // set cell coordinate as active
+ $this->setSelectedCells(strtoupper($pCellCoordinate));
+
+ return $this->parent->getCellXfSupervisor();
+ }
+
+ /**
+ * Get conditional styles for a cell
+ *
+ * @param string $pCoordinate
+ * @return PHPExcel_Style_Conditional[]
+ */
+ public function getConditionalStyles($pCoordinate = 'A1')
+ {
+ $pCoordinate = strtoupper($pCoordinate);
+ if (!isset($this->conditionalStylesCollection[$pCoordinate])) {
+ $this->conditionalStylesCollection[$pCoordinate] = array();
+ }
+ return $this->conditionalStylesCollection[$pCoordinate];
+ }
+
+ /**
+ * Do conditional styles exist for this cell?
+ *
+ * @param string $pCoordinate
+ * @return boolean
+ */
+ public function conditionalStylesExists($pCoordinate = 'A1')
+ {
+ if (isset($this->conditionalStylesCollection[strtoupper($pCoordinate)])) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Removes conditional styles for a cell
+ *
+ * @param string $pCoordinate
+ * @return PHPExcel_Worksheet
+ */
+ public function removeConditionalStyles($pCoordinate = 'A1')
+ {
+ unset($this->conditionalStylesCollection[strtoupper($pCoordinate)]);
+ return $this;
+ }
+
+ /**
+ * Get collection of conditional styles
+ *
+ * @return array
+ */
+ public function getConditionalStylesCollection()
+ {
+ return $this->conditionalStylesCollection;
+ }
+
+ /**
+ * Set conditional styles
+ *
+ * @param $pCoordinate string E.g. 'A1'
+ * @param $pValue PHPExcel_Style_Conditional[]
+ * @return PHPExcel_Worksheet
+ */
+ public function setConditionalStyles($pCoordinate = 'A1', $pValue)
+ {
+ $this->conditionalStylesCollection[strtoupper($pCoordinate)] = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get style for cell by using numeric cell coordinates
+ *
+ * @param int $pColumn Numeric column coordinate of the cell
+ * @param int $pRow Numeric row coordinate of the cell
+ * @param int pColumn2 Numeric column coordinate of the range cell
+ * @param int pRow2 Numeric row coordinate of the range cell
+ * @return PHPExcel_Style
+ */
+ public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null)
+ {
+ if (!is_null($pColumn2) && !is_null($pRow2)) {
+ $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
+ return $this->getStyle($cellRange);
+ }
+
+ return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
+ }
+
+ /**
+ * Set shared cell style to a range of cells
+ *
+ * Please note that this will overwrite existing cell styles for cells in range!
+ *
+ * @deprecated
+ * @param PHPExcel_Style $pSharedCellStyle Cell style to share
+ * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setSharedStyle(PHPExcel_Style $pSharedCellStyle = null, $pRange = '')
+ {
+ $this->duplicateStyle($pSharedCellStyle, $pRange);
+ return $this;
+ }
+
+ /**
+ * Duplicate cell style to a range of cells
+ *
+ * Please note that this will overwrite existing cell styles for cells in range!
+ *
+ * @param PHPExcel_Style $pCellStyle Cell style to duplicate
+ * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function duplicateStyle(PHPExcel_Style $pCellStyle = null, $pRange = '')
+ {
+ // make sure we have a real style and not supervisor
+ $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle;
+
+ // Add the style to the workbook if necessary
+ $workbook = $this->parent;
+ if ($existingStyle = $this->parent->getCellXfByHashCode($pCellStyle->getHashCode())) {
+ // there is already such cell Xf in our collection
+ $xfIndex = $existingStyle->getIndex();
+ } else {
+ // we don't have such a cell Xf, need to add
+ $workbook->addCellXf($pCellStyle);
+ $xfIndex = $pCellStyle->getIndex();
+ }
+
+ // Calculate range outer borders
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange . ':' . $pRange);
+
+ // Make sure we can loop upwards on rows and columns
+ if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
+ $tmp = $rangeStart;
+ $rangeStart = $rangeEnd;
+ $rangeEnd = $tmp;
+ }
+
+ // Loop through cells and apply styles
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ $this->getCell(PHPExcel_Cell::stringFromColumnIndex($col - 1) . $row)->setXfIndex($xfIndex);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Duplicate conditional style to a range of cells
+ *
+ * Please note that this will overwrite existing cell styles for cells in range!
+ *
+ * @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate
+ * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
+ {
+ foreach ($pCellStyle as $cellStyle) {
+ if (!($cellStyle instanceof PHPExcel_Style_Conditional)) {
+ throw new PHPExcel_Exception('Style is not a conditional style');
+ }
+ }
+
+ // Calculate range outer borders
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange . ':' . $pRange);
+
+ // Make sure we can loop upwards on rows and columns
+ if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
+ $tmp = $rangeStart;
+ $rangeStart = $rangeEnd;
+ $rangeEnd = $tmp;
+ }
+
+ // Loop through cells and apply styles
+ for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
+ for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
+ $this->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($col - 1) . $row, $pCellStyle);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Duplicate cell style array to a range of cells
+ *
+ * Please note that this will overwrite existing cell styles for cells in range,
+ * if they are in the styles array. For example, if you decide to set a range of
+ * cells to font bold, only include font bold in the styles array.
+ *
+ * @deprecated
+ * @param array $pStyles Array containing style information
+ * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
+ * @param boolean $pAdvanced Advanced mode for setting borders.
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true)
+ {
+ $this->getStyle($pRange)->applyFromArray($pStyles, $pAdvanced);
+ return $this;
+ }
+
+ /**
+ * Set break on a cell
+ *
+ * @param string $pCell Cell coordinate (e.g. A1)
+ * @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
+ {
+ // Uppercase coordinate
+ $pCell = strtoupper($pCell);
+
+ if ($pCell != '') {
+ if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) {
+ if (isset($this->breaks[$pCell])) {
+ unset($this->breaks[$pCell]);
+ }
+ } else {
+ $this->breaks[$pCell] = $pBreak;
+ }
+ } else {
+ throw new PHPExcel_Exception('No cell coordinate specified.');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Set break on a cell by using numeric cell coordinates
+ *
+ * @param integer $pColumn Numeric column coordinate of the cell
+ * @param integer $pRow Numeric row coordinate of the cell
+ * @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
+ * @return PHPExcel_Worksheet
+ */
+ public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE)
+ {
+ return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak);
+ }
+
+ /**
+ * Get breaks
+ *
+ * @return array[]
+ */
+ public function getBreaks()
+ {
+ return $this->breaks;
+ }
+
+ /**
+ * Set merge on a cell range
+ *
+ * @param string $pRange Cell range (e.g. A1:E1)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function mergeCells($pRange = 'A1:A1')
+ {
+ // Uppercase coordinate
+ $pRange = strtoupper($pRange);
+
+ if (strpos($pRange, ':') !== false) {
+ $this->mergeCells[$pRange] = $pRange;
+
+ // make sure cells are created
+
+ // get the cells in the range
+ $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
+
+ // create upper left cell if it does not already exist
+ $upperLeft = $aReferences[0];
+ if (!$this->cellExists($upperLeft)) {
+ $this->getCell($upperLeft)->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
+ }
+
+ // Blank out the rest of the cells in the range (if they exist)
+ $count = count($aReferences);
+ for ($i = 1; $i < $count; $i++) {
+ if ($this->cellExists($aReferences[$i])) {
+ $this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
+ }
+ }
+ } else {
+ throw new PHPExcel_Exception('Merge must be set on a range of cells.');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Set merge on a cell range by using numeric cell coordinates
+ *
+ * @param int $pColumn1 Numeric column coordinate of the first cell
+ * @param int $pRow1 Numeric row coordinate of the first cell
+ * @param int $pColumn2 Numeric column coordinate of the last cell
+ * @param int $pRow2 Numeric row coordinate of the last cell
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
+ {
+ $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
+ return $this->mergeCells($cellRange);
+ }
+
+ /**
+ * Remove merge on a cell range
+ *
+ * @param string $pRange Cell range (e.g. A1:E1)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function unmergeCells($pRange = 'A1:A1')
+ {
+ // Uppercase coordinate
+ $pRange = strtoupper($pRange);
+
+ if (strpos($pRange, ':') !== false) {
+ if (isset($this->mergeCells[$pRange])) {
+ unset($this->mergeCells[$pRange]);
+ } else {
+ throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as merged.');
+ }
+ } else {
+ throw new PHPExcel_Exception('Merge can only be removed from a range of cells.');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Remove merge on a cell range by using numeric cell coordinates
+ *
+ * @param int $pColumn1 Numeric column coordinate of the first cell
+ * @param int $pRow1 Numeric row coordinate of the first cell
+ * @param int $pColumn2 Numeric column coordinate of the last cell
+ * @param int $pRow2 Numeric row coordinate of the last cell
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
+ {
+ $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
+ return $this->unmergeCells($cellRange);
+ }
+
+ /**
+ * Get merge cells array.
+ *
+ * @return array[]
+ */
+ public function getMergeCells()
+ {
+ return $this->mergeCells;
+ }
+
+ /**
+ * Set merge cells array for the entire sheet. Use instead mergeCells() to merge
+ * a single cell range.
+ *
+ * @param array
+ */
+ public function setMergeCells($pValue = array())
+ {
+ $this->mergeCells = $pValue;
+ return $this;
+ }
+
+ /**
+ * Set protection on a cell range
+ *
+ * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
+ * @param string $pPassword Password to unlock the protection
+ * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false)
+ {
+ // Uppercase coordinate
+ $pRange = strtoupper($pRange);
+
+ if (!$pAlreadyHashed) {
+ $pPassword = PHPExcel_Shared_PasswordHasher::hashPassword($pPassword);
+ }
+ $this->protectedCells[$pRange] = $pPassword;
+
+ return $this;
+ }
+
+ /**
+ * Set protection on a cell range by using numeric cell coordinates
+ *
+ * @param int $pColumn1 Numeric column coordinate of the first cell
+ * @param int $pRow1 Numeric row coordinate of the first cell
+ * @param int $pColumn2 Numeric column coordinate of the last cell
+ * @param int $pRow2 Numeric row coordinate of the last cell
+ * @param string $pPassword Password to unlock the protection
+ * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
+ {
+ $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
+ return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed);
+ }
+
+ /**
+ * Remove protection on a cell range
+ *
+ * @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function unprotectCells($pRange = 'A1')
+ {
+ // Uppercase coordinate
+ $pRange = strtoupper($pRange);
+
+ if (isset($this->protectedCells[$pRange])) {
+ unset($this->protectedCells[$pRange]);
+ } else {
+ throw new PHPExcel_Exception('Cell range ' . $pRange . ' not known as protected.');
+ }
+ return $this;
+ }
+
+ /**
+ * Remove protection on a cell range by using numeric cell coordinates
+ *
+ * @param int $pColumn1 Numeric column coordinate of the first cell
+ * @param int $pRow1 Numeric row coordinate of the first cell
+ * @param int $pColumn2 Numeric column coordinate of the last cell
+ * @param int $pRow2 Numeric row coordinate of the last cell
+ * @param string $pPassword Password to unlock the protection
+ * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
+ {
+ $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
+ return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed);
+ }
+
+ /**
+ * Get protected cells
+ *
+ * @return array[]
+ */
+ public function getProtectedCells()
+ {
+ return $this->protectedCells;
+ }
+
+ /**
+ * Get Autofilter
+ *
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function getAutoFilter()
+ {
+ return $this->autoFilter;
+ }
+
+ /**
+ * Set AutoFilter
+ *
+ * @param PHPExcel_Worksheet_AutoFilter|string $pValue
+ * A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setAutoFilter($pValue)
+ {
+ $pRange = strtoupper($pValue);
+ if (is_string($pValue)) {
+ $this->autoFilter->setRange($pValue);
+ } elseif (is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
+ $this->autoFilter = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Set Autofilter Range by using numeric cell coordinates
+ *
+ * @param integer $pColumn1 Numeric column coordinate of the first cell
+ * @param integer $pRow1 Numeric row coordinate of the first cell
+ * @param integer $pColumn2 Numeric column coordinate of the second cell
+ * @param integer $pRow2 Numeric row coordinate of the second cell
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
+ {
+ return $this->setAutoFilter(
+ PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1
+ . ':' .
+ PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2
+ );
+ }
+
+ /**
+ * Remove autofilter
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function removeAutoFilter()
+ {
+ $this->autoFilter->setRange(null);
+ return $this;
+ }
+
+ /**
+ * Get Freeze Pane
+ *
+ * @return string
+ */
+ public function getFreezePane()
+ {
+ return $this->freezePane;
+ }
+
+ /**
+ * Freeze Pane
+ *
+ * @param string $pCell Cell (i.e. A2)
+ * Examples:
+ * A2 will freeze the rows above cell A2 (i.e row 1)
+ * B1 will freeze the columns to the left of cell B1 (i.e column A)
+ * B2 will freeze the rows above and to the left of cell A2
+ * (i.e row 1 and column A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function freezePane($pCell = '')
+ {
+ // Uppercase coordinate
+ $pCell = strtoupper($pCell);
+ if (strpos($pCell, ':') === false && strpos($pCell, ',') === false) {
+ $this->freezePane = $pCell;
+ } else {
+ throw new PHPExcel_Exception('Freeze pane can not be set on a range of cells.');
+ }
+ return $this;
+ }
+
+ /**
+ * Freeze Pane by using numeric cell coordinates
+ *
+ * @param int $pColumn Numeric column coordinate of the cell
+ * @param int $pRow Numeric row coordinate of the cell
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1)
+ {
+ return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
+ }
+
+ /**
+ * Unfreeze Pane
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function unfreezePane()
+ {
+ return $this->freezePane('');
+ }
+
+ /**
+ * Insert a new row, updating all possible related data
+ *
+ * @param int $pBefore Insert before this one
+ * @param int $pNumRows Number of rows to insert
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function insertNewRowBefore($pBefore = 1, $pNumRows = 1)
+ {
+ if ($pBefore >= 1) {
+ $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
+ $objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this);
+ } else {
+ throw new PHPExcel_Exception("Rows can only be inserted before at least row 1.");
+ }
+ return $this;
+ }
+
+ /**
+ * Insert a new column, updating all possible related data
+ *
+ * @param int $pBefore Insert before this one
+ * @param int $pNumCols Number of columns to insert
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1)
+ {
+ if (!is_numeric($pBefore)) {
+ $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
+ $objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this);
+ } else {
+ throw new PHPExcel_Exception("Column references should not be numeric.");
+ }
+ return $this;
+ }
+
+ /**
+ * Insert a new column, updating all possible related data
+ *
+ * @param int $pBefore Insert before this one (numeric column coordinate of the cell)
+ * @param int $pNumCols Number of columns to insert
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1)
+ {
+ if ($pBefore >= 0) {
+ return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols);
+ } else {
+ throw new PHPExcel_Exception("Columns can only be inserted before at least column A (0).");
+ }
+ }
+
+ /**
+ * Delete a row, updating all possible related data
+ *
+ * @param int $pRow Remove starting with this one
+ * @param int $pNumRows Number of rows to remove
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function removeRow($pRow = 1, $pNumRows = 1)
+ {
+ if ($pRow >= 1) {
+ $highestRow = $this->getHighestDataRow();
+ $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
+ $objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
+ for ($r = 0; $r < $pNumRows; ++$r) {
+ $this->getCellCacheController()->removeRow($highestRow);
+ --$highestRow;
+ }
+ } else {
+ throw new PHPExcel_Exception("Rows to be deleted should at least start from row 1.");
+ }
+ return $this;
+ }
+
+ /**
+ * Remove a column, updating all possible related data
+ *
+ * @param string $pColumn Remove starting with this one
+ * @param int $pNumCols Number of columns to remove
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function removeColumn($pColumn = 'A', $pNumCols = 1)
+ {
+ if (!is_numeric($pColumn)) {
+ $highestColumn = $this->getHighestDataColumn();
+ $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
+ $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
+ $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
+ for ($c = 0; $c < $pNumCols; ++$c) {
+ $this->getCellCacheController()->removeColumn($highestColumn);
+ $highestColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($highestColumn) - 2);
+ }
+ } else {
+ throw new PHPExcel_Exception("Column references should not be numeric.");
+ }
+ return $this;
+ }
+
+ /**
+ * Remove a column, updating all possible related data
+ *
+ * @param int $pColumn Remove starting with this one (numeric column coordinate of the cell)
+ * @param int $pNumCols Number of columns to remove
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function removeColumnByIndex($pColumn = 0, $pNumCols = 1)
+ {
+ if ($pColumn >= 0) {
+ return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols);
+ } else {
+ throw new PHPExcel_Exception("Columns to be deleted should at least start from column 0");
+ }
+ }
+
+ /**
+ * Show gridlines?
+ *
+ * @return boolean
+ */
+ public function getShowGridlines()
+ {
+ return $this->showGridlines;
+ }
+
+ /**
+ * Set show gridlines
+ *
+ * @param boolean $pValue Show gridlines (true/false)
+ * @return PHPExcel_Worksheet
+ */
+ public function setShowGridlines($pValue = false)
+ {
+ $this->showGridlines = $pValue;
+ return $this;
+ }
+
+ /**
+ * Print gridlines?
+ *
+ * @return boolean
+ */
+ public function getPrintGridlines()
+ {
+ return $this->printGridlines;
+ }
+
+ /**
+ * Set print gridlines
+ *
+ * @param boolean $pValue Print gridlines (true/false)
+ * @return PHPExcel_Worksheet
+ */
+ public function setPrintGridlines($pValue = false)
+ {
+ $this->printGridlines = $pValue;
+ return $this;
+ }
+
+ /**
+ * Show row and column headers?
+ *
+ * @return boolean
+ */
+ public function getShowRowColHeaders()
+ {
+ return $this->showRowColHeaders;
+ }
+
+ /**
+ * Set show row and column headers
+ *
+ * @param boolean $pValue Show row and column headers (true/false)
+ * @return PHPExcel_Worksheet
+ */
+ public function setShowRowColHeaders($pValue = false)
+ {
+ $this->showRowColHeaders = $pValue;
+ return $this;
+ }
+
+ /**
+ * Show summary below? (Row/Column outlining)
+ *
+ * @return boolean
+ */
+ public function getShowSummaryBelow()
+ {
+ return $this->showSummaryBelow;
+ }
+
+ /**
+ * Set show summary below
+ *
+ * @param boolean $pValue Show summary below (true/false)
+ * @return PHPExcel_Worksheet
+ */
+ public function setShowSummaryBelow($pValue = true)
+ {
+ $this->showSummaryBelow = $pValue;
+ return $this;
+ }
+
+ /**
+ * Show summary right? (Row/Column outlining)
+ *
+ * @return boolean
+ */
+ public function getShowSummaryRight()
+ {
+ return $this->showSummaryRight;
+ }
+
+ /**
+ * Set show summary right
+ *
+ * @param boolean $pValue Show summary right (true/false)
+ * @return PHPExcel_Worksheet
+ */
+ public function setShowSummaryRight($pValue = true)
+ {
+ $this->showSummaryRight = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get comments
+ *
+ * @return PHPExcel_Comment[]
+ */
+ public function getComments()
+ {
+ return $this->comments;
+ }
+
+ /**
+ * Set comments array for the entire sheet.
+ *
+ * @param array of PHPExcel_Comment
+ * @return PHPExcel_Worksheet
+ */
+ public function setComments($pValue = array())
+ {
+ $this->comments = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Get comment for cell
+ *
+ * @param string $pCellCoordinate Cell coordinate to get comment for
+ * @return PHPExcel_Comment
+ * @throws PHPExcel_Exception
+ */
+ public function getComment($pCellCoordinate = 'A1')
+ {
+ // Uppercase coordinate
+ $pCellCoordinate = strtoupper($pCellCoordinate);
+
+ if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells.');
+ } elseif (strpos($pCellCoordinate, '$') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate string must not be absolute.');
+ } elseif ($pCellCoordinate == '') {
+ throw new PHPExcel_Exception('Cell coordinate can not be zero-length string.');
+ } else {
+ // Check if we already have a comment for this cell.
+ // If not, create a new comment.
+ if (isset($this->comments[$pCellCoordinate])) {
+ return $this->comments[$pCellCoordinate];
+ } else {
+ $newComment = new PHPExcel_Comment();
+ $this->comments[$pCellCoordinate] = $newComment;
+ return $newComment;
+ }
+ }
+ }
+
+ /**
+ * Get comment for cell by using numeric cell coordinates
+ *
+ * @param int $pColumn Numeric column coordinate of the cell
+ * @param int $pRow Numeric row coordinate of the cell
+ * @return PHPExcel_Comment
+ */
+ public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1)
+ {
+ return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
+ }
+
+ /**
+ * Get selected cell
+ *
+ * @deprecated
+ * @return string
+ */
+ public function getSelectedCell()
+ {
+ return $this->getSelectedCells();
+ }
+
+ /**
+ * Get active cell
+ *
+ * @return string Example: 'A1'
+ */
+ public function getActiveCell()
+ {
+ return $this->activeCell;
+ }
+
+ /**
+ * Get selected cells
+ *
+ * @return string
+ */
+ public function getSelectedCells()
+ {
+ return $this->selectedCells;
+ }
+
+ /**
+ * Selected cell
+ *
+ * @param string $pCoordinate Cell (i.e. A1)
+ * @return PHPExcel_Worksheet
+ */
+ public function setSelectedCell($pCoordinate = 'A1')
+ {
+ return $this->setSelectedCells($pCoordinate);
+ }
+
+ /**
+ * Select a range of cells.
+ *
+ * @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setSelectedCells($pCoordinate = 'A1')
+ {
+ // Uppercase coordinate
+ $pCoordinate = strtoupper($pCoordinate);
+
+ // Convert 'A' to 'A:A'
+ $pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate);
+
+ // Convert '1' to '1:1'
+ $pCoordinate = preg_replace('/^([0-9]+)$/', '${1}:${1}', $pCoordinate);
+
+ // Convert 'A:C' to 'A1:C1048576'
+ $pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate);
+
+ // Convert '1:3' to 'A1:XFD3'
+ $pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate);
+
+ if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
+ list($first, ) = PHPExcel_Cell::splitRange($pCoordinate);
+ $this->activeCell = $first[0];
+ } else {
+ $this->activeCell = $pCoordinate;
+ }
+ $this->selectedCells = $pCoordinate;
+ return $this;
+ }
+
+ /**
+ * Selected cell by using numeric cell coordinates
+ *
+ * @param int $pColumn Numeric column coordinate of the cell
+ * @param int $pRow Numeric row coordinate of the cell
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1)
+ {
+ return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
+ }
+
+ /**
+ * Get right-to-left
+ *
+ * @return boolean
+ */
+ public function getRightToLeft()
+ {
+ return $this->rightToLeft;
+ }
+
+ /**
+ * Set right-to-left
+ *
+ * @param boolean $value Right-to-left true/false
+ * @return PHPExcel_Worksheet
+ */
+ public function setRightToLeft($value = false)
+ {
+ $this->rightToLeft = $value;
+ return $this;
+ }
+
+ /**
+ * Fill worksheet from values in array
+ *
+ * @param array $source Source array
+ * @param mixed $nullValue Value in source array that stands for blank cell
+ * @param string $startCell Insert array starting from this cell address as the top left coordinate
+ * @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet
+ */
+ public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false)
+ {
+ if (is_array($source)) {
+ // Convert a 1-D array to 2-D (for ease of looping)
+ if (!is_array(end($source))) {
+ $source = array($source);
+ }
+
+ // start coordinate
+ list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($startCell);
+
+ // Loop through $source
+ foreach ($source as $rowData) {
+ $currentColumn = $startColumn;
+ foreach ($rowData as $cellValue) {
+ if ($strictNullComparison) {
+ if ($cellValue !== $nullValue) {
+ // Set cell value
+ $this->getCell($currentColumn . $startRow)->setValue($cellValue);
+ }
+ } else {
+ if ($cellValue != $nullValue) {
+ // Set cell value
+ $this->getCell($currentColumn . $startRow)->setValue($cellValue);
+ }
+ }
+ ++$currentColumn;
+ }
+ ++$startRow;
+ }
+ } else {
+ throw new PHPExcel_Exception("Parameter \$source should be an array.");
+ }
+ return $this;
+ }
+
+ /**
+ * Create array from a range of cells
+ *
+ * @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
+ * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
+ * @param boolean $calculateFormulas Should formulas be calculated?
+ * @param boolean $formatData Should formatting be applied to cell values?
+ * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
+ * True - Return rows and columns indexed by their actual row and column IDs
+ * @return array
+ */
+ public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
+ {
+ // Returnvalue
+ $returnValue = array();
+ // Identify the range that we need to extract from the worksheet
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($pRange);
+ $minCol = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] -1);
+ $minRow = $rangeStart[1];
+ $maxCol = PHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1);
+ $maxRow = $rangeEnd[1];
+
+ $maxCol++;
+ // Loop through rows
+ $r = -1;
+ for ($row = $minRow; $row <= $maxRow; ++$row) {
+ $rRef = ($returnCellRef) ? $row : ++$r;
+ $c = -1;
+ // Loop through columns in the current row
+ for ($col = $minCol; $col != $maxCol; ++$col) {
+ $cRef = ($returnCellRef) ? $col : ++$c;
+ // Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen
+ // so we test and retrieve directly against cellCollection
+ if ($this->cellCollection->isDataSet($col.$row)) {
+ // Cell exists
+ $cell = $this->cellCollection->getCacheData($col.$row);
+ if ($cell->getValue() !== null) {
+ if ($cell->getValue() instanceof PHPExcel_RichText) {
+ $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText();
+ } else {
+ if ($calculateFormulas) {
+ $returnValue[$rRef][$cRef] = $cell->getCalculatedValue();
+ } else {
+ $returnValue[$rRef][$cRef] = $cell->getValue();
+ }
+ }
+
+ if ($formatData) {
+ $style = $this->parent->getCellXfByIndex($cell->getXfIndex());
+ $returnValue[$rRef][$cRef] = PHPExcel_Style_NumberFormat::toFormattedString(
+ $returnValue[$rRef][$cRef],
+ ($style && $style->getNumberFormat()) ? $style->getNumberFormat()->getFormatCode() : PHPExcel_Style_NumberFormat::FORMAT_GENERAL
+ );
+ }
+ } else {
+ // Cell holds a NULL
+ $returnValue[$rRef][$cRef] = $nullValue;
+ }
+ } else {
+ // Cell doesn't exist
+ $returnValue[$rRef][$cRef] = $nullValue;
+ }
+ }
+ }
+
+ // Return
+ return $returnValue;
+ }
+
+
+ /**
+ * Create array from a range of cells
+ *
+ * @param string $pNamedRange Name of the Named Range
+ * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
+ * @param boolean $calculateFormulas Should formulas be calculated?
+ * @param boolean $formatData Should formatting be applied to cell values?
+ * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
+ * True - Return rows and columns indexed by their actual row and column IDs
+ * @return array
+ * @throws PHPExcel_Exception
+ */
+ public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
+ {
+ $namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this);
+ if ($namedRange !== null) {
+ $pWorkSheet = $namedRange->getWorksheet();
+ $pCellRange = $namedRange->getRange();
+
+ return $pWorkSheet->rangeToArray($pCellRange, $nullValue, $calculateFormulas, $formatData, $returnCellRef);
+ }
+
+ throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.');
+ }
+
+
+ /**
+ * Create array from worksheet
+ *
+ * @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
+ * @param boolean $calculateFormulas Should formulas be calculated?
+ * @param boolean $formatData Should formatting be applied to cell values?
+ * @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
+ * True - Return rows and columns indexed by their actual row and column IDs
+ * @return array
+ */
+ public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
+ {
+ // Garbage collect...
+ $this->garbageCollect();
+
+ // Identify the range that we need to extract from the worksheet
+ $maxCol = $this->getHighestColumn();
+ $maxRow = $this->getHighestRow();
+ // Return
+ return $this->rangeToArray('A1:'.$maxCol.$maxRow, $nullValue, $calculateFormulas, $formatData, $returnCellRef);
+ }
+
+ /**
+ * Get row iterator
+ *
+ * @param integer $startRow The row number at which to start iterating
+ * @param integer $endRow The row number at which to stop iterating
+ *
+ * @return PHPExcel_Worksheet_RowIterator
+ */
+ public function getRowIterator($startRow = 1, $endRow = null)
+ {
+ return new PHPExcel_Worksheet_RowIterator($this, $startRow, $endRow);
+ }
+
+ /**
+ * Get column iterator
+ *
+ * @param string $startColumn The column address at which to start iterating
+ * @param string $endColumn The column address at which to stop iterating
+ *
+ * @return PHPExcel_Worksheet_ColumnIterator
+ */
+ public function getColumnIterator($startColumn = 'A', $endColumn = null)
+ {
+ return new PHPExcel_Worksheet_ColumnIterator($this, $startColumn, $endColumn);
+ }
+
+ /**
+ * Run PHPExcel garabage collector.
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function garbageCollect()
+ {
+ // Flush cache
+ $this->cellCollection->getCacheData('A1');
+ // Build a reference table from images
+// $imageCoordinates = array();
+// $iterator = $this->getDrawingCollection()->getIterator();
+// while ($iterator->valid()) {
+// $imageCoordinates[$iterator->current()->getCoordinates()] = true;
+//
+// $iterator->next();
+// }
+//
+ // Lookup highest column and highest row if cells are cleaned
+ $colRow = $this->cellCollection->getHighestRowAndColumn();
+ $highestRow = $colRow['row'];
+ $highestColumn = PHPExcel_Cell::columnIndexFromString($colRow['column']);
+
+ // Loop through column dimensions
+ foreach ($this->columnDimensions as $dimension) {
+ $highestColumn = max($highestColumn, PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex()));
+ }
+
+ // Loop through row dimensions
+ foreach ($this->rowDimensions as $dimension) {
+ $highestRow = max($highestRow, $dimension->getRowIndex());
+ }
+
+ // Cache values
+ if ($highestColumn < 0) {
+ $this->cachedHighestColumn = 'A';
+ } else {
+ $this->cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
+ }
+ $this->cachedHighestRow = $highestRow;
+
+ // Return
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ if ($this->dirty) {
+ $this->hash = md5($this->title . $this->autoFilter . ($this->protection->isProtectionEnabled() ? 't' : 'f') . __CLASS__);
+ $this->dirty = false;
+ }
+ return $this->hash;
+ }
+
+ /**
+ * Extract worksheet title from range.
+ *
+ * Example: extractSheetTitle("testSheet!A1") ==> 'A1'
+ * Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1');
+ *
+ * @param string $pRange Range to extract title from
+ * @param bool $returnRange Return range? (see example)
+ * @return mixed
+ */
+ public static function extractSheetTitle($pRange, $returnRange = false)
+ {
+ // Sheet title included?
+ if (($sep = strpos($pRange, '!')) === false) {
+ return '';
+ }
+
+ if ($returnRange) {
+ return array(trim(substr($pRange, 0, $sep), "'"), substr($pRange, $sep + 1));
+ }
+
+ return substr($pRange, $sep + 1);
+ }
+
+ /**
+ * Get hyperlink
+ *
+ * @param string $pCellCoordinate Cell coordinate to get hyperlink for
+ */
+ public function getHyperlink($pCellCoordinate = 'A1')
+ {
+ // return hyperlink if we already have one
+ if (isset($this->hyperlinkCollection[$pCellCoordinate])) {
+ return $this->hyperlinkCollection[$pCellCoordinate];
+ }
+
+ // else create hyperlink
+ $this->hyperlinkCollection[$pCellCoordinate] = new PHPExcel_Cell_Hyperlink();
+ return $this->hyperlinkCollection[$pCellCoordinate];
+ }
+
+ /**
+ * Set hyperlnk
+ *
+ * @param string $pCellCoordinate Cell coordinate to insert hyperlink
+ * @param PHPExcel_Cell_Hyperlink $pHyperlink
+ * @return PHPExcel_Worksheet
+ */
+ public function setHyperlink($pCellCoordinate = 'A1', PHPExcel_Cell_Hyperlink $pHyperlink = null)
+ {
+ if ($pHyperlink === null) {
+ unset($this->hyperlinkCollection[$pCellCoordinate]);
+ } else {
+ $this->hyperlinkCollection[$pCellCoordinate] = $pHyperlink;
+ }
+ return $this;
+ }
+
+ /**
+ * Hyperlink at a specific coordinate exists?
+ *
+ * @param string $pCoordinate
+ * @return boolean
+ */
+ public function hyperlinkExists($pCoordinate = 'A1')
+ {
+ return isset($this->hyperlinkCollection[$pCoordinate]);
+ }
+
+ /**
+ * Get collection of hyperlinks
+ *
+ * @return PHPExcel_Cell_Hyperlink[]
+ */
+ public function getHyperlinkCollection()
+ {
+ return $this->hyperlinkCollection;
+ }
+
+ /**
+ * Get data validation
+ *
+ * @param string $pCellCoordinate Cell coordinate to get data validation for
+ */
+ public function getDataValidation($pCellCoordinate = 'A1')
+ {
+ // return data validation if we already have one
+ if (isset($this->dataValidationCollection[$pCellCoordinate])) {
+ return $this->dataValidationCollection[$pCellCoordinate];
+ }
+
+ // else create data validation
+ $this->dataValidationCollection[$pCellCoordinate] = new PHPExcel_Cell_DataValidation();
+ return $this->dataValidationCollection[$pCellCoordinate];
+ }
+
+ /**
+ * Set data validation
+ *
+ * @param string $pCellCoordinate Cell coordinate to insert data validation
+ * @param PHPExcel_Cell_DataValidation $pDataValidation
+ * @return PHPExcel_Worksheet
+ */
+ public function setDataValidation($pCellCoordinate = 'A1', PHPExcel_Cell_DataValidation $pDataValidation = null)
+ {
+ if ($pDataValidation === null) {
+ unset($this->dataValidationCollection[$pCellCoordinate]);
+ } else {
+ $this->dataValidationCollection[$pCellCoordinate] = $pDataValidation;
+ }
+ return $this;
+ }
+
+ /**
+ * Data validation at a specific coordinate exists?
+ *
+ * @param string $pCoordinate
+ * @return boolean
+ */
+ public function dataValidationExists($pCoordinate = 'A1')
+ {
+ return isset($this->dataValidationCollection[$pCoordinate]);
+ }
+
+ /**
+ * Get collection of data validations
+ *
+ * @return PHPExcel_Cell_DataValidation[]
+ */
+ public function getDataValidationCollection()
+ {
+ return $this->dataValidationCollection;
+ }
+
+ /**
+ * Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet
+ *
+ * @param string $range
+ * @return string Adjusted range value
+ */
+ public function shrinkRangeToFit($range)
+ {
+ $maxCol = $this->getHighestColumn();
+ $maxRow = $this->getHighestRow();
+ $maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
+
+ $rangeBlocks = explode(' ', $range);
+ foreach ($rangeBlocks as &$rangeSet) {
+ $rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
+
+ if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) {
+ $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
+ }
+ if ($rangeBoundaries[0][1] > $maxRow) {
+ $rangeBoundaries[0][1] = $maxRow;
+ }
+ if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) {
+ $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
+ }
+ if ($rangeBoundaries[1][1] > $maxRow) {
+ $rangeBoundaries[1][1] = $maxRow;
+ }
+ $rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
+ }
+ unset($rangeSet);
+ $stRange = implode(' ', $rangeBlocks);
+
+ return $stRange;
+ }
+
+ /**
+ * Get tab color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getTabColor()
+ {
+ if ($this->tabColor === null) {
+ $this->tabColor = new PHPExcel_Style_Color();
+ }
+ return $this->tabColor;
+ }
+
+ /**
+ * Reset tab color
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function resetTabColor()
+ {
+ $this->tabColor = null;
+ unset($this->tabColor);
+
+ return $this;
+ }
+
+ /**
+ * Tab color set?
+ *
+ * @return boolean
+ */
+ public function isTabColorSet()
+ {
+ return ($this->tabColor !== null);
+ }
+
+ /**
+ * Copy worksheet (!= clone!)
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function copy()
+ {
+ $copied = clone $this;
+
+ return $copied;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ foreach ($this as $key => $val) {
+ if ($key == 'parent') {
+ continue;
+ }
+
+ if (is_object($val) || (is_array($val))) {
+ if ($key == 'cellCollection') {
+ $newCollection = clone $this->cellCollection;
+ $newCollection->copyCellCollection($this);
+ $this->cellCollection = $newCollection;
+ } elseif ($key == 'drawingCollection') {
+ $newCollection = clone $this->drawingCollection;
+ $this->drawingCollection = $newCollection;
+ } elseif (($key == 'autoFilter') && ($this->autoFilter instanceof PHPExcel_Worksheet_AutoFilter)) {
+ $newAutoFilter = clone $this->autoFilter;
+ $this->autoFilter = $newAutoFilter;
+ $this->autoFilter->setParent($this);
+ } else {
+ $this->{$key} = unserialize(serialize($val));
+ }
+ }
+ }
+ }
+/**
+ * Define the code name of the sheet
+ *
+ * @param null|string Same rule as Title minus space not allowed (but, like Excel, change silently space to underscore)
+ * @return objWorksheet
+ * @throws PHPExcel_Exception
+ */
+ public function setCodeName($pValue = null)
+ {
+ // Is this a 'rename' or not?
+ if ($this->getCodeName() == $pValue) {
+ return $this;
+ }
+ $pValue = str_replace(' ', '_', $pValue);//Excel does this automatically without flinching, we are doing the same
+ // Syntax check
+ // throw an exception if not valid
+ self::checkSheetCodeName($pValue);
+
+ // We use the same code that setTitle to find a valid codeName else not using a space (Excel don't like) but a '_'
+
+ if ($this->getParent()) {
+ // Is there already such sheet name?
+ if ($this->getParent()->sheetCodeNameExists($pValue)) {
+ // Use name, but append with lowest possible integer
+
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 29);
+ }
+ $i = 1;
+ while ($this->getParent()->sheetCodeNameExists($pValue . '_' . $i)) {
+ ++$i;
+ if ($i == 10) {
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 28);
+ }
+ } elseif ($i == 100) {
+ if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) {
+ $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 27);
+ }
+ }
+ }
+
+ $pValue = $pValue . '_' . $i;// ok, we have a valid name
+ //codeName is'nt used in formula : no need to call for an update
+ //return $this->setTitle($altTitle, $updateFormulaCellReferences);
+ }
+ }
+
+ $this->codeName=$pValue;
+ return $this;
+ }
+ /**
+ * Return the code name of the sheet
+ *
+ * @return null|string
+ */
+ public function getCodeName()
+ {
+ return $this->codeName;
+ }
+ /**
+ * Sheet has a code name ?
+ * @return boolean
+ */
+ public function hasCodeName()
+ {
+ return !(is_null($this->codeName));
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/AutoFilter.php b/Classes/PHPExcel/Worksheet/AutoFilter.php
new file mode 100644
index 0000000..1bc312b
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/AutoFilter.php
@@ -0,0 +1,846 @@
+range = $pRange;
+ $this->workSheet = $pSheet;
+ }
+
+ /**
+ * Get AutoFilter Parent Worksheet
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function getParent()
+ {
+ return $this->workSheet;
+ }
+
+ /**
+ * Set AutoFilter Parent Worksheet
+ *
+ * @param PHPExcel_Worksheet $pSheet
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setParent(PHPExcel_Worksheet $pSheet = null)
+ {
+ $this->workSheet = $pSheet;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Range
+ *
+ * @return string
+ */
+ public function getRange()
+ {
+ return $this->range;
+ }
+
+ /**
+ * Set AutoFilter Range
+ *
+ * @param string $pRange Cell range (i.e. A1:E10)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setRange($pRange = '')
+ {
+ // Uppercase coordinate
+ $cellAddress = explode('!', strtoupper($pRange));
+ if (count($cellAddress) > 1) {
+ list($worksheet, $pRange) = $cellAddress;
+ }
+
+ if (strpos($pRange, ':') !== false) {
+ $this->range = $pRange;
+ } elseif (empty($pRange)) {
+ $this->range = '';
+ } else {
+ throw new PHPExcel_Exception('Autofilter must be set on a range of cells.');
+ }
+
+ if (empty($pRange)) {
+ // Discard all column rules
+ $this->columns = array();
+ } else {
+ // Discard any column rules that are no longer valid within this range
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ foreach ($this->columns as $key => $value) {
+ $colIndex = PHPExcel_Cell::columnIndexFromString($key);
+ if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
+ unset($this->columns[$key]);
+ }
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get all AutoFilter Columns
+ *
+ * @throws PHPExcel_Exception
+ * @return array of PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumns()
+ {
+ return $this->columns;
+ }
+
+ /**
+ * Validate that the specified column is in the AutoFilter range
+ *
+ * @param string $column Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return integer The column offset within the autofilter range
+ */
+ public function testColumnInRange($column)
+ {
+ if (empty($this->range)) {
+ throw new PHPExcel_Exception("No autofilter range is defined.");
+ }
+
+ $columnIndex = PHPExcel_Cell::columnIndexFromString($column);
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
+ throw new PHPExcel_Exception("Column is outside of current autofilter range.");
+ }
+
+ return $columnIndex - $rangeStart[0];
+ }
+
+ /**
+ * Get a specified AutoFilter Column Offset within the defined AutoFilter range
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return integer The offset of the specified column within the autofilter range
+ */
+ public function getColumnOffset($pColumn)
+ {
+ return $this->testColumnInRange($pColumn);
+ }
+
+ /**
+ * Get a specified AutoFilter Column
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumn($pColumn)
+ {
+ $this->testColumnInRange($pColumn);
+
+ if (!isset($this->columns[$pColumn])) {
+ $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
+ }
+
+ return $this->columns[$pColumn];
+ }
+
+ /**
+ * Get a specified AutoFilter Column by it's offset
+ *
+ * @param integer $pColumnOffset Column offset within range (starting from 0)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumnByOffset($pColumnOffset = 0)
+ {
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ $pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
+
+ return $this->getColumn($pColumn);
+ }
+
+ /**
+ * Set AutoFilter
+ *
+ * @param PHPExcel_Worksheet_AutoFilter_Column|string $pColumn
+ * A simple string containing a Column ID like 'A' is permitted
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setColumn($pColumn)
+ {
+ if ((is_string($pColumn)) && (!empty($pColumn))) {
+ $column = $pColumn;
+ } elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
+ $column = $pColumn->getColumnIndex();
+ } else {
+ throw new PHPExcel_Exception("Column is not within the autofilter range.");
+ }
+ $this->testColumnInRange($column);
+
+ if (is_string($pColumn)) {
+ $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
+ } elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
+ $pColumn->setParent($this);
+ $this->columns[$column] = $pColumn;
+ }
+ ksort($this->columns);
+
+ return $this;
+ }
+
+ /**
+ * Clear a specified AutoFilter Column
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function clearColumn($pColumn)
+ {
+ $this->testColumnInRange($pColumn);
+
+ if (isset($this->columns[$pColumn])) {
+ unset($this->columns[$pColumn]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Shift an AutoFilter Column Rule to a different column
+ *
+ * Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range.
+ * Nor does it verify whether any column rule already exists at $toColumn, but will simply overrideany existing value.
+ * Use with caution.
+ *
+ * @param string $fromColumn Column name (e.g. A)
+ * @param string $toColumn Column name (e.g. B)
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function shiftColumn($fromColumn = null, $toColumn = null)
+ {
+ $fromColumn = strtoupper($fromColumn);
+ $toColumn = strtoupper($toColumn);
+
+ if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) {
+ $this->columns[$fromColumn]->setParent();
+ $this->columns[$fromColumn]->setColumnIndex($toColumn);
+ $this->columns[$toColumn] = $this->columns[$fromColumn];
+ $this->columns[$toColumn]->setParent($this);
+ unset($this->columns[$fromColumn]);
+
+ ksort($this->columns);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Test if cell value is in the defined set of values
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $dataSet
+ * @return boolean
+ */
+ private static function filterTestInSimpleDataSet($cellValue, $dataSet)
+ {
+ $dataSetValues = $dataSet['filterValues'];
+ $blanks = $dataSet['blanks'];
+ if (($cellValue == '') || ($cellValue === null)) {
+ return $blanks;
+ }
+ return in_array($cellValue, $dataSetValues);
+ }
+
+ /**
+ * Test if cell value is in the defined set of Excel date values
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $dataSet
+ * @return boolean
+ */
+ private static function filterTestInDateGroupSet($cellValue, $dataSet)
+ {
+ $dateSet = $dataSet['filterValues'];
+ $blanks = $dataSet['blanks'];
+ if (($cellValue == '') || ($cellValue === null)) {
+ return $blanks;
+ }
+
+ if (is_numeric($cellValue)) {
+ $dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue);
+ if ($cellValue < 1) {
+ // Just the time part
+ $dtVal = date('His', $dateValue);
+ $dateSet = $dateSet['time'];
+ } elseif ($cellValue == floor($cellValue)) {
+ // Just the date part
+ $dtVal = date('Ymd', $dateValue);
+ $dateSet = $dateSet['date'];
+ } else {
+ // date and time parts
+ $dtVal = date('YmdHis', $dateValue);
+ $dateSet = $dateSet['dateTime'];
+ }
+ foreach ($dateSet as $dateValue) {
+ // Use of substr to extract value at the appropriate group level
+ if (substr($dtVal, 0, strlen($dateValue)) == $dateValue) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if cell value is within a set of values defined by a ruleset
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $ruleSet
+ * @return boolean
+ */
+ private static function filterTestInCustomDataSet($cellValue, $ruleSet)
+ {
+ $dataSet = $ruleSet['filterRules'];
+ $join = $ruleSet['join'];
+ $customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
+
+ if (!$customRuleForBlanks) {
+ // Blank cells are always ignored, so return a FALSE
+ if (($cellValue == '') || ($cellValue === null)) {
+ return false;
+ }
+ }
+ $returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
+ foreach ($dataSet as $rule) {
+ if (is_numeric($rule['value'])) {
+ // Numeric values are tested using the appropriate operator
+ switch ($rule['operator']) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
+ $retVal = ($cellValue == $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
+ $retVal = ($cellValue != $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN:
+ $retVal = ($cellValue > $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL:
+ $retVal = ($cellValue >= $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN:
+ $retVal = ($cellValue < $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL:
+ $retVal = ($cellValue <= $rule['value']);
+ break;
+ }
+ } elseif ($rule['value'] == '') {
+ switch ($rule['operator']) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
+ $retVal = (($cellValue == '') || ($cellValue === null));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
+ $retVal = (($cellValue != '') && ($cellValue !== null));
+ break;
+ default:
+ $retVal = true;
+ break;
+ }
+ } else {
+ // String values are always tested for equality, factoring in for wildcards (hence a regexp test)
+ $retVal = preg_match('/^'.$rule['value'].'$/i', $cellValue);
+ }
+ // If there are multiple conditions, then we need to test both using the appropriate join operator
+ switch ($join) {
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR:
+ $returnVal = $returnVal || $retVal;
+ // Break as soon as we have a TRUE match for OR joins,
+ // to avoid unnecessary additional code execution
+ if ($returnVal) {
+ return $returnVal;
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND:
+ $returnVal = $returnVal && $retVal;
+ break;
+ }
+ }
+
+ return $returnVal;
+ }
+
+ /**
+ * Test if cell date value is matches a set of values defined by a set of months
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $monthSet
+ * @return boolean
+ */
+ private static function filterTestInPeriodDateSet($cellValue, $monthSet)
+ {
+ // Blank cells are always ignored, so return a FALSE
+ if (($cellValue == '') || ($cellValue === null)) {
+ return false;
+ }
+
+ if (is_numeric($cellValue)) {
+ $dateValue = date('m', PHPExcel_Shared_Date::ExcelToPHP($cellValue));
+ if (in_array($dateValue, $monthSet)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching
+ *
+ * @var array
+ */
+ private static $fromReplace = array('\*', '\?', '~~', '~.*', '~.?');
+ private static $toReplace = array('.*', '.', '~', '\*', '\?');
+
+
+ /**
+ * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation
+ *
+ * @param string $dynamicRuleType
+ * @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn
+ * @return mixed[]
+ */
+ private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn)
+ {
+ $rDateType = PHPExcel_Calculation_Functions::getReturnDateType();
+ PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
+ $val = $maxVal = null;
+
+ $ruleValues = array();
+ $baseDate = PHPExcel_Calculation_DateTime::DATENOW();
+ // Calculate start/end dates for the required date range based on current date
+ switch ($dynamicRuleType) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
+ $baseDate = strtotime('-7 days', $baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
+ $baseDate = strtotime('-7 days', $baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
+ $baseDate = strtotime('-1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
+ $baseDate = strtotime('+1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
+ $baseDate = strtotime('-3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
+ $baseDate = strtotime('+3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
+ $baseDate = strtotime('-1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
+ $baseDate = strtotime('+1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ }
+
+ switch ($dynamicRuleType) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
+ $thisMonth = date('m', $baseDate);
+ $thisQuarter = floor(--$thisMonth / 3);
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
+ $dayOfWeek = date('w', $baseDate);
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek;
+ $maxVal = $val + 7;
+ break;
+ }
+
+ switch ($dynamicRuleType) {
+ // Adjust Today dates for Yesterday and Tomorrow
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
+ --$maxVal;
+ --$val;
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
+ ++$maxVal;
+ ++$val;
+ break;
+ }
+
+ // Set the filter column rule attributes ready for writing
+ $filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
+
+ // Set the rules for identifying rows for hide/show
+ $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
+ $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
+ PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
+
+ return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
+ }
+
+ private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue)
+ {
+ $range = $columnID.$startRow.':'.$columnID.$endRow;
+ $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false));
+
+ $dataValues = array_filter($dataValues);
+ if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
+ rsort($dataValues);
+ } else {
+ sort($dataValues);
+ }
+
+ return array_pop(array_slice($dataValues, 0, $ruleValue));
+ }
+
+ /**
+ * Apply the AutoFilter rules to the AutoFilter Range
+ *
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function showHideRows()
+ {
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+
+ // The heading row should always be visible
+// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
+ $this->workSheet->getRowDimension($rangeStart[1])->setVisible(true);
+
+ $columnFilterTests = array();
+ foreach ($this->columns as $columnID => $filterColumn) {
+ $rules = $filterColumn->getRules();
+ switch ($filterColumn->getFilterType()) {
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER:
+ $ruleValues = array();
+ // Build a list of the filter value selections
+ foreach ($rules as $rule) {
+ $ruleType = $rule->getRuleType();
+ $ruleValues[] = $rule->getValue();
+ }
+ // Test if we want to include blanks in our filter criteria
+ $blanks = false;
+ $ruleDataSet = array_filter($ruleValues);
+ if (count($ruleValues) != count($ruleDataSet)) {
+ $blanks = true;
+ }
+ if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
+ // Filter on absolute values
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInSimpleDataSet',
+ 'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
+ );
+ } else {
+ // Filter on date group values
+ $arguments = array(
+ 'date' => array(),
+ 'time' => array(),
+ 'dateTime' => array(),
+ );
+ foreach ($ruleDataSet as $ruleValue) {
+ $date = $time = '';
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) {
+ $date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) {
+ $date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) {
+ $date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
+ }
+ $dateTime = $date . $time;
+ $arguments['date'][] = $date;
+ $arguments['time'][] = $time;
+ $arguments['dateTime'][] = $dateTime;
+ }
+ // Remove empty elements
+ $arguments['date'] = array_filter($arguments['date']);
+ $arguments['time'] = array_filter($arguments['time']);
+ $arguments['dateTime'] = array_filter($arguments['dateTime']);
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInDateGroupSet',
+ 'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
+ );
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER:
+ $customRuleForBlanks = false;
+ $ruleValues = array();
+ // Build a list of the filter value selections
+ foreach ($rules as $rule) {
+ $ruleType = $rule->getRuleType();
+ $ruleValue = $rule->getValue();
+ if (!is_numeric($ruleValue)) {
+ // Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards
+ $ruleValue = preg_quote($ruleValue);
+ $ruleValue = str_replace(self::$fromReplace, self::$toReplace, $ruleValue);
+ if (trim($ruleValue) == '') {
+ $customRuleForBlanks = true;
+ $ruleValue = trim($ruleValue);
+ }
+ }
+ $ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
+ }
+ $join = $filterColumn->getJoin();
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
+ );
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER:
+ $ruleValues = array();
+ foreach ($rules as $rule) {
+ // We should only ever have one Dynamic Filter Rule anyway
+ $dynamicRuleType = $rule->getGrouping();
+ if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ||
+ ($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) {
+ // Number (Average) based
+ // Calculate the average
+ $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
+ $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1'));
+ // Set above/below rule based on greaterThan or LessTan
+ $operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
+ ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
+ : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
+ $ruleValues[] = array('operator' => $operator,
+ 'value' => $average
+ );
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
+ );
+ } else {
+ // Date based
+ if ($dynamicRuleType[0] == 'M' || $dynamicRuleType[0] == 'Q') {
+ // Month or Quarter
+ sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period);
+ if ($periodType == 'M') {
+ $ruleValues = array($period);
+ } else {
+ --$period;
+ $periodEnd = (1+$period)*3;
+ $periodStart = 1+$period*3;
+ $ruleValues = range($periodStart, $periodEnd);
+ }
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInPeriodDateSet',
+ 'arguments' => $ruleValues
+ );
+ $filterColumn->setAttributes(array());
+ } else {
+ // Date Range
+ $columnFilterTests[$columnID] = $this->dynamicFilterDateRange($dynamicRuleType, $filterColumn);
+ break;
+ }
+ }
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER:
+ $ruleValues = array();
+ $dataRowCount = $rangeEnd[1] - $rangeStart[1];
+ foreach ($rules as $rule) {
+ // We should only ever have one Dynamic Filter Rule anyway
+ $toptenRuleType = $rule->getGrouping();
+ $ruleValue = $rule->getValue();
+ $ruleOperator = $rule->getOperator();
+ }
+ if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) {
+ $ruleValue = floor($ruleValue * ($dataRowCount / 100));
+ }
+ if ($ruleValue < 1) {
+ $ruleValue = 1;
+ }
+ if ($ruleValue > 500) {
+ $ruleValue = 500;
+ }
+
+ $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
+
+ $operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
+ ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
+ : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
+ $ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
+ );
+ $filterColumn->setAttributes(array('maxVal' => $maxVal));
+ break;
+ }
+ }
+
+// echo 'Column Filter Test CRITERIA',PHP_EOL;
+// var_dump($columnFilterTests);
+//
+ // Execute the column tests for each row in the autoFilter range to determine show/hide,
+ for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
+// echo 'Testing Row = ', $row,PHP_EOL;
+ $result = true;
+ foreach ($columnFilterTests as $columnID => $columnFilterTest) {
+// echo 'Testing cell ', $columnID.$row,PHP_EOL;
+ $cellValue = $this->workSheet->getCell($columnID.$row)->getCalculatedValue();
+// echo 'Value is ', $cellValue,PHP_EOL;
+ // Execute the filter test
+ $result = $result &&
+ call_user_func_array(
+ array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
+ array($cellValue, $columnFilterTest['arguments'])
+ );
+// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
+ // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
+ if (!$result) {
+ break;
+ }
+ }
+ // Set show/hide for the row based on the result of the autoFilter result
+// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
+ $this->workSheet->getRowDimension($row)->setVisible($result);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ if ($key == 'workSheet') {
+ // Detach from worksheet
+ $this->{$key} = null;
+ } else {
+ $this->{$key} = clone $value;
+ }
+ } elseif ((is_array($value)) && ($key == 'columns')) {
+ // The columns array of PHPExcel_Worksheet_AutoFilter objects
+ $this->{$key} = array();
+ foreach ($value as $k => $v) {
+ $this->{$key}[$k] = clone $v;
+ // attach the new cloned Column to this new cloned Autofilter object
+ $this->{$key}[$k]->setParent($this);
+ }
+ } else {
+ $this->{$key} = $value;
+ }
+ }
+ }
+
+ /**
+ * toString method replicates previous behavior by returning the range if object is
+ * referenced as a property of its parent.
+ */
+ public function __toString()
+ {
+ return (string) $this->range;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/AutoFilter.php.bk-aleluya b/Classes/PHPExcel/Worksheet/AutoFilter.php.bk-aleluya
new file mode 100644
index 0000000..6ec8a44
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/AutoFilter.php.bk-aleluya
@@ -0,0 +1,846 @@
+range = $pRange;
+ $this->workSheet = $pSheet;
+ }
+
+ /**
+ * Get AutoFilter Parent Worksheet
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function getParent()
+ {
+ return $this->workSheet;
+ }
+
+ /**
+ * Set AutoFilter Parent Worksheet
+ *
+ * @param PHPExcel_Worksheet $pSheet
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setParent(PHPExcel_Worksheet $pSheet = null)
+ {
+ $this->workSheet = $pSheet;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Range
+ *
+ * @return string
+ */
+ public function getRange()
+ {
+ return $this->range;
+ }
+
+ /**
+ * Set AutoFilter Range
+ *
+ * @param string $pRange Cell range (i.e. A1:E10)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setRange($pRange = '')
+ {
+ // Uppercase coordinate
+ $cellAddress = explode('!', strtoupper($pRange));
+ if (count($cellAddress) > 1) {
+ list($worksheet, $pRange) = $cellAddress;
+ }
+
+ if (strpos($pRange, ':') !== false) {
+ $this->range = $pRange;
+ } elseif (empty($pRange)) {
+ $this->range = '';
+ } else {
+ throw new PHPExcel_Exception('Autofilter must be set on a range of cells.');
+ }
+
+ if (empty($pRange)) {
+ // Discard all column rules
+ $this->columns = array();
+ } else {
+ // Discard any column rules that are no longer valid within this range
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ foreach ($this->columns as $key => $value) {
+ $colIndex = PHPExcel_Cell::columnIndexFromString($key);
+ if (($rangeStart[0] > $colIndex) || ($rangeEnd[0] < $colIndex)) {
+ unset($this->columns[$key]);
+ }
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get all AutoFilter Columns
+ *
+ * @throws PHPExcel_Exception
+ * @return array of PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumns()
+ {
+ return $this->columns;
+ }
+
+ /**
+ * Validate that the specified column is in the AutoFilter range
+ *
+ * @param string $column Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return integer The column offset within the autofilter range
+ */
+ public function testColumnInRange($column)
+ {
+ if (empty($this->range)) {
+ throw new PHPExcel_Exception("No autofilter range is defined.");
+ }
+
+ $columnIndex = PHPExcel_Cell::columnIndexFromString($column);
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ if (($rangeStart[0] > $columnIndex) || ($rangeEnd[0] < $columnIndex)) {
+ throw new PHPExcel_Exception("Column is outside of current autofilter range.");
+ }
+
+ return $columnIndex - $rangeStart[0];
+ }
+
+ /**
+ * Get a specified AutoFilter Column Offset within the defined AutoFilter range
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return integer The offset of the specified column within the autofilter range
+ */
+ public function getColumnOffset($pColumn)
+ {
+ return $this->testColumnInRange($pColumn);
+ }
+
+ /**
+ * Get a specified AutoFilter Column
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumn($pColumn)
+ {
+ $this->testColumnInRange($pColumn);
+
+ if (!isset($this->columns[$pColumn])) {
+ $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
+ }
+
+ return $this->columns[$pColumn];
+ }
+
+ /**
+ * Get a specified AutoFilter Column by it's offset
+ *
+ * @param integer $pColumnOffset Column offset within range (starting from 0)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getColumnByOffset($pColumnOffset = 0)
+ {
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+ $pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
+
+ return $this->getColumn($pColumn);
+ }
+
+ /**
+ * Set AutoFilter
+ *
+ * @param PHPExcel_Worksheet_AutoFilter_Column|string $pColumn
+ * A simple string containing a Column ID like 'A' is permitted
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function setColumn($pColumn)
+ {
+ if ((is_string($pColumn)) && (!empty($pColumn))) {
+ $column = $pColumn;
+ } elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
+ $column = $pColumn->getColumnIndex();
+ } else {
+ throw new PHPExcel_Exception("Column is not within the autofilter range.");
+ }
+ $this->testColumnInRange($column);
+
+ if (is_string($pColumn)) {
+ $this->columns[$pColumn] = new PHPExcel_Worksheet_AutoFilter_Column($pColumn, $this);
+ } elseif (is_object($pColumn) && ($pColumn instanceof PHPExcel_Worksheet_AutoFilter_Column)) {
+ $pColumn->setParent($this);
+ $this->columns[$column] = $pColumn;
+ }
+ ksort($this->columns);
+
+ return $this;
+ }
+
+ /**
+ * Clear a specified AutoFilter Column
+ *
+ * @param string $pColumn Column name (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function clearColumn($pColumn)
+ {
+ $this->testColumnInRange($pColumn);
+
+ if (isset($this->columns[$pColumn])) {
+ unset($this->columns[$pColumn]);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Shift an AutoFilter Column Rule to a different column
+ *
+ * Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range.
+ * Nor does it verify whether any column rule already exists at $toColumn, but will simply overrideany existing value.
+ * Use with caution.
+ *
+ * @param string $fromColumn Column name (e.g. A)
+ * @param string $toColumn Column name (e.g. B)
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function shiftColumn($fromColumn = null, $toColumn = null)
+ {
+ $fromColumn = strtoupper($fromColumn);
+ $toColumn = strtoupper($toColumn);
+
+ if (($fromColumn !== null) && (isset($this->columns[$fromColumn])) && ($toColumn !== null)) {
+ $this->columns[$fromColumn]->setParent();
+ $this->columns[$fromColumn]->setColumnIndex($toColumn);
+ $this->columns[$toColumn] = $this->columns[$fromColumn];
+ $this->columns[$toColumn]->setParent($this);
+ unset($this->columns[$fromColumn]);
+
+ ksort($this->columns);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Test if cell value is in the defined set of values
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $dataSet
+ * @return boolean
+ */
+ private static function filterTestInSimpleDataSet($cellValue, $dataSet)
+ {
+ $dataSetValues = $dataSet['filterValues'];
+ $blanks = $dataSet['blanks'];
+ if (($cellValue == '') || ($cellValue === null)) {
+ return $blanks;
+ }
+ return in_array($cellValue, $dataSetValues);
+ }
+
+ /**
+ * Test if cell value is in the defined set of Excel date values
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $dataSet
+ * @return boolean
+ */
+ private static function filterTestInDateGroupSet($cellValue, $dataSet)
+ {
+ $dateSet = $dataSet['filterValues'];
+ $blanks = $dataSet['blanks'];
+ if (($cellValue == '') || ($cellValue === null)) {
+ return $blanks;
+ }
+
+ if (is_numeric($cellValue)) {
+ $dateValue = PHPExcel_Shared_Date::ExcelToPHP($cellValue);
+ if ($cellValue < 1) {
+ // Just the time part
+ $dtVal = date('His', $dateValue);
+ $dateSet = $dateSet['time'];
+ } elseif ($cellValue == floor($cellValue)) {
+ // Just the date part
+ $dtVal = date('Ymd', $dateValue);
+ $dateSet = $dateSet['date'];
+ } else {
+ // date and time parts
+ $dtVal = date('YmdHis', $dateValue);
+ $dateSet = $dateSet['dateTime'];
+ }
+ foreach ($dateSet as $dateValue) {
+ // Use of substr to extract value at the appropriate group level
+ if (substr($dtVal, 0, strlen($dateValue)) == $dateValue) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if cell value is within a set of values defined by a ruleset
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $ruleSet
+ * @return boolean
+ */
+ private static function filterTestInCustomDataSet($cellValue, $ruleSet)
+ {
+ $dataSet = $ruleSet['filterRules'];
+ $join = $ruleSet['join'];
+ $customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
+
+ if (!$customRuleForBlanks) {
+ // Blank cells are always ignored, so return a FALSE
+ if (($cellValue == '') || ($cellValue === null)) {
+ return false;
+ }
+ }
+ $returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
+ foreach ($dataSet as $rule) {
+ if (is_numeric($rule['value'])) {
+ // Numeric values are tested using the appropriate operator
+ switch ($rule['operator']) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
+ $retVal = ($cellValue == $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
+ $retVal = ($cellValue != $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN:
+ $retVal = ($cellValue > $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL:
+ $retVal = ($cellValue >= $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN:
+ $retVal = ($cellValue < $rule['value']);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL:
+ $retVal = ($cellValue <= $rule['value']);
+ break;
+ }
+ } elseif ($rule['value'] == '') {
+ switch ($rule['operator']) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL:
+ $retVal = (($cellValue == '') || ($cellValue === null));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL:
+ $retVal = (($cellValue != '') && ($cellValue !== null));
+ break;
+ default:
+ $retVal = true;
+ break;
+ }
+ } else {
+ // String values are always tested for equality, factoring in for wildcards (hence a regexp test)
+ $retVal = preg_match('/^'.$rule['value'].'$/i', $cellValue);
+ }
+ // If there are multiple conditions, then we need to test both using the appropriate join operator
+ switch ($join) {
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR:
+ $returnVal = $returnVal || $retVal;
+ // Break as soon as we have a TRUE match for OR joins,
+ // to avoid unnecessary additional code execution
+ if ($returnVal) {
+ return $returnVal;
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND:
+ $returnVal = $returnVal && $retVal;
+ break;
+ }
+ }
+
+ return $returnVal;
+ }
+
+ /**
+ * Test if cell date value is matches a set of values defined by a set of months
+ *
+ * @param mixed $cellValue
+ * @param mixed[] $monthSet
+ * @return boolean
+ */
+ private static function filterTestInPeriodDateSet($cellValue, $monthSet)
+ {
+ // Blank cells are always ignored, so return a FALSE
+ if (($cellValue == '') || ($cellValue === null)) {
+ return false;
+ }
+
+ if (is_numeric($cellValue)) {
+ $dateValue = date('m', PHPExcel_Shared_Date::ExcelToPHP($cellValue));
+ if (in_array($dateValue, $monthSet)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Search/Replace arrays to convert Excel wildcard syntax to a regexp syntax for preg_matching
+ *
+ * @var array
+ */
+ private static $fromReplace = array('\*', '\?', '~~', '~.*', '~.?');
+ private static $toReplace = array('.*', '.', '~', '\*', '\?');
+
+
+ /**
+ * Convert a dynamic rule daterange to a custom filter range expression for ease of calculation
+ *
+ * @param string $dynamicRuleType
+ * @param PHPExcel_Worksheet_AutoFilter_Column &$filterColumn
+ * @return mixed[]
+ */
+ private function dynamicFilterDateRange($dynamicRuleType, &$filterColumn)
+ {
+ $rDateType = PHPExcel_Calculation_Functions::getReturnDateType();
+ PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
+ $val = $maxVal = null;
+
+ $ruleValues = array();
+ $baseDate = PHPExcel_Calculation_DateTime::DATENOW();
+ // Calculate start/end dates for the required date range based on current date
+ switch ($dynamicRuleType) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
+ $baseDate = strtotime('-7 days', $baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
+ $baseDate = strtotime('-7 days', $baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
+ $baseDate = strtotime('-1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
+ $baseDate = strtotime('+1 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
+ $baseDate = strtotime('-3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
+ $baseDate = strtotime('+3 month', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
+ $baseDate = strtotime('-1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
+ $baseDate = strtotime('+1 year', gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ }
+
+ switch ($dynamicRuleType) {
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TODAY:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate);
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(strtotime('+1 day', $baseDate));
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 31, 12, date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER:
+ $thisMonth = date('m', $baseDate);
+ $thisQuarter = floor(--$thisMonth / 3);
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), (1+$thisQuarter)*3, date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, 1+$thisQuarter*3, date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH:
+ $maxVal = (int) PHPExcel_Shared_Date::PHPtoExcel(gmmktime(0, 0, 0, date('t', $baseDate), date('m', $baseDate), date('Y', $baseDate)));
+ ++$maxVal;
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, 1, date('m', $baseDate), date('Y', $baseDate)));
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK:
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK:
+ $dayOfWeek = date('w', $baseDate);
+ $val = (int) PHPExcel_Shared_Date::PHPToExcel($baseDate) - $dayOfWeek;
+ $maxVal = $val + 7;
+ break;
+ }
+
+ switch ($dynamicRuleType) {
+ // Adjust Today dates for Yesterday and Tomorrow
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY:
+ --$maxVal;
+ --$val;
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW:
+ ++$maxVal;
+ ++$val;
+ break;
+ }
+
+ // Set the filter column rule attributes ready for writing
+ $filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
+
+ // Set the rules for identifying rows for hide/show
+ $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
+ $ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
+ PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
+
+ return array('method' => 'filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
+ }
+
+ private function calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue)
+ {
+ $range = $columnID.$startRow.':'.$columnID.$endRow;
+ $dataValues = PHPExcel_Calculation_Functions::flattenArray($this->workSheet->rangeToArray($range, null, true, false));
+
+ $dataValues = array_filter($dataValues);
+ if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
+ rsort($dataValues);
+ } else {
+ sort($dataValues);
+ }
+
+ return array_pop(array_slice($dataValues, 0, $ruleValue));
+ }
+
+ /**
+ * Apply the AutoFilter rules to the AutoFilter Range
+ *
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function showHideRows()
+ {
+ list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->range);
+
+ // The heading row should always be visible
+// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
+ $this->workSheet->getRowDimension($rangeStart[1])->setVisible(true);
+
+ $columnFilterTests = array();
+ foreach ($this->columns as $columnID => $filterColumn) {
+ $rules = $filterColumn->getRules();
+ switch ($filterColumn->getFilterType()) {
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER:
+ $ruleValues = array();
+ // Build a list of the filter value selections
+ foreach ($rules as $rule) {
+ $ruleType = $rule->getRuleType();
+ $ruleValues[] = $rule->getValue();
+ }
+ // Test if we want to include blanks in our filter criteria
+ $blanks = false;
+ $ruleDataSet = array_filter($ruleValues);
+ if (count($ruleValues) != count($ruleDataSet)) {
+ $blanks = true;
+ }
+ if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
+ // Filter on absolute values
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInSimpleDataSet',
+ 'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
+ );
+ } else {
+ // Filter on date group values
+ $arguments = array(
+ 'date' => array(),
+ 'time' => array(),
+ 'dateTime' => array(),
+ );
+ foreach ($ruleDataSet as $ruleValue) {
+ $date = $time = '';
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR] !== '')) {
+ $date .= sprintf('%04d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_YEAR]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH] != '')) {
+ $date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MONTH]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY] !== '')) {
+ $date .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_DAY]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_HOUR]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_MINUTE]);
+ }
+ if ((isset($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND])) &&
+ ($ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND] !== '')) {
+ $time .= sprintf('%02d', $ruleValue[PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP_SECOND]);
+ }
+ $dateTime = $date . $time;
+ $arguments['date'][] = $date;
+ $arguments['time'][] = $time;
+ $arguments['dateTime'][] = $dateTime;
+ }
+ // Remove empty elements
+ $arguments['date'] = array_filter($arguments['date']);
+ $arguments['time'] = array_filter($arguments['time']);
+ $arguments['dateTime'] = array_filter($arguments['dateTime']);
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInDateGroupSet',
+ 'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
+ );
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER:
+ $customRuleForBlanks = false;
+ $ruleValues = array();
+ // Build a list of the filter value selections
+ foreach ($rules as $rule) {
+ $ruleType = $rule->getRuleType();
+ $ruleValue = $rule->getValue();
+ if (!is_numeric($ruleValue)) {
+ // Convert to a regexp allowing for regexp reserved characters, wildcards and escaped wildcards
+ $ruleValue = preg_quote($ruleValue);
+ $ruleValue = str_replace(self::$fromReplace, self::$toReplace, $ruleValue);
+ if (trim($ruleValue) == '') {
+ $customRuleForBlanks = true;
+ $ruleValue = trim($ruleValue);
+ }
+ }
+ $ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
+ }
+ $join = $filterColumn->getJoin();
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
+ );
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER:
+ $ruleValues = array();
+ foreach ($rules as $rule) {
+ // We should only ever have one Dynamic Filter Rule anyway
+ $dynamicRuleType = $rule->getGrouping();
+ if (($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ||
+ ($dynamicRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE)) {
+ // Number (Average) based
+ // Calculate the average
+ $averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
+ $average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula, null, $this->workSheet->getCell('A1'));
+ // Set above/below rule based on greaterThan or LessTan
+ $operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
+ ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
+ : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN;
+ $ruleValues[] = array('operator' => $operator,
+ 'value' => $average
+ );
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
+ );
+ } else {
+ // Date based
+ if ($dynamicRuleType{0} == 'M' || $dynamicRuleType{0} == 'Q') {
+ // Month or Quarter
+ sscanf($dynamicRuleType, '%[A-Z]%d', $periodType, $period);
+ if ($periodType == 'M') {
+ $ruleValues = array($period);
+ } else {
+ --$period;
+ $periodEnd = (1+$period)*3;
+ $periodStart = 1+$period*3;
+ $ruleValues = range($periodStart, $periodEnd);
+ }
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInPeriodDateSet',
+ 'arguments' => $ruleValues
+ );
+ $filterColumn->setAttributes(array());
+ } else {
+ // Date Range
+ $columnFilterTests[$columnID] = $this->dynamicFilterDateRange($dynamicRuleType, $filterColumn);
+ break;
+ }
+ }
+ }
+ break;
+ case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER:
+ $ruleValues = array();
+ $dataRowCount = $rangeEnd[1] - $rangeStart[1];
+ foreach ($rules as $rule) {
+ // We should only ever have one Dynamic Filter Rule anyway
+ $toptenRuleType = $rule->getGrouping();
+ $ruleValue = $rule->getValue();
+ $ruleOperator = $rule->getOperator();
+ }
+ if ($ruleOperator === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) {
+ $ruleValue = floor($ruleValue * ($dataRowCount / 100));
+ }
+ if ($ruleValue < 1) {
+ $ruleValue = 1;
+ }
+ if ($ruleValue > 500) {
+ $ruleValue = 500;
+ }
+
+ $maxVal = $this->calculateTopTenValue($columnID, $rangeStart[1]+1, $rangeEnd[1], $toptenRuleType, $ruleValue);
+
+ $operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
+ ? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
+ : PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
+ $ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
+ $columnFilterTests[$columnID] = array(
+ 'method' => 'filterTestInCustomDataSet',
+ 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
+ );
+ $filterColumn->setAttributes(array('maxVal' => $maxVal));
+ break;
+ }
+ }
+
+// echo 'Column Filter Test CRITERIA',PHP_EOL;
+// var_dump($columnFilterTests);
+//
+ // Execute the column tests for each row in the autoFilter range to determine show/hide,
+ for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
+// echo 'Testing Row = ', $row,PHP_EOL;
+ $result = true;
+ foreach ($columnFilterTests as $columnID => $columnFilterTest) {
+// echo 'Testing cell ', $columnID.$row,PHP_EOL;
+ $cellValue = $this->workSheet->getCell($columnID.$row)->getCalculatedValue();
+// echo 'Value is ', $cellValue,PHP_EOL;
+ // Execute the filter test
+ $result = $result &&
+ call_user_func_array(
+ array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
+ array($cellValue, $columnFilterTest['arguments'])
+ );
+// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
+ // If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
+ if (!$result) {
+ break;
+ }
+ }
+ // Set show/hide for the row based on the result of the autoFilter result
+// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
+ $this->workSheet->getRowDimension($row)->setVisible($result);
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ if ($key == 'workSheet') {
+ // Detach from worksheet
+ $this->{$key} = null;
+ } else {
+ $this->{$key} = clone $value;
+ }
+ } elseif ((is_array($value)) && ($key == 'columns')) {
+ // The columns array of PHPExcel_Worksheet_AutoFilter objects
+ $this->{$key} = array();
+ foreach ($value as $k => $v) {
+ $this->{$key}[$k] = clone $v;
+ // attach the new cloned Column to this new cloned Autofilter object
+ $this->{$key}[$k]->setParent($this);
+ }
+ } else {
+ $this->{$key} = $value;
+ }
+ }
+ }
+
+ /**
+ * toString method replicates previous behavior by returning the range if object is
+ * referenced as a property of its parent.
+ */
+ public function __toString()
+ {
+ return (string) $this->range;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php
new file mode 100644
index 0000000..d64fd81
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column.php
@@ -0,0 +1,405 @@
+columnIndex = $pColumn;
+ $this->parent = $pParent;
+ }
+
+ /**
+ * Get AutoFilter Column Index
+ *
+ * @return string
+ */
+ public function getColumnIndex()
+ {
+ return $this->columnIndex;
+ }
+
+ /**
+ * Set AutoFilter Column Index
+ *
+ * @param string $pColumn Column (e.g. A)
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setColumnIndex($pColumn)
+ {
+ // Uppercase coordinate
+ $pColumn = strtoupper($pColumn);
+ if ($this->parent !== null) {
+ $this->parent->testColumnInRange($pColumn);
+ }
+
+ $this->columnIndex = $pColumn;
+
+ return $this;
+ }
+
+ /**
+ * Get this Column's AutoFilter Parent
+ *
+ * @return PHPExcel_Worksheet_AutoFilter
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Set this Column's AutoFilter Parent
+ *
+ * @param PHPExcel_Worksheet_AutoFilter
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = null)
+ {
+ $this->parent = $pParent;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Type
+ *
+ * @return string
+ */
+ public function getFilterType()
+ {
+ return $this->filterType;
+ }
+
+ /**
+ * Set AutoFilter Type
+ *
+ * @param string $pFilterType
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER)
+ {
+ if (!in_array($pFilterType, self::$filterTypes)) {
+ throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.');
+ }
+
+ $this->filterType = $pFilterType;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Multiple Rules And/Or Join
+ *
+ * @return string
+ */
+ public function getJoin()
+ {
+ return $this->join;
+ }
+
+ /**
+ * Set AutoFilter Multiple Rules And/Or
+ *
+ * @param string $pJoin And/Or
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR)
+ {
+ // Lowercase And/Or
+ $pJoin = strtolower($pJoin);
+ if (!in_array($pJoin, self::$ruleJoins)) {
+ throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.');
+ }
+
+ $this->join = $pJoin;
+
+ return $this;
+ }
+
+ /**
+ * Set AutoFilter Attributes
+ *
+ * @param string[] $pAttributes
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setAttributes($pAttributes = array())
+ {
+ $this->attributes = $pAttributes;
+
+ return $this;
+ }
+
+ /**
+ * Set An AutoFilter Attribute
+ *
+ * @param string $pName Attribute Name
+ * @param string $pValue Attribute Value
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setAttribute($pName, $pValue)
+ {
+ $this->attributes[$pName] = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Column Attributes
+ *
+ * @return string
+ */
+ public function getAttributes()
+ {
+ return $this->attributes;
+ }
+
+ /**
+ * Get specific AutoFilter Column Attribute
+ *
+ * @param string $pName Attribute Name
+ * @return string
+ */
+ public function getAttribute($pName)
+ {
+ if (isset($this->attributes[$pName])) {
+ return $this->attributes[$pName];
+ }
+ return null;
+ }
+
+ /**
+ * Get all AutoFilter Column Rules
+ *
+ * @throws PHPExcel_Exception
+ * @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function getRules()
+ {
+ return $this->ruleset;
+ }
+
+ /**
+ * Get a specified AutoFilter Column Rule
+ *
+ * @param integer $pIndex Rule index in the ruleset array
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function getRule($pIndex)
+ {
+ if (!isset($this->ruleset[$pIndex])) {
+ $this->ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
+ }
+ return $this->ruleset[$pIndex];
+ }
+
+ /**
+ * Create a new AutoFilter Column Rule in the ruleset
+ *
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function createRule()
+ {
+ $this->ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this);
+
+ return end($this->ruleset);
+ }
+
+ /**
+ * Add a new AutoFilter Column Rule to the ruleset
+ *
+ * @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule
+ * @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned
+ * @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule = true)
+ {
+ $pRule->setParent($this);
+ $this->ruleset[] = $pRule;
+
+ return ($returnRule) ? $pRule : $this;
+ }
+
+ /**
+ * Delete a specified AutoFilter Column Rule
+ * If the number of rules is reduced to 1, then we reset And/Or logic to Or
+ *
+ * @param integer $pIndex Rule index in the ruleset array
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function deleteRule($pIndex)
+ {
+ if (isset($this->ruleset[$pIndex])) {
+ unset($this->ruleset[$pIndex]);
+ // If we've just deleted down to a single rule, then reset And/Or joining to Or
+ if (count($this->ruleset) <= 1) {
+ $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Delete all AutoFilter Column Rules
+ *
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function clearRules()
+ {
+ $this->ruleset = array();
+ $this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR);
+
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ if ($key == 'parent') {
+ // Detach from autofilter parent
+ $this->$key = null;
+ } else {
+ $this->$key = clone $value;
+ }
+ } elseif ((is_array($value)) && ($key == 'ruleset')) {
+ // The columns array of PHPExcel_Worksheet_AutoFilter objects
+ $this->$key = array();
+ foreach ($value as $k => $v) {
+ $this->$key[$k] = clone $v;
+ // attach the new cloned Rule to this new cloned Autofilter Cloned object
+ $this->$key[$k]->setParent($this);
+ }
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php
new file mode 100644
index 0000000..39ad18b
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/AutoFilter/Column/Rule.php
@@ -0,0 +1,468 @@
+
+ *
+ *
+ *
+ *
+ *
+ */
+ const AUTOFILTER_COLUMN_RULE_EQUAL = 'equal';
+ const AUTOFILTER_COLUMN_RULE_NOTEQUAL = 'notEqual';
+ const AUTOFILTER_COLUMN_RULE_GREATERTHAN = 'greaterThan';
+ const AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL = 'greaterThanOrEqual';
+ const AUTOFILTER_COLUMN_RULE_LESSTHAN = 'lessThan';
+ const AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL = 'lessThanOrEqual';
+
+ private static $operators = array(
+ self::AUTOFILTER_COLUMN_RULE_EQUAL,
+ self::AUTOFILTER_COLUMN_RULE_NOTEQUAL,
+ self::AUTOFILTER_COLUMN_RULE_GREATERTHAN,
+ self::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ self::AUTOFILTER_COLUMN_RULE_LESSTHAN,
+ self::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ );
+
+ const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE = 'byValue';
+ const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT = 'byPercent';
+
+ private static $topTenValue = array(
+ self::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
+ self::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
+ );
+
+ const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP = 'top';
+ const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM = 'bottom';
+
+ private static $topTenType = array(
+ self::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP,
+ self::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM,
+ );
+
+
+ /* Rule Operators (Numeric, Boolean etc) */
+// const AUTOFILTER_COLUMN_RULE_BETWEEN = 'between'; // greaterThanOrEqual 1 && lessThanOrEqual 2
+ /* Rule Operators (Numeric Special) which are translated to standard numeric operators with calculated values */
+// const AUTOFILTER_COLUMN_RULE_TOPTEN = 'topTen'; // greaterThan calculated value
+// const AUTOFILTER_COLUMN_RULE_TOPTENPERCENT = 'topTenPercent'; // greaterThan calculated value
+// const AUTOFILTER_COLUMN_RULE_ABOVEAVERAGE = 'aboveAverage'; // Value is calculated as the average
+// const AUTOFILTER_COLUMN_RULE_BELOWAVERAGE = 'belowAverage'; // Value is calculated as the average
+ /* Rule Operators (String) which are set as wild-carded values */
+// const AUTOFILTER_COLUMN_RULE_BEGINSWITH = 'beginsWith'; // A*
+// const AUTOFILTER_COLUMN_RULE_ENDSWITH = 'endsWith'; // *Z
+// const AUTOFILTER_COLUMN_RULE_CONTAINS = 'contains'; // *B*
+// const AUTOFILTER_COLUMN_RULE_DOESNTCONTAIN = 'notEqual'; // notEqual *B*
+ /* Rule Operators (Date Special) which are translated to standard numeric operators with calculated values */
+// const AUTOFILTER_COLUMN_RULE_BEFORE = 'lessThan';
+// const AUTOFILTER_COLUMN_RULE_AFTER = 'greaterThan';
+// const AUTOFILTER_COLUMN_RULE_YESTERDAY = 'yesterday';
+// const AUTOFILTER_COLUMN_RULE_TODAY = 'today';
+// const AUTOFILTER_COLUMN_RULE_TOMORROW = 'tomorrow';
+// const AUTOFILTER_COLUMN_RULE_LASTWEEK = 'lastWeek';
+// const AUTOFILTER_COLUMN_RULE_THISWEEK = 'thisWeek';
+// const AUTOFILTER_COLUMN_RULE_NEXTWEEK = 'nextWeek';
+// const AUTOFILTER_COLUMN_RULE_LASTMONTH = 'lastMonth';
+// const AUTOFILTER_COLUMN_RULE_THISMONTH = 'thisMonth';
+// const AUTOFILTER_COLUMN_RULE_NEXTMONTH = 'nextMonth';
+// const AUTOFILTER_COLUMN_RULE_LASTQUARTER = 'lastQuarter';
+// const AUTOFILTER_COLUMN_RULE_THISQUARTER = 'thisQuarter';
+// const AUTOFILTER_COLUMN_RULE_NEXTQUARTER = 'nextQuarter';
+// const AUTOFILTER_COLUMN_RULE_LASTYEAR = 'lastYear';
+// const AUTOFILTER_COLUMN_RULE_THISYEAR = 'thisYear';
+// const AUTOFILTER_COLUMN_RULE_NEXTYEAR = 'nextYear';
+// const AUTOFILTER_COLUMN_RULE_YEARTODATE = 'yearToDate'; //
+// const AUTOFILTER_COLUMN_RULE_ALLDATESINMONTH = 'allDatesInMonth'; // for Month/February
+// const AUTOFILTER_COLUMN_RULE_ALLDATESINQUARTER = 'allDatesInQuarter'; // for Quarter 2
+
+ /**
+ * Autofilter Column
+ *
+ * @var PHPExcel_Worksheet_AutoFilter_Column
+ */
+ private $parent = null;
+
+
+ /**
+ * Autofilter Rule Type
+ *
+ * @var string
+ */
+ private $ruleType = self::AUTOFILTER_RULETYPE_FILTER;
+
+
+ /**
+ * Autofilter Rule Value
+ *
+ * @var string
+ */
+ private $value = '';
+
+ /**
+ * Autofilter Rule Operator
+ *
+ * @var string
+ */
+ private $operator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
+
+ /**
+ * DateTimeGrouping Group Value
+ *
+ * @var string
+ */
+ private $grouping = '';
+
+
+ /**
+ * Create a new PHPExcel_Worksheet_AutoFilter_Column_Rule
+ *
+ * @param PHPExcel_Worksheet_AutoFilter_Column $pParent
+ */
+ public function __construct(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
+ {
+ $this->parent = $pParent;
+ }
+
+ /**
+ * Get AutoFilter Rule Type
+ *
+ * @return string
+ */
+ public function getRuleType()
+ {
+ return $this->ruleType;
+ }
+
+ /**
+ * Set AutoFilter Rule Type
+ *
+ * @param string $pRuleType
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function setRuleType($pRuleType = self::AUTOFILTER_RULETYPE_FILTER)
+ {
+ if (!in_array($pRuleType, self::$ruleTypes)) {
+ throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
+ }
+
+ $this->ruleType = $pRuleType;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Rule Value
+ *
+ * @return string
+ */
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ /**
+ * Set AutoFilter Rule Value
+ *
+ * @param string|string[] $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function setValue($pValue = '')
+ {
+ if (is_array($pValue)) {
+ $grouping = -1;
+ foreach ($pValue as $key => $value) {
+ // Validate array entries
+ if (!in_array($key, self::$dateTimeGroups)) {
+ // Remove any invalid entries from the value array
+ unset($pValue[$key]);
+ } else {
+ // Work out what the dateTime grouping will be
+ $grouping = max($grouping, array_search($key, self::$dateTimeGroups));
+ }
+ }
+ if (count($pValue) == 0) {
+ throw new PHPExcel_Exception('Invalid rule value for column AutoFilter Rule.');
+ }
+ // Set the dateTime grouping that we've anticipated
+ $this->setGrouping(self::$dateTimeGroups[$grouping]);
+ }
+ $this->value = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Rule Operator
+ *
+ * @return string
+ */
+ public function getOperator()
+ {
+ return $this->operator;
+ }
+
+ /**
+ * Set AutoFilter Rule Operator
+ *
+ * @param string $pOperator
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function setOperator($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL)
+ {
+ if (empty($pOperator)) {
+ $pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL;
+ }
+ if ((!in_array($pOperator, self::$operators)) &&
+ (!in_array($pOperator, self::$topTenValue))) {
+ throw new PHPExcel_Exception('Invalid operator for column AutoFilter Rule.');
+ }
+ $this->operator = $pOperator;
+
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter Rule Grouping
+ *
+ * @return string
+ */
+ public function getGrouping()
+ {
+ return $this->grouping;
+ }
+
+ /**
+ * Set AutoFilter Rule Grouping
+ *
+ * @param string $pGrouping
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function setGrouping($pGrouping = null)
+ {
+ if (($pGrouping !== null) &&
+ (!in_array($pGrouping, self::$dateTimeGroups)) &&
+ (!in_array($pGrouping, self::$dynamicTypes)) &&
+ (!in_array($pGrouping, self::$topTenType))) {
+ throw new PHPExcel_Exception('Invalid rule type for column AutoFilter Rule.');
+ }
+ $this->grouping = $pGrouping;
+
+ return $this;
+ }
+
+ /**
+ * Set AutoFilter Rule
+ *
+ * @param string $pOperator
+ * @param string|string[] $pValue
+ * @param string $pGrouping
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function setRule($pOperator = self::AUTOFILTER_COLUMN_RULE_EQUAL, $pValue = '', $pGrouping = null)
+ {
+ $this->setOperator($pOperator);
+ $this->setValue($pValue);
+ // Only set grouping if it's been passed in as a user-supplied argument,
+ // otherwise we're calculating it when we setValue() and don't want to overwrite that
+ // If the user supplies an argumnet for grouping, then on their own head be it
+ if ($pGrouping !== null) {
+ $this->setGrouping($pGrouping);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get this Rule's AutoFilter Column Parent
+ *
+ * @return PHPExcel_Worksheet_AutoFilter_Column
+ */
+ public function getParent()
+ {
+ return $this->parent;
+ }
+
+ /**
+ * Set this Rule's AutoFilter Column Parent
+ *
+ * @param PHPExcel_Worksheet_AutoFilter_Column
+ * @return PHPExcel_Worksheet_AutoFilter_Column_Rule
+ */
+ public function setParent(PHPExcel_Worksheet_AutoFilter_Column $pParent = null)
+ {
+ $this->parent = $pParent;
+
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ if ($key == 'parent') {
+ // Detach from autofilter column parent
+ $this->$key = null;
+ } else {
+ $this->$key = clone $value;
+ }
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/BaseDrawing.php b/Classes/PHPExcel/Worksheet/BaseDrawing.php
new file mode 100644
index 0000000..9ad15c7
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/BaseDrawing.php
@@ -0,0 +1,507 @@
+name = '';
+ $this->description = '';
+ $this->worksheet = null;
+ $this->coordinates = 'A1';
+ $this->offsetX = 0;
+ $this->offsetY = 0;
+ $this->width = 0;
+ $this->height = 0;
+ $this->resizeProportional = true;
+ $this->rotation = 0;
+ $this->shadow = new PHPExcel_Worksheet_Drawing_Shadow();
+
+ // Set image index
+ self::$imageCounter++;
+ $this->imageIndex = self::$imageCounter;
+ }
+
+ /**
+ * Get image index
+ *
+ * @return int
+ */
+ public function getImageIndex()
+ {
+ return $this->imageIndex;
+ }
+
+ /**
+ * Get Name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Set Name
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setName($pValue = '')
+ {
+ $this->name = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Description
+ *
+ * @return string
+ */
+ public function getDescription()
+ {
+ return $this->description;
+ }
+
+ /**
+ * Set Description
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setDescription($pValue = '')
+ {
+ $this->description = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Worksheet
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function getWorksheet()
+ {
+ return $this->worksheet;
+ }
+
+ /**
+ * Set Worksheet
+ *
+ * @param PHPExcel_Worksheet $pValue
+ * @param bool $pOverrideOld If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
+ {
+ if (is_null($this->worksheet)) {
+ // Add drawing to PHPExcel_Worksheet
+ $this->worksheet = $pValue;
+ $this->worksheet->getCell($this->coordinates);
+ $this->worksheet->getDrawingCollection()->append($this);
+ } else {
+ if ($pOverrideOld) {
+ // Remove drawing from old PHPExcel_Worksheet
+ $iterator = $this->worksheet->getDrawingCollection()->getIterator();
+
+ while ($iterator->valid()) {
+ if ($iterator->current()->getHashCode() == $this->getHashCode()) {
+ $this->worksheet->getDrawingCollection()->offsetUnset($iterator->key());
+ $this->worksheet = null;
+ break;
+ }
+ }
+
+ // Set new PHPExcel_Worksheet
+ $this->setWorksheet($pValue);
+ } else {
+ throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Get Coordinates
+ *
+ * @return string
+ */
+ public function getCoordinates()
+ {
+ return $this->coordinates;
+ }
+
+ /**
+ * Set Coordinates
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setCoordinates($pValue = 'A1')
+ {
+ $this->coordinates = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get OffsetX
+ *
+ * @return int
+ */
+ public function getOffsetX()
+ {
+ return $this->offsetX;
+ }
+
+ /**
+ * Set OffsetX
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setOffsetX($pValue = 0)
+ {
+ $this->offsetX = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get OffsetY
+ *
+ * @return int
+ */
+ public function getOffsetY()
+ {
+ return $this->offsetY;
+ }
+
+ /**
+ * Set OffsetY
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setOffsetY($pValue = 0)
+ {
+ $this->offsetY = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Width
+ *
+ * @return int
+ */
+ public function getWidth()
+ {
+ return $this->width;
+ }
+
+ /**
+ * Set Width
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setWidth($pValue = 0)
+ {
+ // Resize proportional?
+ if ($this->resizeProportional && $pValue != 0) {
+ $ratio = $this->height / ($this->width != 0 ? $this->width : 1);
+ $this->height = round($ratio * $pValue);
+ }
+
+ // Set width
+ $this->width = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Get Height
+ *
+ * @return int
+ */
+ public function getHeight()
+ {
+ return $this->height;
+ }
+
+ /**
+ * Set Height
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setHeight($pValue = 0)
+ {
+ // Resize proportional?
+ if ($this->resizeProportional && $pValue != 0) {
+ $ratio = $this->width / ($this->height != 0 ? $this->height : 1);
+ $this->width = round($ratio * $pValue);
+ }
+
+ // Set height
+ $this->height = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Set width and height with proportional resize
+ * Example:
+ *
+ * $objDrawing->setResizeProportional(true);
+ * $objDrawing->setWidthAndHeight(160,120);
+ *
+ *
+ * @author Vincent@luo MSN:kele_100@hotmail.com
+ * @param int $width
+ * @param int $height
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setWidthAndHeight($width = 0, $height = 0)
+ {
+ $xratio = $width / ($this->width != 0 ? $this->width : 1);
+ $yratio = $height / ($this->height != 0 ? $this->height : 1);
+ if ($this->resizeProportional && !($width == 0 || $height == 0)) {
+ if (($xratio * $this->height) < $height) {
+ $this->height = ceil($xratio * $this->height);
+ $this->width = $width;
+ } else {
+ $this->width = ceil($yratio * $this->width);
+ $this->height = $height;
+ }
+ } else {
+ $this->width = $width;
+ $this->height = $height;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get ResizeProportional
+ *
+ * @return boolean
+ */
+ public function getResizeProportional()
+ {
+ return $this->resizeProportional;
+ }
+
+ /**
+ * Set ResizeProportional
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setResizeProportional($pValue = true)
+ {
+ $this->resizeProportional = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Rotation
+ *
+ * @return int
+ */
+ public function getRotation()
+ {
+ return $this->rotation;
+ }
+
+ /**
+ * Set Rotation
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setRotation($pValue = 0)
+ {
+ $this->rotation = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Shadow
+ *
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function getShadow()
+ {
+ return $this->shadow;
+ }
+
+ /**
+ * Set Shadow
+ *
+ * @param PHPExcel_Worksheet_Drawing_Shadow $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_BaseDrawing
+ */
+ public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null)
+ {
+ $this->shadow = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ $this->name .
+ $this->description .
+ $this->worksheet->getHashCode() .
+ $this->coordinates .
+ $this->offsetX .
+ $this->offsetY .
+ $this->width .
+ $this->height .
+ $this->rotation .
+ $this->shadow->getHashCode() .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/CellIterator.php b/Classes/PHPExcel/Worksheet/CellIterator.php
new file mode 100644
index 0000000..151c17f
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/CellIterator.php
@@ -0,0 +1,88 @@
+subject);
+ }
+
+ /**
+ * Get loop only existing cells
+ *
+ * @return boolean
+ */
+ public function getIterateOnlyExistingCells()
+ {
+ return $this->onlyExistingCells;
+ }
+
+ /**
+ * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
+ *
+ * @throws PHPExcel_Exception
+ */
+ abstract protected function adjustForExistingOnlyRange();
+
+ /**
+ * Set the iterator to loop only existing cells
+ *
+ * @param boolean $value
+ * @throws PHPExcel_Exception
+ */
+ public function setIterateOnlyExistingCells($value = true)
+ {
+ $this->onlyExistingCells = (boolean) $value;
+
+ $this->adjustForExistingOnlyRange();
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Column.php b/Classes/PHPExcel/Worksheet/Column.php
new file mode 100644
index 0000000..6d3f36d
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Column.php
@@ -0,0 +1,86 @@
+parent = $parent;
+ $this->columnIndex = $columnIndex;
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->parent);
+ }
+
+ /**
+ * Get column index
+ *
+ * @return string
+ */
+ public function getColumnIndex()
+ {
+ return $this->columnIndex;
+ }
+
+ /**
+ * Get cell iterator
+ *
+ * @param integer $startRow The row number at which to start iterating
+ * @param integer $endRow Optionally, the row number at which to stop iterating
+ * @return PHPExcel_Worksheet_CellIterator
+ */
+ public function getCellIterator($startRow = 1, $endRow = null)
+ {
+ return new PHPExcel_Worksheet_ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow);
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/ColumnCellIterator.php b/Classes/PHPExcel/Worksheet/ColumnCellIterator.php
new file mode 100644
index 0000000..7b8c219
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/ColumnCellIterator.php
@@ -0,0 +1,216 @@
+subject = $subject;
+ $this->columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1;
+ $this->resetEnd($endRow);
+ $this->resetStart($startRow);
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->subject);
+ }
+
+ /**
+ * (Re)Set the start row and the current row pointer
+ *
+ * @param integer $startRow The row number at which to start iterating
+ * @return PHPExcel_Worksheet_ColumnCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetStart($startRow = 1)
+ {
+ $this->startRow = $startRow;
+ $this->adjustForExistingOnlyRange();
+ $this->seek($startRow);
+
+ return $this;
+ }
+
+ /**
+ * (Re)Set the end row
+ *
+ * @param integer $endRow The row number at which to stop iterating
+ * @return PHPExcel_Worksheet_ColumnCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetEnd($endRow = null)
+ {
+ $this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow();
+ $this->adjustForExistingOnlyRange();
+
+ return $this;
+ }
+
+ /**
+ * Set the row pointer to the selected row
+ *
+ * @param integer $row The row number to set the current pointer at
+ * @return PHPExcel_Worksheet_ColumnCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function seek($row = 1)
+ {
+ if (($row < $this->startRow) || ($row > $this->endRow)) {
+ throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
+ } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) {
+ throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
+ }
+ $this->position = $row;
+
+ return $this;
+ }
+
+ /**
+ * Rewind the iterator to the starting row
+ */
+ public function rewind()
+ {
+ $this->position = $this->startRow;
+ }
+
+ /**
+ * Return the current cell in this worksheet column
+ *
+ * @return PHPExcel_Worksheet_Row
+ */
+ public function current()
+ {
+ return $this->subject->getCellByColumnAndRow($this->columnIndex, $this->position);
+ }
+
+ /**
+ * Return the current iterator key
+ *
+ * @return int
+ */
+ public function key()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Set the iterator to its next value
+ */
+ public function next()
+ {
+ do {
+ ++$this->position;
+ } while (($this->onlyExistingCells) &&
+ (!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) &&
+ ($this->position <= $this->endRow));
+ }
+
+ /**
+ * Set the iterator to its previous value
+ */
+ public function prev()
+ {
+ if ($this->position <= $this->startRow) {
+ throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
+ }
+
+ do {
+ --$this->position;
+ } while (($this->onlyExistingCells) &&
+ (!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) &&
+ ($this->position >= $this->startRow));
+ }
+
+ /**
+ * Indicate if more rows exist in the worksheet range of rows that we're iterating
+ *
+ * @return boolean
+ */
+ public function valid()
+ {
+ return $this->position <= $this->endRow;
+ }
+
+ /**
+ * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
+ *
+ * @throws PHPExcel_Exception
+ */
+ protected function adjustForExistingOnlyRange()
+ {
+ if ($this->onlyExistingCells) {
+ while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) &&
+ ($this->startRow <= $this->endRow)) {
+ ++$this->startRow;
+ }
+ if ($this->startRow > $this->endRow) {
+ throw new PHPExcel_Exception('No cells exist within the specified range');
+ }
+ while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) &&
+ ($this->endRow >= $this->startRow)) {
+ --$this->endRow;
+ }
+ if ($this->endRow < $this->startRow) {
+ throw new PHPExcel_Exception('No cells exist within the specified range');
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/ColumnDimension.php b/Classes/PHPExcel/Worksheet/ColumnDimension.php
new file mode 100644
index 0000000..405b825
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/ColumnDimension.php
@@ -0,0 +1,132 @@
+columnIndex = $pIndex;
+
+ // set dimension as unformatted by default
+ parent::__construct(0);
+ }
+
+ /**
+ * Get ColumnIndex
+ *
+ * @return string
+ */
+ public function getColumnIndex()
+ {
+ return $this->columnIndex;
+ }
+
+ /**
+ * Set ColumnIndex
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function setColumnIndex($pValue)
+ {
+ $this->columnIndex = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Width
+ *
+ * @return double
+ */
+ public function getWidth()
+ {
+ return $this->width;
+ }
+
+ /**
+ * Set Width
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function setWidth($pValue = -1)
+ {
+ $this->width = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Auto Size
+ *
+ * @return bool
+ */
+ public function getAutoSize()
+ {
+ return $this->autoSize;
+ }
+
+ /**
+ * Set Auto Size
+ *
+ * @param bool $pValue
+ * @return PHPExcel_Worksheet_ColumnDimension
+ */
+ public function setAutoSize($pValue = false)
+ {
+ $this->autoSize = $pValue;
+ return $this;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/ColumnIterator.php b/Classes/PHPExcel/Worksheet/ColumnIterator.php
new file mode 100644
index 0000000..0db3e53
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/ColumnIterator.php
@@ -0,0 +1,201 @@
+subject = $subject;
+ $this->resetEnd($endColumn);
+ $this->resetStart($startColumn);
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->subject);
+ }
+
+ /**
+ * (Re)Set the start column and the current column pointer
+ *
+ * @param integer $startColumn The column address at which to start iterating
+ * @return PHPExcel_Worksheet_ColumnIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetStart($startColumn = 'A')
+ {
+ $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
+ if ($startColumnIndex > PHPExcel_Cell::columnIndexFromString($this->subject->getHighestColumn()) - 1) {
+ throw new PHPExcel_Exception("Start column ({$startColumn}) is beyond highest column ({$this->subject->getHighestColumn()})");
+ }
+
+ $this->startColumn = $startColumnIndex;
+ if ($this->endColumn < $this->startColumn) {
+ $this->endColumn = $this->startColumn;
+ }
+ $this->seek($startColumn);
+
+ return $this;
+ }
+
+ /**
+ * (Re)Set the end column
+ *
+ * @param string $endColumn The column address at which to stop iterating
+ * @return PHPExcel_Worksheet_ColumnIterator
+ */
+ public function resetEnd($endColumn = null)
+ {
+ $endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
+ $this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
+
+ return $this;
+ }
+
+ /**
+ * Set the column pointer to the selected column
+ *
+ * @param string $column The column address to set the current pointer at
+ * @return PHPExcel_Worksheet_ColumnIterator
+ * @throws PHPExcel_Exception
+ */
+ public function seek($column = 'A')
+ {
+ $column = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ if (($column < $this->startColumn) || ($column > $this->endColumn)) {
+ throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
+ }
+ $this->position = $column;
+
+ return $this;
+ }
+
+ /**
+ * Rewind the iterator to the starting column
+ */
+ public function rewind()
+ {
+ $this->position = $this->startColumn;
+ }
+
+ /**
+ * Return the current column in this worksheet
+ *
+ * @return PHPExcel_Worksheet_Column
+ */
+ public function current()
+ {
+ return new PHPExcel_Worksheet_Column($this->subject, PHPExcel_Cell::stringFromColumnIndex($this->position));
+ }
+
+ /**
+ * Return the current iterator key
+ *
+ * @return string
+ */
+ public function key()
+ {
+ return PHPExcel_Cell::stringFromColumnIndex($this->position);
+ }
+
+ /**
+ * Set the iterator to its next value
+ */
+ public function next()
+ {
+ ++$this->position;
+ }
+
+ /**
+ * Set the iterator to its previous value
+ *
+ * @throws PHPExcel_Exception
+ */
+ public function prev()
+ {
+ if ($this->position <= $this->startColumn) {
+ throw new PHPExcel_Exception(
+ "Column is already at the beginning of range (" .
+ PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " .
+ PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")"
+ );
+ }
+
+ --$this->position;
+ }
+
+ /**
+ * Indicate if more columns exist in the worksheet range of columns that we're iterating
+ *
+ * @return boolean
+ */
+ public function valid()
+ {
+ return $this->position <= $this->endColumn;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Dimension.php b/Classes/PHPExcel/Worksheet/Dimension.php
new file mode 100644
index 0000000..84f692c
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Dimension.php
@@ -0,0 +1,178 @@
+xfIndex = $initialValue;
+ }
+
+ /**
+ * Get Visible
+ *
+ * @return bool
+ */
+ public function getVisible()
+ {
+ return $this->visible;
+ }
+
+ /**
+ * Set Visible
+ *
+ * @param bool $pValue
+ * @return PHPExcel_Worksheet_Dimension
+ */
+ public function setVisible($pValue = true)
+ {
+ $this->visible = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Outline Level
+ *
+ * @return int
+ */
+ public function getOutlineLevel()
+ {
+ return $this->outlineLevel;
+ }
+
+ /**
+ * Set Outline Level
+ *
+ * Value must be between 0 and 7
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_Dimension
+ */
+ public function setOutlineLevel($pValue)
+ {
+ if ($pValue < 0 || $pValue > 7) {
+ throw new PHPExcel_Exception("Outline level must range between 0 and 7.");
+ }
+
+ $this->outlineLevel = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Collapsed
+ *
+ * @return bool
+ */
+ public function getCollapsed()
+ {
+ return $this->collapsed;
+ }
+
+ /**
+ * Set Collapsed
+ *
+ * @param bool $pValue
+ * @return PHPExcel_Worksheet_Dimension
+ */
+ public function setCollapsed($pValue = true)
+ {
+ $this->collapsed = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get index to cellXf
+ *
+ * @return int
+ */
+ public function getXfIndex()
+ {
+ return $this->xfIndex;
+ }
+
+ /**
+ * Set index to cellXf
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Dimension
+ */
+ public function setXfIndex($pValue = 0)
+ {
+ $this->xfIndex = $pValue;
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Drawing.php b/Classes/PHPExcel/Worksheet/Drawing.php
new file mode 100644
index 0000000..e39d3eb
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Drawing.php
@@ -0,0 +1,147 @@
+path = '';
+
+ // Initialize parent
+ parent::__construct();
+ }
+
+ /**
+ * Get Filename
+ *
+ * @return string
+ */
+ public function getFilename()
+ {
+ return basename($this->path);
+ }
+
+ /**
+ * Get indexed filename (using image index)
+ *
+ * @return string
+ */
+ public function getIndexedFilename()
+ {
+ $fileName = $this->getFilename();
+ $fileName = str_replace(' ', '_', $fileName);
+ return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
+ }
+
+ /**
+ * Get Extension
+ *
+ * @return string
+ */
+ public function getExtension()
+ {
+ $exploded = explode(".", basename($this->path));
+ return $exploded[count($exploded) - 1];
+ }
+
+ /**
+ * Get Path
+ *
+ * @return string
+ */
+ public function getPath()
+ {
+ return $this->path;
+ }
+
+ /**
+ * Set Path
+ *
+ * @param string $pValue File path
+ * @param boolean $pVerifyFile Verify file
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_Drawing
+ */
+ public function setPath($pValue = '', $pVerifyFile = true)
+ {
+ if ($pVerifyFile) {
+ if (file_exists($pValue)) {
+ $this->path = $pValue;
+
+ if ($this->width == 0 && $this->height == 0) {
+ // Get width/height
+ list($this->width, $this->height) = getimagesize($pValue);
+ }
+ } else {
+ throw new PHPExcel_Exception("File $pValue not found!");
+ }
+ } else {
+ $this->path = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ $this->path .
+ parent::getHashCode() .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php
new file mode 100644
index 0000000..84db91d
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php
@@ -0,0 +1,296 @@
+visible = false;
+ $this->blurRadius = 6;
+ $this->distance = 2;
+ $this->direction = 0;
+ $this->alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
+ $this->color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
+ $this->alpha = 50;
+ }
+
+ /**
+ * Get Visible
+ *
+ * @return boolean
+ */
+ public function getVisible()
+ {
+ return $this->visible;
+ }
+
+ /**
+ * Set Visible
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setVisible($pValue = false)
+ {
+ $this->visible = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Blur radius
+ *
+ * @return int
+ */
+ public function getBlurRadius()
+ {
+ return $this->blurRadius;
+ }
+
+ /**
+ * Set Blur radius
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setBlurRadius($pValue = 6)
+ {
+ $this->blurRadius = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Shadow distance
+ *
+ * @return int
+ */
+ public function getDistance()
+ {
+ return $this->distance;
+ }
+
+ /**
+ * Set Shadow distance
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setDistance($pValue = 2)
+ {
+ $this->distance = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Shadow direction (in degrees)
+ *
+ * @return int
+ */
+ public function getDirection()
+ {
+ return $this->direction;
+ }
+
+ /**
+ * Set Shadow direction (in degrees)
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setDirection($pValue = 0)
+ {
+ $this->direction = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Shadow alignment
+ *
+ * @return int
+ */
+ public function getAlignment()
+ {
+ return $this->alignment;
+ }
+
+ /**
+ * Set Shadow alignment
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setAlignment($pValue = 0)
+ {
+ $this->alignment = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Color
+ *
+ * @return PHPExcel_Style_Color
+ */
+ public function getColor()
+ {
+ return $this->color;
+ }
+
+ /**
+ * Set Color
+ *
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setColor(PHPExcel_Style_Color $pValue = null)
+ {
+ $this->color = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Alpha
+ *
+ * @return int
+ */
+ public function getAlpha()
+ {
+ return $this->alpha;
+ }
+
+ /**
+ * Set Alpha
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_Drawing_Shadow
+ */
+ public function setAlpha($pValue = 0)
+ {
+ $this->alpha = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ ($this->visible ? 't' : 'f') .
+ $this->blurRadius .
+ $this->distance .
+ $this->direction .
+ $this->alignment .
+ $this->color->getHashCode() .
+ $this->alpha .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/HeaderFooter.php b/Classes/PHPExcel/Worksheet/HeaderFooter.php
new file mode 100644
index 0000000..3a88923
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/HeaderFooter.php
@@ -0,0 +1,494 @@
+
+ * Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference, page 1970:
+ *
+ * There are a number of formatting codes that can be written inline with the actual header / footer text, which
+ * affect the formatting in the header or footer.
+ *
+ * Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on
+ * the second line (center section).
+ * &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
+ *
+ * General Rules:
+ * There is no required order in which these codes must appear.
+ *
+ * The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again:
+ * - strikethrough
+ * - superscript
+ * - subscript
+ * Superscript and subscript cannot both be ON at same time. Whichever comes first wins and the other is ignored,
+ * while the first is ON.
+ * &L - code for "left section" (there are three header / footer locations, "left", "center", and "right"). When
+ * two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the
+ * order of appearance, and placed into the left section.
+ * &P - code for "current page #"
+ * &N - code for "total pages"
+ * &font size - code for "text font size", where font size is a font size in points.
+ * &K - code for "text font color"
+ * RGB Color is specified as RRGGBB
+ * Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade
+ * value, NN is the tint/shade value.
+ * &S - code for "text strikethrough" on / off
+ * &X - code for "text super script" on / off
+ * &Y - code for "text subscript" on / off
+ * &C - code for "center section". When two or more occurrences of this section marker exist, the contents
+ * from all markers are concatenated, in the order of appearance, and placed into the center section.
+ *
+ * &D - code for "date"
+ * &T - code for "time"
+ * &G - code for "picture as background"
+ * &U - code for "text single underline"
+ * &E - code for "double underline"
+ * &R - code for "right section". When two or more occurrences of this section marker exist, the contents
+ * from all markers are concatenated, in the order of appearance, and placed into the right section.
+ * &Z - code for "this workbook's file path"
+ * &F - code for "this workbook's file name"
+ * &A - code for "sheet tab name"
+ * &+ - code for add to page #.
+ * &- - code for subtract from page #.
+ * &"font name,font type" - code for "text font name" and "text font type", where font name and font type
+ * are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font
+ * name, it means "none specified". Both of font name and font type can be localized values.
+ * &"-,Bold" - code for "bold font style"
+ * &B - also means "bold font style".
+ * &"-,Regular" - code for "regular font style"
+ * &"-,Italic" - code for "italic font style"
+ * &I - also means "italic font style"
+ * &"-,Bold Italic" code for "bold italic font style"
+ * &O - code for "outline style"
+ * &H - code for "shadow style"
+ *
+ *
+ */
+class PHPExcel_Worksheet_HeaderFooter
+{
+ /* Header/footer image location */
+ const IMAGE_HEADER_LEFT = 'LH';
+ const IMAGE_HEADER_CENTER = 'CH';
+ const IMAGE_HEADER_RIGHT = 'RH';
+ const IMAGE_FOOTER_LEFT = 'LF';
+ const IMAGE_FOOTER_CENTER = 'CF';
+ const IMAGE_FOOTER_RIGHT = 'RF';
+
+ /**
+ * OddHeader
+ *
+ * @var string
+ */
+ private $oddHeader = '';
+
+ /**
+ * OddFooter
+ *
+ * @var string
+ */
+ private $oddFooter = '';
+
+ /**
+ * EvenHeader
+ *
+ * @var string
+ */
+ private $evenHeader = '';
+
+ /**
+ * EvenFooter
+ *
+ * @var string
+ */
+ private $evenFooter = '';
+
+ /**
+ * FirstHeader
+ *
+ * @var string
+ */
+ private $firstHeader = '';
+
+ /**
+ * FirstFooter
+ *
+ * @var string
+ */
+ private $firstFooter = '';
+
+ /**
+ * Different header for Odd/Even, defaults to false
+ *
+ * @var boolean
+ */
+ private $differentOddEven = false;
+
+ /**
+ * Different header for first page, defaults to false
+ *
+ * @var boolean
+ */
+ private $differentFirst = false;
+
+ /**
+ * Scale with document, defaults to true
+ *
+ * @var boolean
+ */
+ private $scaleWithDocument = true;
+
+ /**
+ * Align with margins, defaults to true
+ *
+ * @var boolean
+ */
+ private $alignWithMargins = true;
+
+ /**
+ * Header/footer images
+ *
+ * @var PHPExcel_Worksheet_HeaderFooterDrawing[]
+ */
+ private $headerFooterImages = array();
+
+ /**
+ * Create a new PHPExcel_Worksheet_HeaderFooter
+ */
+ public function __construct()
+ {
+ }
+
+ /**
+ * Get OddHeader
+ *
+ * @return string
+ */
+ public function getOddHeader()
+ {
+ return $this->oddHeader;
+ }
+
+ /**
+ * Set OddHeader
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setOddHeader($pValue)
+ {
+ $this->oddHeader = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get OddFooter
+ *
+ * @return string
+ */
+ public function getOddFooter()
+ {
+ return $this->oddFooter;
+ }
+
+ /**
+ * Set OddFooter
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setOddFooter($pValue)
+ {
+ $this->oddFooter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get EvenHeader
+ *
+ * @return string
+ */
+ public function getEvenHeader()
+ {
+ return $this->evenHeader;
+ }
+
+ /**
+ * Set EvenHeader
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setEvenHeader($pValue)
+ {
+ $this->evenHeader = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get EvenFooter
+ *
+ * @return string
+ */
+ public function getEvenFooter()
+ {
+ return $this->evenFooter;
+ }
+
+ /**
+ * Set EvenFooter
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setEvenFooter($pValue)
+ {
+ $this->evenFooter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get FirstHeader
+ *
+ * @return string
+ */
+ public function getFirstHeader()
+ {
+ return $this->firstHeader;
+ }
+
+ /**
+ * Set FirstHeader
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setFirstHeader($pValue)
+ {
+ $this->firstHeader = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get FirstFooter
+ *
+ * @return string
+ */
+ public function getFirstFooter()
+ {
+ return $this->firstFooter;
+ }
+
+ /**
+ * Set FirstFooter
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setFirstFooter($pValue)
+ {
+ $this->firstFooter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get DifferentOddEven
+ *
+ * @return boolean
+ */
+ public function getDifferentOddEven()
+ {
+ return $this->differentOddEven;
+ }
+
+ /**
+ * Set DifferentOddEven
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setDifferentOddEven($pValue = false)
+ {
+ $this->differentOddEven = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get DifferentFirst
+ *
+ * @return boolean
+ */
+ public function getDifferentFirst()
+ {
+ return $this->differentFirst;
+ }
+
+ /**
+ * Set DifferentFirst
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setDifferentFirst($pValue = false)
+ {
+ $this->differentFirst = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get ScaleWithDocument
+ *
+ * @return boolean
+ */
+ public function getScaleWithDocument()
+ {
+ return $this->scaleWithDocument;
+ }
+
+ /**
+ * Set ScaleWithDocument
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setScaleWithDocument($pValue = true)
+ {
+ $this->scaleWithDocument = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get AlignWithMargins
+ *
+ * @return boolean
+ */
+ public function getAlignWithMargins()
+ {
+ return $this->alignWithMargins;
+ }
+
+ /**
+ * Set AlignWithMargins
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setAlignWithMargins($pValue = true)
+ {
+ $this->alignWithMargins = $pValue;
+ return $this;
+ }
+
+ /**
+ * Add header/footer image
+ *
+ * @param PHPExcel_Worksheet_HeaderFooterDrawing $image
+ * @param string $location
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
+ {
+ $this->headerFooterImages[$location] = $image;
+ return $this;
+ }
+
+ /**
+ * Remove header/footer image
+ *
+ * @param string $location
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function removeImage($location = self::IMAGE_HEADER_LEFT)
+ {
+ if (isset($this->headerFooterImages[$location])) {
+ unset($this->headerFooterImages[$location]);
+ }
+ return $this;
+ }
+
+ /**
+ * Set header/footer images
+ *
+ * @param PHPExcel_Worksheet_HeaderFooterDrawing[] $images
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setImages($images)
+ {
+ if (!is_array($images)) {
+ throw new PHPExcel_Exception('Invalid parameter!');
+ }
+
+ $this->headerFooterImages = $images;
+ return $this;
+ }
+
+ /**
+ * Get header/footer images
+ *
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing[]
+ */
+ public function getImages()
+ {
+ // Sort array
+ $images = array();
+ if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) {
+ $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT];
+ }
+ if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) {
+ $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER];
+ }
+ if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
+ $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT];
+ }
+ if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
+ $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT];
+ }
+ if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
+ $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER];
+ }
+ if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
+ $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT];
+ }
+ $this->headerFooterImages = $images;
+
+ return $this->headerFooterImages;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php
new file mode 100644
index 0000000..a491f4b
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php
@@ -0,0 +1,361 @@
+path = '';
+ $this->name = '';
+ $this->offsetX = 0;
+ $this->offsetY = 0;
+ $this->width = 0;
+ $this->height = 0;
+ $this->resizeProportional = true;
+ }
+
+ /**
+ * Get Name
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->name;
+ }
+
+ /**
+ * Set Name
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setName($pValue = '')
+ {
+ $this->name = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get OffsetX
+ *
+ * @return int
+ */
+ public function getOffsetX()
+ {
+ return $this->offsetX;
+ }
+
+ /**
+ * Set OffsetX
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setOffsetX($pValue = 0)
+ {
+ $this->offsetX = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get OffsetY
+ *
+ * @return int
+ */
+ public function getOffsetY()
+ {
+ return $this->offsetY;
+ }
+
+ /**
+ * Set OffsetY
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setOffsetY($pValue = 0)
+ {
+ $this->offsetY = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Width
+ *
+ * @return int
+ */
+ public function getWidth()
+ {
+ return $this->width;
+ }
+
+ /**
+ * Set Width
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setWidth($pValue = 0)
+ {
+ // Resize proportional?
+ if ($this->resizeProportional && $pValue != 0) {
+ $ratio = $this->width / $this->height;
+ $this->height = round($ratio * $pValue);
+ }
+
+ // Set width
+ $this->width = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Get Height
+ *
+ * @return int
+ */
+ public function getHeight()
+ {
+ return $this->height;
+ }
+
+ /**
+ * Set Height
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setHeight($pValue = 0)
+ {
+ // Resize proportional?
+ if ($this->resizeProportional && $pValue != 0) {
+ $ratio = $this->width / $this->height;
+ $this->width = round($ratio * $pValue);
+ }
+
+ // Set height
+ $this->height = $pValue;
+
+ return $this;
+ }
+
+ /**
+ * Set width and height with proportional resize
+ * Example:
+ *
+ * $objDrawing->setResizeProportional(true);
+ * $objDrawing->setWidthAndHeight(160,120);
+ *
+ *
+ * @author Vincent@luo MSN:kele_100@hotmail.com
+ * @param int $width
+ * @param int $height
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setWidthAndHeight($width = 0, $height = 0)
+ {
+ $xratio = $width / $this->width;
+ $yratio = $height / $this->height;
+ if ($this->resizeProportional && !($width == 0 || $height == 0)) {
+ if (($xratio * $this->height) < $height) {
+ $this->height = ceil($xratio * $this->height);
+ $this->width = $width;
+ } else {
+ $this->width = ceil($yratio * $this->width);
+ $this->height = $height;
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Get ResizeProportional
+ *
+ * @return boolean
+ */
+ public function getResizeProportional()
+ {
+ return $this->resizeProportional;
+ }
+
+ /**
+ * Set ResizeProportional
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setResizeProportional($pValue = true)
+ {
+ $this->resizeProportional = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Filename
+ *
+ * @return string
+ */
+ public function getFilename()
+ {
+ return basename($this->path);
+ }
+
+ /**
+ * Get Extension
+ *
+ * @return string
+ */
+ public function getExtension()
+ {
+ $parts = explode(".", basename($this->path));
+ return end($parts);
+ }
+
+ /**
+ * Get Path
+ *
+ * @return string
+ */
+ public function getPath()
+ {
+ return $this->path;
+ }
+
+ /**
+ * Set Path
+ *
+ * @param string $pValue File path
+ * @param boolean $pVerifyFile Verify file
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_HeaderFooterDrawing
+ */
+ public function setPath($pValue = '', $pVerifyFile = true)
+ {
+ if ($pVerifyFile) {
+ if (file_exists($pValue)) {
+ $this->path = $pValue;
+
+ if ($this->width == 0 && $this->height == 0) {
+ // Get width/height
+ list($this->width, $this->height) = getimagesize($pValue);
+ }
+ } else {
+ throw new PHPExcel_Exception("File $pValue not found!");
+ }
+ } else {
+ $this->path = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ $this->path .
+ $this->name .
+ $this->offsetX .
+ $this->offsetY .
+ $this->width .
+ $this->height .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/MemoryDrawing.php b/Classes/PHPExcel/Worksheet/MemoryDrawing.php
new file mode 100644
index 0000000..438ed2c
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/MemoryDrawing.php
@@ -0,0 +1,201 @@
+imageResource = null;
+ $this->renderingFunction = self::RENDERING_DEFAULT;
+ $this->mimeType = self::MIMETYPE_DEFAULT;
+ $this->uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
+
+ // Initialize parent
+ parent::__construct();
+ }
+
+ /**
+ * Get image resource
+ *
+ * @return resource
+ */
+ public function getImageResource()
+ {
+ return $this->imageResource;
+ }
+
+ /**
+ * Set image resource
+ *
+ * @param $value resource
+ * @return PHPExcel_Worksheet_MemoryDrawing
+ */
+ public function setImageResource($value = null)
+ {
+ $this->imageResource = $value;
+
+ if (!is_null($this->imageResource)) {
+ // Get width/height
+ $this->width = imagesx($this->imageResource);
+ $this->height = imagesy($this->imageResource);
+ }
+ return $this;
+ }
+
+ /**
+ * Get rendering function
+ *
+ * @return string
+ */
+ public function getRenderingFunction()
+ {
+ return $this->renderingFunction;
+ }
+
+ /**
+ * Set rendering function
+ *
+ * @param string $value
+ * @return PHPExcel_Worksheet_MemoryDrawing
+ */
+ public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT)
+ {
+ $this->renderingFunction = $value;
+ return $this;
+ }
+
+ /**
+ * Get mime type
+ *
+ * @return string
+ */
+ public function getMimeType()
+ {
+ return $this->mimeType;
+ }
+
+ /**
+ * Set mime type
+ *
+ * @param string $value
+ * @return PHPExcel_Worksheet_MemoryDrawing
+ */
+ public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT)
+ {
+ $this->mimeType = $value;
+ return $this;
+ }
+
+ /**
+ * Get indexed filename (using image index)
+ *
+ * @return string
+ */
+ public function getIndexedFilename()
+ {
+ $extension = strtolower($this->getMimeType());
+ $extension = explode('/', $extension);
+ $extension = $extension[1];
+
+ return $this->uniqueName . $this->getImageIndex() . '.' . $extension;
+ }
+
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode()
+ {
+ return md5(
+ $this->renderingFunction .
+ $this->mimeType .
+ $this->uniqueName .
+ parent::getHashCode() .
+ __CLASS__
+ );
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/PageMargins.php b/Classes/PHPExcel/Worksheet/PageMargins.php
new file mode 100644
index 0000000..70f5ee0
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/PageMargins.php
@@ -0,0 +1,233 @@
+left;
+ }
+
+ /**
+ * Set Left
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setLeft($pValue)
+ {
+ $this->left = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Right
+ *
+ * @return double
+ */
+ public function getRight()
+ {
+ return $this->right;
+ }
+
+ /**
+ * Set Right
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setRight($pValue)
+ {
+ $this->right = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Top
+ *
+ * @return double
+ */
+ public function getTop()
+ {
+ return $this->top;
+ }
+
+ /**
+ * Set Top
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setTop($pValue)
+ {
+ $this->top = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Bottom
+ *
+ * @return double
+ */
+ public function getBottom()
+ {
+ return $this->bottom;
+ }
+
+ /**
+ * Set Bottom
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setBottom($pValue)
+ {
+ $this->bottom = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Header
+ *
+ * @return double
+ */
+ public function getHeader()
+ {
+ return $this->header;
+ }
+
+ /**
+ * Set Header
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setHeader($pValue)
+ {
+ $this->header = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Footer
+ *
+ * @return double
+ */
+ public function getFooter()
+ {
+ return $this->footer;
+ }
+
+ /**
+ * Set Footer
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_PageMargins
+ */
+ public function setFooter($pValue)
+ {
+ $this->footer = $pValue;
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/PageSetup.php b/Classes/PHPExcel/Worksheet/PageSetup.php
new file mode 100644
index 0000000..c67053e
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/PageSetup.php
@@ -0,0 +1,839 @@
+
+ * Paper size taken from Office Open XML Part 4 - Markup Language Reference, page 1988:
+ *
+ * 1 = Letter paper (8.5 in. by 11 in.)
+ * 2 = Letter small paper (8.5 in. by 11 in.)
+ * 3 = Tabloid paper (11 in. by 17 in.)
+ * 4 = Ledger paper (17 in. by 11 in.)
+ * 5 = Legal paper (8.5 in. by 14 in.)
+ * 6 = Statement paper (5.5 in. by 8.5 in.)
+ * 7 = Executive paper (7.25 in. by 10.5 in.)
+ * 8 = A3 paper (297 mm by 420 mm)
+ * 9 = A4 paper (210 mm by 297 mm)
+ * 10 = A4 small paper (210 mm by 297 mm)
+ * 11 = A5 paper (148 mm by 210 mm)
+ * 12 = B4 paper (250 mm by 353 mm)
+ * 13 = B5 paper (176 mm by 250 mm)
+ * 14 = Folio paper (8.5 in. by 13 in.)
+ * 15 = Quarto paper (215 mm by 275 mm)
+ * 16 = Standard paper (10 in. by 14 in.)
+ * 17 = Standard paper (11 in. by 17 in.)
+ * 18 = Note paper (8.5 in. by 11 in.)
+ * 19 = #9 envelope (3.875 in. by 8.875 in.)
+ * 20 = #10 envelope (4.125 in. by 9.5 in.)
+ * 21 = #11 envelope (4.5 in. by 10.375 in.)
+ * 22 = #12 envelope (4.75 in. by 11 in.)
+ * 23 = #14 envelope (5 in. by 11.5 in.)
+ * 24 = C paper (17 in. by 22 in.)
+ * 25 = D paper (22 in. by 34 in.)
+ * 26 = E paper (34 in. by 44 in.)
+ * 27 = DL envelope (110 mm by 220 mm)
+ * 28 = C5 envelope (162 mm by 229 mm)
+ * 29 = C3 envelope (324 mm by 458 mm)
+ * 30 = C4 envelope (229 mm by 324 mm)
+ * 31 = C6 envelope (114 mm by 162 mm)
+ * 32 = C65 envelope (114 mm by 229 mm)
+ * 33 = B4 envelope (250 mm by 353 mm)
+ * 34 = B5 envelope (176 mm by 250 mm)
+ * 35 = B6 envelope (176 mm by 125 mm)
+ * 36 = Italy envelope (110 mm by 230 mm)
+ * 37 = Monarch envelope (3.875 in. by 7.5 in.).
+ * 38 = 6 3/4 envelope (3.625 in. by 6.5 in.)
+ * 39 = US standard fanfold (14.875 in. by 11 in.)
+ * 40 = German standard fanfold (8.5 in. by 12 in.)
+ * 41 = German legal fanfold (8.5 in. by 13 in.)
+ * 42 = ISO B4 (250 mm by 353 mm)
+ * 43 = Japanese double postcard (200 mm by 148 mm)
+ * 44 = Standard paper (9 in. by 11 in.)
+ * 45 = Standard paper (10 in. by 11 in.)
+ * 46 = Standard paper (15 in. by 11 in.)
+ * 47 = Invite envelope (220 mm by 220 mm)
+ * 50 = Letter extra paper (9.275 in. by 12 in.)
+ * 51 = Legal extra paper (9.275 in. by 15 in.)
+ * 52 = Tabloid extra paper (11.69 in. by 18 in.)
+ * 53 = A4 extra paper (236 mm by 322 mm)
+ * 54 = Letter transverse paper (8.275 in. by 11 in.)
+ * 55 = A4 transverse paper (210 mm by 297 mm)
+ * 56 = Letter extra transverse paper (9.275 in. by 12 in.)
+ * 57 = SuperA/SuperA/A4 paper (227 mm by 356 mm)
+ * 58 = SuperB/SuperB/A3 paper (305 mm by 487 mm)
+ * 59 = Letter plus paper (8.5 in. by 12.69 in.)
+ * 60 = A4 plus paper (210 mm by 330 mm)
+ * 61 = A5 transverse paper (148 mm by 210 mm)
+ * 62 = JIS B5 transverse paper (182 mm by 257 mm)
+ * 63 = A3 extra paper (322 mm by 445 mm)
+ * 64 = A5 extra paper (174 mm by 235 mm)
+ * 65 = ISO B5 extra paper (201 mm by 276 mm)
+ * 66 = A2 paper (420 mm by 594 mm)
+ * 67 = A3 transverse paper (297 mm by 420 mm)
+ * 68 = A3 extra transverse paper (322 mm by 445 mm)
+ *
+ *
+ * @category PHPExcel
+ * @package PHPExcel_Worksheet
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ */
+class PHPExcel_Worksheet_PageSetup
+{
+ /* Paper size */
+ const PAPERSIZE_LETTER = 1;
+ const PAPERSIZE_LETTER_SMALL = 2;
+ const PAPERSIZE_TABLOID = 3;
+ const PAPERSIZE_LEDGER = 4;
+ const PAPERSIZE_LEGAL = 5;
+ const PAPERSIZE_STATEMENT = 6;
+ const PAPERSIZE_EXECUTIVE = 7;
+ const PAPERSIZE_A3 = 8;
+ const PAPERSIZE_A4 = 9;
+ const PAPERSIZE_A4_SMALL = 10;
+ const PAPERSIZE_A5 = 11;
+ const PAPERSIZE_B4 = 12;
+ const PAPERSIZE_B5 = 13;
+ const PAPERSIZE_FOLIO = 14;
+ const PAPERSIZE_QUARTO = 15;
+ const PAPERSIZE_STANDARD_1 = 16;
+ const PAPERSIZE_STANDARD_2 = 17;
+ const PAPERSIZE_NOTE = 18;
+ const PAPERSIZE_NO9_ENVELOPE = 19;
+ const PAPERSIZE_NO10_ENVELOPE = 20;
+ const PAPERSIZE_NO11_ENVELOPE = 21;
+ const PAPERSIZE_NO12_ENVELOPE = 22;
+ const PAPERSIZE_NO14_ENVELOPE = 23;
+ const PAPERSIZE_C = 24;
+ const PAPERSIZE_D = 25;
+ const PAPERSIZE_E = 26;
+ const PAPERSIZE_DL_ENVELOPE = 27;
+ const PAPERSIZE_C5_ENVELOPE = 28;
+ const PAPERSIZE_C3_ENVELOPE = 29;
+ const PAPERSIZE_C4_ENVELOPE = 30;
+ const PAPERSIZE_C6_ENVELOPE = 31;
+ const PAPERSIZE_C65_ENVELOPE = 32;
+ const PAPERSIZE_B4_ENVELOPE = 33;
+ const PAPERSIZE_B5_ENVELOPE = 34;
+ const PAPERSIZE_B6_ENVELOPE = 35;
+ const PAPERSIZE_ITALY_ENVELOPE = 36;
+ const PAPERSIZE_MONARCH_ENVELOPE = 37;
+ const PAPERSIZE_6_3_4_ENVELOPE = 38;
+ const PAPERSIZE_US_STANDARD_FANFOLD = 39;
+ const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
+ const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
+ const PAPERSIZE_ISO_B4 = 42;
+ const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
+ const PAPERSIZE_STANDARD_PAPER_1 = 44;
+ const PAPERSIZE_STANDARD_PAPER_2 = 45;
+ const PAPERSIZE_STANDARD_PAPER_3 = 46;
+ const PAPERSIZE_INVITE_ENVELOPE = 47;
+ const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
+ const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
+ const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
+ const PAPERSIZE_A4_EXTRA_PAPER = 51;
+ const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
+ const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
+ const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
+ const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
+ const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
+ const PAPERSIZE_LETTER_PLUS_PAPER = 57;
+ const PAPERSIZE_A4_PLUS_PAPER = 58;
+ const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
+ const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
+ const PAPERSIZE_A3_EXTRA_PAPER = 61;
+ const PAPERSIZE_A5_EXTRA_PAPER = 62;
+ const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
+ const PAPERSIZE_A2_PAPER = 64;
+ const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
+ const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
+
+ /* Page orientation */
+ const ORIENTATION_DEFAULT = 'default';
+ const ORIENTATION_LANDSCAPE = 'landscape';
+ const ORIENTATION_PORTRAIT = 'portrait';
+
+ /* Print Range Set Method */
+ const SETPRINTRANGE_OVERWRITE = 'O';
+ const SETPRINTRANGE_INSERT = 'I';
+
+
+ /**
+ * Paper size
+ *
+ * @var int
+ */
+ private $paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
+
+ /**
+ * Orientation
+ *
+ * @var string
+ */
+ private $orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
+
+ /**
+ * Scale (Print Scale)
+ *
+ * Print scaling. Valid values range from 10 to 400
+ * This setting is overridden when fitToWidth and/or fitToHeight are in use
+ *
+ * @var int?
+ */
+ private $scale = 100;
+
+ /**
+ * Fit To Page
+ * Whether scale or fitToWith / fitToHeight applies
+ *
+ * @var boolean
+ */
+ private $fitToPage = false;
+
+ /**
+ * Fit To Height
+ * Number of vertical pages to fit on
+ *
+ * @var int?
+ */
+ private $fitToHeight = 1;
+
+ /**
+ * Fit To Width
+ * Number of horizontal pages to fit on
+ *
+ * @var int?
+ */
+ private $fitToWidth = 1;
+
+ /**
+ * Columns to repeat at left
+ *
+ * @var array Containing start column and end column, empty array if option unset
+ */
+ private $columnsToRepeatAtLeft = array('', '');
+
+ /**
+ * Rows to repeat at top
+ *
+ * @var array Containing start row number and end row number, empty array if option unset
+ */
+ private $rowsToRepeatAtTop = array(0, 0);
+
+ /**
+ * Center page horizontally
+ *
+ * @var boolean
+ */
+ private $horizontalCentered = false;
+
+ /**
+ * Center page vertically
+ *
+ * @var boolean
+ */
+ private $verticalCentered = false;
+
+ /**
+ * Print area
+ *
+ * @var string
+ */
+ private $printArea = null;
+
+ /**
+ * First page number
+ *
+ * @var int
+ */
+ private $firstPageNumber = null;
+
+ /**
+ * Create a new PHPExcel_Worksheet_PageSetup
+ */
+ public function __construct()
+ {
+ }
+
+ /**
+ * Get Paper Size
+ *
+ * @return int
+ */
+ public function getPaperSize()
+ {
+ return $this->paperSize;
+ }
+
+ /**
+ * Set Paper Size
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
+ {
+ $this->paperSize = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Orientation
+ *
+ * @return string
+ */
+ public function getOrientation()
+ {
+ return $this->orientation;
+ }
+
+ /**
+ * Set Orientation
+ *
+ * @param string $pValue
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
+ {
+ $this->orientation = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Scale
+ *
+ * @return int?
+ */
+ public function getScale()
+ {
+ return $this->scale;
+ }
+
+ /**
+ * Set Scale
+ *
+ * Print scaling. Valid values range from 10 to 400
+ * This setting is overridden when fitToWidth and/or fitToHeight are in use
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function setScale($pValue = 100, $pUpdate = true)
+ {
+ // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
+ // but it is apparently still able to handle any scale >= 0, where 0 results in 100
+ if (($pValue >= 0) || is_null($pValue)) {
+ $this->scale = $pValue;
+ if ($pUpdate) {
+ $this->fitToPage = false;
+ }
+ } else {
+ throw new PHPExcel_Exception("Scale must not be negative");
+ }
+ return $this;
+ }
+
+ /**
+ * Get Fit To Page
+ *
+ * @return boolean
+ */
+ public function getFitToPage()
+ {
+ return $this->fitToPage;
+ }
+
+ /**
+ * Set Fit To Page
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToPage($pValue = true)
+ {
+ $this->fitToPage = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Fit To Height
+ *
+ * @return int?
+ */
+ public function getFitToHeight()
+ {
+ return $this->fitToHeight;
+ }
+
+ /**
+ * Set Fit To Height
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToHeight($pValue = 1, $pUpdate = true)
+ {
+ $this->fitToHeight = $pValue;
+ if ($pUpdate) {
+ $this->fitToPage = true;
+ }
+ return $this;
+ }
+
+ /**
+ * Get Fit To Width
+ *
+ * @return int?
+ */
+ public function getFitToWidth()
+ {
+ return $this->fitToWidth;
+ }
+
+ /**
+ * Set Fit To Width
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToWidth($pValue = 1, $pUpdate = true)
+ {
+ $this->fitToWidth = $pValue;
+ if ($pUpdate) {
+ $this->fitToPage = true;
+ }
+ return $this;
+ }
+
+ /**
+ * Is Columns to repeat at left set?
+ *
+ * @return boolean
+ */
+ public function isColumnsToRepeatAtLeftSet()
+ {
+ if (is_array($this->columnsToRepeatAtLeft)) {
+ if ($this->columnsToRepeatAtLeft[0] != '' && $this->columnsToRepeatAtLeft[1] != '') {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get Columns to repeat at left
+ *
+ * @return array Containing start column and end column, empty array if option unset
+ */
+ public function getColumnsToRepeatAtLeft()
+ {
+ return $this->columnsToRepeatAtLeft;
+ }
+
+ /**
+ * Set Columns to repeat at left
+ *
+ * @param array $pValue Containing start column and end column, empty array if option unset
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setColumnsToRepeatAtLeft($pValue = null)
+ {
+ if (is_array($pValue)) {
+ $this->columnsToRepeatAtLeft = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Set Columns to repeat at left by start and end
+ *
+ * @param string $pStart
+ * @param string $pEnd
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A')
+ {
+ $this->columnsToRepeatAtLeft = array($pStart, $pEnd);
+ return $this;
+ }
+
+ /**
+ * Is Rows to repeat at top set?
+ *
+ * @return boolean
+ */
+ public function isRowsToRepeatAtTopSet()
+ {
+ if (is_array($this->rowsToRepeatAtTop)) {
+ if ($this->rowsToRepeatAtTop[0] != 0 && $this->rowsToRepeatAtTop[1] != 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Get Rows to repeat at top
+ *
+ * @return array Containing start column and end column, empty array if option unset
+ */
+ public function getRowsToRepeatAtTop()
+ {
+ return $this->rowsToRepeatAtTop;
+ }
+
+ /**
+ * Set Rows to repeat at top
+ *
+ * @param array $pValue Containing start column and end column, empty array if option unset
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setRowsToRepeatAtTop($pValue = null)
+ {
+ if (is_array($pValue)) {
+ $this->rowsToRepeatAtTop = $pValue;
+ }
+ return $this;
+ }
+
+ /**
+ * Set Rows to repeat at top by start and end
+ *
+ * @param int $pStart
+ * @param int $pEnd
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1)
+ {
+ $this->rowsToRepeatAtTop = array($pStart, $pEnd);
+ return $this;
+ }
+
+ /**
+ * Get center page horizontally
+ *
+ * @return bool
+ */
+ public function getHorizontalCentered()
+ {
+ return $this->horizontalCentered;
+ }
+
+ /**
+ * Set center page horizontally
+ *
+ * @param bool $value
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setHorizontalCentered($value = false)
+ {
+ $this->horizontalCentered = $value;
+ return $this;
+ }
+
+ /**
+ * Get center page vertically
+ *
+ * @return bool
+ */
+ public function getVerticalCentered()
+ {
+ return $this->verticalCentered;
+ }
+
+ /**
+ * Set center page vertically
+ *
+ * @param bool $value
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setVerticalCentered($value = false)
+ {
+ $this->verticalCentered = $value;
+ return $this;
+ }
+
+ /**
+ * Get print area
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string
+ * Otherwise, the specific range identified by the value of $index will be returned
+ * Print areas are numbered from 1
+ * @throws PHPExcel_Exception
+ * @return string
+ */
+ public function getPrintArea($index = 0)
+ {
+ if ($index == 0) {
+ return $this->printArea;
+ }
+ $printAreas = explode(',', $this->printArea);
+ if (isset($printAreas[$index-1])) {
+ return $printAreas[$index-1];
+ }
+ throw new PHPExcel_Exception("Requested Print Area does not exist");
+ }
+
+ /**
+ * Is print area set?
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or an index value of 0, will identify whether any print range is set
+ * Otherwise, existence of the range identified by the value of $index will be returned
+ * Print areas are numbered from 1
+ * @return boolean
+ */
+ public function isPrintAreaSet($index = 0)
+ {
+ if ($index == 0) {
+ return !is_null($this->printArea);
+ }
+ $printAreas = explode(',', $this->printArea);
+ return isset($printAreas[$index-1]);
+ }
+
+ /**
+ * Clear a print area
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or an index value of 0, will clear all print ranges that are set
+ * Otherwise, the range identified by the value of $index will be removed from the series
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function clearPrintArea($index = 0)
+ {
+ if ($index == 0) {
+ $this->printArea = null;
+ } else {
+ $printAreas = explode(',', $this->printArea);
+ if (isset($printAreas[$index-1])) {
+ unset($printAreas[$index-1]);
+ $this->printArea = implode(',', $printAreas);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'
+ *
+ * @param string $value
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
+ * entry in the print areas list; a negative index value will identify which entry to
+ * overwrite working bacward through the print area to the list, with the last entry as -1.
+ * Specifying an index value of 0, will overwrite all existing print ranges.
+ * When the method is "I"nsert, then a positive index will insert after that indexed entry in
+ * the print areas list, while a negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @param string $method Determines the method used when setting multiple print areas
+ * Default behaviour, or the "O" method, overwrites existing print area
+ * The "I" method, inserts the new print area before any specified index, or at the end of the list
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
+ {
+ if (strpos($value, '!') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
+ } elseif (strpos($value, ':') === false) {
+ throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
+ } elseif (strpos($value, '$') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
+ }
+ $value = strtoupper($value);
+
+ if ($method == self::SETPRINTRANGE_OVERWRITE) {
+ if ($index == 0) {
+ $this->printArea = $value;
+ } else {
+ $printAreas = explode(',', $this->printArea);
+ if ($index < 0) {
+ $index = count($printAreas) - abs($index) + 1;
+ }
+ if (($index <= 0) || ($index > count($printAreas))) {
+ throw new PHPExcel_Exception('Invalid index for setting print range.');
+ }
+ $printAreas[$index-1] = $value;
+ $this->printArea = implode(',', $printAreas);
+ }
+ } elseif ($method == self::SETPRINTRANGE_INSERT) {
+ if ($index == 0) {
+ $this->printArea .= ($this->printArea == '') ? $value : ','.$value;
+ } else {
+ $printAreas = explode(',', $this->printArea);
+ if ($index < 0) {
+ $index = abs($index) - 1;
+ }
+ if ($index > count($printAreas)) {
+ throw new PHPExcel_Exception('Invalid index for setting print range.');
+ }
+ $printAreas = array_merge(array_slice($printAreas, 0, $index), array($value), array_slice($printAreas, $index));
+ $this->printArea = implode(',', $printAreas);
+ }
+ } else {
+ throw new PHPExcel_Exception('Invalid method for setting print range.');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas
+ *
+ * @param string $value
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * A positive index will insert after that indexed entry in the print areas list, while a
+ * negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function addPrintArea($value, $index = -1)
+ {
+ return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
+ }
+
+ /**
+ * Set print area
+ *
+ * @param int $column1 Column 1
+ * @param int $row1 Row 1
+ * @param int $column2 Column 2
+ * @param int $row2 Row 2
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
+ * entry in the print areas list; a negative index value will identify which entry to
+ * overwrite working bacward through the print area to the list, with the last entry as -1.
+ * Specifying an index value of 0, will overwrite all existing print ranges.
+ * When the method is "I"nsert, then a positive index will insert after that indexed entry in
+ * the print areas list, while a negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @param string $method Determines the method used when setting multiple print areas
+ * Default behaviour, or the "O" method, overwrites existing print area
+ * The "I" method, inserts the new print area before any specified index, or at the end of the list
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
+ {
+ return $this->setPrintArea(
+ PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2,
+ $index,
+ $method
+ );
+ }
+
+ /**
+ * Add a new print area to the list of print areas
+ *
+ * @param int $column1 Start Column for the print area
+ * @param int $row1 Start Row for the print area
+ * @param int $column2 End Column for the print area
+ * @param int $row2 End Row for the print area
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * A positive index will insert after that indexed entry in the print areas list, while a
+ * negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1)
+ {
+ return $this->setPrintArea(
+ PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2,
+ $index,
+ self::SETPRINTRANGE_INSERT
+ );
+ }
+
+ /**
+ * Get first page number
+ *
+ * @return int
+ */
+ public function getFirstPageNumber()
+ {
+ return $this->firstPageNumber;
+ }
+
+ /**
+ * Set first page number
+ *
+ * @param int $value
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function setFirstPageNumber($value = null)
+ {
+ $this->firstPageNumber = $value;
+ return $this;
+ }
+
+ /**
+ * Reset first page number
+ *
+ * @return PHPExcel_Worksheet_HeaderFooter
+ */
+ public function resetFirstPageNumber()
+ {
+ return $this->setFirstPageNumber(null);
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Protection.php b/Classes/PHPExcel/Worksheet/Protection.php
new file mode 100644
index 0000000..00633ee
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Protection.php
@@ -0,0 +1,581 @@
+sheet ||
+ $this->objects ||
+ $this->scenarios ||
+ $this->formatCells ||
+ $this->formatColumns ||
+ $this->formatRows ||
+ $this->insertColumns ||
+ $this->insertRows ||
+ $this->insertHyperlinks ||
+ $this->deleteColumns ||
+ $this->deleteRows ||
+ $this->selectLockedCells ||
+ $this->sort ||
+ $this->autoFilter ||
+ $this->pivotTables ||
+ $this->selectUnlockedCells;
+ }
+
+ /**
+ * Get Sheet
+ *
+ * @return boolean
+ */
+ public function getSheet()
+ {
+ return $this->sheet;
+ }
+
+ /**
+ * Set Sheet
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setSheet($pValue = false)
+ {
+ $this->sheet = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Objects
+ *
+ * @return boolean
+ */
+ public function getObjects()
+ {
+ return $this->objects;
+ }
+
+ /**
+ * Set Objects
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setObjects($pValue = false)
+ {
+ $this->objects = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Scenarios
+ *
+ * @return boolean
+ */
+ public function getScenarios()
+ {
+ return $this->scenarios;
+ }
+
+ /**
+ * Set Scenarios
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setScenarios($pValue = false)
+ {
+ $this->scenarios = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get FormatCells
+ *
+ * @return boolean
+ */
+ public function getFormatCells()
+ {
+ return $this->formatCells;
+ }
+
+ /**
+ * Set FormatCells
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setFormatCells($pValue = false)
+ {
+ $this->formatCells = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get FormatColumns
+ *
+ * @return boolean
+ */
+ public function getFormatColumns()
+ {
+ return $this->formatColumns;
+ }
+
+ /**
+ * Set FormatColumns
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setFormatColumns($pValue = false)
+ {
+ $this->formatColumns = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get FormatRows
+ *
+ * @return boolean
+ */
+ public function getFormatRows()
+ {
+ return $this->formatRows;
+ }
+
+ /**
+ * Set FormatRows
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setFormatRows($pValue = false)
+ {
+ $this->formatRows = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get InsertColumns
+ *
+ * @return boolean
+ */
+ public function getInsertColumns()
+ {
+ return $this->insertColumns;
+ }
+
+ /**
+ * Set InsertColumns
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setInsertColumns($pValue = false)
+ {
+ $this->insertColumns = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get InsertRows
+ *
+ * @return boolean
+ */
+ public function getInsertRows()
+ {
+ return $this->insertRows;
+ }
+
+ /**
+ * Set InsertRows
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setInsertRows($pValue = false)
+ {
+ $this->insertRows = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get InsertHyperlinks
+ *
+ * @return boolean
+ */
+ public function getInsertHyperlinks()
+ {
+ return $this->insertHyperlinks;
+ }
+
+ /**
+ * Set InsertHyperlinks
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setInsertHyperlinks($pValue = false)
+ {
+ $this->insertHyperlinks = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get DeleteColumns
+ *
+ * @return boolean
+ */
+ public function getDeleteColumns()
+ {
+ return $this->deleteColumns;
+ }
+
+ /**
+ * Set DeleteColumns
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setDeleteColumns($pValue = false)
+ {
+ $this->deleteColumns = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get DeleteRows
+ *
+ * @return boolean
+ */
+ public function getDeleteRows()
+ {
+ return $this->deleteRows;
+ }
+
+ /**
+ * Set DeleteRows
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setDeleteRows($pValue = false)
+ {
+ $this->deleteRows = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get SelectLockedCells
+ *
+ * @return boolean
+ */
+ public function getSelectLockedCells()
+ {
+ return $this->selectLockedCells;
+ }
+
+ /**
+ * Set SelectLockedCells
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setSelectLockedCells($pValue = false)
+ {
+ $this->selectLockedCells = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Sort
+ *
+ * @return boolean
+ */
+ public function getSort()
+ {
+ return $this->sort;
+ }
+
+ /**
+ * Set Sort
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setSort($pValue = false)
+ {
+ $this->sort = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get AutoFilter
+ *
+ * @return boolean
+ */
+ public function getAutoFilter()
+ {
+ return $this->autoFilter;
+ }
+
+ /**
+ * Set AutoFilter
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setAutoFilter($pValue = false)
+ {
+ $this->autoFilter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get PivotTables
+ *
+ * @return boolean
+ */
+ public function getPivotTables()
+ {
+ return $this->pivotTables;
+ }
+
+ /**
+ * Set PivotTables
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setPivotTables($pValue = false)
+ {
+ $this->pivotTables = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get SelectUnlockedCells
+ *
+ * @return boolean
+ */
+ public function getSelectUnlockedCells()
+ {
+ return $this->selectUnlockedCells;
+ }
+
+ /**
+ * Set SelectUnlockedCells
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setSelectUnlockedCells($pValue = false)
+ {
+ $this->selectUnlockedCells = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Password (hashed)
+ *
+ * @return string
+ */
+ public function getPassword()
+ {
+ return $this->password;
+ }
+
+ /**
+ * Set Password
+ *
+ * @param string $pValue
+ * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
+ * @return PHPExcel_Worksheet_Protection
+ */
+ public function setPassword($pValue = '', $pAlreadyHashed = false)
+ {
+ if (!$pAlreadyHashed) {
+ $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
+ }
+ $this->password = $pValue;
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/Row.php b/Classes/PHPExcel/Worksheet/Row.php
new file mode 100644
index 0000000..4f6034f
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/Row.php
@@ -0,0 +1,86 @@
+parent = $parent;
+ $this->rowIndex = $rowIndex;
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->parent);
+ }
+
+ /**
+ * Get row index
+ *
+ * @return int
+ */
+ public function getRowIndex()
+ {
+ return $this->rowIndex;
+ }
+
+ /**
+ * Get cell iterator
+ *
+ * @param string $startColumn The column address at which to start iterating
+ * @param string $endColumn Optionally, the column address at which to stop iterating
+ * @return PHPExcel_Worksheet_CellIterator
+ */
+ public function getCellIterator($startColumn = 'A', $endColumn = null)
+ {
+ return new PHPExcel_Worksheet_RowCellIterator($this->parent, $this->rowIndex, $startColumn, $endColumn);
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/RowCellIterator.php b/Classes/PHPExcel/Worksheet/RowCellIterator.php
new file mode 100644
index 0000000..90eb9c9
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/RowCellIterator.php
@@ -0,0 +1,225 @@
+subject = $subject;
+ $this->rowIndex = $rowIndex;
+ $this->resetEnd($endColumn);
+ $this->resetStart($startColumn);
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->subject);
+ }
+
+ /**
+ * (Re)Set the start column and the current column pointer
+ *
+ * @param integer $startColumn The column address at which to start iterating
+ * @return PHPExcel_Worksheet_RowCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetStart($startColumn = 'A')
+ {
+ $startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
+ $this->startColumn = $startColumnIndex;
+ $this->adjustForExistingOnlyRange();
+ $this->seek(PHPExcel_Cell::stringFromColumnIndex($this->startColumn));
+
+ return $this;
+ }
+
+ /**
+ * (Re)Set the end column
+ *
+ * @param string $endColumn The column address at which to stop iterating
+ * @return PHPExcel_Worksheet_RowCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetEnd($endColumn = null)
+ {
+ $endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn();
+ $this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1;
+ $this->adjustForExistingOnlyRange();
+
+ return $this;
+ }
+
+ /**
+ * Set the column pointer to the selected column
+ *
+ * @param string $column The column address to set the current pointer at
+ * @return PHPExcel_Worksheet_RowCellIterator
+ * @throws PHPExcel_Exception
+ */
+ public function seek($column = 'A')
+ {
+ $column = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ if (($column < $this->startColumn) || ($column > $this->endColumn)) {
+ throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
+ } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) {
+ throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
+ }
+ $this->position = $column;
+
+ return $this;
+ }
+
+ /**
+ * Rewind the iterator to the starting column
+ */
+ public function rewind()
+ {
+ $this->position = $this->startColumn;
+ }
+
+ /**
+ * Return the current cell in this worksheet row
+ *
+ * @return PHPExcel_Cell
+ */
+ public function current()
+ {
+ return $this->subject->getCellByColumnAndRow($this->position, $this->rowIndex);
+ }
+
+ /**
+ * Return the current iterator key
+ *
+ * @return string
+ */
+ public function key()
+ {
+ return PHPExcel_Cell::stringFromColumnIndex($this->position);
+ }
+
+ /**
+ * Set the iterator to its next value
+ */
+ public function next()
+ {
+ do {
+ ++$this->position;
+ } while (($this->onlyExistingCells) &&
+ (!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) &&
+ ($this->position <= $this->endColumn));
+ }
+
+ /**
+ * Set the iterator to its previous value
+ *
+ * @throws PHPExcel_Exception
+ */
+ public function prev()
+ {
+ if ($this->position <= $this->startColumn) {
+ throw new PHPExcel_Exception(
+ "Column is already at the beginning of range (" .
+ PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " .
+ PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")"
+ );
+ }
+
+ do {
+ --$this->position;
+ } while (($this->onlyExistingCells) &&
+ (!$this->subject->cellExistsByColumnAndRow($this->position, $this->rowIndex)) &&
+ ($this->position >= $this->startColumn));
+ }
+
+ /**
+ * Indicate if more columns exist in the worksheet range of columns that we're iterating
+ *
+ * @return boolean
+ */
+ public function valid()
+ {
+ return $this->position <= $this->endColumn;
+ }
+
+ /**
+ * Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary
+ *
+ * @throws PHPExcel_Exception
+ */
+ protected function adjustForExistingOnlyRange()
+ {
+ if ($this->onlyExistingCells) {
+ while ((!$this->subject->cellExistsByColumnAndRow($this->startColumn, $this->rowIndex)) &&
+ ($this->startColumn <= $this->endColumn)) {
+ ++$this->startColumn;
+ }
+ if ($this->startColumn > $this->endColumn) {
+ throw new PHPExcel_Exception('No cells exist within the specified range');
+ }
+ while ((!$this->subject->cellExistsByColumnAndRow($this->endColumn, $this->rowIndex)) &&
+ ($this->endColumn >= $this->startColumn)) {
+ --$this->endColumn;
+ }
+ if ($this->endColumn < $this->startColumn) {
+ throw new PHPExcel_Exception('No cells exist within the specified range');
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/RowDimension.php b/Classes/PHPExcel/Worksheet/RowDimension.php
new file mode 100644
index 0000000..c147486
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/RowDimension.php
@@ -0,0 +1,132 @@
+rowIndex = $pIndex;
+
+ // set dimension as unformatted by default
+ parent::__construct(null);
+ }
+
+ /**
+ * Get Row Index
+ *
+ * @return int
+ */
+ public function getRowIndex()
+ {
+ return $this->rowIndex;
+ }
+
+ /**
+ * Set Row Index
+ *
+ * @param int $pValue
+ * @return PHPExcel_Worksheet_RowDimension
+ */
+ public function setRowIndex($pValue)
+ {
+ $this->rowIndex = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Row Height
+ *
+ * @return double
+ */
+ public function getRowHeight()
+ {
+ return $this->height;
+ }
+
+ /**
+ * Set Row Height
+ *
+ * @param double $pValue
+ * @return PHPExcel_Worksheet_RowDimension
+ */
+ public function setRowHeight($pValue = -1)
+ {
+ $this->height = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get ZeroHeight
+ *
+ * @return bool
+ */
+ public function getZeroHeight()
+ {
+ return $this->zeroHeight;
+ }
+
+ /**
+ * Set ZeroHeight
+ *
+ * @param bool $pValue
+ * @return PHPExcel_Worksheet_RowDimension
+ */
+ public function setZeroHeight($pValue = false)
+ {
+ $this->zeroHeight = $pValue;
+ return $this;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/RowIterator.php b/Classes/PHPExcel/Worksheet/RowIterator.php
new file mode 100644
index 0000000..9ddb3e0
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/RowIterator.php
@@ -0,0 +1,192 @@
+subject = $subject;
+ $this->resetEnd($endRow);
+ $this->resetStart($startRow);
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->subject);
+ }
+
+ /**
+ * (Re)Set the start row and the current row pointer
+ *
+ * @param integer $startRow The row number at which to start iterating
+ * @return PHPExcel_Worksheet_RowIterator
+ * @throws PHPExcel_Exception
+ */
+ public function resetStart($startRow = 1)
+ {
+ if ($startRow > $this->subject->getHighestRow()) {
+ throw new PHPExcel_Exception("Start row ({$startRow}) is beyond highest row ({$this->subject->getHighestRow()})");
+ }
+
+ $this->startRow = $startRow;
+ if ($this->endRow < $this->startRow) {
+ $this->endRow = $this->startRow;
+ }
+ $this->seek($startRow);
+
+ return $this;
+ }
+
+ /**
+ * (Re)Set the end row
+ *
+ * @param integer $endRow The row number at which to stop iterating
+ * @return PHPExcel_Worksheet_RowIterator
+ */
+ public function resetEnd($endRow = null)
+ {
+ $this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow();
+
+ return $this;
+ }
+
+ /**
+ * Set the row pointer to the selected row
+ *
+ * @param integer $row The row number to set the current pointer at
+ * @return PHPExcel_Worksheet_RowIterator
+ * @throws PHPExcel_Exception
+ */
+ public function seek($row = 1)
+ {
+ if (($row < $this->startRow) || ($row > $this->endRow)) {
+ throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
+ }
+ $this->position = $row;
+
+ return $this;
+ }
+
+ /**
+ * Rewind the iterator to the starting row
+ */
+ public function rewind()
+ {
+ $this->position = $this->startRow;
+ }
+
+ /**
+ * Return the current row in this worksheet
+ *
+ * @return PHPExcel_Worksheet_Row
+ */
+ public function current()
+ {
+ return new PHPExcel_Worksheet_Row($this->subject, $this->position);
+ }
+
+ /**
+ * Return the current iterator key
+ *
+ * @return int
+ */
+ public function key()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Set the iterator to its next value
+ */
+ public function next()
+ {
+ ++$this->position;
+ }
+
+ /**
+ * Set the iterator to its previous value
+ */
+ public function prev()
+ {
+ if ($this->position <= $this->startRow) {
+ throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})");
+ }
+
+ --$this->position;
+ }
+
+ /**
+ * Indicate if more rows exist in the worksheet range of rows that we're iterating
+ *
+ * @return boolean
+ */
+ public function valid()
+ {
+ return $this->position <= $this->endRow;
+ }
+}
diff --git a/Classes/PHPExcel/Worksheet/SheetView.php b/Classes/PHPExcel/Worksheet/SheetView.php
new file mode 100644
index 0000000..5aaef3b
--- /dev/null
+++ b/Classes/PHPExcel/Worksheet/SheetView.php
@@ -0,0 +1,187 @@
+zoomScale;
+ }
+
+ /**
+ * Set ZoomScale
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setZoomScale($pValue = 100)
+ {
+ // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
+ // but it is apparently still able to handle any scale >= 1
+ if (($pValue >= 1) || is_null($pValue)) {
+ $this->zoomScale = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get ZoomScaleNormal
+ *
+ * @return int
+ */
+ public function getZoomScaleNormal()
+ {
+ return $this->zoomScaleNormal;
+ }
+
+ /**
+ * Set ZoomScale
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setZoomScaleNormal($pValue = 100)
+ {
+ if (($pValue >= 1) || is_null($pValue)) {
+ $this->zoomScaleNormal = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
+ }
+ return $this;
+ }
+
+ /**
+ * Get View
+ *
+ * @return string
+ */
+ public function getView()
+ {
+ return $this->sheetviewType;
+ }
+
+ /**
+ * Set View
+ *
+ * Valid values are
+ * 'normal' self::SHEETVIEW_NORMAL
+ * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
+ * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
+ *
+ * @param string $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setView($pValue = null)
+ {
+ // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface
+ if ($pValue === null) {
+ $pValue = self::SHEETVIEW_NORMAL;
+ }
+ if (in_array($pValue, self::$sheetViewTypes)) {
+ $this->sheetviewType = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Invalid sheetview layout type.");
+ }
+
+ return $this;
+ }
+
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone()
+ {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
+}
diff --git a/Classes/PHPExcel/WorksheetIterator.php b/Classes/PHPExcel/WorksheetIterator.php
new file mode 100644
index 0000000..cb1b281
--- /dev/null
+++ b/Classes/PHPExcel/WorksheetIterator.php
@@ -0,0 +1,108 @@
+subject = $subject;
+ }
+
+ /**
+ * Destructor
+ */
+ public function __destruct()
+ {
+ unset($this->subject);
+ }
+
+ /**
+ * Rewind iterator
+ */
+ public function rewind()
+ {
+ $this->position = 0;
+ }
+
+ /**
+ * Current PHPExcel_Worksheet
+ *
+ * @return PHPExcel_Worksheet
+ */
+ public function current()
+ {
+ return $this->subject->getSheet($this->position);
+ }
+
+ /**
+ * Current key
+ *
+ * @return int
+ */
+ public function key()
+ {
+ return $this->position;
+ }
+
+ /**
+ * Next value
+ */
+ public function next()
+ {
+ ++$this->position;
+ }
+
+ /**
+ * More PHPExcel_Worksheet instances available?
+ *
+ * @return boolean
+ */
+ public function valid()
+ {
+ return $this->position < $this->subject->getSheetCount();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Abstract.php b/Classes/PHPExcel/Writer/Abstract.php
new file mode 100644
index 0000000..2a797a9
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Abstract.php
@@ -0,0 +1,157 @@
+includeCharts;
+ }
+
+ /**
+ * Set write charts in workbook
+ * Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.
+ * Set to false (the default) to ignore charts.
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Writer_IWriter
+ */
+ public function setIncludeCharts($pValue = false)
+ {
+ $this->includeCharts = (boolean) $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Pre-Calculate Formulas flag
+ * If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
+ * so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
+ * viewer when opening the file
+ * If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower
+ * when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself
+ *
+ * @return boolean
+ */
+ public function getPreCalculateFormulas()
+ {
+ return $this->preCalculateFormulas;
+ }
+
+ /**
+ * Set Pre-Calculate Formulas
+ * Set to true (the default) to advise the Writer to calculate all formulae on save
+ * Set to false to prevent precalculation of formulae on save.
+ *
+ * @param boolean $pValue Pre-Calculate Formulas?
+ * @return PHPExcel_Writer_IWriter
+ */
+ public function setPreCalculateFormulas($pValue = true)
+ {
+ $this->preCalculateFormulas = (boolean) $pValue;
+ return $this;
+ }
+
+ /**
+ * Get use disk caching where possible?
+ *
+ * @return boolean
+ */
+ public function getUseDiskCaching()
+ {
+ return $this->_useDiskCaching;
+ }
+
+ /**
+ * Set use disk caching where possible?
+ *
+ * @param boolean $pValue
+ * @param string $pDirectory Disk caching directory
+ * @throws PHPExcel_Writer_Exception when directory does not exist
+ * @return PHPExcel_Writer_Excel2007
+ */
+ public function setUseDiskCaching($pValue = false, $pDirectory = null)
+ {
+ $this->_useDiskCaching = $pValue;
+
+ if ($pDirectory !== null) {
+ if (is_dir($pDirectory)) {
+ $this->_diskCachingDirectory = $pDirectory;
+ } else {
+ throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory");
+ }
+ }
+ return $this;
+ }
+
+ /**
+ * Get disk caching directory
+ *
+ * @return string
+ */
+ public function getDiskCachingDirectory()
+ {
+ return $this->_diskCachingDirectory;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/CSV.php b/Classes/PHPExcel/Writer/CSV.php
new file mode 100644
index 0000000..e59c301
--- /dev/null
+++ b/Classes/PHPExcel/Writer/CSV.php
@@ -0,0 +1,352 @@
+phpExcel = $phpExcel;
+ }
+
+ /**
+ * Save PHPExcel to file
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function save($pFilename = null)
+ {
+ // Fetch sheet
+ $sheet = $this->phpExcel->getSheet($this->sheetIndex);
+
+ $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
+ $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
+ PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
+
+ // Open file
+ $fileHandle = fopen($pFilename, 'wb+');
+ if ($fileHandle === false) {
+ throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
+ }
+
+ if ($this->excelCompatibility) {
+ $this->setUseBOM(true); // Enforce UTF-8 BOM Header
+ $this->setIncludeSeparatorLine(true); // Set separator line
+ $this->setEnclosure('"'); // Set enclosure to "
+ $this->setDelimiter(";"); // Set delimiter to a semi-colon
+ $this->setLineEnding("\r\n");
+ }
+ if ($this->useBOM) {
+ // Write the UTF-8 BOM code if required
+ fwrite($fileHandle, "\xEF\xBB\xBF");
+ }
+ if ($this->includeSeparatorLine) {
+ // Write the separator line if required
+ fwrite($fileHandle, 'sep=' . $this->getDelimiter() . $this->lineEnding);
+ }
+
+ // Identify the range that we need to extract from the worksheet
+ $maxCol = $sheet->getHighestDataColumn();
+ $maxRow = $sheet->getHighestDataRow();
+
+ // Write rows to file
+ for ($row = 1; $row <= $maxRow; ++$row) {
+ // Convert the row to an array...
+ $cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row, '', $this->preCalculateFormulas);
+ // ... and write to the file
+ $this->writeLine($fileHandle, $cellsArray[0]);
+ }
+
+ // Close file
+ fclose($fileHandle);
+
+ PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
+ }
+
+ /**
+ * Get delimiter
+ *
+ * @return string
+ */
+ public function getDelimiter()
+ {
+ return $this->delimiter;
+ }
+
+ /**
+ * Set delimiter
+ *
+ * @param string $pValue Delimiter, defaults to ,
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setDelimiter($pValue = ',')
+ {
+ $this->delimiter = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get enclosure
+ *
+ * @return string
+ */
+ public function getEnclosure()
+ {
+ return $this->enclosure;
+ }
+
+ /**
+ * Set enclosure
+ *
+ * @param string $pValue Enclosure, defaults to "
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setEnclosure($pValue = '"')
+ {
+ if ($pValue == '') {
+ $pValue = null;
+ }
+ $this->enclosure = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get line ending
+ *
+ * @return string
+ */
+ public function getLineEnding()
+ {
+ return $this->lineEnding;
+ }
+
+ /**
+ * Set line ending
+ *
+ * @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setLineEnding($pValue = PHP_EOL)
+ {
+ $this->lineEnding = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get whether BOM should be used
+ *
+ * @return boolean
+ */
+ public function getUseBOM()
+ {
+ return $this->useBOM;
+ }
+
+ /**
+ * Set whether BOM should be used
+ *
+ * @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setUseBOM($pValue = false)
+ {
+ $this->useBOM = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get whether a separator line should be included
+ *
+ * @return boolean
+ */
+ public function getIncludeSeparatorLine()
+ {
+ return $this->includeSeparatorLine;
+ }
+
+ /**
+ * Set whether a separator line should be included as the first line of the file
+ *
+ * @param boolean $pValue Use separator line? Defaults to false
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setIncludeSeparatorLine($pValue = false)
+ {
+ $this->includeSeparatorLine = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get whether the file should be saved with full Excel Compatibility
+ *
+ * @return boolean
+ */
+ public function getExcelCompatibility()
+ {
+ return $this->excelCompatibility;
+ }
+
+ /**
+ * Set whether the file should be saved with full Excel Compatibility
+ *
+ * @param boolean $pValue Set the file to be written as a fully Excel compatible csv file
+ * Note that this overrides other settings such as useBOM, enclosure and delimiter
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setExcelCompatibility($pValue = false)
+ {
+ $this->excelCompatibility = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get sheet index
+ *
+ * @return int
+ */
+ public function getSheetIndex()
+ {
+ return $this->sheetIndex;
+ }
+
+ /**
+ * Set sheet index
+ *
+ * @param int $pValue Sheet index
+ * @return PHPExcel_Writer_CSV
+ */
+ public function setSheetIndex($pValue = 0)
+ {
+ $this->sheetIndex = $pValue;
+ return $this;
+ }
+
+ /**
+ * Write line to CSV file
+ *
+ * @param mixed $pFileHandle PHP filehandle
+ * @param array $pValues Array containing values in a row
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeLine($pFileHandle = null, $pValues = null)
+ {
+ if (is_array($pValues)) {
+ // No leading delimiter
+ $writeDelimiter = false;
+
+ // Build the line
+ $line = '';
+
+ foreach ($pValues as $element) {
+ // Escape enclosures
+ $element = str_replace($this->enclosure, $this->enclosure . $this->enclosure, $element);
+
+ // Add delimiter
+ if ($writeDelimiter) {
+ $line .= $this->delimiter;
+ } else {
+ $writeDelimiter = true;
+ }
+
+ // Add enclosed string
+ $line .= $this->enclosure . $element . $this->enclosure;
+ }
+
+ // Add line ending
+ $line .= $this->lineEnding;
+
+ // Write to file
+ fwrite($pFileHandle, $line);
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer.");
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007.php b/Classes/PHPExcel/Writer/Excel2007.php
new file mode 100644
index 0000000..11d354b
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007.php
@@ -0,0 +1,533 @@
+setPHPExcel($pPHPExcel);
+
+ $writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
+ 'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
+ 'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
+ 'rels' => 'PHPExcel_Writer_Excel2007_Rels',
+ 'theme' => 'PHPExcel_Writer_Excel2007_Theme',
+ 'style' => 'PHPExcel_Writer_Excel2007_Style',
+ 'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
+ 'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
+ 'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
+ 'comments' => 'PHPExcel_Writer_Excel2007_Comments',
+ 'chart' => 'PHPExcel_Writer_Excel2007_Chart',
+ 'relsvba' => 'PHPExcel_Writer_Excel2007_RelsVBA',
+ 'relsribbonobjects' => 'PHPExcel_Writer_Excel2007_RelsRibbon'
+ );
+
+ // Initialise writer parts
+ // and Assign their parent IWriters
+ foreach ($writerPartsArray as $writer => $class) {
+ $this->writerParts[$writer] = new $class($this);
+ }
+
+ $hashTablesArray = array( 'stylesConditionalHashTable', 'fillHashTable', 'fontHashTable',
+ 'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
+ 'styleHashTable'
+ );
+
+ // Set HashTable variables
+ foreach ($hashTablesArray as $tableName) {
+ $this->$tableName = new PHPExcel_HashTable();
+ }
+ }
+
+ /**
+ * Get writer part
+ *
+ * @param string $pPartName Writer part name
+ * @return PHPExcel_Writer_Excel2007_WriterPart
+ */
+ public function getWriterPart($pPartName = '')
+ {
+ if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) {
+ return $this->writerParts[strtolower($pPartName)];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Save PHPExcel to file
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function save($pFilename = null)
+ {
+ if ($this->spreadSheet !== null) {
+ // garbage collect
+ $this->spreadSheet->garbageCollect();
+
+ // If $pFilename is php://output or php://stdout, make it a temporary file...
+ $originalFilename = $pFilename;
+ if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
+ $pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp');
+ if ($pFilename == '') {
+ $pFilename = $originalFilename;
+ }
+ }
+
+ $saveDebugLog = PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->getWriteDebugLog();
+ PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog(false);
+ $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
+ PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
+
+ // Create string lookup table
+ $this->stringTable = array();
+ for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
+ $this->stringTable = $this->getWriterPart('StringTable')->createStringTable($this->spreadSheet->getSheet($i), $this->stringTable);
+ }
+
+ // Create styles dictionaries
+ $this->styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->spreadSheet));
+ $this->stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->spreadSheet));
+ $this->fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->spreadSheet));
+ $this->fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->spreadSheet));
+ $this->bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->spreadSheet));
+ $this->numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->spreadSheet));
+
+ // Create drawing dictionary
+ $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->spreadSheet));
+
+ // Create new ZIP file and open it for writing
+ $zipClass = PHPExcel_Settings::getZipClass();
+ $objZip = new $zipClass();
+
+ // Retrieve OVERWRITE and CREATE constants from the instantiated zip class
+ // This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP
+ $ro = new ReflectionObject($objZip);
+ $zipOverWrite = $ro->getConstant('OVERWRITE');
+ $zipCreate = $ro->getConstant('CREATE');
+
+ if (file_exists($pFilename)) {
+ unlink($pFilename);
+ }
+ // Try opening the ZIP file
+ if ($objZip->open($pFilename, $zipOverWrite) !== true) {
+ if ($objZip->open($pFilename, $zipCreate) !== true) {
+ throw new PHPExcel_Writer_Exception("Could not open " . $pFilename . " for writing.");
+ }
+ }
+
+ // Add [Content_Types].xml to ZIP file
+ $objZip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->spreadSheet, $this->includeCharts));
+
+ //if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
+ if ($this->spreadSheet->hasMacros()) {
+ $macrosCode=$this->spreadSheet->getMacrosCode();
+ if (!is_null($macrosCode)) {// we have the code ?
+ $objZip->addFromString('xl/vbaProject.bin', $macrosCode);//allways in 'xl', allways named vbaProject.bin
+ if ($this->spreadSheet->hasMacrosCertificate()) {//signed macros ?
+ // Yes : add the certificate file and the related rels file
+ $objZip->addFromString('xl/vbaProjectSignature.bin', $this->spreadSheet->getMacrosCertificate());
+ $objZip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->spreadSheet));
+ }
+ }
+ }
+ //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
+ if ($this->spreadSheet->hasRibbon()) {
+ $tmpRibbonTarget=$this->spreadSheet->getRibbonXMLData('target');
+ $objZip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data'));
+ if ($this->spreadSheet->hasRibbonBinObjects()) {
+ $tmpRootPath=dirname($tmpRibbonTarget).'/';
+ $ribbonBinObjects=$this->spreadSheet->getRibbonBinObjects('data');//the files to write
+ foreach ($ribbonBinObjects as $aPath => $aContent) {
+ $objZip->addFromString($tmpRootPath.$aPath, $aContent);
+ }
+ //the rels for files
+ $objZip->addFromString($tmpRootPath.'_rels/'.basename($tmpRibbonTarget).'.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet));
+ }
+ }
+
+ // Add relationships to ZIP file
+ $objZip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->spreadSheet));
+ $objZip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->spreadSheet));
+
+ // Add document properties to ZIP file
+ $objZip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->spreadSheet));
+ $objZip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->spreadSheet));
+ $customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->spreadSheet);
+ if ($customPropertiesPart !== null) {
+ $objZip->addFromString('docProps/custom.xml', $customPropertiesPart);
+ }
+
+ // Add theme to ZIP file
+ $objZip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->spreadSheet));
+
+ // Add string table to ZIP file
+ $objZip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->stringTable));
+
+ // Add styles to ZIP file
+ $objZip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->spreadSheet));
+
+ // Add workbook to ZIP file
+ $objZip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->spreadSheet, $this->preCalculateFormulas));
+
+ $chartCount = 0;
+ // Add worksheets
+ for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
+ $objZip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->spreadSheet->getSheet($i), $this->stringTable, $this->includeCharts));
+ if ($this->includeCharts) {
+ $charts = $this->spreadSheet->getSheet($i)->getChartCollection();
+ if (count($charts) > 0) {
+ foreach ($charts as $chart) {
+ $objZip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart, $this->preCalculateFormulas));
+ $chartCount++;
+ }
+ }
+ }
+ }
+
+ $chartRef1 = $chartRef2 = 0;
+ // Add worksheet relationships (drawings, ...)
+ for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
+ // Add relationships
+ $objZip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts));
+
+ $drawings = $this->spreadSheet->getSheet($i)->getDrawingCollection();
+ $drawingCount = count($drawings);
+ if ($this->includeCharts) {
+ $chartCount = $this->spreadSheet->getSheet($i)->getChartCount();
+ }
+
+ // Add drawing and image relationship parts
+ if (($drawingCount > 0) || ($chartCount > 0)) {
+ // Drawing relationships
+ $objZip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts));
+
+ // Drawings
+ $objZip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $chartRef2, $this->includeCharts));
+ }
+
+ // Add comment relationship parts
+ if (count($this->spreadSheet->getSheet($i)->getComments()) > 0) {
+ // VML Comments
+ $objZip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->spreadSheet->getSheet($i)));
+
+ // Comments
+ $objZip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->spreadSheet->getSheet($i)));
+ }
+
+ // Add header/footer relationship parts
+ if (count($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
+ // VML Drawings
+ $objZip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->spreadSheet->getSheet($i)));
+
+ // VML Drawing relationships
+ $objZip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->spreadSheet->getSheet($i)));
+
+ // Media
+ foreach ($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) {
+ $objZip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath()));
+ }
+ }
+ }
+
+ // Add media
+ for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
+ if ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
+ $imageContents = null;
+ $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath();
+ if (strpos($imagePath, 'zip://') !== false) {
+ $imagePath = substr($imagePath, 6);
+ $imagePathSplitted = explode('#', $imagePath);
+
+ $imageZip = new ZipArchive();
+ $imageZip->open($imagePathSplitted[0]);
+ $imageContents = $imageZip->getFromName($imagePathSplitted[1]);
+ $imageZip->close();
+ unset($imageZip);
+ } else {
+ $imageContents = file_get_contents($imagePath);
+ }
+
+ $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
+ } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ ob_start();
+ call_user_func(
+ $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),
+ $this->getDrawingHashTable()->getByIndex($i)->getImageResource()
+ );
+ $imageContents = ob_get_contents();
+ ob_end_clean();
+
+ $objZip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
+ }
+ }
+
+ PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
+ PHPExcel_Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);
+
+ // Close file
+ if ($objZip->close() === false) {
+ throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
+ }
+
+ // If a temporary file was used, copy it to the correct file stream
+ if ($originalFilename != $pFilename) {
+ if (copy($pFilename, $originalFilename) === false) {
+ throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
+ }
+ @unlink($pFilename);
+ }
+ } else {
+ throw new PHPExcel_Writer_Exception("PHPExcel object unassigned.");
+ }
+ }
+
+ /**
+ * Get PHPExcel object
+ *
+ * @return PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function getPHPExcel()
+ {
+ if ($this->spreadSheet !== null) {
+ return $this->spreadSheet;
+ } else {
+ throw new PHPExcel_Writer_Exception("No PHPExcel object assigned.");
+ }
+ }
+
+ /**
+ * Set PHPExcel object
+ *
+ * @param PHPExcel $pPHPExcel PHPExcel object
+ * @throws PHPExcel_Writer_Exception
+ * @return PHPExcel_Writer_Excel2007
+ */
+ public function setPHPExcel(PHPExcel $pPHPExcel = null)
+ {
+ $this->spreadSheet = $pPHPExcel;
+ return $this;
+ }
+
+ /**
+ * Get string table
+ *
+ * @return string[]
+ */
+ public function getStringTable()
+ {
+ return $this->stringTable;
+ }
+
+ /**
+ * Get PHPExcel_Style HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getStyleHashTable()
+ {
+ return $this->styleHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Style_Conditional HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getStylesConditionalHashTable()
+ {
+ return $this->stylesConditionalHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Style_Fill HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getFillHashTable()
+ {
+ return $this->fillHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Style_Font HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getFontHashTable()
+ {
+ return $this->fontHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Style_Borders HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getBordersHashTable()
+ {
+ return $this->bordersHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Style_NumberFormat HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getNumFmtHashTable()
+ {
+ return $this->numFmtHashTable;
+ }
+
+ /**
+ * Get PHPExcel_Worksheet_BaseDrawing HashTable
+ *
+ * @return PHPExcel_HashTable
+ */
+ public function getDrawingHashTable()
+ {
+ return $this->drawingHashTable;
+ }
+
+ /**
+ * Get Office2003 compatibility
+ *
+ * @return boolean
+ */
+ public function getOffice2003Compatibility()
+ {
+ return $this->office2003compatibility;
+ }
+
+ /**
+ * Set Office2003 compatibility
+ *
+ * @param boolean $pValue Office2003 compatibility?
+ * @return PHPExcel_Writer_Excel2007
+ */
+ public function setOffice2003Compatibility($pValue = false)
+ {
+ $this->office2003compatibility = $pValue;
+ return $this;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Chart.php b/Classes/PHPExcel/Writer/Excel2007/Chart.php
new file mode 100644
index 0000000..92fa215
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Chart.php
@@ -0,0 +1,1520 @@
+calculateCellValues = $calculateCellValues;
+
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+ // Ensure that data series values are up-to-date before we save
+ if ($this->calculateCellValues) {
+ $pChart->refresh();
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // c:chartSpace
+ $objWriter->startElement('c:chartSpace');
+ $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
+ $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
+ $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
+
+ $objWriter->startElement('c:date1904');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ $objWriter->startElement('c:lang');
+ $objWriter->writeAttribute('val', "en-GB");
+ $objWriter->endElement();
+ $objWriter->startElement('c:roundedCorners');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $this->writeAlternateContent($objWriter);
+
+ $objWriter->startElement('c:chart');
+
+ $this->writeTitle($pChart->getTitle(), $objWriter);
+
+ $objWriter->startElement('c:autoTitleDeleted');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $this->writePlotArea($pChart->getPlotArea(), $pChart->getXAxisLabel(), $pChart->getYAxisLabel(), $objWriter, $pChart->getWorksheet(), $pChart->getChartAxisX(), $pChart->getChartAxisY(), $pChart->getMajorGridlines(), $pChart->getMinorGridlines());
+
+ $this->writeLegend($pChart->getLegend(), $objWriter);
+
+ $objWriter->startElement('c:plotVisOnly');
+ $objWriter->writeAttribute('val', 1);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:dispBlanksAs');
+ $objWriter->writeAttribute('val', "gap");
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showDLblsOverMax');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $this->writePrintSettings($objWriter);
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write Chart Title
+ *
+ * @param PHPExcel_Chart_Title $title
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
+ {
+ if (is_null($title)) {
+ return;
+ }
+
+ $objWriter->startElement('c:title');
+ $objWriter->startElement('c:tx');
+ $objWriter->startElement('c:rich');
+
+ $objWriter->startElement('a:bodyPr');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:lstStyle');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:p');
+
+ $caption = $title->getCaption();
+ if ((is_array($caption)) && (count($caption) > 0)) {
+ $caption = $caption[0];
+ }
+ $this->getParentWriter()->getWriterPart('stringtable')->writeRichTextForCharts($objWriter, $caption, 'a');
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $this->writeLayout($title->getLayout(), $objWriter);
+
+ $objWriter->startElement('c:overlay');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Chart Legend
+ *
+ * @param PHPExcel_Chart_Legend $legend
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
+ {
+ if (is_null($legend)) {
+ return;
+ }
+
+ $objWriter->startElement('c:legend');
+
+ $objWriter->startElement('c:legendPos');
+ $objWriter->writeAttribute('val', $legend->getPosition());
+ $objWriter->endElement();
+
+ $this->writeLayout($legend->getLayout(), $objWriter);
+
+ $objWriter->startElement('c:overlay');
+ $objWriter->writeAttribute('val', ($legend->getOverlay()) ? '1' : '0');
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:txPr');
+ $objWriter->startElement('a:bodyPr');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:lstStyle');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:p');
+ $objWriter->startElement('a:pPr');
+ $objWriter->writeAttribute('rtl', 0);
+
+ $objWriter->startElement('a:defRPr');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:endParaRPr');
+ $objWriter->writeAttribute('lang', "en-US");
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Chart Plot Area
+ *
+ * @param PHPExcel_Chart_PlotArea $plotArea
+ * @param PHPExcel_Chart_Title $xAxisLabel
+ * @param PHPExcel_Chart_Title $yAxisLabel
+ * @param PHPExcel_Chart_Axis $xAxis
+ * @param PHPExcel_Chart_Axis $yAxis
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
+ {
+ if (is_null($plotArea)) {
+ return;
+ }
+
+ $id1 = $id2 = 0;
+ $this->_seriesIndex = 0;
+ $objWriter->startElement('c:plotArea');
+
+ $layout = $plotArea->getLayout();
+
+ $this->writeLayout($layout, $objWriter);
+
+ $chartTypes = self::getChartType($plotArea);
+ $catIsMultiLevelSeries = $valIsMultiLevelSeries = false;
+ $plotGroupingType = '';
+ foreach ($chartTypes as $chartType) {
+ $objWriter->startElement('c:' . $chartType);
+
+ $groupCount = $plotArea->getPlotGroupCount();
+ for ($i = 0; $i < $groupCount; ++$i) {
+ $plotGroup = $plotArea->getPlotGroupByIndex($i);
+ $groupType = $plotGroup->getPlotType();
+ if ($groupType == $chartType) {
+ $plotStyle = $plotGroup->getPlotStyle();
+ if ($groupType === PHPExcel_Chart_DataSeries::TYPE_RADARCHART) {
+ $objWriter->startElement('c:radarStyle');
+ $objWriter->writeAttribute('val', $plotStyle);
+ $objWriter->endElement();
+ } elseif ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART) {
+ $objWriter->startElement('c:scatterStyle');
+ $objWriter->writeAttribute('val', $plotStyle);
+ $objWriter->endElement();
+ }
+
+ $this->writePlotGroup($plotGroup, $chartType, $objWriter, $catIsMultiLevelSeries, $valIsMultiLevelSeries, $plotGroupingType, $pSheet);
+ }
+ }
+
+ $this->writeDataLabels($objWriter, $layout);
+
+ if ($chartType === PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
+ // Line only, Line3D can't be smoothed
+
+ $objWriter->startElement('c:smooth');
+ $objWriter->writeAttribute('val', (integer) $plotGroup->getSmoothLine());
+ $objWriter->endElement();
+ } elseif (($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) ||($chartType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
+ $objWriter->startElement('c:gapWidth');
+ $objWriter->writeAttribute('val', 150);
+ $objWriter->endElement();
+
+ if ($plotGroupingType == 'percentStacked' || $plotGroupingType == 'stacked') {
+ $objWriter->startElement('c:overlap');
+ $objWriter->writeAttribute('val', 100);
+ $objWriter->endElement();
+ }
+ } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
+ $objWriter->startElement('c:bubbleScale');
+ $objWriter->writeAttribute('val', 25);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showNegBubbles');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ } elseif ($chartType === PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
+ $objWriter->startElement('c:hiLowLines');
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:upDownBars');
+
+ $objWriter->startElement('c:gapWidth');
+ $objWriter->writeAttribute('val', 300);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:upBars');
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:downBars');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ // Generate 2 unique numbers to use for axId values
+ // $id1 = $id2 = rand(10000000,99999999);
+ // do {
+ // $id2 = rand(10000000,99999999);
+ // } while ($id1 == $id2);
+ $id1 = '75091328';
+ $id2 = '75089408';
+
+ if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
+ $objWriter->startElement('c:axId');
+ $objWriter->writeAttribute('val', $id1);
+ $objWriter->endElement();
+ $objWriter->startElement('c:axId');
+ $objWriter->writeAttribute('val', $id2);
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('c:firstSliceAng');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ if ($chartType === PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) {
+ $objWriter->startElement('c:holeSize');
+ $objWriter->writeAttribute('val', 50);
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+ }
+
+ if (($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($chartType !== PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
+ if ($chartType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
+ $this->writeValueAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
+ } else {
+ $this->writeCategoryAxis($objWriter, $plotArea, $xAxisLabel, $chartType, $id1, $id2, $catIsMultiLevelSeries, $xAxis, $yAxis);
+ }
+
+ $this->writeValueAxis($objWriter, $plotArea, $yAxisLabel, $chartType, $id1, $id2, $valIsMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines);
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Data Labels
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Chart_Layout $chartLayout Chart layout
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDataLabels($objWriter, $chartLayout)
+ {
+ $objWriter->startElement('c:dLbls');
+
+ $objWriter->startElement('c:showLegendKey');
+ $showLegendKey = (empty($chartLayout)) ? 0 : $chartLayout->getShowLegendKey();
+ $objWriter->writeAttribute('val', ((empty($showLegendKey)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showVal');
+ $showVal = (empty($chartLayout)) ? 0 : $chartLayout->getShowVal();
+ $objWriter->writeAttribute('val', ((empty($showVal)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showCatName');
+ $showCatName = (empty($chartLayout)) ? 0 : $chartLayout->getShowCatName();
+ $objWriter->writeAttribute('val', ((empty($showCatName)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showSerName');
+ $showSerName = (empty($chartLayout)) ? 0 : $chartLayout->getShowSerName();
+ $objWriter->writeAttribute('val', ((empty($showSerName)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showPercent');
+ $showPercent = (empty($chartLayout)) ? 0 : $chartLayout->getShowPercent();
+ $objWriter->writeAttribute('val', ((empty($showPercent)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showBubbleSize');
+ $showBubbleSize = (empty($chartLayout)) ? 0 : $chartLayout->getShowBubbleSize();
+ $objWriter->writeAttribute('val', ((empty($showBubbleSize)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:showLeaderLines');
+ $showLeaderLines = (empty($chartLayout)) ? 1 : $chartLayout->getShowLeaderLines();
+ $objWriter->writeAttribute('val', ((empty($showLeaderLines)) ? 0 : 1));
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Category Axis
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Chart_PlotArea $plotArea
+ * @param PHPExcel_Chart_Title $xAxisLabel
+ * @param string $groupType Chart type
+ * @param string $id1
+ * @param string $id2
+ * @param boolean $isMultiLevelSeries
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCategoryAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
+ {
+ $objWriter->startElement('c:catAx');
+
+ if ($id1 > 0) {
+ $objWriter->startElement('c:axId');
+ $objWriter->writeAttribute('val', $id1);
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:scaling');
+ $objWriter->startElement('c:orientation');
+ $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('orientation'));
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:delete');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:axPos');
+ $objWriter->writeAttribute('val', "b");
+ $objWriter->endElement();
+
+ if (!is_null($xAxisLabel)) {
+ $objWriter->startElement('c:title');
+ $objWriter->startElement('c:tx');
+ $objWriter->startElement('c:rich');
+
+ $objWriter->startElement('a:bodyPr');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:lstStyle');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:p');
+ $objWriter->startElement('a:r');
+
+ $caption = $xAxisLabel->getCaption();
+ if (is_array($caption)) {
+ $caption = $caption[0];
+ }
+ $objWriter->startElement('a:t');
+ // $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($caption));
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $layout = $xAxisLabel->getLayout();
+ $this->writeLayout($layout, $objWriter);
+
+ $objWriter->startElement('c:overlay');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:numFmt');
+ $objWriter->writeAttribute('formatCode', $yAxis->getAxisNumberFormat());
+ $objWriter->writeAttribute('sourceLinked', $yAxis->getAxisNumberSourceLinked());
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:majorTickMark');
+ $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('major_tick_mark'));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:minorTickMark');
+ $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('minor_tick_mark'));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:tickLblPos');
+ $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('axis_labels'));
+ $objWriter->endElement();
+
+ if ($id2 > 0) {
+ $objWriter->startElement('c:crossAx');
+ $objWriter->writeAttribute('val', $id2);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:crosses');
+ $objWriter->writeAttribute('val', $yAxis->getAxisOptionsProperty('horizontal_crosses'));
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:auto');
+ $objWriter->writeAttribute('val', 1);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:lblAlgn');
+ $objWriter->writeAttribute('val', "ctr");
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:lblOffset');
+ $objWriter->writeAttribute('val', 100);
+ $objWriter->endElement();
+
+ if ($isMultiLevelSeries) {
+ $objWriter->startElement('c:noMultiLvlLbl');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ }
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Value Axis
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Chart_PlotArea $plotArea
+ * @param PHPExcel_Chart_Title $yAxisLabel
+ * @param string $groupType Chart type
+ * @param string $id1
+ * @param string $id2
+ * @param boolean $isMultiLevelSeries
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeValueAxis($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
+ {
+ $objWriter->startElement('c:valAx');
+
+ if ($id2 > 0) {
+ $objWriter->startElement('c:axId');
+ $objWriter->writeAttribute('val', $id2);
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:scaling');
+
+ if (!is_null($xAxis->getAxisOptionsProperty('maximum'))) {
+ $objWriter->startElement('c:max');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('maximum'));
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getAxisOptionsProperty('minimum'))) {
+ $objWriter->startElement('c:min');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minimum'));
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:orientation');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('orientation'));
+
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:delete');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:axPos');
+ $objWriter->writeAttribute('val', "l");
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:majorGridlines');
+ $objWriter->startElement('c:spPr');
+
+ if (!is_null($majorGridlines->getLineColorProperty('value'))) {
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', $majorGridlines->getLineStyleProperty('width'));
+ $objWriter->startElement('a:solidFill');
+ $objWriter->startElement("a:{$majorGridlines->getLineColorProperty('type')}");
+ $objWriter->writeAttribute('val', $majorGridlines->getLineColorProperty('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $majorGridlines->getLineColorProperty('alpha'));
+ $objWriter->endElement(); //end alpha
+ $objWriter->endElement(); //end srgbClr
+ $objWriter->endElement(); //end solidFill
+
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', $majorGridlines->getLineStyleProperty('dash'));
+ $objWriter->endElement();
+
+ if ($majorGridlines->getLineStyleProperty('join') == 'miter') {
+ $objWriter->startElement('a:miter');
+ $objWriter->writeAttribute('lim', '800000');
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('a:bevel');
+ $objWriter->endElement();
+ }
+
+ if (!is_null($majorGridlines->getLineStyleProperty(array('arrow', 'head', 'type')))) {
+ $objWriter->startElement('a:headEnd');
+ $objWriter->writeAttribute('type', $majorGridlines->getLineStyleProperty(array('arrow', 'head', 'type')));
+ $objWriter->writeAttribute('w', $majorGridlines->getLineStyleArrowParameters('head', 'w'));
+ $objWriter->writeAttribute('len', $majorGridlines->getLineStyleArrowParameters('head', 'len'));
+ $objWriter->endElement();
+ }
+
+ if (!is_null($majorGridlines->getLineStyleProperty(array('arrow', 'end', 'type')))) {
+ $objWriter->startElement('a:tailEnd');
+ $objWriter->writeAttribute('type', $majorGridlines->getLineStyleProperty(array('arrow', 'end', 'type')));
+ $objWriter->writeAttribute('w', $majorGridlines->getLineStyleArrowParameters('end', 'w'));
+ $objWriter->writeAttribute('len', $majorGridlines->getLineStyleArrowParameters('end', 'len'));
+ $objWriter->endElement();
+ }
+ $objWriter->endElement(); //end ln
+ }
+ $objWriter->startElement('a:effectLst');
+
+ if (!is_null($majorGridlines->getGlowSize())) {
+ $objWriter->startElement('a:glow');
+ $objWriter->writeAttribute('rad', $majorGridlines->getGlowSize());
+ $objWriter->startElement("a:{$majorGridlines->getGlowColor('type')}");
+ $objWriter->writeAttribute('val', $majorGridlines->getGlowColor('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $majorGridlines->getGlowColor('alpha'));
+ $objWriter->endElement(); //end alpha
+ $objWriter->endElement(); //end schemeClr
+ $objWriter->endElement(); //end glow
+ }
+
+ if (!is_null($majorGridlines->getShadowProperty('presets'))) {
+ $objWriter->startElement("a:{$majorGridlines->getShadowProperty('effect')}");
+ if (!is_null($majorGridlines->getShadowProperty('blur'))) {
+ $objWriter->writeAttribute('blurRad', $majorGridlines->getShadowProperty('blur'));
+ }
+ if (!is_null($majorGridlines->getShadowProperty('distance'))) {
+ $objWriter->writeAttribute('dist', $majorGridlines->getShadowProperty('distance'));
+ }
+ if (!is_null($majorGridlines->getShadowProperty('direction'))) {
+ $objWriter->writeAttribute('dir', $majorGridlines->getShadowProperty('direction'));
+ }
+ if (!is_null($majorGridlines->getShadowProperty('algn'))) {
+ $objWriter->writeAttribute('algn', $majorGridlines->getShadowProperty('algn'));
+ }
+ if (!is_null($majorGridlines->getShadowProperty(array('size', 'sx')))) {
+ $objWriter->writeAttribute('sx', $majorGridlines->getShadowProperty(array('size', 'sx')));
+ }
+ if (!is_null($majorGridlines->getShadowProperty(array('size', 'sy')))) {
+ $objWriter->writeAttribute('sy', $majorGridlines->getShadowProperty(array('size', 'sy')));
+ }
+ if (!is_null($majorGridlines->getShadowProperty(array('size', 'kx')))) {
+ $objWriter->writeAttribute('kx', $majorGridlines->getShadowProperty(array('size', 'kx')));
+ }
+ if (!is_null($majorGridlines->getShadowProperty('rotWithShape'))) {
+ $objWriter->writeAttribute('rotWithShape', $majorGridlines->getShadowProperty('rotWithShape'));
+ }
+ $objWriter->startElement("a:{$majorGridlines->getShadowProperty(array('color', 'type'))}");
+ $objWriter->writeAttribute('val', $majorGridlines->getShadowProperty(array('color', 'value')));
+
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $majorGridlines->getShadowProperty(array('color', 'alpha')));
+ $objWriter->endElement(); //end alpha
+
+ $objWriter->endElement(); //end color:type
+ $objWriter->endElement(); //end shadow
+ }
+
+ if (!is_null($majorGridlines->getSoftEdgesSize())) {
+ $objWriter->startElement('a:softEdge');
+ $objWriter->writeAttribute('rad', $majorGridlines->getSoftEdgesSize());
+ $objWriter->endElement(); //end softEdge
+ }
+
+ $objWriter->endElement(); //end effectLst
+ $objWriter->endElement(); //end spPr
+ $objWriter->endElement(); //end majorGridLines
+
+ if ($minorGridlines->getObjectState()) {
+ $objWriter->startElement('c:minorGridlines');
+ $objWriter->startElement('c:spPr');
+
+ if (!is_null($minorGridlines->getLineColorProperty('value'))) {
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', $minorGridlines->getLineStyleProperty('width'));
+ $objWriter->startElement('a:solidFill');
+ $objWriter->startElement("a:{$minorGridlines->getLineColorProperty('type')}");
+ $objWriter->writeAttribute('val', $minorGridlines->getLineColorProperty('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $minorGridlines->getLineColorProperty('alpha'));
+ $objWriter->endElement(); //end alpha
+ $objWriter->endElement(); //end srgbClr
+ $objWriter->endElement(); //end solidFill
+
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', $minorGridlines->getLineStyleProperty('dash'));
+ $objWriter->endElement();
+
+ if ($minorGridlines->getLineStyleProperty('join') == 'miter') {
+ $objWriter->startElement('a:miter');
+ $objWriter->writeAttribute('lim', '800000');
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('a:bevel');
+ $objWriter->endElement();
+ }
+
+ if (!is_null($minorGridlines->getLineStyleProperty(array('arrow', 'head', 'type')))) {
+ $objWriter->startElement('a:headEnd');
+ $objWriter->writeAttribute('type', $minorGridlines->getLineStyleProperty(array('arrow', 'head', 'type')));
+ $objWriter->writeAttribute('w', $minorGridlines->getLineStyleArrowParameters('head', 'w'));
+ $objWriter->writeAttribute('len', $minorGridlines->getLineStyleArrowParameters('head', 'len'));
+ $objWriter->endElement();
+ }
+
+ if (!is_null($minorGridlines->getLineStyleProperty(array('arrow', 'end', 'type')))) {
+ $objWriter->startElement('a:tailEnd');
+ $objWriter->writeAttribute('type', $minorGridlines->getLineStyleProperty(array('arrow', 'end', 'type')));
+ $objWriter->writeAttribute('w', $minorGridlines->getLineStyleArrowParameters('end', 'w'));
+ $objWriter->writeAttribute('len', $minorGridlines->getLineStyleArrowParameters('end', 'len'));
+ $objWriter->endElement();
+ }
+ $objWriter->endElement(); //end ln
+ }
+
+ $objWriter->startElement('a:effectLst');
+
+ if (!is_null($minorGridlines->getGlowSize())) {
+ $objWriter->startElement('a:glow');
+ $objWriter->writeAttribute('rad', $minorGridlines->getGlowSize());
+ $objWriter->startElement("a:{$minorGridlines->getGlowColor('type')}");
+ $objWriter->writeAttribute('val', $minorGridlines->getGlowColor('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $minorGridlines->getGlowColor('alpha'));
+ $objWriter->endElement(); //end alpha
+ $objWriter->endElement(); //end schemeClr
+ $objWriter->endElement(); //end glow
+ }
+
+ if (!is_null($minorGridlines->getShadowProperty('presets'))) {
+ $objWriter->startElement("a:{$minorGridlines->getShadowProperty('effect')}");
+ if (!is_null($minorGridlines->getShadowProperty('blur'))) {
+ $objWriter->writeAttribute('blurRad', $minorGridlines->getShadowProperty('blur'));
+ }
+ if (!is_null($minorGridlines->getShadowProperty('distance'))) {
+ $objWriter->writeAttribute('dist', $minorGridlines->getShadowProperty('distance'));
+ }
+ if (!is_null($minorGridlines->getShadowProperty('direction'))) {
+ $objWriter->writeAttribute('dir', $minorGridlines->getShadowProperty('direction'));
+ }
+ if (!is_null($minorGridlines->getShadowProperty('algn'))) {
+ $objWriter->writeAttribute('algn', $minorGridlines->getShadowProperty('algn'));
+ }
+ if (!is_null($minorGridlines->getShadowProperty(array('size', 'sx')))) {
+ $objWriter->writeAttribute('sx', $minorGridlines->getShadowProperty(array('size', 'sx')));
+ }
+ if (!is_null($minorGridlines->getShadowProperty(array('size', 'sy')))) {
+ $objWriter->writeAttribute('sy', $minorGridlines->getShadowProperty(array('size', 'sy')));
+ }
+ if (!is_null($minorGridlines->getShadowProperty(array('size', 'kx')))) {
+ $objWriter->writeAttribute('kx', $minorGridlines->getShadowProperty(array('size', 'kx')));
+ }
+ if (!is_null($minorGridlines->getShadowProperty('rotWithShape'))) {
+ $objWriter->writeAttribute('rotWithShape', $minorGridlines->getShadowProperty('rotWithShape'));
+ }
+ $objWriter->startElement("a:{$minorGridlines->getShadowProperty(array('color', 'type'))}");
+ $objWriter->writeAttribute('val', $minorGridlines->getShadowProperty(array('color', 'value')));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $minorGridlines->getShadowProperty(array('color', 'alpha')));
+ $objWriter->endElement(); //end alpha
+ $objWriter->endElement(); //end color:type
+ $objWriter->endElement(); //end shadow
+ }
+
+ if (!is_null($minorGridlines->getSoftEdgesSize())) {
+ $objWriter->startElement('a:softEdge');
+ $objWriter->writeAttribute('rad', $minorGridlines->getSoftEdgesSize());
+ $objWriter->endElement(); //end softEdge
+ }
+
+ $objWriter->endElement(); //end effectLst
+ $objWriter->endElement(); //end spPr
+ $objWriter->endElement(); //end minorGridLines
+ }
+
+ if (!is_null($yAxisLabel)) {
+ $objWriter->startElement('c:title');
+ $objWriter->startElement('c:tx');
+ $objWriter->startElement('c:rich');
+
+ $objWriter->startElement('a:bodyPr');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:lstStyle');
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:p');
+ $objWriter->startElement('a:r');
+
+ $caption = $yAxisLabel->getCaption();
+ if (is_array($caption)) {
+ $caption = $caption[0];
+ }
+
+ $objWriter->startElement('a:t');
+ // $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($caption));
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
+ $layout = $yAxisLabel->getLayout();
+ $this->writeLayout($layout, $objWriter);
+ }
+
+ $objWriter->startElement('c:overlay');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:numFmt');
+ $objWriter->writeAttribute('formatCode', $xAxis->getAxisNumberFormat());
+ $objWriter->writeAttribute('sourceLinked', $xAxis->getAxisNumberSourceLinked());
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:majorTickMark');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('major_tick_mark'));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:minorTickMark');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_tick_mark'));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:tickLblPos');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('axis_labels'));
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:spPr');
+
+ if (!is_null($xAxis->getFillProperty('value'))) {
+ $objWriter->startElement('a:solidFill');
+ $objWriter->startElement("a:" . $xAxis->getFillProperty('type'));
+ $objWriter->writeAttribute('val', $xAxis->getFillProperty('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $xAxis->getFillProperty('alpha'));
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('a:ln');
+
+ $objWriter->writeAttribute('w', $xAxis->getLineStyleProperty('width'));
+ $objWriter->writeAttribute('cap', $xAxis->getLineStyleProperty('cap'));
+ $objWriter->writeAttribute('cmpd', $xAxis->getLineStyleProperty('compound'));
+
+ if (!is_null($xAxis->getLineProperty('value'))) {
+ $objWriter->startElement('a:solidFill');
+ $objWriter->startElement("a:" . $xAxis->getLineProperty('type'));
+ $objWriter->writeAttribute('val', $xAxis->getLineProperty('value'));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $xAxis->getLineProperty('alpha'));
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', $xAxis->getLineStyleProperty('dash'));
+ $objWriter->endElement();
+
+ if ($xAxis->getLineStyleProperty('join') == 'miter') {
+ $objWriter->startElement('a:miter');
+ $objWriter->writeAttribute('lim', '800000');
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('a:bevel');
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getLineStyleProperty(array('arrow', 'head', 'type')))) {
+ $objWriter->startElement('a:headEnd');
+ $objWriter->writeAttribute('type', $xAxis->getLineStyleProperty(array('arrow', 'head', 'type')));
+ $objWriter->writeAttribute('w', $xAxis->getLineStyleArrowWidth('head'));
+ $objWriter->writeAttribute('len', $xAxis->getLineStyleArrowLength('head'));
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getLineStyleProperty(array('arrow', 'end', 'type')))) {
+ $objWriter->startElement('a:tailEnd');
+ $objWriter->writeAttribute('type', $xAxis->getLineStyleProperty(array('arrow', 'end', 'type')));
+ $objWriter->writeAttribute('w', $xAxis->getLineStyleArrowWidth('end'));
+ $objWriter->writeAttribute('len', $xAxis->getLineStyleArrowLength('end'));
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:effectLst');
+
+ if (!is_null($xAxis->getGlowProperty('size'))) {
+ $objWriter->startElement('a:glow');
+ $objWriter->writeAttribute('rad', $xAxis->getGlowProperty('size'));
+ $objWriter->startElement("a:{$xAxis->getGlowProperty(array('color','type'))}");
+ $objWriter->writeAttribute('val', $xAxis->getGlowProperty(array('color','value')));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $xAxis->getGlowProperty(array('color','alpha')));
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getShadowProperty('presets'))) {
+ $objWriter->startElement("a:{$xAxis->getShadowProperty('effect')}");
+
+ if (!is_null($xAxis->getShadowProperty('blur'))) {
+ $objWriter->writeAttribute('blurRad', $xAxis->getShadowProperty('blur'));
+ }
+ if (!is_null($xAxis->getShadowProperty('distance'))) {
+ $objWriter->writeAttribute('dist', $xAxis->getShadowProperty('distance'));
+ }
+ if (!is_null($xAxis->getShadowProperty('direction'))) {
+ $objWriter->writeAttribute('dir', $xAxis->getShadowProperty('direction'));
+ }
+ if (!is_null($xAxis->getShadowProperty('algn'))) {
+ $objWriter->writeAttribute('algn', $xAxis->getShadowProperty('algn'));
+ }
+ if (!is_null($xAxis->getShadowProperty(array('size','sx')))) {
+ $objWriter->writeAttribute('sx', $xAxis->getShadowProperty(array('size','sx')));
+ }
+ if (!is_null($xAxis->getShadowProperty(array('size','sy')))) {
+ $objWriter->writeAttribute('sy', $xAxis->getShadowProperty(array('size','sy')));
+ }
+ if (!is_null($xAxis->getShadowProperty(array('size','kx')))) {
+ $objWriter->writeAttribute('kx', $xAxis->getShadowProperty(array('size','kx')));
+ }
+ if (!is_null($xAxis->getShadowProperty('rotWithShape'))) {
+ $objWriter->writeAttribute('rotWithShape', $xAxis->getShadowProperty('rotWithShape'));
+ }
+
+ $objWriter->startElement("a:{$xAxis->getShadowProperty(array('color','type'))}");
+ $objWriter->writeAttribute('val', $xAxis->getShadowProperty(array('color','value')));
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $xAxis->getShadowProperty(array('color','alpha')));
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getSoftEdgesSize())) {
+ $objWriter->startElement('a:softEdge');
+ $objWriter->writeAttribute('rad', $xAxis->getSoftEdgesSize());
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement(); //effectList
+ $objWriter->endElement(); //end spPr
+
+ if ($id1 > 0) {
+ $objWriter->startElement('c:crossAx');
+ $objWriter->writeAttribute('val', $id2);
+ $objWriter->endElement();
+
+ if (!is_null($xAxis->getAxisOptionsProperty('horizontal_crosses_value'))) {
+ $objWriter->startElement('c:crossesAt');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('horizontal_crosses_value'));
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('c:crosses');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('horizontal_crosses'));
+ $objWriter->endElement();
+ }
+
+ $objWriter->startElement('c:crossBetween');
+ $objWriter->writeAttribute('val', "midCat");
+ $objWriter->endElement();
+
+ if (!is_null($xAxis->getAxisOptionsProperty('major_unit'))) {
+ $objWriter->startElement('c:majorUnit');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('major_unit'));
+ $objWriter->endElement();
+ }
+
+ if (!is_null($xAxis->getAxisOptionsProperty('minor_unit'))) {
+ $objWriter->startElement('c:minorUnit');
+ $objWriter->writeAttribute('val', $xAxis->getAxisOptionsProperty('minor_unit'));
+ $objWriter->endElement();
+ }
+ }
+
+ if ($isMultiLevelSeries) {
+ if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
+ $objWriter->startElement('c:noMultiLvlLbl');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Get the data series type(s) for a chart plot series
+ *
+ * @param PHPExcel_Chart_PlotArea $plotArea
+ *
+ * @return string|array
+ * @throws PHPExcel_Writer_Exception
+ */
+ private static function getChartType($plotArea)
+ {
+ $groupCount = $plotArea->getPlotGroupCount();
+
+ if ($groupCount == 1) {
+ $chartType = array($plotArea->getPlotGroupByIndex(0)->getPlotType());
+ } else {
+ $chartTypes = array();
+ for ($i = 0; $i < $groupCount; ++$i) {
+ $chartTypes[] = $plotArea->getPlotGroupByIndex($i)->getPlotType();
+ }
+ $chartType = array_unique($chartTypes);
+ if (count($chartTypes) == 0) {
+ throw new PHPExcel_Writer_Exception('Chart is not yet implemented');
+ }
+ }
+
+ return $chartType;
+ }
+
+ /**
+ * Write Plot Group (series of related plots)
+ *
+ * @param PHPExcel_Chart_DataSeries $plotGroup
+ * @param string $groupType Type of plot for dataseries
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param boolean &$catIsMultiLevelSeries Is category a multi-series category
+ * @param boolean &$valIsMultiLevelSeries Is value set a multi-series set
+ * @param string &$plotGroupingType Type of grouping for multi-series values
+ * @param PHPExcel_Worksheet $pSheet
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
+ {
+ if (is_null($plotGroup)) {
+ return;
+ }
+
+ if (($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D)) {
+ $objWriter->startElement('c:barDir');
+ $objWriter->writeAttribute('val', $plotGroup->getPlotDirection());
+ $objWriter->endElement();
+ }
+
+ if (!is_null($plotGroup->getPlotGrouping())) {
+ $plotGroupingType = $plotGroup->getPlotGrouping();
+ $objWriter->startElement('c:grouping');
+ $objWriter->writeAttribute('val', $plotGroupingType);
+ $objWriter->endElement();
+ }
+
+ // Get these details before the loop, because we can use the count to check for varyColors
+ $plotSeriesOrder = $plotGroup->getPlotOrder();
+ $plotSeriesCount = count($plotSeriesOrder);
+
+ if (($groupType !== PHPExcel_Chart_DataSeries::TYPE_RADARCHART) && ($groupType !== PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
+ if ($groupType !== PHPExcel_Chart_DataSeries::TYPE_LINECHART) {
+ if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART) || ($plotSeriesCount > 1)) {
+ $objWriter->startElement('c:varyColors');
+ $objWriter->writeAttribute('val', 1);
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('c:varyColors');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ }
+ }
+ }
+
+ foreach ($plotSeriesOrder as $plotSeriesIdx => $plotSeriesRef) {
+ $objWriter->startElement('c:ser');
+
+ $objWriter->startElement('c:idx');
+ $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesIdx);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:order');
+ $objWriter->writeAttribute('val', $this->_seriesIndex + $plotSeriesRef);
+ $objWriter->endElement();
+
+ if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
+ $objWriter->startElement('c:dPt');
+ $objWriter->startElement('c:idx');
+ $objWriter->writeAttribute('val', 3);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:bubble3D');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:spPr');
+ $objWriter->startElement('a:solidFill');
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', 'FF9900');
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ // Labels
+ $plotSeriesLabel = $plotGroup->getPlotLabelByIndex($plotSeriesRef);
+ if ($plotSeriesLabel && ($plotSeriesLabel->getPointCount() > 0)) {
+ $objWriter->startElement('c:tx');
+ $objWriter->startElement('c:strRef');
+ $this->writePlotSeriesLabel($plotSeriesLabel, $objWriter);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ // Formatting for the points
+ if (($groupType == PHPExcel_Chart_DataSeries::TYPE_LINECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART)) {
+ $objWriter->startElement('c:spPr');
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', 12700);
+ if ($groupType == PHPExcel_Chart_DataSeries::TYPE_STOCKCHART) {
+ $objWriter->startElement('a:noFill');
+ $objWriter->endElement();
+ }
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+
+ $plotSeriesValues = $plotGroup->getPlotValuesByIndex($plotSeriesRef);
+ if ($plotSeriesValues) {
+ $plotSeriesMarker = $plotSeriesValues->getPointMarker();
+ if ($plotSeriesMarker) {
+ $objWriter->startElement('c:marker');
+ $objWriter->startElement('c:symbol');
+ $objWriter->writeAttribute('val', $plotSeriesMarker);
+ $objWriter->endElement();
+
+ if ($plotSeriesMarker !== 'none') {
+ $objWriter->startElement('c:size');
+ $objWriter->writeAttribute('val', 3);
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BARCHART_3D) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART)) {
+ $objWriter->startElement('c:invertIfNegative');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ }
+
+ // Category Labels
+ $plotSeriesCategory = $plotGroup->getPlotCategoryByIndex($plotSeriesRef);
+ if ($plotSeriesCategory && ($plotSeriesCategory->getPointCount() > 0)) {
+ $catIsMultiLevelSeries = $catIsMultiLevelSeries || $plotSeriesCategory->isMultiLevelSeries();
+
+ if (($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) || ($groupType == PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
+ if (!is_null($plotGroup->getPlotStyle())) {
+ $plotStyle = $plotGroup->getPlotStyle();
+ if ($plotStyle) {
+ $objWriter->startElement('c:explosion');
+ $objWriter->writeAttribute('val', 25);
+ $objWriter->endElement();
+ }
+ }
+ }
+
+ if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
+ $objWriter->startElement('c:xVal');
+ } else {
+ $objWriter->startElement('c:cat');
+ }
+
+ $this->writePlotSeriesValues($plotSeriesCategory, $objWriter, $groupType, 'str', $pSheet);
+ $objWriter->endElement();
+ }
+
+ // Values
+ if ($plotSeriesValues) {
+ $valIsMultiLevelSeries = $valIsMultiLevelSeries || $plotSeriesValues->isMultiLevelSeries();
+
+ if (($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) || ($groupType === PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART)) {
+ $objWriter->startElement('c:yVal');
+ } else {
+ $objWriter->startElement('c:val');
+ }
+
+ $this->writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, 'num', $pSheet);
+ $objWriter->endElement();
+ }
+
+ if ($groupType === PHPExcel_Chart_DataSeries::TYPE_BUBBLECHART) {
+ $this->writeBubbles($plotSeriesValues, $objWriter, $pSheet);
+ }
+
+ $objWriter->endElement();
+ }
+
+ $this->_seriesIndex += $plotSeriesIdx + 1;
+ }
+
+ /**
+ * Write Plot Series Label
+ *
+ * @param PHPExcel_Chart_DataSeriesValues $plotSeriesLabel
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePlotSeriesLabel($plotSeriesLabel, $objWriter)
+ {
+ if (is_null($plotSeriesLabel)) {
+ return;
+ }
+
+ $objWriter->startElement('c:f');
+ $objWriter->writeRawData($plotSeriesLabel->getDataSource());
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:strCache');
+ $objWriter->startElement('c:ptCount');
+ $objWriter->writeAttribute('val', $plotSeriesLabel->getPointCount());
+ $objWriter->endElement();
+
+ foreach ($plotSeriesLabel->getDataValues() as $plotLabelKey => $plotLabelValue) {
+ $objWriter->startElement('c:pt');
+ $objWriter->writeAttribute('idx', $plotLabelKey);
+
+ $objWriter->startElement('c:v');
+ $objWriter->writeRawData($plotLabelValue);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Plot Series Values
+ *
+ * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $groupType Type of plot for dataseries
+ * @param string $dataType Datatype of series values
+ * @param PHPExcel_Worksheet $pSheet
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
+ {
+ if (is_null($plotSeriesValues)) {
+ return;
+ }
+
+ if ($plotSeriesValues->isMultiLevelSeries()) {
+ $levelCount = $plotSeriesValues->multiLevelCount();
+
+ $objWriter->startElement('c:multiLvlStrRef');
+
+ $objWriter->startElement('c:f');
+ $objWriter->writeRawData($plotSeriesValues->getDataSource());
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:multiLvlStrCache');
+
+ $objWriter->startElement('c:ptCount');
+ $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount());
+ $objWriter->endElement();
+
+ for ($level = 0; $level < $levelCount; ++$level) {
+ $objWriter->startElement('c:lvl');
+
+ foreach ($plotSeriesValues->getDataValues() as $plotSeriesKey => $plotSeriesValue) {
+ if (isset($plotSeriesValue[$level])) {
+ $objWriter->startElement('c:pt');
+ $objWriter->writeAttribute('idx', $plotSeriesKey);
+
+ $objWriter->startElement('c:v');
+ $objWriter->writeRawData($plotSeriesValue[$level]);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ } else {
+ $objWriter->startElement('c:' . $dataType . 'Ref');
+
+ $objWriter->startElement('c:f');
+ $objWriter->writeRawData($plotSeriesValues->getDataSource());
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:' . $dataType . 'Cache');
+
+ if (($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_PIECHART_3D) && ($groupType != PHPExcel_Chart_DataSeries::TYPE_DONUTCHART)) {
+ if (($plotSeriesValues->getFormatCode() !== null) && ($plotSeriesValues->getFormatCode() !== '')) {
+ $objWriter->startElement('c:formatCode');
+ $objWriter->writeRawData($plotSeriesValues->getFormatCode());
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->startElement('c:ptCount');
+ $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount());
+ $objWriter->endElement();
+
+ $dataValues = $plotSeriesValues->getDataValues();
+ if (!empty($dataValues)) {
+ if (is_array($dataValues)) {
+ foreach ($dataValues as $plotSeriesKey => $plotSeriesValue) {
+ $objWriter->startElement('c:pt');
+ $objWriter->writeAttribute('idx', $plotSeriesKey);
+
+ $objWriter->startElement('c:v');
+ $objWriter->writeRawData($plotSeriesValue);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+ }
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write Bubble Chart Details
+ *
+ * @param PHPExcel_Chart_DataSeriesValues $plotSeriesValues
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
+ {
+ if (is_null($plotSeriesValues)) {
+ return;
+ }
+
+ $objWriter->startElement('c:bubbleSize');
+ $objWriter->startElement('c:numLit');
+
+ $objWriter->startElement('c:formatCode');
+ $objWriter->writeRawData('General');
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:ptCount');
+ $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount());
+ $objWriter->endElement();
+
+ $dataValues = $plotSeriesValues->getDataValues();
+ if (!empty($dataValues)) {
+ if (is_array($dataValues)) {
+ foreach ($dataValues as $plotSeriesKey => $plotSeriesValue) {
+ $objWriter->startElement('c:pt');
+ $objWriter->writeAttribute('idx', $plotSeriesKey);
+ $objWriter->startElement('c:v');
+ $objWriter->writeRawData(1);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ }
+ }
+ }
+
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:bubble3D');
+ $objWriter->writeAttribute('val', 0);
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Layout
+ *
+ * @param PHPExcel_Chart_Layout $layout
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
+ {
+ $objWriter->startElement('c:layout');
+
+ if (!is_null($layout)) {
+ $objWriter->startElement('c:manualLayout');
+
+ $layoutTarget = $layout->getLayoutTarget();
+ if (!is_null($layoutTarget)) {
+ $objWriter->startElement('c:layoutTarget');
+ $objWriter->writeAttribute('val', $layoutTarget);
+ $objWriter->endElement();
+ }
+
+ $xMode = $layout->getXMode();
+ if (!is_null($xMode)) {
+ $objWriter->startElement('c:xMode');
+ $objWriter->writeAttribute('val', $xMode);
+ $objWriter->endElement();
+ }
+
+ $yMode = $layout->getYMode();
+ if (!is_null($yMode)) {
+ $objWriter->startElement('c:yMode');
+ $objWriter->writeAttribute('val', $yMode);
+ $objWriter->endElement();
+ }
+
+ $x = $layout->getXPosition();
+ if (!is_null($x)) {
+ $objWriter->startElement('c:x');
+ $objWriter->writeAttribute('val', $x);
+ $objWriter->endElement();
+ }
+
+ $y = $layout->getYPosition();
+ if (!is_null($y)) {
+ $objWriter->startElement('c:y');
+ $objWriter->writeAttribute('val', $y);
+ $objWriter->endElement();
+ }
+
+ $w = $layout->getWidth();
+ if (!is_null($w)) {
+ $objWriter->startElement('c:w');
+ $objWriter->writeAttribute('val', $w);
+ $objWriter->endElement();
+ }
+
+ $h = $layout->getHeight();
+ if (!is_null($h)) {
+ $objWriter->startElement('c:h');
+ $objWriter->writeAttribute('val', $h);
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Alternate Content block
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeAlternateContent($objWriter)
+ {
+ $objWriter->startElement('mc:AlternateContent');
+ $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
+
+ $objWriter->startElement('mc:Choice');
+ $objWriter->writeAttribute('xmlns:c14', 'http://schemas.microsoft.com/office/drawing/2007/8/2/chart');
+ $objWriter->writeAttribute('Requires', 'c14');
+
+ $objWriter->startElement('c14:style');
+ $objWriter->writeAttribute('val', '102');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('mc:Fallback');
+ $objWriter->startElement('c:style');
+ $objWriter->writeAttribute('val', '2');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Printer Settings
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePrintSettings($objWriter)
+ {
+ $objWriter->startElement('c:printSettings');
+
+ $objWriter->startElement('c:headerFooter');
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:pageMargins');
+ $objWriter->writeAttribute('footer', 0.3);
+ $objWriter->writeAttribute('header', 0.3);
+ $objWriter->writeAttribute('r', 0.7);
+ $objWriter->writeAttribute('l', 0.7);
+ $objWriter->writeAttribute('t', 0.75);
+ $objWriter->writeAttribute('b', 0.75);
+ $objWriter->endElement();
+
+ $objWriter->startElement('c:pageSetup');
+ $objWriter->writeAttribute('orientation', "portrait");
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Comments.php b/Classes/PHPExcel/Writer/Excel2007/Comments.php
new file mode 100644
index 0000000..7139f6c
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Comments.php
@@ -0,0 +1,260 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Comments cache
+ $comments = $pWorksheet->getComments();
+
+ // Authors cache
+ $authors = array();
+ $authorId = 0;
+ foreach ($comments as $comment) {
+ if (!isset($authors[$comment->getAuthor()])) {
+ $authors[$comment->getAuthor()] = $authorId++;
+ }
+ }
+
+ // comments
+ $objWriter->startElement('comments');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
+
+ // Loop through authors
+ $objWriter->startElement('authors');
+ foreach ($authors as $author => $index) {
+ $objWriter->writeElement('author', $author);
+ }
+ $objWriter->endElement();
+
+ // Loop through comments
+ $objWriter->startElement('commentList');
+ foreach ($comments as $key => $value) {
+ $this->writeComment($objWriter, $key, $value, $authors);
+ }
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write comment to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pCellReference Cell reference
+ * @param PHPExcel_Comment $pComment Comment
+ * @param array $pAuthors Array of authors
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null)
+ {
+ // comment
+ $objWriter->startElement('comment');
+ $objWriter->writeAttribute('ref', $pCellReference);
+ $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
+
+ // text
+ $objWriter->startElement('text');
+ $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write VML comments to XML format
+ *
+ * @param PHPExcel_Worksheet $pWorksheet
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Comments cache
+ $comments = $pWorksheet->getComments();
+
+ // xml
+ $objWriter->startElement('xml');
+ $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
+ $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
+ $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
+
+ // o:shapelayout
+ $objWriter->startElement('o:shapelayout');
+ $objWriter->writeAttribute('v:ext', 'edit');
+
+ // o:idmap
+ $objWriter->startElement('o:idmap');
+ $objWriter->writeAttribute('v:ext', 'edit');
+ $objWriter->writeAttribute('data', '1');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // v:shapetype
+ $objWriter->startElement('v:shapetype');
+ $objWriter->writeAttribute('id', '_x0000_t202');
+ $objWriter->writeAttribute('coordsize', '21600,21600');
+ $objWriter->writeAttribute('o:spt', '202');
+ $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
+
+ // v:stroke
+ $objWriter->startElement('v:stroke');
+ $objWriter->writeAttribute('joinstyle', 'miter');
+ $objWriter->endElement();
+
+ // v:path
+ $objWriter->startElement('v:path');
+ $objWriter->writeAttribute('gradientshapeok', 't');
+ $objWriter->writeAttribute('o:connecttype', 'rect');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // Loop through comments
+ foreach ($comments as $key => $value) {
+ $this->writeVMLComment($objWriter, $key, $value);
+ }
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write VML comment to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pCellReference Cell reference
+ * @param PHPExcel_Comment $pComment Comment
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null)
+ {
+ // Metadata
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference);
+ $column = PHPExcel_Cell::columnIndexFromString($column);
+ $id = 1024 + $column + $row;
+ $id = substr($id, 0, 4);
+
+ // v:shape
+ $objWriter->startElement('v:shape');
+ $objWriter->writeAttribute('id', '_x0000_s' . $id);
+ $objWriter->writeAttribute('type', '#_x0000_t202');
+ $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
+ $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
+ $objWriter->writeAttribute('o:insetmode', 'auto');
+
+ // v:fill
+ $objWriter->startElement('v:fill');
+ $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
+ $objWriter->endElement();
+
+ // v:shadow
+ $objWriter->startElement('v:shadow');
+ $objWriter->writeAttribute('on', 't');
+ $objWriter->writeAttribute('color', 'black');
+ $objWriter->writeAttribute('obscured', 't');
+ $objWriter->endElement();
+
+ // v:path
+ $objWriter->startElement('v:path');
+ $objWriter->writeAttribute('o:connecttype', 'none');
+ $objWriter->endElement();
+
+ // v:textbox
+ $objWriter->startElement('v:textbox');
+ $objWriter->writeAttribute('style', 'mso-direction-alt:auto');
+
+ // div
+ $objWriter->startElement('div');
+ $objWriter->writeAttribute('style', 'text-align:left');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // x:ClientData
+ $objWriter->startElement('x:ClientData');
+ $objWriter->writeAttribute('ObjectType', 'Note');
+
+ // x:MoveWithCells
+ $objWriter->writeElement('x:MoveWithCells', '');
+
+ // x:SizeWithCells
+ $objWriter->writeElement('x:SizeWithCells', '');
+
+ // x:Anchor
+ //$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18');
+
+ // x:AutoFill
+ $objWriter->writeElement('x:AutoFill', 'False');
+
+ // x:Row
+ $objWriter->writeElement('x:Row', ($row - 1));
+
+ // x:Column
+ $objWriter->writeElement('x:Column', ($column - 1));
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php
new file mode 100644
index 0000000..0d91189
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/ContentTypes.php
@@ -0,0 +1,240 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Types
+ $objWriter->startElement('Types');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
+
+ // Theme
+ $this->writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
+
+ // Styles
+ $this->writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
+
+ // Rels
+ $this->writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
+
+ // XML
+ $this->writeDefaultContentType($objWriter, 'xml', 'application/xml');
+
+ // VML
+ $this->writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
+
+ // Workbook
+ if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
+ // Yes : not standard content but "macroEnabled"
+ $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
+ //... and define a new type for the VBA project
+ $this->writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
+ if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
+ // Yes : add needed information
+ $this->writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
+ }
+ } else {// no macros in workbook, so standard type
+ $this->writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
+ }
+
+ // DocProps
+ $this->writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
+
+ $this->writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
+
+ $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
+ if (!empty($customPropertyList)) {
+ $this->writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
+ }
+
+ // Worksheets
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ $this->writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
+ }
+
+ // Shared strings
+ $this->writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
+
+ // Add worksheet relationship content types
+ $chart = 1;
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ $drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
+ $drawingCount = count($drawings);
+ $chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
+
+ // We need a drawing relationship for the worksheet if we have either drawings or charts
+ if (($drawingCount > 0) || ($chartCount > 0)) {
+ $this->writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
+ }
+
+ // If we have charts, then we need a chart relationship for every individual chart
+ if ($chartCount > 0) {
+ for ($c = 0; $c < $chartCount; ++$c) {
+ $this->writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
+ }
+ }
+ }
+
+ // Comments
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
+ $this->writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
+ }
+ }
+
+ // Add media content-types
+ $aMediaContentTypes = array();
+ $mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
+ for ($i = 0; $i < $mediaCount; ++$i) {
+ $extension = '';
+ $mimeType = '';
+
+ if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
+ $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
+ $mimeType = $this->getImageMimeType($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
+ } elseif ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ $extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
+ $extension = explode('/', $extension);
+ $extension = $extension[1];
+
+ $mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
+ }
+
+ if (!isset( $aMediaContentTypes[$extension])) {
+ $aMediaContentTypes[$extension] = $mimeType;
+
+ $this->writeDefaultContentType($objWriter, $extension, $mimeType);
+ }
+ }
+ if ($pPHPExcel->hasRibbonBinObjects()) {
+ // Some additional objects in the ribbon ?
+ // we need to write "Extension" but not already write for media content
+ $tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
+ foreach ($tabRibbonTypes as $aRibbonType) {
+ $mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
+ $this->writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
+ }
+ }
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
+ foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
+ if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
+ $aMediaContentTypes[strtolower($image->getExtension())] = $this->getImageMimeType($image->getPath());
+
+ $this->writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
+ }
+ }
+ }
+ }
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Get image mime type
+ *
+ * @param string $pFile Filename
+ * @return string Mime Type
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function getImageMimeType($pFile = '')
+ {
+ if (PHPExcel_Shared_File::file_exists($pFile)) {
+ $image = getimagesize($pFile);
+ return image_type_to_mime_type($image[2]);
+ } else {
+ throw new PHPExcel_Writer_Exception("File $pFile does not exist");
+ }
+ }
+
+ /**
+ * Write Default content type
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pPartname Part name
+ * @param string $pContentType Content type
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
+ {
+ if ($pPartname != '' && $pContentType != '') {
+ // Write content type
+ $objWriter->startElement('Default');
+ $objWriter->writeAttribute('Extension', $pPartname);
+ $objWriter->writeAttribute('ContentType', $pContentType);
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Write Override content type
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pPartname Part name
+ * @param string $pContentType Content type
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '')
+ {
+ if ($pPartname != '' && $pContentType != '') {
+ // Write content type
+ $objWriter->startElement('Override');
+ $objWriter->writeAttribute('PartName', $pPartname);
+ $objWriter->writeAttribute('ContentType', $pContentType);
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/DocProps.php b/Classes/PHPExcel/Writer/Excel2007/DocProps.php
new file mode 100644
index 0000000..fef3d93
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/DocProps.php
@@ -0,0 +1,262 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Properties
+ $objWriter->startElement('Properties');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
+ $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
+
+ // Application
+ $objWriter->writeElement('Application', 'Microsoft Excel');
+
+ // DocSecurity
+ $objWriter->writeElement('DocSecurity', '0');
+
+ // ScaleCrop
+ $objWriter->writeElement('ScaleCrop', 'false');
+
+ // HeadingPairs
+ $objWriter->startElement('HeadingPairs');
+
+ // Vector
+ $objWriter->startElement('vt:vector');
+ $objWriter->writeAttribute('size', '2');
+ $objWriter->writeAttribute('baseType', 'variant');
+
+ // Variant
+ $objWriter->startElement('vt:variant');
+ $objWriter->writeElement('vt:lpstr', 'Worksheets');
+ $objWriter->endElement();
+
+ // Variant
+ $objWriter->startElement('vt:variant');
+ $objWriter->writeElement('vt:i4', $pPHPExcel->getSheetCount());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // TitlesOfParts
+ $objWriter->startElement('TitlesOfParts');
+
+ // Vector
+ $objWriter->startElement('vt:vector');
+ $objWriter->writeAttribute('size', $pPHPExcel->getSheetCount());
+ $objWriter->writeAttribute('baseType', 'lpstr');
+
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ $objWriter->writeElement('vt:lpstr', $pPHPExcel->getSheet($i)->getTitle());
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // Company
+ $objWriter->writeElement('Company', $pPHPExcel->getProperties()->getCompany());
+
+ // Company
+ $objWriter->writeElement('Manager', $pPHPExcel->getProperties()->getManager());
+
+ // LinksUpToDate
+ $objWriter->writeElement('LinksUpToDate', 'false');
+
+ // SharedDoc
+ $objWriter->writeElement('SharedDoc', 'false');
+
+ // HyperlinksChanged
+ $objWriter->writeElement('HyperlinksChanged', 'false');
+
+ // AppVersion
+ $objWriter->writeElement('AppVersion', '12.0000');
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write docProps/core.xml to XML format
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeDocPropsCore(PHPExcel $pPHPExcel = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // cp:coreProperties
+ $objWriter->startElement('cp:coreProperties');
+ $objWriter->writeAttribute('xmlns:cp', 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties');
+ $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
+ $objWriter->writeAttribute('xmlns:dcterms', 'http://purl.org/dc/terms/');
+ $objWriter->writeAttribute('xmlns:dcmitype', 'http://purl.org/dc/dcmitype/');
+ $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
+
+ // dc:creator
+ $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
+
+ // cp:lastModifiedBy
+ $objWriter->writeElement('cp:lastModifiedBy', $pPHPExcel->getProperties()->getLastModifiedBy());
+
+ // dcterms:created
+ $objWriter->startElement('dcterms:created');
+ $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
+ $objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
+ $objWriter->endElement();
+
+ // dcterms:modified
+ $objWriter->startElement('dcterms:modified');
+ $objWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
+ $objWriter->writeRawData(date(DATE_W3C, $pPHPExcel->getProperties()->getModified()));
+ $objWriter->endElement();
+
+ // dc:title
+ $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
+
+ // dc:description
+ $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
+
+ // dc:subject
+ $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
+
+ // cp:keywords
+ $objWriter->writeElement('cp:keywords', $pPHPExcel->getProperties()->getKeywords());
+
+ // cp:category
+ $objWriter->writeElement('cp:category', $pPHPExcel->getProperties()->getCategory());
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write docProps/custom.xml to XML format
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeDocPropsCustom(PHPExcel $pPHPExcel = null)
+ {
+ $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
+ if (empty($customPropertyList)) {
+ return;
+ }
+
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // cp:coreProperties
+ $objWriter->startElement('Properties');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/custom-properties');
+ $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
+
+
+ foreach ($customPropertyList as $key => $customProperty) {
+ $propertyValue = $pPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
+ $propertyType = $pPHPExcel->getProperties()->getCustomPropertyType($customProperty);
+
+ $objWriter->startElement('property');
+ $objWriter->writeAttribute('fmtid', '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}');
+ $objWriter->writeAttribute('pid', $key+2);
+ $objWriter->writeAttribute('name', $customProperty);
+
+ switch ($propertyType) {
+ case 'i':
+ $objWriter->writeElement('vt:i4', $propertyValue);
+ break;
+ case 'f':
+ $objWriter->writeElement('vt:r8', $propertyValue);
+ break;
+ case 'b':
+ $objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
+ break;
+ case 'd':
+ $objWriter->startElement('vt:filetime');
+ $objWriter->writeRawData(date(DATE_W3C, $propertyValue));
+ $objWriter->endElement();
+ break;
+ default:
+ $objWriter->writeElement('vt:lpwstr', $propertyValue);
+ break;
+ }
+
+ $objWriter->endElement();
+ }
+
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Drawing.php b/Classes/PHPExcel/Writer/Excel2007/Drawing.php
new file mode 100644
index 0000000..2814388
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Drawing.php
@@ -0,0 +1,589 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // xdr:wsDr
+ $objWriter->startElement('xdr:wsDr');
+ $objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
+ $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
+
+ // Loop through images and write drawings
+ $i = 1;
+ $iterator = $pWorksheet->getDrawingCollection()->getIterator();
+ while ($iterator->valid()) {
+ $this->writeDrawing($objWriter, $iterator->current(), $i);
+
+ $iterator->next();
+ ++$i;
+ }
+
+ if ($includeCharts) {
+ $chartCount = $pWorksheet->getChartCount();
+ // Loop through charts and write the chart position
+ if ($chartCount > 0) {
+ for ($c = 0; $c < $chartCount; ++$c) {
+ $this->writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
+ }
+ }
+ }
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write drawings to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Chart $pChart
+ * @param int $pRelationId
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeChart(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Chart $pChart = null, $pRelationId = -1)
+ {
+ $tl = $pChart->getTopLeftPosition();
+ $tl['colRow'] = PHPExcel_Cell::coordinateFromString($tl['cell']);
+ $br = $pChart->getBottomRightPosition();
+ $br['colRow'] = PHPExcel_Cell::coordinateFromString($br['cell']);
+
+ $objWriter->startElement('xdr:twoCellAnchor');
+
+ $objWriter->startElement('xdr:from');
+ $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($tl['colRow'][0]) - 1);
+ $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['xOffset']));
+ $objWriter->writeElement('xdr:row', $tl['colRow'][1] - 1);
+ $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($tl['yOffset']));
+ $objWriter->endElement();
+ $objWriter->startElement('xdr:to');
+ $objWriter->writeElement('xdr:col', PHPExcel_Cell::columnIndexFromString($br['colRow'][0]) - 1);
+ $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['xOffset']));
+ $objWriter->writeElement('xdr:row', $br['colRow'][1] - 1);
+ $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($br['yOffset']));
+ $objWriter->endElement();
+
+ $objWriter->startElement('xdr:graphicFrame');
+ $objWriter->writeAttribute('macro', '');
+ $objWriter->startElement('xdr:nvGraphicFramePr');
+ $objWriter->startElement('xdr:cNvPr');
+ $objWriter->writeAttribute('name', 'Chart '.$pRelationId);
+ $objWriter->writeAttribute('id', 1025 * $pRelationId);
+ $objWriter->endElement();
+ $objWriter->startElement('xdr:cNvGraphicFramePr');
+ $objWriter->startElement('a:graphicFrameLocks');
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('xdr:xfrm');
+ $objWriter->startElement('a:off');
+ $objWriter->writeAttribute('x', '0');
+ $objWriter->writeAttribute('y', '0');
+ $objWriter->endElement();
+ $objWriter->startElement('a:ext');
+ $objWriter->writeAttribute('cx', '0');
+ $objWriter->writeAttribute('cy', '0');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('a:graphic');
+ $objWriter->startElement('a:graphicData');
+ $objWriter->writeAttribute('uri', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
+ $objWriter->startElement('c:chart');
+ $objWriter->writeAttribute('xmlns:c', 'http://schemas.openxmlformats.org/drawingml/2006/chart');
+ $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
+ $objWriter->writeAttribute('r:id', 'rId'.$pRelationId);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ $objWriter->startElement('xdr:clientData');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write drawings to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet_BaseDrawing $pDrawing
+ * @param int $pRelationId
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet_BaseDrawing $pDrawing = null, $pRelationId = -1)
+ {
+ if ($pRelationId >= 0) {
+ // xdr:oneCellAnchor
+ $objWriter->startElement('xdr:oneCellAnchor');
+ // Image location
+ $aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
+ $aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
+
+ // xdr:from
+ $objWriter->startElement('xdr:from');
+ $objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
+ $objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
+ $objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
+ $objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
+ $objWriter->endElement();
+
+ // xdr:ext
+ $objWriter->startElement('xdr:ext');
+ $objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
+ $objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
+ $objWriter->endElement();
+
+ // xdr:pic
+ $objWriter->startElement('xdr:pic');
+
+ // xdr:nvPicPr
+ $objWriter->startElement('xdr:nvPicPr');
+
+ // xdr:cNvPr
+ $objWriter->startElement('xdr:cNvPr');
+ $objWriter->writeAttribute('id', $pRelationId);
+ $objWriter->writeAttribute('name', $pDrawing->getName());
+ $objWriter->writeAttribute('descr', $pDrawing->getDescription());
+ $objWriter->endElement();
+
+ // xdr:cNvPicPr
+ $objWriter->startElement('xdr:cNvPicPr');
+
+ // a:picLocks
+ $objWriter->startElement('a:picLocks');
+ $objWriter->writeAttribute('noChangeAspect', '1');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // xdr:blipFill
+ $objWriter->startElement('xdr:blipFill');
+
+ // a:blip
+ $objWriter->startElement('a:blip');
+ $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
+ $objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
+ $objWriter->endElement();
+
+ // a:stretch
+ $objWriter->startElement('a:stretch');
+ $objWriter->writeElement('a:fillRect', null);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // xdr:spPr
+ $objWriter->startElement('xdr:spPr');
+
+ // a:xfrm
+ $objWriter->startElement('a:xfrm');
+ $objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
+ $objWriter->endElement();
+
+ // a:prstGeom
+ $objWriter->startElement('a:prstGeom');
+ $objWriter->writeAttribute('prst', 'rect');
+
+ // a:avLst
+ $objWriter->writeElement('a:avLst', null);
+
+ $objWriter->endElement();
+
+// // a:solidFill
+// $objWriter->startElement('a:solidFill');
+
+// // a:srgbClr
+// $objWriter->startElement('a:srgbClr');
+// $objWriter->writeAttribute('val', 'FFFFFF');
+
+///* SHADE
+// // a:shade
+// $objWriter->startElement('a:shade');
+// $objWriter->writeAttribute('val', '85000');
+// $objWriter->endElement();
+//*/
+
+// $objWriter->endElement();
+
+// $objWriter->endElement();
+/*
+ // a:ln
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', '88900');
+ $objWriter->writeAttribute('cap', 'sq');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', 'FFFFFF');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:miter
+ $objWriter->startElement('a:miter');
+ $objWriter->writeAttribute('lim', '800000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+*/
+
+ if ($pDrawing->getShadow()->getVisible()) {
+ // a:effectLst
+ $objWriter->startElement('a:effectLst');
+
+ // a:outerShdw
+ $objWriter->startElement('a:outerShdw');
+ $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
+ $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
+ $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
+ $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
+ $objWriter->writeAttribute('rotWithShape', '0');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
+
+ // a:alpha
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+/*
+
+ // a:scene3d
+ $objWriter->startElement('a:scene3d');
+
+ // a:camera
+ $objWriter->startElement('a:camera');
+ $objWriter->writeAttribute('prst', 'orthographicFront');
+ $objWriter->endElement();
+
+ // a:lightRig
+ $objWriter->startElement('a:lightRig');
+ $objWriter->writeAttribute('rig', 'twoPt');
+ $objWriter->writeAttribute('dir', 't');
+
+ // a:rot
+ $objWriter->startElement('a:rot');
+ $objWriter->writeAttribute('lat', '0');
+ $objWriter->writeAttribute('lon', '0');
+ $objWriter->writeAttribute('rev', '0');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+*/
+/*
+ // a:sp3d
+ $objWriter->startElement('a:sp3d');
+
+ // a:bevelT
+ $objWriter->startElement('a:bevelT');
+ $objWriter->writeAttribute('w', '25400');
+ $objWriter->writeAttribute('h', '19050');
+ $objWriter->endElement();
+
+ // a:contourClr
+ $objWriter->startElement('a:contourClr');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', 'FFFFFF');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+*/
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // xdr:clientData
+ $objWriter->writeElement('xdr:clientData', null);
+
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Write VML header/footer images to XML format
+ *
+ * @param PHPExcel_Worksheet $pWorksheet
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeVMLHeaderFooterImages(PHPExcel_Worksheet $pWorksheet = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Header/footer images
+ $images = $pWorksheet->getHeaderFooter()->getImages();
+
+ // xml
+ $objWriter->startElement('xml');
+ $objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
+ $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
+ $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
+
+ // o:shapelayout
+ $objWriter->startElement('o:shapelayout');
+ $objWriter->writeAttribute('v:ext', 'edit');
+
+ // o:idmap
+ $objWriter->startElement('o:idmap');
+ $objWriter->writeAttribute('v:ext', 'edit');
+ $objWriter->writeAttribute('data', '1');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // v:shapetype
+ $objWriter->startElement('v:shapetype');
+ $objWriter->writeAttribute('id', '_x0000_t75');
+ $objWriter->writeAttribute('coordsize', '21600,21600');
+ $objWriter->writeAttribute('o:spt', '75');
+ $objWriter->writeAttribute('o:preferrelative', 't');
+ $objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
+ $objWriter->writeAttribute('filled', 'f');
+ $objWriter->writeAttribute('stroked', 'f');
+
+ // v:stroke
+ $objWriter->startElement('v:stroke');
+ $objWriter->writeAttribute('joinstyle', 'miter');
+ $objWriter->endElement();
+
+ // v:formulas
+ $objWriter->startElement('v:formulas');
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'sum @0 1 0');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'sum 0 0 @1');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @2 1 2');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'sum @0 0 1');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @6 1 2');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'sum @8 21600 0');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
+ $objWriter->endElement();
+
+ // v:f
+ $objWriter->startElement('v:f');
+ $objWriter->writeAttribute('eqn', 'sum @10 21600 0');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // v:path
+ $objWriter->startElement('v:path');
+ $objWriter->writeAttribute('o:extrusionok', 'f');
+ $objWriter->writeAttribute('gradientshapeok', 't');
+ $objWriter->writeAttribute('o:connecttype', 'rect');
+ $objWriter->endElement();
+
+ // o:lock
+ $objWriter->startElement('o:lock');
+ $objWriter->writeAttribute('v:ext', 'edit');
+ $objWriter->writeAttribute('aspectratio', 't');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // Loop through images
+ foreach ($images as $key => $value) {
+ $this->writeVMLHeaderFooterImage($objWriter, $key, $value);
+ }
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write VML comment to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pReference Reference
+ * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null)
+ {
+ // Calculate object id
+ preg_match('{(\d+)}', md5($pReference), $m);
+ $id = 1500 + (substr($m[1], 0, 2) * 1);
+
+ // Calculate offset
+ $width = $pImage->getWidth();
+ $height = $pImage->getHeight();
+ $marginLeft = $pImage->getOffsetX();
+ $marginTop = $pImage->getOffsetY();
+
+ // v:shape
+ $objWriter->startElement('v:shape');
+ $objWriter->writeAttribute('id', $pReference);
+ $objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
+ $objWriter->writeAttribute('type', '#_x0000_t75');
+ $objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
+
+ // v:imagedata
+ $objWriter->startElement('v:imagedata');
+ $objWriter->writeAttribute('o:relid', 'rId' . $pReference);
+ $objWriter->writeAttribute('o:title', $pImage->getName());
+ $objWriter->endElement();
+
+ // o:lock
+ $objWriter->startElement('o:lock');
+ $objWriter->writeAttribute('v:ext', 'edit');
+ $objWriter->writeAttribute('rotation', 't');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+
+ /**
+ * Get an array of all drawings
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Worksheet_Drawing[] All drawings in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allDrawings(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of all drawings
+ $aDrawings = array();
+
+ // Loop through PHPExcel
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ // Loop through images and add to array
+ $iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator();
+ while ($iterator->valid()) {
+ $aDrawings[] = $iterator->current();
+
+ $iterator->next();
+ }
+ }
+
+ return $aDrawings;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Rels.php b/Classes/PHPExcel/Writer/Excel2007/Rels.php
new file mode 100644
index 0000000..14ff337
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Rels.php
@@ -0,0 +1,424 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+
+ $customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
+ if (!empty($customPropertyList)) {
+ // Relationship docProps/app.xml
+ $this->writeRelationship(
+ $objWriter,
+ 4,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
+ 'docProps/custom.xml'
+ );
+
+ }
+
+ // Relationship docProps/app.xml
+ $this->writeRelationship(
+ $objWriter,
+ 3,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
+ 'docProps/app.xml'
+ );
+
+ // Relationship docProps/core.xml
+ $this->writeRelationship(
+ $objWriter,
+ 2,
+ 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
+ 'docProps/core.xml'
+ );
+
+ // Relationship xl/workbook.xml
+ $this->writeRelationship(
+ $objWriter,
+ 1,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
+ 'xl/workbook.xml'
+ );
+ // a custom UI in workbook ?
+ if ($pPHPExcel->hasRibbon()) {
+ $this->writeRelationShip(
+ $objWriter,
+ 5,
+ 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
+ $pPHPExcel->getRibbonXMLData('target')
+ );
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write workbook relationships to XML format
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeWorkbookRelationships(PHPExcel $pPHPExcel = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+
+ // Relationship styles.xml
+ $this->writeRelationship(
+ $objWriter,
+ 1,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
+ 'styles.xml'
+ );
+
+ // Relationship theme/theme1.xml
+ $this->writeRelationship(
+ $objWriter,
+ 2,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
+ 'theme/theme1.xml'
+ );
+
+ // Relationship sharedStrings.xml
+ $this->writeRelationship(
+ $objWriter,
+ 3,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
+ 'sharedStrings.xml'
+ );
+
+ // Relationships with sheets
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ $this->writeRelationship(
+ $objWriter,
+ ($i + 1 + 3),
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
+ 'worksheets/sheet' . ($i + 1) . '.xml'
+ );
+ }
+ // Relationships for vbaProject if needed
+ // id : just after the last sheet
+ if ($pPHPExcel->hasMacros()) {
+ $this->writeRelationShip(
+ $objWriter,
+ ($i + 1 + 3),
+ 'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
+ 'vbaProject.bin'
+ );
+ ++$i;//increment i if needed for an another relation
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write worksheet relationships to XML format
+ *
+ * Numbering is as follows:
+ * rId1 - Drawings
+ * rId_hyperlink_x - Hyperlinks
+ *
+ * @param PHPExcel_Worksheet $pWorksheet
+ * @param int $pWorksheetId
+ * @param boolean $includeCharts Flag indicating if we should write charts
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+
+ // Write drawing relationships?
+ $d = 0;
+ if ($includeCharts) {
+ $charts = $pWorksheet->getChartCollection();
+ } else {
+ $charts = array();
+ }
+ if (($pWorksheet->getDrawingCollection()->count() > 0) ||
+ (count($charts) > 0)) {
+ $this->writeRelationship(
+ $objWriter,
+ ++$d,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
+ '../drawings/drawing' . $pWorksheetId . '.xml'
+ );
+ }
+
+ // Write chart relationships?
+// $chartCount = 0;
+// $charts = $pWorksheet->getChartCollection();
+// echo 'Chart Rels: ' , count($charts) , '
';
+// if (count($charts) > 0) {
+// foreach ($charts as $chart) {
+// $this->writeRelationship(
+// $objWriter,
+// ++$d,
+// 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
+// '../charts/chart' . ++$chartCount . '.xml'
+// );
+// }
+// }
+//
+ // Write hyperlink relationships?
+ $i = 1;
+ foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
+ if (!$hyperlink->isInternal()) {
+ $this->writeRelationship(
+ $objWriter,
+ '_hyperlink_' . $i,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
+ $hyperlink->getUrl(),
+ 'External'
+ );
+
+ ++$i;
+ }
+ }
+
+ // Write comments relationship?
+ $i = 1;
+ if (count($pWorksheet->getComments()) > 0) {
+ $this->writeRelationship(
+ $objWriter,
+ '_comments_vml' . $i,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
+ '../drawings/vmlDrawing' . $pWorksheetId . '.vml'
+ );
+
+ $this->writeRelationship(
+ $objWriter,
+ '_comments' . $i,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
+ '../comments' . $pWorksheetId . '.xml'
+ );
+ }
+
+ // Write header/footer relationship?
+ $i = 1;
+ if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
+ $this->writeRelationship(
+ $objWriter,
+ '_headerfooter_vml' . $i,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
+ '../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
+ );
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write drawing relationships to XML format
+ *
+ * @param PHPExcel_Worksheet $pWorksheet
+ * @param int &$chartRef Chart ID
+ * @param boolean $includeCharts Flag indicating if we should write charts
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+
+ // Loop through images and write relationships
+ $i = 1;
+ $iterator = $pWorksheet->getDrawingCollection()->getIterator();
+ while ($iterator->valid()) {
+ if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
+ || $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ // Write relationship for image drawing
+ $this->writeRelationship(
+ $objWriter,
+ $i,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
+ '../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
+ );
+ }
+
+ $iterator->next();
+ ++$i;
+ }
+
+ if ($includeCharts) {
+ // Loop through charts and write relationships
+ $chartCount = $pWorksheet->getChartCount();
+ if ($chartCount > 0) {
+ for ($c = 0; $c < $chartCount; ++$c) {
+ $this->writeRelationship(
+ $objWriter,
+ $i++,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
+ '../charts/chart' . ++$chartRef . '.xml'
+ );
+ }
+ }
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write header/footer drawing relationships to XML format
+ *
+ * @param PHPExcel_Worksheet $pWorksheet
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+
+ // Loop through images and write relationships
+ foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
+ // Write relationship for image drawing
+ $this->writeRelationship(
+ $objWriter,
+ $key,
+ 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
+ '../media/' . $value->getIndexedFilename()
+ );
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write Override content type
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param int $pId Relationship ID. rId will be prepended!
+ * @param string $pType Relationship type
+ * @param string $pTarget Relationship target
+ * @param string $pTargetMode Relationship target mode
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeRelationship(PHPExcel_Shared_XMLWriter $objWriter = null, $pId = 1, $pType = '', $pTarget = '', $pTargetMode = '')
+ {
+ if ($pType != '' && $pTarget != '') {
+ // Write relationship
+ $objWriter->startElement('Relationship');
+ $objWriter->writeAttribute('Id', 'rId' . $pId);
+ $objWriter->writeAttribute('Type', $pType);
+ $objWriter->writeAttribute('Target', $pTarget);
+
+ if ($pTargetMode != '') {
+ $objWriter->writeAttribute('TargetMode', $pTargetMode);
+ }
+
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/RelsRibbon.php b/Classes/PHPExcel/Writer/Excel2007/RelsRibbon.php
new file mode 100644
index 0000000..5a4a9fc
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/RelsRibbon.php
@@ -0,0 +1,67 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+ $localRels = $pPHPExcel->getRibbonBinObjects('names');
+ if (is_array($localRels)) {
+ foreach ($localRels as $aId => $aTarget) {
+ $objWriter->startElement('Relationship');
+ $objWriter->writeAttribute('Id', $aId);
+ $objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
+ $objWriter->writeAttribute('Target', $aTarget);
+ $objWriter->endElement();
+ }
+ }
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/RelsVBA.php b/Classes/PHPExcel/Writer/Excel2007/RelsVBA.php
new file mode 100644
index 0000000..bee0e64
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/RelsVBA.php
@@ -0,0 +1,63 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Relationships
+ $objWriter->startElement('Relationships');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
+ $objWriter->startElement('Relationship');
+ $objWriter->writeAttribute('Id', 'rId1');
+ $objWriter->writeAttribute('Type', 'http://schemas.microsoft.com/office/2006/relationships/vbaProjectSignature');
+ $objWriter->writeAttribute('Target', 'vbaProjectSignature.bin');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/StringTable.php b/Classes/PHPExcel/Writer/Excel2007/StringTable.php
new file mode 100644
index 0000000..fccec66
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/StringTable.php
@@ -0,0 +1,313 @@
+flipStringTable($aStringTable);
+
+ // Loop through cells
+ foreach ($pSheet->getCellCollection() as $cellID) {
+ $cell = $pSheet->getCell($cellID);
+ $cellValue = $cell->getValue();
+ if (!is_object($cellValue) &&
+ ($cellValue !== null) &&
+ $cellValue !== '' &&
+ !isset($aFlippedStringTable[$cellValue]) &&
+ ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) {
+ $aStringTable[] = $cellValue;
+ $aFlippedStringTable[$cellValue] = true;
+ } elseif ($cellValue instanceof PHPExcel_RichText &&
+ ($cellValue !== null) &&
+ !isset($aFlippedStringTable[$cellValue->getHashCode()])) {
+ $aStringTable[] = $cellValue;
+ $aFlippedStringTable[$cellValue->getHashCode()] = true;
+ }
+ }
+
+ return $aStringTable;
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed.");
+ }
+ }
+
+ /**
+ * Write string table to XML format
+ *
+ * @param string[] $pStringTable
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeStringTable($pStringTable = null)
+ {
+ if ($pStringTable !== null) {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // String table
+ $objWriter->startElement('sst');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
+ $objWriter->writeAttribute('uniqueCount', count($pStringTable));
+
+ // Loop through string table
+ foreach ($pStringTable as $textElement) {
+ $objWriter->startElement('si');
+
+ if (! $textElement instanceof PHPExcel_RichText) {
+ $textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement);
+ $objWriter->startElement('t');
+ if ($textToWrite !== trim($textToWrite)) {
+ $objWriter->writeAttribute('xml:space', 'preserve');
+ }
+ $objWriter->writeRawData($textToWrite);
+ $objWriter->endElement();
+ } elseif ($textElement instanceof PHPExcel_RichText) {
+ $this->writeRichText($objWriter, $textElement);
+ }
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid string table array passed.");
+ }
+ }
+
+ /**
+ * Write Rich Text
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_RichText $pRichText Rich text
+ * @param string $prefix Optional Namespace prefix
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix = null)
+ {
+ if ($prefix !== null) {
+ $prefix .= ':';
+ }
+
+ // Loop through rich text elements
+ $elements = $pRichText->getRichTextElements();
+ foreach ($elements as $element) {
+ // r
+ $objWriter->startElement($prefix.'r');
+
+ // rPr
+ if ($element instanceof PHPExcel_RichText_Run) {
+ // rPr
+ $objWriter->startElement($prefix.'rPr');
+
+ // rFont
+ $objWriter->startElement($prefix.'rFont');
+ $objWriter->writeAttribute('val', $element->getFont()->getName());
+ $objWriter->endElement();
+
+ // Bold
+ $objWriter->startElement($prefix.'b');
+ $objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
+ $objWriter->endElement();
+
+ // Italic
+ $objWriter->startElement($prefix.'i');
+ $objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
+ $objWriter->endElement();
+
+ // Superscript / subscript
+ if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
+ $objWriter->startElement($prefix.'vertAlign');
+ if ($element->getFont()->getSuperScript()) {
+ $objWriter->writeAttribute('val', 'superscript');
+ } elseif ($element->getFont()->getSubScript()) {
+ $objWriter->writeAttribute('val', 'subscript');
+ }
+ $objWriter->endElement();
+ }
+
+ // Strikethrough
+ $objWriter->startElement($prefix.'strike');
+ $objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
+ $objWriter->endElement();
+
+ // Color
+ $objWriter->startElement($prefix.'color');
+ $objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
+ $objWriter->endElement();
+
+ // Size
+ $objWriter->startElement($prefix.'sz');
+ $objWriter->writeAttribute('val', $element->getFont()->getSize());
+ $objWriter->endElement();
+
+ // Underline
+ $objWriter->startElement($prefix.'u');
+ $objWriter->writeAttribute('val', $element->getFont()->getUnderline());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ // t
+ $objWriter->startElement($prefix.'t');
+ $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write Rich Text
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string|PHPExcel_RichText $pRichText text string or Rich text
+ * @param string $prefix Optional Namespace prefix
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix = null)
+ {
+ if (!$pRichText instanceof PHPExcel_RichText) {
+ $textRun = $pRichText;
+ $pRichText = new PHPExcel_RichText();
+ $pRichText->createTextRun($textRun);
+ }
+
+ if ($prefix !== null) {
+ $prefix .= ':';
+ }
+
+ // Loop through rich text elements
+ $elements = $pRichText->getRichTextElements();
+ foreach ($elements as $element) {
+ // r
+ $objWriter->startElement($prefix.'r');
+
+ // rPr
+ $objWriter->startElement($prefix.'rPr');
+
+ // Bold
+ $objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
+ // Italic
+ $objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
+ // Underline
+ $underlineType = $element->getFont()->getUnderline();
+ switch ($underlineType) {
+ case 'single':
+ $underlineType = 'sng';
+ break;
+ case 'double':
+ $underlineType = 'dbl';
+ break;
+ }
+ $objWriter->writeAttribute('u', $underlineType);
+ // Strikethrough
+ $objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
+
+ // rFont
+ $objWriter->startElement($prefix.'latin');
+ $objWriter->writeAttribute('typeface', $element->getFont()->getName());
+ $objWriter->endElement();
+
+ // Superscript / subscript
+// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
+// $objWriter->startElement($prefix.'vertAlign');
+// if ($element->getFont()->getSuperScript()) {
+// $objWriter->writeAttribute('val', 'superscript');
+// } elseif ($element->getFont()->getSubScript()) {
+// $objWriter->writeAttribute('val', 'subscript');
+// }
+// $objWriter->endElement();
+// }
+//
+ $objWriter->endElement();
+
+ // t
+ $objWriter->startElement($prefix.'t');
+// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
+ $objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Flip string table (for index searching)
+ *
+ * @param array $stringTable Stringtable
+ * @return array
+ */
+ public function flipStringTable($stringTable = array())
+ {
+ // Return value
+ $returnValue = array();
+
+ // Loop through stringtable and add flipped items to $returnValue
+ foreach ($stringTable as $key => $value) {
+ if (! $value instanceof PHPExcel_RichText) {
+ $returnValue[$value] = $key;
+ } elseif ($value instanceof PHPExcel_RichText) {
+ $returnValue[$value->getHashCode()] = $key;
+ }
+ }
+
+ return $returnValue;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Style.php b/Classes/PHPExcel/Writer/Excel2007/Style.php
new file mode 100644
index 0000000..d3f0af7
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Style.php
@@ -0,0 +1,696 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // styleSheet
+ $objWriter->startElement('styleSheet');
+ $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
+
+ // numFmts
+ $objWriter->startElement('numFmts');
+ $objWriter->writeAttribute('count', $this->getParentWriter()->getNumFmtHashTable()->count());
+
+ // numFmt
+ for ($i = 0; $i < $this->getParentWriter()->getNumFmtHashTable()->count(); ++$i) {
+ $this->writeNumFmt($objWriter, $this->getParentWriter()->getNumFmtHashTable()->getByIndex($i), $i);
+ }
+
+ $objWriter->endElement();
+
+ // fonts
+ $objWriter->startElement('fonts');
+ $objWriter->writeAttribute('count', $this->getParentWriter()->getFontHashTable()->count());
+
+ // font
+ for ($i = 0; $i < $this->getParentWriter()->getFontHashTable()->count(); ++$i) {
+ $this->writeFont($objWriter, $this->getParentWriter()->getFontHashTable()->getByIndex($i));
+ }
+
+ $objWriter->endElement();
+
+ // fills
+ $objWriter->startElement('fills');
+ $objWriter->writeAttribute('count', $this->getParentWriter()->getFillHashTable()->count());
+
+ // fill
+ for ($i = 0; $i < $this->getParentWriter()->getFillHashTable()->count(); ++$i) {
+ $this->writeFill($objWriter, $this->getParentWriter()->getFillHashTable()->getByIndex($i));
+ }
+
+ $objWriter->endElement();
+
+ // borders
+ $objWriter->startElement('borders');
+ $objWriter->writeAttribute('count', $this->getParentWriter()->getBordersHashTable()->count());
+
+ // border
+ for ($i = 0; $i < $this->getParentWriter()->getBordersHashTable()->count(); ++$i) {
+ $this->writeBorder($objWriter, $this->getParentWriter()->getBordersHashTable()->getByIndex($i));
+ }
+
+ $objWriter->endElement();
+
+ // cellStyleXfs
+ $objWriter->startElement('cellStyleXfs');
+ $objWriter->writeAttribute('count', 1);
+
+ // xf
+ $objWriter->startElement('xf');
+ $objWriter->writeAttribute('numFmtId', 0);
+ $objWriter->writeAttribute('fontId', 0);
+ $objWriter->writeAttribute('fillId', 0);
+ $objWriter->writeAttribute('borderId', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // cellXfs
+ $objWriter->startElement('cellXfs');
+ $objWriter->writeAttribute('count', count($pPHPExcel->getCellXfCollection()));
+
+ // xf
+ foreach ($pPHPExcel->getCellXfCollection() as $cellXf) {
+ $this->writeCellStyleXf($objWriter, $cellXf, $pPHPExcel);
+ }
+
+ $objWriter->endElement();
+
+ // cellStyles
+ $objWriter->startElement('cellStyles');
+ $objWriter->writeAttribute('count', 1);
+
+ // cellStyle
+ $objWriter->startElement('cellStyle');
+ $objWriter->writeAttribute('name', 'Normal');
+ $objWriter->writeAttribute('xfId', 0);
+ $objWriter->writeAttribute('builtinId', 0);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // dxfs
+ $objWriter->startElement('dxfs');
+ $objWriter->writeAttribute('count', $this->getParentWriter()->getStylesConditionalHashTable()->count());
+
+ // dxf
+ for ($i = 0; $i < $this->getParentWriter()->getStylesConditionalHashTable()->count(); ++$i) {
+ $this->writeCellStyleDxf($objWriter, $this->getParentWriter()->getStylesConditionalHashTable()->getByIndex($i)->getStyle());
+ }
+
+ $objWriter->endElement();
+
+ // tableStyles
+ $objWriter->startElement('tableStyles');
+ $objWriter->writeAttribute('defaultTableStyle', 'TableStyleMedium9');
+ $objWriter->writeAttribute('defaultPivotStyle', 'PivotTableStyle1');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write Fill
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_Fill $pFill Fill style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
+ {
+ // Check if this is a pattern type or gradient type
+ if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR ||
+ $pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
+ // Gradient fill
+ $this->writeGradientFill($objWriter, $pFill);
+ } elseif ($pFill->getFillType() !== null) {
+ // Pattern fill
+ $this->writePatternFill($objWriter, $pFill);
+ }
+ }
+
+ /**
+ * Write Gradient Fill
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_Fill $pFill Fill style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeGradientFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
+ {
+ // fill
+ $objWriter->startElement('fill');
+
+ // gradientFill
+ $objWriter->startElement('gradientFill');
+ $objWriter->writeAttribute('type', $pFill->getFillType());
+ $objWriter->writeAttribute('degree', $pFill->getRotation());
+
+ // stop
+ $objWriter->startElement('stop');
+ $objWriter->writeAttribute('position', '0');
+
+ // color
+ $objWriter->startElement('color');
+ $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // stop
+ $objWriter->startElement('stop');
+ $objWriter->writeAttribute('position', '1');
+
+ // color
+ $objWriter->startElement('color');
+ $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Pattern Fill
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_Fill $pFill Fill style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePatternFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
+ {
+ // fill
+ $objWriter->startElement('fill');
+
+ // patternFill
+ $objWriter->startElement('patternFill');
+ $objWriter->writeAttribute('patternType', $pFill->getFillType());
+
+ if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
+ // fgColor
+ if ($pFill->getStartColor()->getARGB()) {
+ $objWriter->startElement('fgColor');
+ $objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
+ $objWriter->endElement();
+ }
+ }
+ if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
+ // bgColor
+ if ($pFill->getEndColor()->getARGB()) {
+ $objWriter->startElement('bgColor');
+ $objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Font
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_Font $pFont Font style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
+ {
+ // font
+ $objWriter->startElement('font');
+ // Weird! The order of these elements actually makes a difference when opening Excel2007
+ // files in Excel2003 with the compatibility pack. It's not documented behaviour,
+ // and makes for a real WTF!
+
+ // Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
+ // for conditional formatting). Otherwise it will apparently not be picked up in conditional
+ // formatting style dialog
+ if ($pFont->getBold() !== null) {
+ $objWriter->startElement('b');
+ $objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
+ $objWriter->endElement();
+ }
+
+ // Italic
+ if ($pFont->getItalic() !== null) {
+ $objWriter->startElement('i');
+ $objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
+ $objWriter->endElement();
+ }
+
+ // Strikethrough
+ if ($pFont->getStrikethrough() !== null) {
+ $objWriter->startElement('strike');
+ $objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
+ $objWriter->endElement();
+ }
+
+ // Underline
+ if ($pFont->getUnderline() !== null) {
+ $objWriter->startElement('u');
+ $objWriter->writeAttribute('val', $pFont->getUnderline());
+ $objWriter->endElement();
+ }
+
+ // Superscript / subscript
+ if ($pFont->getSuperScript() === true || $pFont->getSubScript() === true) {
+ $objWriter->startElement('vertAlign');
+ if ($pFont->getSuperScript() === true) {
+ $objWriter->writeAttribute('val', 'superscript');
+ } elseif ($pFont->getSubScript() === true) {
+ $objWriter->writeAttribute('val', 'subscript');
+ }
+ $objWriter->endElement();
+ }
+
+ // Size
+ if ($pFont->getSize() !== null) {
+ $objWriter->startElement('sz');
+ $objWriter->writeAttribute('val', $pFont->getSize());
+ $objWriter->endElement();
+ }
+
+ // Foreground color
+ if ($pFont->getColor()->getARGB() !== null) {
+ $objWriter->startElement('color');
+ $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
+ $objWriter->endElement();
+ }
+
+ // Name
+ if ($pFont->getName() !== null) {
+ $objWriter->startElement('name');
+ $objWriter->writeAttribute('val', $pFont->getName());
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Border
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_Borders $pBorders Borders style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeBorder(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Borders $pBorders = null)
+ {
+ // Write border
+ $objWriter->startElement('border');
+ // Diagonal?
+ switch ($pBorders->getDiagonalDirection()) {
+ case PHPExcel_Style_Borders::DIAGONAL_UP:
+ $objWriter->writeAttribute('diagonalUp', 'true');
+ $objWriter->writeAttribute('diagonalDown', 'false');
+ break;
+ case PHPExcel_Style_Borders::DIAGONAL_DOWN:
+ $objWriter->writeAttribute('diagonalUp', 'false');
+ $objWriter->writeAttribute('diagonalDown', 'true');
+ break;
+ case PHPExcel_Style_Borders::DIAGONAL_BOTH:
+ $objWriter->writeAttribute('diagonalUp', 'true');
+ $objWriter->writeAttribute('diagonalDown', 'true');
+ break;
+ }
+
+ // BorderPr
+ $this->writeBorderPr($objWriter, 'left', $pBorders->getLeft());
+ $this->writeBorderPr($objWriter, 'right', $pBorders->getRight());
+ $this->writeBorderPr($objWriter, 'top', $pBorders->getTop());
+ $this->writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
+ $this->writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Cell Style Xf
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style $pStyle Style
+ * @param PHPExcel $pPHPExcel Workbook
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null, PHPExcel $pPHPExcel = null)
+ {
+ // xf
+ $objWriter->startElement('xf');
+ $objWriter->writeAttribute('xfId', 0);
+ $objWriter->writeAttribute('fontId', (int)$this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
+ if ($pStyle->getQuotePrefix()) {
+ $objWriter->writeAttribute('quotePrefix', 1);
+ }
+
+ if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
+ $objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
+ } else {
+ $objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
+ }
+
+ $objWriter->writeAttribute('fillId', (int)$this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
+ $objWriter->writeAttribute('borderId', (int)$this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
+
+ // Apply styles?
+ $objWriter->writeAttribute('applyFont', ($pPHPExcel->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
+ $objWriter->writeAttribute('applyNumberFormat', ($pPHPExcel->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
+ $objWriter->writeAttribute('applyFill', ($pPHPExcel->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
+ $objWriter->writeAttribute('applyBorder', ($pPHPExcel->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
+ $objWriter->writeAttribute('applyAlignment', ($pPHPExcel->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
+ if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
+ $objWriter->writeAttribute('applyProtection', 'true');
+ }
+
+ // alignment
+ $objWriter->startElement('alignment');
+ $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
+ $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
+
+ $textRotation = 0;
+ if ($pStyle->getAlignment()->getTextRotation() >= 0) {
+ $textRotation = $pStyle->getAlignment()->getTextRotation();
+ } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
+ $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
+ }
+ $objWriter->writeAttribute('textRotation', $textRotation);
+
+ $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
+ $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
+
+ if ($pStyle->getAlignment()->getIndent() > 0) {
+ $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
+ }
+ if ($pStyle->getAlignment()->getReadorder() > 0) {
+ $objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
+ }
+ $objWriter->endElement();
+
+ // protection
+ if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
+ $objWriter->startElement('protection');
+ if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
+ $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
+ }
+ if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
+ $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
+ }
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Cell Style Dxf
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style $pStyle Style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
+ {
+ // dxf
+ $objWriter->startElement('dxf');
+
+ // font
+ $this->writeFont($objWriter, $pStyle->getFont());
+
+ // numFmt
+ $this->writeNumFmt($objWriter, $pStyle->getNumberFormat());
+
+ // fill
+ $this->writeFill($objWriter, $pStyle->getFill());
+
+ // alignment
+ $objWriter->startElement('alignment');
+ if ($pStyle->getAlignment()->getHorizontal() !== null) {
+ $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
+ }
+ if ($pStyle->getAlignment()->getVertical() !== null) {
+ $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
+ }
+
+ if ($pStyle->getAlignment()->getTextRotation() !== null) {
+ $textRotation = 0;
+ if ($pStyle->getAlignment()->getTextRotation() >= 0) {
+ $textRotation = $pStyle->getAlignment()->getTextRotation();
+ } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
+ $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
+ }
+ $objWriter->writeAttribute('textRotation', $textRotation);
+ }
+ $objWriter->endElement();
+
+ // border
+ $this->writeBorder($objWriter, $pStyle->getBorders());
+
+ // protection
+ if (($pStyle->getProtection()->getLocked() !== null) || ($pStyle->getProtection()->getHidden() !== null)) {
+ if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
+ $pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
+ $objWriter->startElement('protection');
+ if (($pStyle->getProtection()->getLocked() !== null) &&
+ ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
+ $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
+ }
+ if (($pStyle->getProtection()->getHidden() !== null) &&
+ ($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
+ $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
+ }
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write BorderPr
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pName Element name
+ * @param PHPExcel_Style_Border $pBorder Border style
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null)
+ {
+ // Write BorderPr
+ if ($pBorder->getBorderStyle() != PHPExcel_Style_Border::BORDER_NONE) {
+ $objWriter->startElement($pName);
+ $objWriter->writeAttribute('style', $pBorder->getBorderStyle());
+
+ // color
+ $objWriter->startElement('color');
+ $objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write NumberFormat
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Style_NumberFormat $pNumberFormat Number Format
+ * @param int $pId Number Format identifier
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeNumFmt(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_NumberFormat $pNumberFormat = null, $pId = 0)
+ {
+ // Translate formatcode
+ $formatCode = $pNumberFormat->getFormatCode();
+
+ // numFmt
+ if ($formatCode !== null) {
+ $objWriter->startElement('numFmt');
+ $objWriter->writeAttribute('numFmtId', ($pId + 164));
+ $objWriter->writeAttribute('formatCode', $formatCode);
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Get an array of all styles
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style[] All styles in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allStyles(PHPExcel $pPHPExcel = null)
+ {
+ return $pPHPExcel->getCellXfCollection();
+ }
+
+ /**
+ * Get an array of all conditional styles
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style_Conditional[] All conditional styles in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allConditionalStyles(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of all styles
+ $aStyles = array();
+
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ foreach ($pPHPExcel->getSheet($i)->getConditionalStylesCollection() as $conditionalStyles) {
+ foreach ($conditionalStyles as $conditionalStyle) {
+ $aStyles[] = $conditionalStyle;
+ }
+ }
+ }
+
+ return $aStyles;
+ }
+
+ /**
+ * Get an array of all fills
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style_Fill[] All fills in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allFills(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of unique fills
+ $aFills = array();
+
+ // Two first fills are predefined
+ $fill0 = new PHPExcel_Style_Fill();
+ $fill0->setFillType(PHPExcel_Style_Fill::FILL_NONE);
+ $aFills[] = $fill0;
+
+ $fill1 = new PHPExcel_Style_Fill();
+ $fill1->setFillType(PHPExcel_Style_Fill::FILL_PATTERN_GRAY125);
+ $aFills[] = $fill1;
+ // The remaining fills
+ $aStyles = $this->allStyles($pPHPExcel);
+ foreach ($aStyles as $style) {
+ if (!array_key_exists($style->getFill()->getHashCode(), $aFills)) {
+ $aFills[ $style->getFill()->getHashCode() ] = $style->getFill();
+ }
+ }
+
+ return $aFills;
+ }
+
+ /**
+ * Get an array of all fonts
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style_Font[] All fonts in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allFonts(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of unique fonts
+ $aFonts = array();
+ $aStyles = $this->allStyles($pPHPExcel);
+
+ foreach ($aStyles as $style) {
+ if (!array_key_exists($style->getFont()->getHashCode(), $aFonts)) {
+ $aFonts[ $style->getFont()->getHashCode() ] = $style->getFont();
+ }
+ }
+
+ return $aFonts;
+ }
+
+ /**
+ * Get an array of all borders
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style_Borders[] All borders in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allBorders(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of unique borders
+ $aBorders = array();
+ $aStyles = $this->allStyles($pPHPExcel);
+
+ foreach ($aStyles as $style) {
+ if (!array_key_exists($style->getBorders()->getHashCode(), $aBorders)) {
+ $aBorders[ $style->getBorders()->getHashCode() ] = $style->getBorders();
+ }
+ }
+
+ return $aBorders;
+ }
+
+ /**
+ * Get an array of all number formats
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return PHPExcel_Style_NumberFormat[] All number formats in PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function allNumberFormats(PHPExcel $pPHPExcel = null)
+ {
+ // Get an array of unique number formats
+ $aNumFmts = array();
+ $aStyles = $this->allStyles($pPHPExcel);
+
+ foreach ($aStyles as $style) {
+ if ($style->getNumberFormat()->getBuiltInFormatCode() === false && !array_key_exists($style->getNumberFormat()->getHashCode(), $aNumFmts)) {
+ $aNumFmts[ $style->getNumberFormat()->getHashCode() ] = $style->getNumberFormat();
+ }
+ }
+
+ return $aNumFmts;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Theme.php b/Classes/PHPExcel/Writer/Excel2007/Theme.php
new file mode 100644
index 0000000..223e402
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Theme.php
@@ -0,0 +1,869 @@
+ 'ï¼ï¼³ Pゴシック',
+ 'Hang' => 'ë§‘ì€ ê³ ë”•',
+ 'Hans' => '宋体',
+ 'Hant' => '新細明體',
+ 'Arab' => 'Times New Roman',
+ 'Hebr' => 'Times New Roman',
+ 'Thai' => 'Tahoma',
+ 'Ethi' => 'Nyala',
+ 'Beng' => 'Vrinda',
+ 'Gujr' => 'Shruti',
+ 'Khmr' => 'MoolBoran',
+ 'Knda' => 'Tunga',
+ 'Guru' => 'Raavi',
+ 'Cans' => 'Euphemia',
+ 'Cher' => 'Plantagenet Cherokee',
+ 'Yiii' => 'Microsoft Yi Baiti',
+ 'Tibt' => 'Microsoft Himalaya',
+ 'Thaa' => 'MV Boli',
+ 'Deva' => 'Mangal',
+ 'Telu' => 'Gautami',
+ 'Taml' => 'Latha',
+ 'Syrc' => 'Estrangelo Edessa',
+ 'Orya' => 'Kalinga',
+ 'Mlym' => 'Kartika',
+ 'Laoo' => 'DokChampa',
+ 'Sinh' => 'Iskoola Pota',
+ 'Mong' => 'Mongolian Baiti',
+ 'Viet' => 'Times New Roman',
+ 'Uigh' => 'Microsoft Uighur',
+ 'Geor' => 'Sylfaen',
+ );
+
+ /**
+ * Map of Minor fonts to write
+ * @static array of string
+ *
+ */
+ private static $minorFonts = array(
+ 'Jpan' => 'ï¼ï¼³ Pゴシック',
+ 'Hang' => 'ë§‘ì€ ê³ ë”•',
+ 'Hans' => '宋体',
+ 'Hant' => '新細明體',
+ 'Arab' => 'Arial',
+ 'Hebr' => 'Arial',
+ 'Thai' => 'Tahoma',
+ 'Ethi' => 'Nyala',
+ 'Beng' => 'Vrinda',
+ 'Gujr' => 'Shruti',
+ 'Khmr' => 'DaunPenh',
+ 'Knda' => 'Tunga',
+ 'Guru' => 'Raavi',
+ 'Cans' => 'Euphemia',
+ 'Cher' => 'Plantagenet Cherokee',
+ 'Yiii' => 'Microsoft Yi Baiti',
+ 'Tibt' => 'Microsoft Himalaya',
+ 'Thaa' => 'MV Boli',
+ 'Deva' => 'Mangal',
+ 'Telu' => 'Gautami',
+ 'Taml' => 'Latha',
+ 'Syrc' => 'Estrangelo Edessa',
+ 'Orya' => 'Kalinga',
+ 'Mlym' => 'Kartika',
+ 'Laoo' => 'DokChampa',
+ 'Sinh' => 'Iskoola Pota',
+ 'Mong' => 'Mongolian Baiti',
+ 'Viet' => 'Arial',
+ 'Uigh' => 'Microsoft Uighur',
+ 'Geor' => 'Sylfaen',
+ );
+
+ /**
+ * Map of core colours
+ * @static array of string
+ *
+ */
+ private static $colourScheme = array(
+ 'dk2' => '1F497D',
+ 'lt2' => 'EEECE1',
+ 'accent1' => '4F81BD',
+ 'accent2' => 'C0504D',
+ 'accent3' => '9BBB59',
+ 'accent4' => '8064A2',
+ 'accent5' => '4BACC6',
+ 'accent6' => 'F79646',
+ 'hlink' => '0000FF',
+ 'folHlink' => '800080',
+ );
+
+ /**
+ * Write theme to XML format
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function writeTheme(PHPExcel $pPHPExcel = null)
+ {
+ // Create XML writer
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // a:theme
+ $objWriter->startElement('a:theme');
+ $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
+ $objWriter->writeAttribute('name', 'Office Theme');
+
+ // a:themeElements
+ $objWriter->startElement('a:themeElements');
+
+ // a:clrScheme
+ $objWriter->startElement('a:clrScheme');
+ $objWriter->writeAttribute('name', 'Office');
+
+ // a:dk1
+ $objWriter->startElement('a:dk1');
+
+ // a:sysClr
+ $objWriter->startElement('a:sysClr');
+ $objWriter->writeAttribute('val', 'windowText');
+ $objWriter->writeAttribute('lastClr', '000000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:lt1
+ $objWriter->startElement('a:lt1');
+
+ // a:sysClr
+ $objWriter->startElement('a:sysClr');
+ $objWriter->writeAttribute('val', 'window');
+ $objWriter->writeAttribute('lastClr', 'FFFFFF');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:dk2
+ $this->writeColourScheme($objWriter);
+
+ $objWriter->endElement();
+
+ // a:fontScheme
+ $objWriter->startElement('a:fontScheme');
+ $objWriter->writeAttribute('name', 'Office');
+
+ // a:majorFont
+ $objWriter->startElement('a:majorFont');
+ $this->writeFonts($objWriter, 'Cambria', self::$majorFonts);
+ $objWriter->endElement();
+
+ // a:minorFont
+ $objWriter->startElement('a:minorFont');
+ $this->writeFonts($objWriter, 'Calibri', self::$minorFonts);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:fmtScheme
+ $objWriter->startElement('a:fmtScheme');
+ $objWriter->writeAttribute('name', 'Office');
+
+ // a:fillStyleLst
+ $objWriter->startElement('a:fillStyleLst');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gradFill
+ $objWriter->startElement('a:gradFill');
+ $objWriter->writeAttribute('rotWithShape', '1');
+
+ // a:gsLst
+ $objWriter->startElement('a:gsLst');
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '0');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '50000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '300000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '35000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '37000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '300000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '100000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '15000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '350000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:lin
+ $objWriter->startElement('a:lin');
+ $objWriter->writeAttribute('ang', '16200000');
+ $objWriter->writeAttribute('scaled', '1');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gradFill
+ $objWriter->startElement('a:gradFill');
+ $objWriter->writeAttribute('rotWithShape', '1');
+
+ // a:gsLst
+ $objWriter->startElement('a:gsLst');
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '0');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '51000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '130000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '80000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '93000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '130000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '100000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '94000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '135000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:lin
+ $objWriter->startElement('a:lin');
+ $objWriter->writeAttribute('ang', '16200000');
+ $objWriter->writeAttribute('scaled', '0');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:lnStyleLst
+ $objWriter->startElement('a:lnStyleLst');
+
+ // a:ln
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', '9525');
+ $objWriter->writeAttribute('cap', 'flat');
+ $objWriter->writeAttribute('cmpd', 'sng');
+ $objWriter->writeAttribute('algn', 'ctr');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '95000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '105000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:prstDash
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', 'solid');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:ln
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', '25400');
+ $objWriter->writeAttribute('cap', 'flat');
+ $objWriter->writeAttribute('cmpd', 'sng');
+ $objWriter->writeAttribute('algn', 'ctr');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:prstDash
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', 'solid');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:ln
+ $objWriter->startElement('a:ln');
+ $objWriter->writeAttribute('w', '38100');
+ $objWriter->writeAttribute('cap', 'flat');
+ $objWriter->writeAttribute('cmpd', 'sng');
+ $objWriter->writeAttribute('algn', 'ctr');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:prstDash
+ $objWriter->startElement('a:prstDash');
+ $objWriter->writeAttribute('val', 'solid');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+
+
+ // a:effectStyleLst
+ $objWriter->startElement('a:effectStyleLst');
+
+ // a:effectStyle
+ $objWriter->startElement('a:effectStyle');
+
+ // a:effectLst
+ $objWriter->startElement('a:effectLst');
+
+ // a:outerShdw
+ $objWriter->startElement('a:outerShdw');
+ $objWriter->writeAttribute('blurRad', '40000');
+ $objWriter->writeAttribute('dist', '20000');
+ $objWriter->writeAttribute('dir', '5400000');
+ $objWriter->writeAttribute('rotWithShape', '0');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', '000000');
+
+ // a:alpha
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', '38000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:effectStyle
+ $objWriter->startElement('a:effectStyle');
+
+ // a:effectLst
+ $objWriter->startElement('a:effectLst');
+
+ // a:outerShdw
+ $objWriter->startElement('a:outerShdw');
+ $objWriter->writeAttribute('blurRad', '40000');
+ $objWriter->writeAttribute('dist', '23000');
+ $objWriter->writeAttribute('dir', '5400000');
+ $objWriter->writeAttribute('rotWithShape', '0');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', '000000');
+
+ // a:alpha
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', '35000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:effectStyle
+ $objWriter->startElement('a:effectStyle');
+
+ // a:effectLst
+ $objWriter->startElement('a:effectLst');
+
+ // a:outerShdw
+ $objWriter->startElement('a:outerShdw');
+ $objWriter->writeAttribute('blurRad', '40000');
+ $objWriter->writeAttribute('dist', '23000');
+ $objWriter->writeAttribute('dir', '5400000');
+ $objWriter->writeAttribute('rotWithShape', '0');
+
+ // a:srgbClr
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', '000000');
+
+ // a:alpha
+ $objWriter->startElement('a:alpha');
+ $objWriter->writeAttribute('val', '35000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:scene3d
+ $objWriter->startElement('a:scene3d');
+
+ // a:camera
+ $objWriter->startElement('a:camera');
+ $objWriter->writeAttribute('prst', 'orthographicFront');
+
+ // a:rot
+ $objWriter->startElement('a:rot');
+ $objWriter->writeAttribute('lat', '0');
+ $objWriter->writeAttribute('lon', '0');
+ $objWriter->writeAttribute('rev', '0');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:lightRig
+ $objWriter->startElement('a:lightRig');
+ $objWriter->writeAttribute('rig', 'threePt');
+ $objWriter->writeAttribute('dir', 't');
+
+ // a:rot
+ $objWriter->startElement('a:rot');
+ $objWriter->writeAttribute('lat', '0');
+ $objWriter->writeAttribute('lon', '0');
+ $objWriter->writeAttribute('rev', '1200000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:sp3d
+ $objWriter->startElement('a:sp3d');
+
+ // a:bevelT
+ $objWriter->startElement('a:bevelT');
+ $objWriter->writeAttribute('w', '63500');
+ $objWriter->writeAttribute('h', '25400');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:bgFillStyleLst
+ $objWriter->startElement('a:bgFillStyleLst');
+
+ // a:solidFill
+ $objWriter->startElement('a:solidFill');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gradFill
+ $objWriter->startElement('a:gradFill');
+ $objWriter->writeAttribute('rotWithShape', '1');
+
+ // a:gsLst
+ $objWriter->startElement('a:gsLst');
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '0');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '40000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '350000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '40000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '45000');
+ $objWriter->endElement();
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '99000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '350000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '100000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '20000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '255000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:path
+ $objWriter->startElement('a:path');
+ $objWriter->writeAttribute('path', 'circle');
+
+ // a:fillToRect
+ $objWriter->startElement('a:fillToRect');
+ $objWriter->writeAttribute('l', '50000');
+ $objWriter->writeAttribute('t', '-80000');
+ $objWriter->writeAttribute('r', '50000');
+ $objWriter->writeAttribute('b', '180000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gradFill
+ $objWriter->startElement('a:gradFill');
+ $objWriter->writeAttribute('rotWithShape', '1');
+
+ // a:gsLst
+ $objWriter->startElement('a:gsLst');
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '0');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:tint
+ $objWriter->startElement('a:tint');
+ $objWriter->writeAttribute('val', '80000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '300000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:gs
+ $objWriter->startElement('a:gs');
+ $objWriter->writeAttribute('pos', '100000');
+
+ // a:schemeClr
+ $objWriter->startElement('a:schemeClr');
+ $objWriter->writeAttribute('val', 'phClr');
+
+ // a:shade
+ $objWriter->startElement('a:shade');
+ $objWriter->writeAttribute('val', '30000');
+ $objWriter->endElement();
+
+ // a:satMod
+ $objWriter->startElement('a:satMod');
+ $objWriter->writeAttribute('val', '200000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:path
+ $objWriter->startElement('a:path');
+ $objWriter->writeAttribute('path', 'circle');
+
+ // a:fillToRect
+ $objWriter->startElement('a:fillToRect');
+ $objWriter->writeAttribute('l', '50000');
+ $objWriter->writeAttribute('t', '50000');
+ $objWriter->writeAttribute('r', '50000');
+ $objWriter->writeAttribute('b', '50000');
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ // a:objectDefaults
+ $objWriter->writeElement('a:objectDefaults', null);
+
+ // a:extraClrSchemeLst
+ $objWriter->writeElement('a:extraClrSchemeLst', null);
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write fonts to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ * @param string $latinFont
+ * @param array of string $fontSet
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeFonts($objWriter, $latinFont, $fontSet)
+ {
+ // a:latin
+ $objWriter->startElement('a:latin');
+ $objWriter->writeAttribute('typeface', $latinFont);
+ $objWriter->endElement();
+
+ // a:ea
+ $objWriter->startElement('a:ea');
+ $objWriter->writeAttribute('typeface', '');
+ $objWriter->endElement();
+
+ // a:cs
+ $objWriter->startElement('a:cs');
+ $objWriter->writeAttribute('typeface', '');
+ $objWriter->endElement();
+
+ foreach ($fontSet as $fontScript => $typeface) {
+ $objWriter->startElement('a:font');
+ $objWriter->writeAttribute('script', $fontScript);
+ $objWriter->writeAttribute('typeface', $typeface);
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write colour scheme to XML format
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeColourScheme($objWriter)
+ {
+ foreach (self::$colourScheme as $colourName => $colourValue) {
+ $objWriter->startElement('a:'.$colourName);
+
+ $objWriter->startElement('a:srgbClr');
+ $objWriter->writeAttribute('val', $colourValue);
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Workbook.php b/Classes/PHPExcel/Writer/Excel2007/Workbook.php
new file mode 100644
index 0000000..87c877e
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Workbook.php
@@ -0,0 +1,448 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // workbook
+ $objWriter->startElement('workbook');
+ $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
+ $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
+
+ // fileVersion
+ $this->writeFileVersion($objWriter);
+
+ // workbookPr
+ $this->writeWorkbookPr($objWriter);
+
+ // workbookProtection
+ $this->writeWorkbookProtection($objWriter, $pPHPExcel);
+
+ // bookViews
+ if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
+ $this->writeBookViews($objWriter, $pPHPExcel);
+ }
+
+ // sheets
+ $this->writeSheets($objWriter, $pPHPExcel);
+
+ // definedNames
+ $this->writeDefinedNames($objWriter, $pPHPExcel);
+
+ // calcPr
+ $this->writeCalcPr($objWriter, $recalcRequired);
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write file version
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter = null)
+ {
+ $objWriter->startElement('fileVersion');
+ $objWriter->writeAttribute('appName', 'xl');
+ $objWriter->writeAttribute('lastEdited', '4');
+ $objWriter->writeAttribute('lowestEdited', '4');
+ $objWriter->writeAttribute('rupBuild', '4505');
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write WorkbookPr
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter = null)
+ {
+ $objWriter->startElement('workbookPr');
+
+ if (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904) {
+ $objWriter->writeAttribute('date1904', '1');
+ }
+
+ $objWriter->writeAttribute('codeName', 'ThisWorkbook');
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write BookViews
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel $pPHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeBookViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
+ {
+ // bookViews
+ $objWriter->startElement('bookViews');
+
+ // workbookView
+ $objWriter->startElement('workbookView');
+
+ $objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
+ $objWriter->writeAttribute('autoFilterDateGrouping', '1');
+ $objWriter->writeAttribute('firstSheet', '0');
+ $objWriter->writeAttribute('minimized', '0');
+ $objWriter->writeAttribute('showHorizontalScroll', '1');
+ $objWriter->writeAttribute('showSheetTabs', '1');
+ $objWriter->writeAttribute('showVerticalScroll', '1');
+ $objWriter->writeAttribute('tabRatio', '600');
+ $objWriter->writeAttribute('visibility', 'visible');
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write WorkbookProtection
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel $pPHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
+ {
+ if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
+ $objWriter->startElement('workbookProtection');
+ $objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
+ $objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
+ $objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
+
+ if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') {
+ $objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
+ }
+
+ if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') {
+ $objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write calcPr
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param boolean $recalcRequired Indicate whether formulas should be recalculated before writing
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter = null, $recalcRequired = true)
+ {
+ $objWriter->startElement('calcPr');
+
+ // Set the calcid to a higher value than Excel itself will use, otherwise Excel will always recalc
+ // If MS Excel does do a recalc, then users opening a file in MS Excel will be prompted to save on exit
+ // because the file has changed
+ $objWriter->writeAttribute('calcId', '999999');
+ $objWriter->writeAttribute('calcMode', 'auto');
+ // fullCalcOnLoad isn't needed if we've recalculating for the save
+ $objWriter->writeAttribute('calcCompleted', ($recalcRequired) ? 1 : 0);
+ $objWriter->writeAttribute('fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write sheets
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel $pPHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheets(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
+ {
+ // Write sheets
+ $objWriter->startElement('sheets');
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ // sheet
+ $this->writeSheet(
+ $objWriter,
+ $pPHPExcel->getSheet($i)->getTitle(),
+ ($i + 1),
+ ($i + 1 + 3),
+ $pPHPExcel->getSheet($i)->getSheetState()
+ );
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write sheet
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param string $pSheetname Sheet name
+ * @param int $pSheetId Sheet id
+ * @param int $pRelId Relationship ID
+ * @param string $sheetState Sheet state (visible, hidden, veryHidden)
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheet(PHPExcel_Shared_XMLWriter $objWriter = null, $pSheetname = '', $pSheetId = 1, $pRelId = 1, $sheetState = 'visible')
+ {
+ if ($pSheetname != '') {
+ // Write sheet
+ $objWriter->startElement('sheet');
+ $objWriter->writeAttribute('name', $pSheetname);
+ $objWriter->writeAttribute('sheetId', $pSheetId);
+ if ($sheetState != 'visible' && $sheetState != '') {
+ $objWriter->writeAttribute('state', $sheetState);
+ }
+ $objWriter->writeAttribute('r:id', 'rId' . $pRelId);
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Write Defined Names
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel $pPHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel = null)
+ {
+ // Write defined names
+ $objWriter->startElement('definedNames');
+
+ // Named ranges
+ if (count($pPHPExcel->getNamedRanges()) > 0) {
+ // Named ranges
+ $this->writeNamedRanges($objWriter, $pPHPExcel);
+ }
+
+ // Other defined names
+ $sheetCount = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheetCount; ++$i) {
+ // definedName for autoFilter
+ $this->writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i);
+
+ // definedName for Print_Titles
+ $this->writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i);
+
+ // definedName for Print_Area
+ $this->writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i);
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write named ranges
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel $pPHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel)
+ {
+ // Loop named ranges
+ $namedRanges = $pPHPExcel->getNamedRanges();
+ foreach ($namedRanges as $namedRange) {
+ $this->writeDefinedNameForNamedRange($objWriter, $namedRange);
+ }
+ }
+
+ /**
+ * Write Defined Name for named range
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_NamedRange $pNamedRange
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_NamedRange $pNamedRange)
+ {
+ // definedName for named range
+ $objWriter->startElement('definedName');
+ $objWriter->writeAttribute('name', $pNamedRange->getName());
+ if ($pNamedRange->getLocalOnly()) {
+ $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
+ }
+
+ // Create absolute coordinate and write as raw text
+ $range = PHPExcel_Cell::splitRange($pNamedRange->getRange());
+ for ($i = 0; $i < count($range); $i++) {
+ $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]);
+ if (isset($range[$i][1])) {
+ $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]);
+ }
+ }
+ $range = PHPExcel_Cell::buildRange($range);
+
+ $objWriter->writeRawData($range);
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Defined Name for autoFilter
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet
+ * @param int $pSheetId
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
+ {
+ // definedName for autoFilter
+ $autoFilterRange = $pSheet->getAutoFilter()->getRange();
+ if (!empty($autoFilterRange)) {
+ $objWriter->startElement('definedName');
+ $objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
+ $objWriter->writeAttribute('localSheetId', $pSheetId);
+ $objWriter->writeAttribute('hidden', '1');
+
+ // Create absolute coordinate and write as raw text
+ $range = PHPExcel_Cell::splitRange($autoFilterRange);
+ $range = $range[0];
+ // Strip any worksheet ref so we can make the cell ref absolute
+ if (strpos($range[0], '!') !== false) {
+ list($ws, $range[0]) = explode('!', $range[0]);
+ }
+
+ $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]);
+ $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]);
+ $range = implode(':', $range);
+
+ $objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range);
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write Defined Name for PrintTitles
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet
+ * @param int $pSheetId
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
+ {
+ // definedName for PrintTitles
+ if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
+ $objWriter->startElement('definedName');
+ $objWriter->writeAttribute('name', '_xlnm.Print_Titles');
+ $objWriter->writeAttribute('localSheetId', $pSheetId);
+
+ // Setting string
+ $settingString = '';
+
+ // Columns to repeat
+ if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
+ $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft();
+
+ $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
+ }
+
+ // Rows to repeat
+ if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
+ if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
+ $settingString .= ',';
+ }
+
+ $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop();
+
+ $settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
+ }
+
+ $objWriter->writeRawData($settingString);
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write Defined Name for PrintTitles
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet
+ * @param int $pSheetId
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0)
+ {
+ // definedName for PrintArea
+ if ($pSheet->getPageSetup()->isPrintAreaSet()) {
+ $objWriter->startElement('definedName');
+ $objWriter->writeAttribute('name', '_xlnm.Print_Area');
+ $objWriter->writeAttribute('localSheetId', $pSheetId);
+
+ // Setting string
+ $settingString = '';
+
+ // Print area
+ $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea());
+
+ $chunks = array();
+ foreach ($printArea as $printAreaRect) {
+ $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]);
+ $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]);
+ $chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect);
+ }
+
+ $objWriter->writeRawData(implode(',', $chunks));
+
+ $objWriter->endElement();
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/Worksheet.php b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php
new file mode 100644
index 0000000..c211403
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/Worksheet.php
@@ -0,0 +1,1219 @@
+getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8', 'yes');
+
+ // Worksheet
+ $objWriter->startElement('worksheet');
+ $objWriter->writeAttribute('xml:space', 'preserve');
+ $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
+ $objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
+
+ // sheetPr
+ $this->writeSheetPr($objWriter, $pSheet);
+
+ // Dimension
+ $this->writeDimension($objWriter, $pSheet);
+
+ // sheetViews
+ $this->writeSheetViews($objWriter, $pSheet);
+
+ // sheetFormatPr
+ $this->writeSheetFormatPr($objWriter, $pSheet);
+
+ // cols
+ $this->writeCols($objWriter, $pSheet);
+
+ // sheetData
+ $this->writeSheetData($objWriter, $pSheet, $pStringTable);
+
+ // sheetProtection
+ $this->writeSheetProtection($objWriter, $pSheet);
+
+ // protectedRanges
+ $this->writeProtectedRanges($objWriter, $pSheet);
+
+ // autoFilter
+ $this->writeAutoFilter($objWriter, $pSheet);
+
+ // mergeCells
+ $this->writeMergeCells($objWriter, $pSheet);
+
+ // conditionalFormatting
+ $this->writeConditionalFormatting($objWriter, $pSheet);
+
+ // dataValidations
+ $this->writeDataValidations($objWriter, $pSheet);
+
+ // hyperlinks
+ $this->writeHyperlinks($objWriter, $pSheet);
+
+ // Print options
+ $this->writePrintOptions($objWriter, $pSheet);
+
+ // Page margins
+ $this->writePageMargins($objWriter, $pSheet);
+
+ // Page setup
+ $this->writePageSetup($objWriter, $pSheet);
+
+ // Header / footer
+ $this->writeHeaderFooter($objWriter, $pSheet);
+
+ // Breaks
+ $this->writeBreaks($objWriter, $pSheet);
+
+ // Drawings and/or Charts
+ $this->writeDrawings($objWriter, $pSheet, $includeCharts);
+
+ // LegacyDrawing
+ $this->writeLegacyDrawing($objWriter, $pSheet);
+
+ // LegacyDrawingHF
+ $this->writeLegacyDrawingHF($objWriter, $pSheet);
+
+ $objWriter->endElement();
+
+ // Return
+ return $objWriter->getData();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid PHPExcel_Worksheet object passed.");
+ }
+ }
+
+ /**
+ * Write SheetPr
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheetPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // sheetPr
+ $objWriter->startElement('sheetPr');
+ //$objWriter->writeAttribute('codeName', $pSheet->getTitle());
+ if ($pSheet->getParent()->hasMacros()) {//if the workbook have macros, we need to have codeName for the sheet
+ if ($pSheet->hasCodeName()==false) {
+ $pSheet->setCodeName($pSheet->getTitle());
+ }
+ $objWriter->writeAttribute('codeName', $pSheet->getCodeName());
+ }
+ $autoFilterRange = $pSheet->getAutoFilter()->getRange();
+ if (!empty($autoFilterRange)) {
+ $objWriter->writeAttribute('filterMode', 1);
+ $pSheet->getAutoFilter()->showHideRows();
+ }
+
+ // tabColor
+ if ($pSheet->isTabColorSet()) {
+ $objWriter->startElement('tabColor');
+ $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
+ $objWriter->endElement();
+ }
+
+ // outlinePr
+ $objWriter->startElement('outlinePr');
+ $objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
+ $objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
+ $objWriter->endElement();
+
+ // pageSetUpPr
+ if ($pSheet->getPageSetup()->getFitToPage()) {
+ $objWriter->startElement('pageSetUpPr');
+ $objWriter->writeAttribute('fitToPage', '1');
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Dimension
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDimension(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // dimension
+ $objWriter->startElement('dimension');
+ $objWriter->writeAttribute('ref', $pSheet->calculateWorksheetDimension());
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write SheetViews
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // sheetViews
+ $objWriter->startElement('sheetViews');
+
+ // Sheet selected?
+ $sheetSelected = false;
+ if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
+ $sheetSelected = true;
+ }
+
+ // sheetView
+ $objWriter->startElement('sheetView');
+ $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
+ $objWriter->writeAttribute('workbookViewId', '0');
+
+ // Zoom scales
+ if ($pSheet->getSheetView()->getZoomScale() != 100) {
+ $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
+ }
+ if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
+ $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
+ }
+
+ // View Layout Type
+ if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
+ $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
+ }
+
+ // Gridlines
+ if ($pSheet->getShowGridlines()) {
+ $objWriter->writeAttribute('showGridLines', 'true');
+ } else {
+ $objWriter->writeAttribute('showGridLines', 'false');
+ }
+
+ // Row and column headers
+ if ($pSheet->getShowRowColHeaders()) {
+ $objWriter->writeAttribute('showRowColHeaders', '1');
+ } else {
+ $objWriter->writeAttribute('showRowColHeaders', '0');
+ }
+
+ // Right-to-left
+ if ($pSheet->getRightToLeft()) {
+ $objWriter->writeAttribute('rightToLeft', 'true');
+ }
+
+ $activeCell = $pSheet->getActiveCell();
+
+ // Pane
+ $pane = '';
+ $topLeftCell = $pSheet->getFreezePane();
+ if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
+ $activeCell = empty($activeCell) ? $topLeftCell : $activeCell;
+ // Calculate freeze coordinates
+ $xSplit = $ySplit = 0;
+
+ list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
+ $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
+
+ // pane
+ $pane = 'topRight';
+ $objWriter->startElement('pane');
+ if ($xSplit > 1) {
+ $objWriter->writeAttribute('xSplit', $xSplit - 1);
+ }
+ if ($ySplit > 1) {
+ $objWriter->writeAttribute('ySplit', $ySplit - 1);
+ $pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
+ }
+ $objWriter->writeAttribute('topLeftCell', $topLeftCell);
+ $objWriter->writeAttribute('activePane', $pane);
+ $objWriter->writeAttribute('state', 'frozen');
+ $objWriter->endElement();
+
+ if (($xSplit > 1) && ($ySplit > 1)) {
+ // Write additional selections if more than two panes (ie both an X and a Y split)
+ $objWriter->startElement('selection');
+ $objWriter->writeAttribute('pane', 'topRight');
+ $objWriter->endElement();
+ $objWriter->startElement('selection');
+ $objWriter->writeAttribute('pane', 'bottomLeft');
+ $objWriter->endElement();
+ }
+ }
+
+ // Selection
+// if ($pane != '') {
+ // Only need to write selection element if we have a split pane
+ // We cheat a little by over-riding the active cell selection, setting it to the split cell
+ $objWriter->startElement('selection');
+ if ($pane != '') {
+ $objWriter->writeAttribute('pane', $pane);
+ }
+ $objWriter->writeAttribute('activeCell', $activeCell);
+ $objWriter->writeAttribute('sqref', $activeCell);
+ $objWriter->endElement();
+// }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write SheetFormatPr
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheetFormatPr(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // sheetFormatPr
+ $objWriter->startElement('sheetFormatPr');
+
+ // Default row height
+ if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
+ $objWriter->writeAttribute('customHeight', 'true');
+ $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
+ } else {
+ $objWriter->writeAttribute('defaultRowHeight', '14.4');
+ }
+
+ // Set Zero Height row
+ if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
+ strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') {
+ $objWriter->writeAttribute('zeroHeight', '1');
+ }
+
+ // Default column width
+ if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
+ $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
+ }
+
+ // Outline level - row
+ $outlineLevelRow = 0;
+ foreach ($pSheet->getRowDimensions() as $dimension) {
+ if ($dimension->getOutlineLevel() > $outlineLevelRow) {
+ $outlineLevelRow = $dimension->getOutlineLevel();
+ }
+ }
+ $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
+
+ // Outline level - column
+ $outlineLevelCol = 0;
+ foreach ($pSheet->getColumnDimensions() as $dimension) {
+ if ($dimension->getOutlineLevel() > $outlineLevelCol) {
+ $outlineLevelCol = $dimension->getOutlineLevel();
+ }
+ }
+ $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Cols
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // cols
+ if (count($pSheet->getColumnDimensions()) > 0) {
+ $objWriter->startElement('cols');
+
+ $pSheet->calculateColumnWidths();
+
+ // Loop through column dimensions
+ foreach ($pSheet->getColumnDimensions() as $colDimension) {
+ // col
+ $objWriter->startElement('col');
+ $objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
+ $objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
+
+ if ($colDimension->getWidth() < 0) {
+ // No width set, apply default of 10
+ $objWriter->writeAttribute('width', '9.10');
+ } else {
+ // Width set
+ $objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
+ }
+
+ // Column visibility
+ if ($colDimension->getVisible() == false) {
+ $objWriter->writeAttribute('hidden', 'true');
+ }
+
+ // Auto size?
+ if ($colDimension->getAutoSize()) {
+ $objWriter->writeAttribute('bestFit', 'true');
+ }
+
+ // Custom width?
+ if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
+ $objWriter->writeAttribute('customWidth', 'true');
+ }
+
+ // Collapsed
+ if ($colDimension->getCollapsed() == true) {
+ $objWriter->writeAttribute('collapsed', 'true');
+ }
+
+ // Outline level
+ if ($colDimension->getOutlineLevel() > 0) {
+ $objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
+ }
+
+ // Style
+ $objWriter->writeAttribute('style', $colDimension->getXfIndex());
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write SheetProtection
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheetProtection(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // sheetProtection
+ $objWriter->startElement('sheetProtection');
+
+ if ($pSheet->getProtection()->getPassword() != '') {
+ $objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
+ }
+
+ $objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
+ $objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
+ $objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
+ $objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
+ $objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
+ $objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
+ $objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
+ $objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
+ $objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
+ $objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
+ $objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
+ $objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
+ $objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
+ $objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
+ $objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
+ $objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write ConditionalFormatting
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeConditionalFormatting(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // Conditional id
+ $id = 1;
+
+ // Loop through styles in the current worksheet
+ foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
+ foreach ($conditionalStyles as $conditional) {
+ // WHY was this again?
+ // if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') {
+ // continue;
+ // }
+ if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) {
+ // conditionalFormatting
+ $objWriter->startElement('conditionalFormatting');
+ $objWriter->writeAttribute('sqref', $cellCoordinate);
+
+ // cfRule
+ $objWriter->startElement('cfRule');
+ $objWriter->writeAttribute('type', $conditional->getConditionType());
+ $objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
+ $objWriter->writeAttribute('priority', $id++);
+
+ if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
+ && $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
+ $objWriter->writeAttribute('operator', $conditional->getOperatorType());
+ }
+
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ && !is_null($conditional->getText())) {
+ $objWriter->writeAttribute('text', $conditional->getText());
+ }
+
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
+ && !is_null($conditional->getText())) {
+ $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
+ && !is_null($conditional->getText())) {
+ $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
+ && !is_null($conditional->getText())) {
+ $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
+ && !is_null($conditional->getText())) {
+ $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
+ foreach ($conditional->getConditions() as $formula) {
+ // Formula
+ $objWriter->writeElement('formula', $formula);
+ }
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+ }
+ }
+
+ /**
+ * Write DataValidations
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDataValidations(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // Datavalidation collection
+ $dataValidationCollection = $pSheet->getDataValidationCollection();
+
+ // Write data validations?
+ if (!empty($dataValidationCollection)) {
+ $objWriter->startElement('dataValidations');
+ $objWriter->writeAttribute('count', count($dataValidationCollection));
+
+ foreach ($dataValidationCollection as $coordinate => $dv) {
+ $objWriter->startElement('dataValidation');
+
+ if ($dv->getType() != '') {
+ $objWriter->writeAttribute('type', $dv->getType());
+ }
+
+ if ($dv->getErrorStyle() != '') {
+ $objWriter->writeAttribute('errorStyle', $dv->getErrorStyle());
+ }
+
+ if ($dv->getOperator() != '') {
+ $objWriter->writeAttribute('operator', $dv->getOperator());
+ }
+
+ $objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
+ $objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
+ $objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
+ $objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
+
+ if ($dv->getErrorTitle() !== '') {
+ $objWriter->writeAttribute('errorTitle', $dv->getErrorTitle());
+ }
+ if ($dv->getError() !== '') {
+ $objWriter->writeAttribute('error', $dv->getError());
+ }
+ if ($dv->getPromptTitle() !== '') {
+ $objWriter->writeAttribute('promptTitle', $dv->getPromptTitle());
+ }
+ if ($dv->getPrompt() !== '') {
+ $objWriter->writeAttribute('prompt', $dv->getPrompt());
+ }
+
+ $objWriter->writeAttribute('sqref', $coordinate);
+
+ if ($dv->getFormula1() !== '') {
+ $objWriter->writeElement('formula1', $dv->getFormula1());
+ }
+ if ($dv->getFormula2() !== '') {
+ $objWriter->writeElement('formula2', $dv->getFormula2());
+ }
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write Hyperlinks
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeHyperlinks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // Hyperlink collection
+ $hyperlinkCollection = $pSheet->getHyperlinkCollection();
+
+ // Relation ID
+ $relationId = 1;
+
+ // Write hyperlinks?
+ if (!empty($hyperlinkCollection)) {
+ $objWriter->startElement('hyperlinks');
+
+ foreach ($hyperlinkCollection as $coordinate => $hyperlink) {
+ $objWriter->startElement('hyperlink');
+
+ $objWriter->writeAttribute('ref', $coordinate);
+ if (!$hyperlink->isInternal()) {
+ $objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
+ ++$relationId;
+ } else {
+ $objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
+ }
+
+ if ($hyperlink->getTooltip() != '') {
+ $objWriter->writeAttribute('tooltip', $hyperlink->getTooltip());
+ }
+
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write ProtectedRanges
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeProtectedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ if (count($pSheet->getProtectedCells()) > 0) {
+ // protectedRanges
+ $objWriter->startElement('protectedRanges');
+
+ // Loop protectedRanges
+ foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
+ // protectedRange
+ $objWriter->startElement('protectedRange');
+ $objWriter->writeAttribute('name', 'p' . md5($protectedCell));
+ $objWriter->writeAttribute('sqref', $protectedCell);
+ if (!empty($passwordHash)) {
+ $objWriter->writeAttribute('password', $passwordHash);
+ }
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write MergeCells
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeMergeCells(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ if (count($pSheet->getMergeCells()) > 0) {
+ // mergeCells
+ $objWriter->startElement('mergeCells');
+
+ // Loop mergeCells
+ foreach ($pSheet->getMergeCells() as $mergeCell) {
+ // mergeCell
+ $objWriter->startElement('mergeCell');
+ $objWriter->writeAttribute('ref', $mergeCell);
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write PrintOptions
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePrintOptions(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // printOptions
+ $objWriter->startElement('printOptions');
+
+ $objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
+ $objWriter->writeAttribute('gridLinesSet', 'true');
+
+ if ($pSheet->getPageSetup()->getHorizontalCentered()) {
+ $objWriter->writeAttribute('horizontalCentered', 'true');
+ }
+
+ if ($pSheet->getPageSetup()->getVerticalCentered()) {
+ $objWriter->writeAttribute('verticalCentered', 'true');
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write PageMargins
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePageMargins(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // pageMargins
+ $objWriter->startElement('pageMargins');
+ $objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
+ $objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
+ $objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
+ $objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
+ $objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
+ $objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write AutoFilter
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeAutoFilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ $autoFilterRange = $pSheet->getAutoFilter()->getRange();
+ if (!empty($autoFilterRange)) {
+ // autoFilter
+ $objWriter->startElement('autoFilter');
+
+ // Strip any worksheet reference from the filter coordinates
+ $range = PHPExcel_Cell::splitRange($autoFilterRange);
+ $range = $range[0];
+ // Strip any worksheet ref
+ if (strpos($range[0], '!') !== false) {
+ list($ws, $range[0]) = explode('!', $range[0]);
+ }
+ $range = implode(':', $range);
+
+ $objWriter->writeAttribute('ref', str_replace('$', '', $range));
+
+ $columns = $pSheet->getAutoFilter()->getColumns();
+ if (count($columns > 0)) {
+ foreach ($columns as $columnID => $column) {
+ $rules = $column->getRules();
+ if (count($rules) > 0) {
+ $objWriter->startElement('filterColumn');
+ $objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
+
+ $objWriter->startElement($column->getFilterType());
+ if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
+ $objWriter->writeAttribute('and', 1);
+ }
+
+ foreach ($rules as $rule) {
+ if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
+ ($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
+ ($rule->getValue() === '')) {
+ // Filter rule for Blanks
+ $objWriter->writeAttribute('blank', 1);
+ } elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
+ // Dynamic Filter Rule
+ $objWriter->writeAttribute('type', $rule->getGrouping());
+ $val = $column->getAttribute('val');
+ if ($val !== null) {
+ $objWriter->writeAttribute('val', $val);
+ }
+ $maxVal = $column->getAttribute('maxVal');
+ if ($maxVal !== null) {
+ $objWriter->writeAttribute('maxVal', $maxVal);
+ }
+ } elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
+ // Top 10 Filter Rule
+ $objWriter->writeAttribute('val', $rule->getValue());
+ $objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
+ $objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
+ } else {
+ // Filter, DateGroupItem or CustomFilter
+ $objWriter->startElement($rule->getRuleType());
+
+ if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
+ $objWriter->writeAttribute('operator', $rule->getOperator());
+ }
+ if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
+ // Date Group filters
+ foreach ($rule->getValue() as $key => $value) {
+ if ($value > '') {
+ $objWriter->writeAttribute($key, $value);
+ }
+ }
+ $objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
+ } else {
+ $objWriter->writeAttribute('val', $rule->getValue());
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+ }
+ }
+ }
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write PageSetup
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writePageSetup(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // pageSetup
+ $objWriter->startElement('pageSetup');
+ $objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
+ $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
+
+ if (!is_null($pSheet->getPageSetup()->getScale())) {
+ $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
+ }
+ if (!is_null($pSheet->getPageSetup()->getFitToHeight())) {
+ $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
+ } else {
+ $objWriter->writeAttribute('fitToHeight', '0');
+ }
+ if (!is_null($pSheet->getPageSetup()->getFitToWidth())) {
+ $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
+ } else {
+ $objWriter->writeAttribute('fitToWidth', '0');
+ }
+ if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) {
+ $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
+ $objWriter->writeAttribute('useFirstPageNumber', '1');
+ }
+
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Header / Footer
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeHeaderFooter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // headerFooter
+ $objWriter->startElement('headerFooter');
+ $objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
+ $objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
+ $objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
+ $objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
+
+ $objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
+ $objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
+ $objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
+ $objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
+ $objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
+ $objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
+ $objWriter->endElement();
+ }
+
+ /**
+ * Write Breaks
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeBreaks(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // Get row and column breaks
+ $aRowBreaks = array();
+ $aColumnBreaks = array();
+ foreach ($pSheet->getBreaks() as $cell => $breakType) {
+ if ($breakType == PHPExcel_Worksheet::BREAK_ROW) {
+ $aRowBreaks[] = $cell;
+ } elseif ($breakType == PHPExcel_Worksheet::BREAK_COLUMN) {
+ $aColumnBreaks[] = $cell;
+ }
+ }
+
+ // rowBreaks
+ if (!empty($aRowBreaks)) {
+ $objWriter->startElement('rowBreaks');
+ $objWriter->writeAttribute('count', count($aRowBreaks));
+ $objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
+
+ foreach ($aRowBreaks as $cell) {
+ $coords = PHPExcel_Cell::coordinateFromString($cell);
+
+ $objWriter->startElement('brk');
+ $objWriter->writeAttribute('id', $coords[1]);
+ $objWriter->writeAttribute('man', '1');
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+
+ // Second, write column breaks
+ if (!empty($aColumnBreaks)) {
+ $objWriter->startElement('colBreaks');
+ $objWriter->writeAttribute('count', count($aColumnBreaks));
+ $objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
+
+ foreach ($aColumnBreaks as $cell) {
+ $coords = PHPExcel_Cell::coordinateFromString($cell);
+
+ $objWriter->startElement('brk');
+ $objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
+ $objWriter->writeAttribute('man', '1');
+ $objWriter->endElement();
+ }
+
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write SheetData
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @param string[] $pStringTable String table
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeSheetData(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pStringTable = null)
+ {
+ if (is_array($pStringTable)) {
+ // Flipped stringtable, for faster index searching
+ $aFlippedStringTable = $this->getParentWriter()->getWriterPart('stringtable')->flipStringTable($pStringTable);
+
+ // sheetData
+ $objWriter->startElement('sheetData');
+
+ // Get column count
+ $colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
+
+ // Highest row number
+ $highestRow = $pSheet->getHighestRow();
+
+ // Loop through cells
+ $cellsByRow = array();
+ foreach ($pSheet->getCellCollection() as $cellID) {
+ $cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
+ $cellsByRow[$cellAddress[1]][] = $cellID;
+ }
+
+ $currentRow = 0;
+ while ($currentRow++ < $highestRow) {
+ // Get row dimension
+ $rowDimension = $pSheet->getRowDimension($currentRow);
+
+ // Write current row?
+ $writeCurrentRow = isset($cellsByRow[$currentRow]) || $rowDimension->getRowHeight() >= 0 || $rowDimension->getVisible() == false || $rowDimension->getCollapsed() == true || $rowDimension->getOutlineLevel() > 0 || $rowDimension->getXfIndex() !== null;
+
+ if ($writeCurrentRow) {
+ // Start a new row
+ $objWriter->startElement('row');
+ $objWriter->writeAttribute('r', $currentRow);
+ $objWriter->writeAttribute('spans', '1:' . $colCount);
+
+ // Row dimensions
+ if ($rowDimension->getRowHeight() >= 0) {
+ $objWriter->writeAttribute('customHeight', '1');
+ $objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
+ }
+
+ // Row visibility
+ if ($rowDimension->getVisible() == false) {
+ $objWriter->writeAttribute('hidden', 'true');
+ }
+
+ // Collapsed
+ if ($rowDimension->getCollapsed() == true) {
+ $objWriter->writeAttribute('collapsed', 'true');
+ }
+
+ // Outline level
+ if ($rowDimension->getOutlineLevel() > 0) {
+ $objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
+ }
+
+ // Style
+ if ($rowDimension->getXfIndex() !== null) {
+ $objWriter->writeAttribute('s', $rowDimension->getXfIndex());
+ $objWriter->writeAttribute('customFormat', '1');
+ }
+
+ // Write cells
+ if (isset($cellsByRow[$currentRow])) {
+ foreach ($cellsByRow[$currentRow] as $cellAddress) {
+ // Write cell
+ $this->writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
+ }
+ }
+
+ // End row
+ $objWriter->endElement();
+ }
+ }
+
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Write Cell
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @param PHPExcel_Cell $pCellAddress Cell Address
+ * @param string[] $pStringTable String table
+ * @param string[] $pFlippedStringTable String table (flipped), for faster index searching
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pCellAddress = null, $pStringTable = null, $pFlippedStringTable = null)
+ {
+ if (is_array($pStringTable) && is_array($pFlippedStringTable)) {
+ // Cell
+ $pCell = $pSheet->getCell($pCellAddress);
+ $objWriter->startElement('c');
+ $objWriter->writeAttribute('r', $pCellAddress);
+
+ // Sheet styles
+ if ($pCell->getXfIndex() != '') {
+ $objWriter->writeAttribute('s', $pCell->getXfIndex());
+ }
+
+ // If cell value is supplied, write cell value
+ $cellValue = $pCell->getValue();
+ if (is_object($cellValue) || $cellValue !== '') {
+ // Map type
+ $mappedType = $pCell->getDataType();
+
+ // Write data type depending on its type
+ switch (strtolower($mappedType)) {
+ case 'inlinestr': // Inline string
+ case 's': // String
+ case 'b': // Boolean
+ $objWriter->writeAttribute('t', $mappedType);
+ break;
+ case 'f': // Formula
+ $calculatedValue = ($this->getParentWriter()->getPreCalculateFormulas()) ?
+ $pCell->getCalculatedValue() :
+ $cellValue;
+ if (is_string($calculatedValue)) {
+ $objWriter->writeAttribute('t', 'str');
+ }
+ break;
+ case 'e': // Error
+ $objWriter->writeAttribute('t', $mappedType);
+ }
+
+ // Write data depending on its type
+ switch (strtolower($mappedType)) {
+ case 'inlinestr': // Inline string
+ if (! $cellValue instanceof PHPExcel_RichText) {
+ $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
+ } elseif ($cellValue instanceof PHPExcel_RichText) {
+ $objWriter->startElement('is');
+ $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
+ $objWriter->endElement();
+ }
+
+ break;
+ case 's': // String
+ if (! $cellValue instanceof PHPExcel_RichText) {
+ if (isset($pFlippedStringTable[$cellValue])) {
+ $objWriter->writeElement('v', $pFlippedStringTable[$cellValue]);
+ }
+ } elseif ($cellValue instanceof PHPExcel_RichText) {
+ $objWriter->writeElement('v', $pFlippedStringTable[$cellValue->getHashCode()]);
+ }
+
+ break;
+ case 'f': // Formula
+ $attributes = $pCell->getFormulaAttributes();
+ if ($attributes['t'] == 'array') {
+ $objWriter->startElement('f');
+ $objWriter->writeAttribute('t', 'array');
+ $objWriter->writeAttribute('ref', $pCellAddress);
+ $objWriter->writeAttribute('aca', '1');
+ $objWriter->writeAttribute('ca', '1');
+ $objWriter->text(substr($cellValue, 1));
+ $objWriter->endElement();
+ } else {
+ $objWriter->writeElement('f', substr($cellValue, 1));
+ }
+ if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
+ if ($this->getParentWriter()->getPreCalculateFormulas()) {
+// $calculatedValue = $pCell->getCalculatedValue();
+ if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
+ $objWriter->writeElement('v', PHPExcel_Shared_String::FormatNumber($calculatedValue));
+ } else {
+ $objWriter->writeElement('v', '0');
+ }
+ } else {
+ $objWriter->writeElement('v', '0');
+ }
+ }
+ break;
+ case 'n': // Numeric
+ // force point as decimal separator in case current locale uses comma
+ $objWriter->writeElement('v', str_replace(',', '.', $cellValue));
+ break;
+ case 'b': // Boolean
+ $objWriter->writeElement('v', ($cellValue ? '1' : '0'));
+ break;
+ case 'e': // Error
+ if (substr($cellValue, 0, 1) == '=') {
+ $objWriter->writeElement('f', substr($cellValue, 1));
+ $objWriter->writeElement('v', substr($cellValue, 1));
+ } else {
+ $objWriter->writeElement('v', $cellValue);
+ }
+
+ break;
+ }
+ }
+
+ $objWriter->endElement();
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Write Drawings
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @param boolean $includeCharts Flag indicating if we should include drawing details for charts
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false)
+ {
+ $chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
+ // If sheet contains drawings, add the relationships
+ if (($pSheet->getDrawingCollection()->count() > 0) ||
+ ($chartCount > 0)) {
+ $objWriter->startElement('drawing');
+ $objWriter->writeAttribute('r:id', 'rId1');
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write LegacyDrawing
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeLegacyDrawing(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // If sheet contains comments, add the relationships
+ if (count($pSheet->getComments()) > 0) {
+ $objWriter->startElement('legacyDrawing');
+ $objWriter->writeAttribute('r:id', 'rId_comments_vml1');
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write LegacyDrawingHF
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
+ * @param PHPExcel_Worksheet $pSheet Worksheet
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeLegacyDrawingHF(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
+ {
+ // If sheet contains images, add the relationships
+ if (count($pSheet->getHeaderFooter()->getImages()) > 0) {
+ $objWriter->startElement('legacyDrawingHF');
+ $objWriter->writeAttribute('r:id', 'rId_headerfooter_vml1');
+ $objWriter->endElement();
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel2007/WriterPart.php b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php
new file mode 100644
index 0000000..806ebe5
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php
@@ -0,0 +1,75 @@
+parentWriter = $pWriter;
+ }
+
+ /**
+ * Get parent IWriter object
+ *
+ * @return PHPExcel_Writer_IWriter
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function getParentWriter()
+ {
+ if (!is_null($this->parentWriter)) {
+ return $this->parentWriter;
+ } else {
+ throw new PHPExcel_Writer_Exception("No parent PHPExcel_Writer_IWriter assigned.");
+ }
+ }
+
+ /**
+ * Set parent IWriter object
+ *
+ * @param PHPExcel_Writer_IWriter $pWriter
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
+ {
+ if (!is_null($pWriter)) {
+ $this->parentWriter = $pWriter;
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5.php b/Classes/PHPExcel/Writer/Excel5.php
new file mode 100644
index 0000000..2dede81
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5.php
@@ -0,0 +1,904 @@
+phpExcel = $phpExcel;
+
+ $this->parser = new PHPExcel_Writer_Excel5_Parser();
+ }
+
+ /**
+ * Save PHPExcel to file
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function save($pFilename = null)
+ {
+
+ // garbage collect
+ $this->phpExcel->garbageCollect();
+
+ $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
+ $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
+ PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
+
+ // initialize colors array
+ $this->colors = array();
+
+ // Initialise workbook writer
+ $this->writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->phpExcel, $this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser);
+
+ // Initialise worksheet writers
+ $countSheets = $this->phpExcel->getSheetCount();
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $this->writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->strTotal, $this->strUnique, $this->strTable, $this->colors, $this->parser, $this->preCalculateFormulas, $this->phpExcel->getSheet($i));
+ }
+
+ // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
+ $this->buildWorksheetEschers();
+ $this->buildWorkbookEscher();
+
+ // add 15 identical cell style Xfs
+ // for now, we use the first cellXf instead of cellStyleXf
+ $cellXfCollection = $this->phpExcel->getCellXfCollection();
+ for ($i = 0; $i < 15; ++$i) {
+ $this->writerWorkbook->addXfWriter($cellXfCollection[0], true);
+ }
+
+ // add all the cell Xfs
+ foreach ($this->phpExcel->getCellXfCollection() as $style) {
+ $this->writerWorkbook->addXfWriter($style, false);
+ }
+
+ // add fonts from rich text eleemnts
+ for ($i = 0; $i < $countSheets; ++$i) {
+ foreach ($this->writerWorksheets[$i]->phpSheet->getCellCollection() as $cellID) {
+ $cell = $this->writerWorksheets[$i]->phpSheet->getCell($cellID);
+ $cVal = $cell->getValue();
+ if ($cVal instanceof PHPExcel_RichText) {
+ $elements = $cVal->getRichTextElements();
+ foreach ($elements as $element) {
+ if ($element instanceof PHPExcel_RichText_Run) {
+ $font = $element->getFont();
+ $this->writerWorksheets[$i]->fontHashIndex[$font->getHashCode()] = $this->writerWorkbook->addFont($font);
+ }
+ }
+ }
+ }
+ }
+
+ // initialize OLE file
+ $workbookStreamName = 'Workbook';
+ $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));
+
+ // Write the worksheet streams before the global workbook stream,
+ // because the byte sizes of these are needed in the global workbook stream
+ $worksheetSizes = array();
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $this->writerWorksheets[$i]->close();
+ $worksheetSizes[] = $this->writerWorksheets[$i]->_datasize;
+ }
+
+ // add binary data for global workbook stream
+ $OLE->append($this->writerWorkbook->writeWorkbook($worksheetSizes));
+
+ // add binary data for sheet streams
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $OLE->append($this->writerWorksheets[$i]->getData());
+ }
+
+ $this->documentSummaryInformation = $this->writeDocumentSummaryInformation();
+ // initialize OLE Document Summary Information
+ if (isset($this->documentSummaryInformation) && !empty($this->documentSummaryInformation)) {
+ $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
+ $OLE_DocumentSummaryInformation->append($this->documentSummaryInformation);
+ }
+
+ $this->summaryInformation = $this->writeSummaryInformation();
+ // initialize OLE Summary Information
+ if (isset($this->summaryInformation) && !empty($this->summaryInformation)) {
+ $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
+ $OLE_SummaryInformation->append($this->summaryInformation);
+ }
+
+ // define OLE Parts
+ $arrRootData = array($OLE);
+ // initialize OLE Properties file
+ if (isset($OLE_SummaryInformation)) {
+ $arrRootData[] = $OLE_SummaryInformation;
+ }
+ // initialize OLE Extended Properties file
+ if (isset($OLE_DocumentSummaryInformation)) {
+ $arrRootData[] = $OLE_DocumentSummaryInformation;
+ }
+
+ $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), $arrRootData);
+ // save the OLE file
+ $res = $root->save($pFilename);
+
+ PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
+ }
+
+ /**
+ * Set temporary storage directory
+ *
+ * @deprecated
+ * @param string $pValue Temporary storage directory
+ * @throws PHPExcel_Writer_Exception when directory does not exist
+ * @return PHPExcel_Writer_Excel5
+ */
+ public function setTempDir($pValue = '')
+ {
+ return $this;
+ }
+
+ /**
+ * Build the Worksheet Escher objects
+ *
+ */
+ private function buildWorksheetEschers()
+ {
+ // 1-based index to BstoreContainer
+ $blipIndex = 0;
+ $lastReducedSpId = 0;
+ $lastSpId = 0;
+
+ foreach ($this->phpExcel->getAllsheets() as $sheet) {
+ // sheet index
+ $sheetIndex = $sheet->getParent()->getIndex($sheet);
+
+ $escher = null;
+
+ // check if there are any shapes for this sheet
+ $filterRange = $sheet->getAutoFilter()->getRange();
+ if (count($sheet->getDrawingCollection()) == 0 && empty($filterRange)) {
+ continue;
+ }
+
+ // create intermediate Escher object
+ $escher = new PHPExcel_Shared_Escher();
+
+ // dgContainer
+ $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
+
+ // set the drawing index (we use sheet index + 1)
+ $dgId = $sheet->getParent()->getIndex($sheet) + 1;
+ $dgContainer->setDgId($dgId);
+ $escher->setDgContainer($dgContainer);
+
+ // spgrContainer
+ $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
+ $dgContainer->setSpgrContainer($spgrContainer);
+
+ // add one shape which is the group shape
+ $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
+ $spContainer->setSpgr(true);
+ $spContainer->setSpType(0);
+ $spContainer->setSpId(($sheet->getParent()->getIndex($sheet) + 1) << 10);
+ $spgrContainer->addChild($spContainer);
+
+ // add the shapes
+
+ $countShapes[$sheetIndex] = 0; // count number of shapes (minus group shape), in sheet
+
+ foreach ($sheet->getDrawingCollection() as $drawing) {
+ ++$blipIndex;
+
+ ++$countShapes[$sheetIndex];
+
+ // add the shape
+ $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
+
+ // set the shape type
+ $spContainer->setSpType(0x004B);
+ // set the shape flag
+ $spContainer->setSpFlag(0x02);
+
+ // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
+ $reducedSpId = $countShapes[$sheetIndex];
+ $spId = $reducedSpId
+ | ($sheet->getParent()->getIndex($sheet) + 1) << 10;
+ $spContainer->setSpId($spId);
+
+ // keep track of last reducedSpId
+ $lastReducedSpId = $reducedSpId;
+
+ // keep track of last spId
+ $lastSpId = $spId;
+
+ // set the BLIP index
+ $spContainer->setOPT(0x4104, $blipIndex);
+
+ // set coordinates and offsets, client anchor
+ $coordinates = $drawing->getCoordinates();
+ $offsetX = $drawing->getOffsetX();
+ $offsetY = $drawing->getOffsetY();
+ $width = $drawing->getWidth();
+ $height = $drawing->getHeight();
+
+ $twoAnchor = PHPExcel_Shared_Excel5::oneAnchor2twoAnchor($sheet, $coordinates, $offsetX, $offsetY, $width, $height);
+
+ $spContainer->setStartCoordinates($twoAnchor['startCoordinates']);
+ $spContainer->setStartOffsetX($twoAnchor['startOffsetX']);
+ $spContainer->setStartOffsetY($twoAnchor['startOffsetY']);
+ $spContainer->setEndCoordinates($twoAnchor['endCoordinates']);
+ $spContainer->setEndOffsetX($twoAnchor['endOffsetX']);
+ $spContainer->setEndOffsetY($twoAnchor['endOffsetY']);
+
+ $spgrContainer->addChild($spContainer);
+ }
+
+ // AutoFilters
+ if (!empty($filterRange)) {
+ $rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
+ $iNumColStart = $rangeBounds[0][0];
+ $iNumColEnd = $rangeBounds[1][0];
+
+ $iInc = $iNumColStart;
+ while ($iInc <= $iNumColEnd) {
+ ++$countShapes[$sheetIndex];
+
+ // create an Drawing Object for the dropdown
+ $oDrawing = new PHPExcel_Worksheet_BaseDrawing();
+ // get the coordinates of drawing
+ $cDrawing = PHPExcel_Cell::stringFromColumnIndex($iInc - 1) . $rangeBounds[0][1];
+ $oDrawing->setCoordinates($cDrawing);
+ $oDrawing->setWorksheet($sheet);
+
+ // add the shape
+ $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
+ // set the shape type
+ $spContainer->setSpType(0x00C9);
+ // set the shape flag
+ $spContainer->setSpFlag(0x01);
+
+ // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index)
+ $reducedSpId = $countShapes[$sheetIndex];
+ $spId = $reducedSpId
+ | ($sheet->getParent()->getIndex($sheet) + 1) << 10;
+ $spContainer->setSpId($spId);
+
+ // keep track of last reducedSpId
+ $lastReducedSpId = $reducedSpId;
+
+ // keep track of last spId
+ $lastSpId = $spId;
+
+ $spContainer->setOPT(0x007F, 0x01040104); // Protection -> fLockAgainstGrouping
+ $spContainer->setOPT(0x00BF, 0x00080008); // Text -> fFitTextToShape
+ $spContainer->setOPT(0x01BF, 0x00010000); // Fill Style -> fNoFillHitTest
+ $spContainer->setOPT(0x01FF, 0x00080000); // Line Style -> fNoLineDrawDash
+ $spContainer->setOPT(0x03BF, 0x000A0000); // Group Shape -> fPrint
+
+ // set coordinates and offsets, client anchor
+ $endCoordinates = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::stringFromColumnIndex($iInc - 1));
+ $endCoordinates .= $rangeBounds[0][1] + 1;
+
+ $spContainer->setStartCoordinates($cDrawing);
+ $spContainer->setStartOffsetX(0);
+ $spContainer->setStartOffsetY(0);
+ $spContainer->setEndCoordinates($endCoordinates);
+ $spContainer->setEndOffsetX(0);
+ $spContainer->setEndOffsetY(0);
+
+ $spgrContainer->addChild($spContainer);
+ $iInc++;
+ }
+ }
+
+ // identifier clusters, used for workbook Escher object
+ $this->IDCLs[$dgId] = $lastReducedSpId;
+
+ // set last shape index
+ $dgContainer->setLastSpId($lastSpId);
+
+ // set the Escher object
+ $this->writerWorksheets[$sheetIndex]->setEscher($escher);
+ }
+ }
+
+ /**
+ * Build the Escher object corresponding to the MSODRAWINGGROUP record
+ */
+ private function buildWorkbookEscher()
+ {
+ $escher = null;
+
+ // any drawings in this workbook?
+ $found = false;
+ foreach ($this->phpExcel->getAllSheets() as $sheet) {
+ if (count($sheet->getDrawingCollection()) > 0) {
+ $found = true;
+ break;
+ }
+ }
+
+ // nothing to do if there are no drawings
+ if (!$found) {
+ return;
+ }
+
+ // if we reach here, then there are drawings in the workbook
+ $escher = new PHPExcel_Shared_Escher();
+
+ // dggContainer
+ $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
+ $escher->setDggContainer($dggContainer);
+
+ // set IDCLs (identifier clusters)
+ $dggContainer->setIDCLs($this->IDCLs);
+
+ // this loop is for determining maximum shape identifier of all drawing
+ $spIdMax = 0;
+ $totalCountShapes = 0;
+ $countDrawings = 0;
+
+ foreach ($this->phpExcel->getAllsheets() as $sheet) {
+ $sheetCountShapes = 0; // count number of shapes (minus group shape), in sheet
+
+ if (count($sheet->getDrawingCollection()) > 0) {
+ ++$countDrawings;
+
+ foreach ($sheet->getDrawingCollection() as $drawing) {
+ ++$sheetCountShapes;
+ ++$totalCountShapes;
+
+ $spId = $sheetCountShapes | ($this->phpExcel->getIndex($sheet) + 1) << 10;
+ $spIdMax = max($spId, $spIdMax);
+ }
+ }
+ }
+
+ $dggContainer->setSpIdMax($spIdMax + 1);
+ $dggContainer->setCDgSaved($countDrawings);
+ $dggContainer->setCSpSaved($totalCountShapes + $countDrawings); // total number of shapes incl. one group shapes per drawing
+
+ // bstoreContainer
+ $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
+ $dggContainer->setBstoreContainer($bstoreContainer);
+
+ // the BSE's (all the images)
+ foreach ($this->phpExcel->getAllsheets() as $sheet) {
+ foreach ($sheet->getDrawingCollection() as $drawing) {
+ if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
+ $filename = $drawing->getPath();
+
+ list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
+
+ switch ($imageFormat) {
+ case 1: // GIF, not supported by BIFF8, we convert to PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ ob_start();
+ imagepng(imagecreatefromgif($filename));
+ $blipData = ob_get_contents();
+ ob_end_clean();
+ break;
+ case 2: // JPEG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
+ $blipData = file_get_contents($filename);
+ break;
+ case 3: // PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ $blipData = file_get_contents($filename);
+ break;
+ case 6: // Windows DIB (BMP), we convert to PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ ob_start();
+ imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
+ $blipData = ob_get_contents();
+ ob_end_clean();
+ break;
+ default:
+ continue 2;
+ }
+
+ $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
+ $blip->setData($blipData);
+
+ $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
+ $BSE->setBlipType($blipType);
+ $BSE->setBlip($blip);
+
+ $bstoreContainer->addBSE($BSE);
+ } elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ switch ($drawing->getRenderingFunction()) {
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
+ $renderingFunction = 'imagejpeg';
+ break;
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ $renderingFunction = 'imagepng';
+ break;
+ }
+
+ ob_start();
+ call_user_func($renderingFunction, $drawing->getImageResource());
+ $blipData = ob_get_contents();
+ ob_end_clean();
+
+ $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
+ $blip->setData($blipData);
+
+ $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
+ $BSE->setBlipType($blipType);
+ $BSE->setBlip($blip);
+
+ $bstoreContainer->addBSE($BSE);
+ }
+ }
+ }
+
+ // Set the Escher object
+ $this->writerWorkbook->setEscher($escher);
+ }
+
+ /**
+ * Build the OLE Part for DocumentSummary Information
+ * @return string
+ */
+ private function writeDocumentSummaryInformation()
+ {
+ // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
+ $data = pack('v', 0xFFFE);
+ // offset: 2; size: 2;
+ $data .= pack('v', 0x0000);
+ // offset: 4; size: 2; OS version
+ $data .= pack('v', 0x0106);
+ // offset: 6; size: 2; OS indicator
+ $data .= pack('v', 0x0002);
+ // offset: 8; size: 16
+ $data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00);
+ // offset: 24; size: 4; section count
+ $data .= pack('V', 0x0001);
+
+ // offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
+ $data .= pack('vvvvvvvv', 0xD502, 0xD5CD, 0x2E9C, 0x101B, 0x9793, 0x0008, 0x2C2B, 0xAEF9);
+ // offset: 44; size: 4; offset of the start
+ $data .= pack('V', 0x30);
+
+ // SECTION
+ $dataSection = array();
+ $dataSection_NumProps = 0;
+ $dataSection_Summary = '';
+ $dataSection_Content = '';
+
+ // GKPIDDSI_CODEPAGE: CodePage
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x01),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x02), // 2 byte signed integer
+ 'data' => array('data' => 1252));
+ $dataSection_NumProps++;
+
+ // GKPIDDSI_CATEGORY : Category
+ if ($this->phpExcel->getProperties()->getCategory()) {
+ $dataProp = $this->phpExcel->getProperties()->getCategory();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E),
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // GKPIDDSI_VERSION :Version of the application that wrote the property storage
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x17),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x03),
+ 'data' => array('pack' => 'V', 'data' => 0x000C0000));
+ $dataSection_NumProps++;
+ // GKPIDDSI_SCALE : FALSE
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0B),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x0B),
+ 'data' => array('data' => false));
+ $dataSection_NumProps++;
+ // GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x10),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x0B),
+ 'data' => array('data' => false));
+ $dataSection_NumProps++;
+ // GKPIDDSI_SHAREDOC : FALSE
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x13),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x0B),
+ 'data' => array('data' => false));
+ $dataSection_NumProps++;
+ // GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x16),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x0B),
+ 'data' => array('data' => false));
+ $dataSection_NumProps++;
+
+ // GKPIDDSI_DOCSPARTS
+ // MS-OSHARED p75 (2.3.3.2.2.1)
+ // Structure is VtVecUnalignedLpstrValue (2.3.3.1.9)
+ // cElements
+ $dataProp = pack('v', 0x0001);
+ $dataProp .= pack('v', 0x0000);
+ // array of UnalignedLpstr
+ // cch
+ $dataProp .= pack('v', 0x000A);
+ $dataProp .= pack('v', 0x0000);
+ // value
+ $dataProp .= 'Worksheet'.chr(0);
+
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x101E),
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+
+ // GKPIDDSI_HEADINGPAIR
+ // VtVecHeadingPairValue
+ // cElements
+ $dataProp = pack('v', 0x0002);
+ $dataProp .= pack('v', 0x0000);
+ // Array of vtHeadingPair
+ // vtUnalignedString - headingString
+ // stringType
+ $dataProp .= pack('v', 0x001E);
+ // padding
+ $dataProp .= pack('v', 0x0000);
+ // UnalignedLpstr
+ // cch
+ $dataProp .= pack('v', 0x0013);
+ $dataProp .= pack('v', 0x0000);
+ // value
+ $dataProp .= 'Feuilles de calcul';
+ // vtUnalignedString - headingParts
+ // wType : 0x0003 = 32 bit signed integer
+ $dataProp .= pack('v', 0x0300);
+ // padding
+ $dataProp .= pack('v', 0x0000);
+ // value
+ $dataProp .= pack('v', 0x0100);
+ $dataProp .= pack('v', 0x0000);
+ $dataProp .= pack('v', 0x0000);
+ $dataProp .= pack('v', 0x0000);
+
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x100C),
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+
+ // 4 Section Length
+ // 4 Property count
+ // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
+ $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
+ foreach ($dataSection as $dataProp) {
+ // Summary
+ $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
+ // Offset
+ $dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset);
+ // DataType
+ $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
+ // Data
+ if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
+ $dataSection_Content .= pack('V', $dataProp['data']['data']);
+
+ $dataSection_Content_Offset += 4 + 4;
+ } elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
+ $dataSection_Content .= pack('V', $dataProp['data']['data']);
+
+ $dataSection_Content_Offset += 4 + 4;
+ } elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
+ if ($dataProp['data']['data'] == false) {
+ $dataSection_Content .= pack('V', 0x0000);
+ } else {
+ $dataSection_Content .= pack('V', 0x0001);
+ }
+ $dataSection_Content_Offset += 4 + 4;
+ } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
+ // Null-terminated string
+ $dataProp['data']['data'] .= chr(0);
+ $dataProp['data']['length'] += 1;
+ // Complete the string with null string for being a %4
+ $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
+ $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
+
+ $dataSection_Content .= pack('V', $dataProp['data']['length']);
+ $dataSection_Content .= $dataProp['data']['data'];
+
+ $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
+ } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ $dataSection_Content .= $dataProp['data']['data'];
+
+ $dataSection_Content_Offset += 4 + 8;
+ } else {
+ // Data Type Not Used at the moment
+ $dataSection_Content .= $dataProp['data']['data'];
+
+ $dataSection_Content_Offset += 4 + $dataProp['data']['length'];
+ }
+ }
+ // Now $dataSection_Content_Offset contains the size of the content
+
+ // section header
+ // offset: $secOffset; size: 4; section length
+ // + x Size of the content (summary + content)
+ $data .= pack('V', $dataSection_Content_Offset);
+ // offset: $secOffset+4; size: 4; property count
+ $data .= pack('V', $dataSection_NumProps);
+ // Section Summary
+ $data .= $dataSection_Summary;
+ // Section Content
+ $data .= $dataSection_Content;
+
+ return $data;
+ }
+
+ /**
+ * Build the OLE Part for Summary Information
+ * @return string
+ */
+ private function writeSummaryInformation()
+ {
+ // offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
+ $data = pack('v', 0xFFFE);
+ // offset: 2; size: 2;
+ $data .= pack('v', 0x0000);
+ // offset: 4; size: 2; OS version
+ $data .= pack('v', 0x0106);
+ // offset: 6; size: 2; OS indicator
+ $data .= pack('v', 0x0002);
+ // offset: 8; size: 16
+ $data .= pack('VVVV', 0x00, 0x00, 0x00, 0x00);
+ // offset: 24; size: 4; section count
+ $data .= pack('V', 0x0001);
+
+ // offset: 28; size: 16; first section's class id: e0 85 9f f2 f9 4f 68 10 ab 91 08 00 2b 27 b3 d9
+ $data .= pack('vvvvvvvv', 0x85E0, 0xF29F, 0x4FF9, 0x1068, 0x91AB, 0x0008, 0x272B, 0xD9B3);
+ // offset: 44; size: 4; offset of the start
+ $data .= pack('V', 0x30);
+
+ // SECTION
+ $dataSection = array();
+ $dataSection_NumProps = 0;
+ $dataSection_Summary = '';
+ $dataSection_Content = '';
+
+ // CodePage : CP-1252
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x01),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x02), // 2 byte signed integer
+ 'data' => array('data' => 1252));
+ $dataSection_NumProps++;
+
+ // Title
+ if ($this->phpExcel->getProperties()->getTitle()) {
+ $dataProp = $this->phpExcel->getProperties()->getTitle();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Subject
+ if ($this->phpExcel->getProperties()->getSubject()) {
+ $dataProp = $this->phpExcel->getProperties()->getSubject();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Author (Creator)
+ if ($this->phpExcel->getProperties()->getCreator()) {
+ $dataProp = $this->phpExcel->getProperties()->getCreator();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Keywords
+ if ($this->phpExcel->getProperties()->getKeywords()) {
+ $dataProp = $this->phpExcel->getProperties()->getKeywords();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Comments (Description)
+ if ($this->phpExcel->getProperties()->getDescription()) {
+ $dataProp = $this->phpExcel->getProperties()->getDescription();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Last Saved By (LastModifiedBy)
+ if ($this->phpExcel->getProperties()->getLastModifiedBy()) {
+ $dataProp = $this->phpExcel->getProperties()->getLastModifiedBy();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x1E), // null-terminated string prepended by dword string length
+ 'data' => array('data' => $dataProp, 'length' => strlen($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Created Date/Time
+ if ($this->phpExcel->getProperties()->getCreated()) {
+ $dataProp = $this->phpExcel->getProperties()->getCreated();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ 'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Modified Date/Time
+ if ($this->phpExcel->getProperties()->getModified()) {
+ $dataProp = $this->phpExcel->getProperties()->getModified();
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x40), // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ 'data' => array('data' => PHPExcel_Shared_OLE::LocalDate2OLE($dataProp)));
+ $dataSection_NumProps++;
+ }
+ // Security
+ $dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x13),
+ 'offset' => array('pack' => 'V'),
+ 'type' => array('pack' => 'V', 'data' => 0x03), // 4 byte signed integer
+ 'data' => array('data' => 0x00));
+ $dataSection_NumProps++;
+
+
+ // 4 Section Length
+ // 4 Property count
+ // 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
+ $dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
+ foreach ($dataSection as $dataProp) {
+ // Summary
+ $dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
+ // Offset
+ $dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset);
+ // DataType
+ $dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
+ // Data
+ if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
+ $dataSection_Content .= pack('V', $dataProp['data']['data']);
+
+ $dataSection_Content_Offset += 4 + 4;
+ } elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
+ $dataSection_Content .= pack('V', $dataProp['data']['data']);
+
+ $dataSection_Content_Offset += 4 + 4;
+ } elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
+ // Null-terminated string
+ $dataProp['data']['data'] .= chr(0);
+ $dataProp['data']['length'] += 1;
+ // Complete the string with null string for being a %4
+ $dataProp['data']['length'] = $dataProp['data']['length'] + ((4 - $dataProp['data']['length'] % 4)==4 ? 0 : (4 - $dataProp['data']['length'] % 4));
+ $dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
+
+ $dataSection_Content .= pack('V', $dataProp['data']['length']);
+ $dataSection_Content .= $dataProp['data']['data'];
+
+ $dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
+ } elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ $dataSection_Content .= $dataProp['data']['data'];
+
+ $dataSection_Content_Offset += 4 + 8;
+ } else {
+ // Data Type Not Used at the moment
+ }
+ }
+ // Now $dataSection_Content_Offset contains the size of the content
+
+ // section header
+ // offset: $secOffset; size: 4; section length
+ // + x Size of the content (summary + content)
+ $data .= pack('V', $dataSection_Content_Offset);
+ // offset: $secOffset+4; size: 4; property count
+ $data .= pack('V', $dataSection_NumProps);
+ // Section Summary
+ $data .= $dataSection_Summary;
+ // Section Content
+ $data .= $dataSection_Content;
+
+ return $data;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php
new file mode 100644
index 0000000..a795752
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php
@@ -0,0 +1,246 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_BIFFwriter
+{
+ /**
+ * The byte order of this architecture. 0 => little endian, 1 => big endian
+ * @var integer
+ */
+ private static $byteOrder;
+
+ /**
+ * The string containing the data of the BIFF stream
+ * @var string
+ */
+ public $_data;
+
+ /**
+ * The size of the data in bytes. Should be the same as strlen($this->_data)
+ * @var integer
+ */
+ public $_datasize;
+
+ /**
+ * The maximum length for a BIFF record (excluding record header and length field). See addContinue()
+ * @var integer
+ * @see addContinue()
+ */
+ private $limit = 8224;
+
+ /**
+ * Constructor
+ */
+ public function __construct()
+ {
+ $this->_data = '';
+ $this->_datasize = 0;
+// $this->limit = 8224;
+ }
+
+ /**
+ * Determine the byte order and store it as class data to avoid
+ * recalculating it for each call to new().
+ *
+ * @return int
+ */
+ public static function getByteOrder()
+ {
+ if (!isset(self::$byteOrder)) {
+ // Check if "pack" gives the required IEEE 64bit float
+ $teststr = pack("d", 1.2345);
+ $number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
+ if ($number == $teststr) {
+ $byte_order = 0; // Little Endian
+ } elseif ($number == strrev($teststr)) {
+ $byte_order = 1; // Big Endian
+ } else {
+ // Give up. I'll fix this in a later version.
+ throw new PHPExcel_Writer_Exception("Required floating point format not supported on this platform.");
+ }
+ self::$byteOrder = $byte_order;
+ }
+
+ return self::$byteOrder;
+ }
+
+ /**
+ * General storage function
+ *
+ * @param string $data binary data to append
+ * @access private
+ */
+ protected function append($data)
+ {
+ if (strlen($data) - 4 > $this->limit) {
+ $data = $this->addContinue($data);
+ }
+ $this->_data .= $data;
+ $this->_datasize += strlen($data);
+ }
+
+ /**
+ * General storage function like append, but returns string instead of modifying $this->_data
+ *
+ * @param string $data binary data to write
+ * @return string
+ */
+ public function writeData($data)
+ {
+ if (strlen($data) - 4 > $this->limit) {
+ $data = $this->addContinue($data);
+ }
+ $this->_datasize += strlen($data);
+
+ return $data;
+ }
+
+ /**
+ * Writes Excel BOF record to indicate the beginning of a stream or
+ * sub-stream in the BIFF file.
+ *
+ * @param integer $type Type of BIFF file to write: 0x0005 Workbook,
+ * 0x0010 Worksheet.
+ * @access private
+ */
+ protected function storeBof($type)
+ {
+ $record = 0x0809; // Record identifier (BIFF5-BIFF8)
+ $length = 0x0010;
+
+ // by inspection of real files, MS Office Excel 2007 writes the following
+ $unknown = pack("VV", 0x000100D1, 0x00000406);
+
+ $build = 0x0DBB; // Excel 97
+ $year = 0x07CC; // Excel 97
+
+ $version = 0x0600; // BIFF8
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $version, $type, $build, $year);
+ $this->append($header . $data . $unknown);
+ }
+
+ /**
+ * Writes Excel EOF record to indicate the end of a BIFF stream.
+ *
+ * @access private
+ */
+ protected function storeEof()
+ {
+ $record = 0x000A; // Record identifier
+ $length = 0x0000; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $this->append($header);
+ }
+
+ /**
+ * Writes Excel EOF record to indicate the end of a BIFF stream.
+ *
+ * @access private
+ */
+ public function writeEof()
+ {
+ $record = 0x000A; // Record identifier
+ $length = 0x0000; // Number of bytes to follow
+ $header = pack("vv", $record, $length);
+ return $this->writeData($header);
+ }
+
+ /**
+ * Excel limits the size of BIFF records. In Excel 5 the limit is 2084 bytes. In
+ * Excel 97 the limit is 8228 bytes. Records that are longer than these limits
+ * must be split up into CONTINUE blocks.
+ *
+ * This function takes a long BIFF record and inserts CONTINUE records as
+ * necessary.
+ *
+ * @param string $data The original binary data to be written
+ * @return string A very convenient string of continue blocks
+ * @access private
+ */
+ private function addContinue($data)
+ {
+ $limit = $this->limit;
+ $record = 0x003C; // Record identifier
+
+ // The first 2080/8224 bytes remain intact. However, we have to change
+ // the length field of the record.
+ $tmp = substr($data, 0, 2) . pack("v", $limit) . substr($data, 4, $limit);
+
+ $header = pack("vv", $record, $limit); // Headers for continue records
+
+ // Retrieve chunks of 2080/8224 bytes +4 for the header.
+ $data_length = strlen($data);
+ for ($i = $limit + 4; $i < ($data_length - $limit); $i += $limit) {
+ $tmp .= $header;
+ $tmp .= substr($data, $i, $limit);
+ }
+
+ // Retrieve the last chunk of data
+ $header = pack("vv", $record, strlen($data) - $i);
+ $tmp .= $header;
+ $tmp .= substr($data, $i, strlen($data) - $i);
+
+ return $tmp;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Escher.php b/Classes/PHPExcel/Writer/Excel5/Escher.php
new file mode 100644
index 0000000..c37fda9
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Escher.php
@@ -0,0 +1,523 @@
+object = $object;
+ }
+
+ /**
+ * Process the object to be written
+ */
+ public function close()
+ {
+ // initialize
+ $this->data = '';
+
+ switch (get_class($this->object)) {
+ case 'PHPExcel_Shared_Escher':
+ if ($dggContainer = $this->object->getDggContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
+ $this->data = $writer->close();
+ } elseif ($dgContainer = $this->object->getDgContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
+ $this->data = $writer->close();
+ $this->spOffsets = $writer->getSpOffsets();
+ $this->spTypes = $writer->getSpTypes();
+ }
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // write the dgg
+ $recVer = 0x0;
+ $recInstance = 0x0000;
+ $recType = 0xF006;
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ // dgg data
+ $dggData =
+ pack(
+ 'VVVV',
+ $this->object->getSpIdMax(), // maximum shape identifier increased by one
+ $this->object->getCDgSaved() + 1, // number of file identifier clusters increased by one
+ $this->object->getCSpSaved(),
+ $this->object->getCDgSaved() // count total number of drawings saved
+ );
+
+ // add file identifier clusters (one per drawing)
+ $IDCLs = $this->object->getIDCLs();
+
+ foreach ($IDCLs as $dgId => $maxReducedSpId) {
+ $dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
+ }
+
+ $header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
+ $innerData .= $header . $dggData;
+
+ // write the bstoreContainer
+ if ($bstoreContainer = $this->object->getBstoreContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
+ $innerData .= $writer->close();
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF000;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header . $innerData;
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // treat the inner data
+ if ($BSECollection = $this->object->getBSECollection()) {
+ foreach ($BSECollection as $BSE) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($BSE);
+ $innerData .= $writer->close();
+ }
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = count($this->object->getBSECollection());
+ $recType = 0xF001;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header . $innerData;
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
+ // this is a semi-container record
+
+ // initialize
+ $innerData = '';
+
+ // here we treat the inner data
+ if ($blip = $this->object->getBlip()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($blip);
+ $innerData .= $writer->close();
+ }
+
+ // initialize
+ $data = '';
+
+ $btWin32 = $this->object->getBlipType();
+ $btMacOS = $this->object->getBlipType();
+ $data .= pack('CC', $btWin32, $btMacOS);
+
+ $rgbUid = pack('VVVV', 0, 0, 0, 0); // todo
+ $data .= $rgbUid;
+
+ $tag = 0;
+ $size = strlen($innerData);
+ $cRef = 1;
+ $foDelay = 0; //todo
+ $unused1 = 0x0;
+ $cbName = 0x0;
+ $unused2 = 0x0;
+ $unused3 = 0x0;
+ $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
+
+ $data .= $innerData;
+
+ // write the record
+ $recVer = 0x2;
+ $recInstance = $this->object->getBlipType();
+ $recType = 0xF007;
+ $length = strlen($data);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header;
+
+ $this->data .= $data;
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
+ // this is an atom record
+
+ // write the record
+ switch ($this->object->getParent()->getBlipType()) {
+ case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
+ // initialize
+ $innerData = '';
+
+ $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
+ $innerData .= $rgbUid1;
+
+ $tag = 0xFF; // todo
+ $innerData .= pack('C', $tag);
+
+ $innerData .= $this->object->getData();
+
+ $recVer = 0x0;
+ $recInstance = 0x46A;
+ $recType = 0xF01D;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header;
+
+ $this->data .= $innerData;
+ break;
+
+ case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
+ // initialize
+ $innerData = '';
+
+ $rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
+ $innerData .= $rgbUid1;
+
+ $tag = 0xFF; // todo
+ $innerData .= pack('C', $tag);
+
+ $innerData .= $this->object->getData();
+
+ $recVer = 0x0;
+ $recInstance = 0x6E0;
+ $recType = 0xF01E;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header;
+
+ $this->data .= $innerData;
+ break;
+ }
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // write the dg
+ $recVer = 0x0;
+ $recInstance = $this->object->getDgId();
+ $recType = 0xF008;
+ $length = 8;
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ // number of shapes in this drawing (including group shape)
+ $countShapes = count($this->object->getSpgrContainer()->getChildren());
+ $innerData .= $header . pack('VV', $countShapes, $this->object->getLastSpId());
+ //$innerData .= $header . pack('VV', 0, 0);
+
+ // write the spgrContainer
+ if ($spgrContainer = $this->object->getSpgrContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
+ $innerData .= $writer->close();
+
+ // get the shape offsets relative to the spgrContainer record
+ $spOffsets = $writer->getSpOffsets();
+ $spTypes = $writer->getSpTypes();
+
+ // save the shape offsets relative to dgContainer
+ foreach ($spOffsets as & $spOffset) {
+ $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
+ }
+
+ $this->spOffsets = $spOffsets;
+ $this->spTypes = $spTypes;
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF002;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header . $innerData;
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // initialize spape offsets
+ $totalSize = 8;
+ $spOffsets = array();
+ $spTypes = array();
+
+ // treat the inner data
+ foreach ($this->object->getChildren() as $spContainer) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
+ $spData = $writer->close();
+ $innerData .= $spData;
+
+ // save the shape offsets (where new shape records begin)
+ $totalSize += strlen($spData);
+ $spOffsets[] = $totalSize;
+
+ $spTypes = array_merge($spTypes, $writer->getSpTypes());
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF003;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header . $innerData;
+ $this->spOffsets = $spOffsets;
+ $this->spTypes = $spTypes;
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
+ // initialize
+ $data = '';
+
+ // build the data
+
+ // write group shape record, if necessary?
+ if ($this->object->getSpgr()) {
+ $recVer = 0x1;
+ $recInstance = 0x0000;
+ $recType = 0xF009;
+ $length = 0x00000010;
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $data .= $header . pack('VVVV', 0, 0, 0, 0);
+ }
+ $this->spTypes[] = ($this->object->getSpType());
+
+ // write the shape record
+ $recVer = 0x2;
+ $recInstance = $this->object->getSpType(); // shape type
+ $recType = 0xF00A;
+ $length = 0x00000008;
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $data .= $header . pack('VV', $this->object->getSpId(), $this->object->getSpgr() ? 0x0005 : 0x0A00);
+
+
+ // the options
+ if ($this->object->getOPTCollection()) {
+ $optData = '';
+
+ $recVer = 0x3;
+ $recInstance = count($this->object->getOPTCollection());
+ $recType = 0xF00B;
+ foreach ($this->object->getOPTCollection() as $property => $value) {
+ $optData .= pack('vV', $property, $value);
+ }
+ $length = strlen($optData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $optData;
+ }
+
+ // the client anchor
+ if ($this->object->getStartCoordinates()) {
+ $clientAnchorData = '';
+
+ $recVer = 0x0;
+ $recInstance = 0x0;
+ $recType = 0xF010;
+
+ // start coordinates
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($this->object->getStartCoordinates());
+ $c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ $r1 = $row - 1;
+
+ // start offsetX
+ $startOffsetX = $this->object->getStartOffsetX();
+
+ // start offsetY
+ $startOffsetY = $this->object->getStartOffsetY();
+
+ // end coordinates
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($this->object->getEndCoordinates());
+ $c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ $r2 = $row - 1;
+
+ // end offsetX
+ $endOffsetX = $this->object->getEndOffsetX();
+
+ // end offsetY
+ $endOffsetY = $this->object->getEndOffsetY();
+
+ $clientAnchorData = pack('vvvvvvvvv', $this->object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
+
+ $length = strlen($clientAnchorData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $clientAnchorData;
+ }
+
+ // the client data, just empty for now
+ if (!$this->object->getSpgr()) {
+ $clientDataData = '';
+
+ $recVer = 0x0;
+ $recInstance = 0x0;
+ $recType = 0xF011;
+
+ $length = strlen($clientDataData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $clientDataData;
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF004;
+ $length = strlen($data);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->data = $header . $data;
+ break;
+ }
+
+ return $this->data;
+ }
+
+ /**
+ * Gets the shape offsets
+ *
+ * @return array
+ */
+ public function getSpOffsets()
+ {
+ return $this->spOffsets;
+ }
+
+ /**
+ * Gets the shape types
+ *
+ * @return array
+ */
+ public function getSpTypes()
+ {
+ return $this->spTypes;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Font.php b/Classes/PHPExcel/Writer/Excel5/Font.php
new file mode 100644
index 0000000..ed85ff4
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Font.php
@@ -0,0 +1,166 @@
+colorIndex = 0x7FFF;
+ $this->font = $font;
+ }
+
+ /**
+ * Set the color index
+ *
+ * @param int $colorIndex
+ */
+ public function setColorIndex($colorIndex)
+ {
+ $this->colorIndex = $colorIndex;
+ }
+
+ /**
+ * Get font record data
+ *
+ * @return string
+ */
+ public function writeFont()
+ {
+ $font_outline = 0;
+ $font_shadow = 0;
+
+ $icv = $this->colorIndex; // Index to color palette
+ if ($this->font->getSuperScript()) {
+ $sss = 1;
+ } elseif ($this->font->getSubScript()) {
+ $sss = 2;
+ } else {
+ $sss = 0;
+ }
+ $bFamily = 0; // Font family
+ $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->font->getName()); // Character set
+
+ $record = 0x31; // Record identifier
+ $reserved = 0x00; // Reserved
+ $grbit = 0x00; // Font attributes
+ if ($this->font->getItalic()) {
+ $grbit |= 0x02;
+ }
+ if ($this->font->getStrikethrough()) {
+ $grbit |= 0x08;
+ }
+ if ($font_outline) {
+ $grbit |= 0x10;
+ }
+ if ($font_shadow) {
+ $grbit |= 0x20;
+ }
+
+ $data = pack(
+ "vvvvvCCCC",
+ // Fontsize (in twips)
+ $this->font->getSize() * 20,
+ $grbit,
+ // Colour
+ $icv,
+ // Font weight
+ self::mapBold($this->font->getBold()),
+ // Superscript/Subscript
+ $sss,
+ self::mapUnderline($this->font->getUnderline()),
+ $bFamily,
+ $bCharSet,
+ $reserved
+ );
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->font->getName());
+
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ return($header . $data);
+ }
+
+ /**
+ * Map to BIFF5-BIFF8 codes for bold
+ *
+ * @param boolean $bold
+ * @return int
+ */
+ private static function mapBold($bold)
+ {
+ if ($bold) {
+ return 0x2BC; // 700 = Bold font weight
+ }
+ return 0x190; // 400 = Normal font weight
+ }
+
+ /**
+ * Map of BIFF2-BIFF8 codes for underline styles
+ * @static array of int
+ *
+ */
+ private static $mapUnderline = array(
+ PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
+ PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
+ PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
+ PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
+ PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
+ );
+
+ /**
+ * Map underline
+ *
+ * @param string
+ * @return int
+ */
+ private static function mapUnderline($underline)
+ {
+ if (isset(self::$mapUnderline[$underline])) {
+ return self::$mapUnderline[$underline];
+ }
+ return 0x00;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php
new file mode 100644
index 0000000..781996f
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Parser.php
@@ -0,0 +1,1531 @@
+=,;#()"{}
+ const REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+';
+
+ // Sheet title in quoted form (without surrounding quotes)
+ // Invalid sheet title characters cannot occur in the sheet title:
+ // *:/\?[] (usual invalid sheet title characters)
+ // Single quote is represented as a pair ''
+ const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+';
+
+ /**
+ * The index of the character we are currently looking at
+ * @var integer
+ */
+ public $currentCharacter;
+
+ /**
+ * The token we are working on.
+ * @var string
+ */
+ public $currentToken;
+
+ /**
+ * The formula to parse
+ * @var string
+ */
+ private $formula;
+
+ /**
+ * The character ahead of the current char
+ * @var string
+ */
+ public $lookAhead;
+
+ /**
+ * The parse tree to be generated
+ * @var string
+ */
+ private $parseTree;
+
+ /**
+ * Array of external sheets
+ * @var array
+ */
+ private $externalSheets;
+
+ /**
+ * Array of sheet references in the form of REF structures
+ * @var array
+ */
+ public $references;
+
+ /**
+ * The class constructor
+ *
+ */
+ public function __construct()
+ {
+ $this->currentCharacter = 0;
+ $this->currentToken = ''; // The token we are working on.
+ $this->formula = ''; // The formula to parse.
+ $this->lookAhead = ''; // The character ahead of the current char.
+ $this->parseTree = ''; // The parse tree to be generated.
+ $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's
+ $this->externalSheets = array();
+ $this->references = array();
+ }
+
+ /**
+ * Initialize the ptg and function hashes.
+ *
+ * @access private
+ */
+ private function initializeHashes()
+ {
+ // The Excel ptg indices
+ $this->ptg = array(
+ 'ptgExp' => 0x01,
+ 'ptgTbl' => 0x02,
+ 'ptgAdd' => 0x03,
+ 'ptgSub' => 0x04,
+ 'ptgMul' => 0x05,
+ 'ptgDiv' => 0x06,
+ 'ptgPower' => 0x07,
+ 'ptgConcat' => 0x08,
+ 'ptgLT' => 0x09,
+ 'ptgLE' => 0x0A,
+ 'ptgEQ' => 0x0B,
+ 'ptgGE' => 0x0C,
+ 'ptgGT' => 0x0D,
+ 'ptgNE' => 0x0E,
+ 'ptgIsect' => 0x0F,
+ 'ptgUnion' => 0x10,
+ 'ptgRange' => 0x11,
+ 'ptgUplus' => 0x12,
+ 'ptgUminus' => 0x13,
+ 'ptgPercent' => 0x14,
+ 'ptgParen' => 0x15,
+ 'ptgMissArg' => 0x16,
+ 'ptgStr' => 0x17,
+ 'ptgAttr' => 0x19,
+ 'ptgSheet' => 0x1A,
+ 'ptgEndSheet' => 0x1B,
+ 'ptgErr' => 0x1C,
+ 'ptgBool' => 0x1D,
+ 'ptgInt' => 0x1E,
+ 'ptgNum' => 0x1F,
+ 'ptgArray' => 0x20,
+ 'ptgFunc' => 0x21,
+ 'ptgFuncVar' => 0x22,
+ 'ptgName' => 0x23,
+ 'ptgRef' => 0x24,
+ 'ptgArea' => 0x25,
+ 'ptgMemArea' => 0x26,
+ 'ptgMemErr' => 0x27,
+ 'ptgMemNoMem' => 0x28,
+ 'ptgMemFunc' => 0x29,
+ 'ptgRefErr' => 0x2A,
+ 'ptgAreaErr' => 0x2B,
+ 'ptgRefN' => 0x2C,
+ 'ptgAreaN' => 0x2D,
+ 'ptgMemAreaN' => 0x2E,
+ 'ptgMemNoMemN' => 0x2F,
+ 'ptgNameX' => 0x39,
+ 'ptgRef3d' => 0x3A,
+ 'ptgArea3d' => 0x3B,
+ 'ptgRefErr3d' => 0x3C,
+ 'ptgAreaErr3d' => 0x3D,
+ 'ptgArrayV' => 0x40,
+ 'ptgFuncV' => 0x41,
+ 'ptgFuncVarV' => 0x42,
+ 'ptgNameV' => 0x43,
+ 'ptgRefV' => 0x44,
+ 'ptgAreaV' => 0x45,
+ 'ptgMemAreaV' => 0x46,
+ 'ptgMemErrV' => 0x47,
+ 'ptgMemNoMemV' => 0x48,
+ 'ptgMemFuncV' => 0x49,
+ 'ptgRefErrV' => 0x4A,
+ 'ptgAreaErrV' => 0x4B,
+ 'ptgRefNV' => 0x4C,
+ 'ptgAreaNV' => 0x4D,
+ 'ptgMemAreaNV' => 0x4E,
+ 'ptgMemNoMemN' => 0x4F,
+ 'ptgFuncCEV' => 0x58,
+ 'ptgNameXV' => 0x59,
+ 'ptgRef3dV' => 0x5A,
+ 'ptgArea3dV' => 0x5B,
+ 'ptgRefErr3dV' => 0x5C,
+ 'ptgAreaErr3d' => 0x5D,
+ 'ptgArrayA' => 0x60,
+ 'ptgFuncA' => 0x61,
+ 'ptgFuncVarA' => 0x62,
+ 'ptgNameA' => 0x63,
+ 'ptgRefA' => 0x64,
+ 'ptgAreaA' => 0x65,
+ 'ptgMemAreaA' => 0x66,
+ 'ptgMemErrA' => 0x67,
+ 'ptgMemNoMemA' => 0x68,
+ 'ptgMemFuncA' => 0x69,
+ 'ptgRefErrA' => 0x6A,
+ 'ptgAreaErrA' => 0x6B,
+ 'ptgRefNA' => 0x6C,
+ 'ptgAreaNA' => 0x6D,
+ 'ptgMemAreaNA' => 0x6E,
+ 'ptgMemNoMemN' => 0x6F,
+ 'ptgFuncCEA' => 0x78,
+ 'ptgNameXA' => 0x79,
+ 'ptgRef3dA' => 0x7A,
+ 'ptgArea3dA' => 0x7B,
+ 'ptgRefErr3dA' => 0x7C,
+ 'ptgAreaErr3d' => 0x7D
+ );
+
+ // Thanks to Michael Meeks and Gnumeric for the initial arg values.
+ //
+ // The following hash was generated by "function_locale.pl" in the distro.
+ // Refer to function_locale.pl for non-English function names.
+ //
+ // The array elements are as follow:
+ // ptg: The Excel function ptg code.
+ // args: The number of arguments that the function takes:
+ // >=0 is a fixed number of arguments.
+ // -1 is a variable number of arguments.
+ // class: The reference, value or array class of the function args.
+ // vol: The function is volatile.
+ //
+ $this->functions = array(
+ // function ptg args class vol
+ 'COUNT' => array( 0, -1, 0, 0 ),
+ 'IF' => array( 1, -1, 1, 0 ),
+ 'ISNA' => array( 2, 1, 1, 0 ),
+ 'ISERROR' => array( 3, 1, 1, 0 ),
+ 'SUM' => array( 4, -1, 0, 0 ),
+ 'AVERAGE' => array( 5, -1, 0, 0 ),
+ 'MIN' => array( 6, -1, 0, 0 ),
+ 'MAX' => array( 7, -1, 0, 0 ),
+ 'ROW' => array( 8, -1, 0, 0 ),
+ 'COLUMN' => array( 9, -1, 0, 0 ),
+ 'NA' => array( 10, 0, 0, 0 ),
+ 'NPV' => array( 11, -1, 1, 0 ),
+ 'STDEV' => array( 12, -1, 0, 0 ),
+ 'DOLLAR' => array( 13, -1, 1, 0 ),
+ 'FIXED' => array( 14, -1, 1, 0 ),
+ 'SIN' => array( 15, 1, 1, 0 ),
+ 'COS' => array( 16, 1, 1, 0 ),
+ 'TAN' => array( 17, 1, 1, 0 ),
+ 'ATAN' => array( 18, 1, 1, 0 ),
+ 'PI' => array( 19, 0, 1, 0 ),
+ 'SQRT' => array( 20, 1, 1, 0 ),
+ 'EXP' => array( 21, 1, 1, 0 ),
+ 'LN' => array( 22, 1, 1, 0 ),
+ 'LOG10' => array( 23, 1, 1, 0 ),
+ 'ABS' => array( 24, 1, 1, 0 ),
+ 'INT' => array( 25, 1, 1, 0 ),
+ 'SIGN' => array( 26, 1, 1, 0 ),
+ 'ROUND' => array( 27, 2, 1, 0 ),
+ 'LOOKUP' => array( 28, -1, 0, 0 ),
+ 'INDEX' => array( 29, -1, 0, 1 ),
+ 'REPT' => array( 30, 2, 1, 0 ),
+ 'MID' => array( 31, 3, 1, 0 ),
+ 'LEN' => array( 32, 1, 1, 0 ),
+ 'VALUE' => array( 33, 1, 1, 0 ),
+ 'TRUE' => array( 34, 0, 1, 0 ),
+ 'FALSE' => array( 35, 0, 1, 0 ),
+ 'AND' => array( 36, -1, 0, 0 ),
+ 'OR' => array( 37, -1, 0, 0 ),
+ 'NOT' => array( 38, 1, 1, 0 ),
+ 'MOD' => array( 39, 2, 1, 0 ),
+ 'DCOUNT' => array( 40, 3, 0, 0 ),
+ 'DSUM' => array( 41, 3, 0, 0 ),
+ 'DAVERAGE' => array( 42, 3, 0, 0 ),
+ 'DMIN' => array( 43, 3, 0, 0 ),
+ 'DMAX' => array( 44, 3, 0, 0 ),
+ 'DSTDEV' => array( 45, 3, 0, 0 ),
+ 'VAR' => array( 46, -1, 0, 0 ),
+ 'DVAR' => array( 47, 3, 0, 0 ),
+ 'TEXT' => array( 48, 2, 1, 0 ),
+ 'LINEST' => array( 49, -1, 0, 0 ),
+ 'TREND' => array( 50, -1, 0, 0 ),
+ 'LOGEST' => array( 51, -1, 0, 0 ),
+ 'GROWTH' => array( 52, -1, 0, 0 ),
+ 'PV' => array( 56, -1, 1, 0 ),
+ 'FV' => array( 57, -1, 1, 0 ),
+ 'NPER' => array( 58, -1, 1, 0 ),
+ 'PMT' => array( 59, -1, 1, 0 ),
+ 'RATE' => array( 60, -1, 1, 0 ),
+ 'MIRR' => array( 61, 3, 0, 0 ),
+ 'IRR' => array( 62, -1, 0, 0 ),
+ 'RAND' => array( 63, 0, 1, 1 ),
+ 'MATCH' => array( 64, -1, 0, 0 ),
+ 'DATE' => array( 65, 3, 1, 0 ),
+ 'TIME' => array( 66, 3, 1, 0 ),
+ 'DAY' => array( 67, 1, 1, 0 ),
+ 'MONTH' => array( 68, 1, 1, 0 ),
+ 'YEAR' => array( 69, 1, 1, 0 ),
+ 'WEEKDAY' => array( 70, -1, 1, 0 ),
+ 'HOUR' => array( 71, 1, 1, 0 ),
+ 'MINUTE' => array( 72, 1, 1, 0 ),
+ 'SECOND' => array( 73, 1, 1, 0 ),
+ 'NOW' => array( 74, 0, 1, 1 ),
+ 'AREAS' => array( 75, 1, 0, 1 ),
+ 'ROWS' => array( 76, 1, 0, 1 ),
+ 'COLUMNS' => array( 77, 1, 0, 1 ),
+ 'OFFSET' => array( 78, -1, 0, 1 ),
+ 'SEARCH' => array( 82, -1, 1, 0 ),
+ 'TRANSPOSE' => array( 83, 1, 1, 0 ),
+ 'TYPE' => array( 86, 1, 1, 0 ),
+ 'ATAN2' => array( 97, 2, 1, 0 ),
+ 'ASIN' => array( 98, 1, 1, 0 ),
+ 'ACOS' => array( 99, 1, 1, 0 ),
+ 'CHOOSE' => array( 100, -1, 1, 0 ),
+ 'HLOOKUP' => array( 101, -1, 0, 0 ),
+ 'VLOOKUP' => array( 102, -1, 0, 0 ),
+ 'ISREF' => array( 105, 1, 0, 0 ),
+ 'LOG' => array( 109, -1, 1, 0 ),
+ 'CHAR' => array( 111, 1, 1, 0 ),
+ 'LOWER' => array( 112, 1, 1, 0 ),
+ 'UPPER' => array( 113, 1, 1, 0 ),
+ 'PROPER' => array( 114, 1, 1, 0 ),
+ 'LEFT' => array( 115, -1, 1, 0 ),
+ 'RIGHT' => array( 116, -1, 1, 0 ),
+ 'EXACT' => array( 117, 2, 1, 0 ),
+ 'TRIM' => array( 118, 1, 1, 0 ),
+ 'REPLACE' => array( 119, 4, 1, 0 ),
+ 'SUBSTITUTE' => array( 120, -1, 1, 0 ),
+ 'CODE' => array( 121, 1, 1, 0 ),
+ 'FIND' => array( 124, -1, 1, 0 ),
+ 'CELL' => array( 125, -1, 0, 1 ),
+ 'ISERR' => array( 126, 1, 1, 0 ),
+ 'ISTEXT' => array( 127, 1, 1, 0 ),
+ 'ISNUMBER' => array( 128, 1, 1, 0 ),
+ 'ISBLANK' => array( 129, 1, 1, 0 ),
+ 'T' => array( 130, 1, 0, 0 ),
+ 'N' => array( 131, 1, 0, 0 ),
+ 'DATEVALUE' => array( 140, 1, 1, 0 ),
+ 'TIMEVALUE' => array( 141, 1, 1, 0 ),
+ 'SLN' => array( 142, 3, 1, 0 ),
+ 'SYD' => array( 143, 4, 1, 0 ),
+ 'DDB' => array( 144, -1, 1, 0 ),
+ 'INDIRECT' => array( 148, -1, 1, 1 ),
+ 'CALL' => array( 150, -1, 1, 0 ),
+ 'CLEAN' => array( 162, 1, 1, 0 ),
+ 'MDETERM' => array( 163, 1, 2, 0 ),
+ 'MINVERSE' => array( 164, 1, 2, 0 ),
+ 'MMULT' => array( 165, 2, 2, 0 ),
+ 'IPMT' => array( 167, -1, 1, 0 ),
+ 'PPMT' => array( 168, -1, 1, 0 ),
+ 'COUNTA' => array( 169, -1, 0, 0 ),
+ 'PRODUCT' => array( 183, -1, 0, 0 ),
+ 'FACT' => array( 184, 1, 1, 0 ),
+ 'DPRODUCT' => array( 189, 3, 0, 0 ),
+ 'ISNONTEXT' => array( 190, 1, 1, 0 ),
+ 'STDEVP' => array( 193, -1, 0, 0 ),
+ 'VARP' => array( 194, -1, 0, 0 ),
+ 'DSTDEVP' => array( 195, 3, 0, 0 ),
+ 'DVARP' => array( 196, 3, 0, 0 ),
+ 'TRUNC' => array( 197, -1, 1, 0 ),
+ 'ISLOGICAL' => array( 198, 1, 1, 0 ),
+ 'DCOUNTA' => array( 199, 3, 0, 0 ),
+ 'USDOLLAR' => array( 204, -1, 1, 0 ),
+ 'FINDB' => array( 205, -1, 1, 0 ),
+ 'SEARCHB' => array( 206, -1, 1, 0 ),
+ 'REPLACEB' => array( 207, 4, 1, 0 ),
+ 'LEFTB' => array( 208, -1, 1, 0 ),
+ 'RIGHTB' => array( 209, -1, 1, 0 ),
+ 'MIDB' => array( 210, 3, 1, 0 ),
+ 'LENB' => array( 211, 1, 1, 0 ),
+ 'ROUNDUP' => array( 212, 2, 1, 0 ),
+ 'ROUNDDOWN' => array( 213, 2, 1, 0 ),
+ 'ASC' => array( 214, 1, 1, 0 ),
+ 'DBCS' => array( 215, 1, 1, 0 ),
+ 'RANK' => array( 216, -1, 0, 0 ),
+ 'ADDRESS' => array( 219, -1, 1, 0 ),
+ 'DAYS360' => array( 220, -1, 1, 0 ),
+ 'TODAY' => array( 221, 0, 1, 1 ),
+ 'VDB' => array( 222, -1, 1, 0 ),
+ 'MEDIAN' => array( 227, -1, 0, 0 ),
+ 'SUMPRODUCT' => array( 228, -1, 2, 0 ),
+ 'SINH' => array( 229, 1, 1, 0 ),
+ 'COSH' => array( 230, 1, 1, 0 ),
+ 'TANH' => array( 231, 1, 1, 0 ),
+ 'ASINH' => array( 232, 1, 1, 0 ),
+ 'ACOSH' => array( 233, 1, 1, 0 ),
+ 'ATANH' => array( 234, 1, 1, 0 ),
+ 'DGET' => array( 235, 3, 0, 0 ),
+ 'INFO' => array( 244, 1, 1, 1 ),
+ 'DB' => array( 247, -1, 1, 0 ),
+ 'FREQUENCY' => array( 252, 2, 0, 0 ),
+ 'ERROR.TYPE' => array( 261, 1, 1, 0 ),
+ 'REGISTER.ID' => array( 267, -1, 1, 0 ),
+ 'AVEDEV' => array( 269, -1, 0, 0 ),
+ 'BETADIST' => array( 270, -1, 1, 0 ),
+ 'GAMMALN' => array( 271, 1, 1, 0 ),
+ 'BETAINV' => array( 272, -1, 1, 0 ),
+ 'BINOMDIST' => array( 273, 4, 1, 0 ),
+ 'CHIDIST' => array( 274, 2, 1, 0 ),
+ 'CHIINV' => array( 275, 2, 1, 0 ),
+ 'COMBIN' => array( 276, 2, 1, 0 ),
+ 'CONFIDENCE' => array( 277, 3, 1, 0 ),
+ 'CRITBINOM' => array( 278, 3, 1, 0 ),
+ 'EVEN' => array( 279, 1, 1, 0 ),
+ 'EXPONDIST' => array( 280, 3, 1, 0 ),
+ 'FDIST' => array( 281, 3, 1, 0 ),
+ 'FINV' => array( 282, 3, 1, 0 ),
+ 'FISHER' => array( 283, 1, 1, 0 ),
+ 'FISHERINV' => array( 284, 1, 1, 0 ),
+ 'FLOOR' => array( 285, 2, 1, 0 ),
+ 'GAMMADIST' => array( 286, 4, 1, 0 ),
+ 'GAMMAINV' => array( 287, 3, 1, 0 ),
+ 'CEILING' => array( 288, 2, 1, 0 ),
+ 'HYPGEOMDIST' => array( 289, 4, 1, 0 ),
+ 'LOGNORMDIST' => array( 290, 3, 1, 0 ),
+ 'LOGINV' => array( 291, 3, 1, 0 ),
+ 'NEGBINOMDIST' => array( 292, 3, 1, 0 ),
+ 'NORMDIST' => array( 293, 4, 1, 0 ),
+ 'NORMSDIST' => array( 294, 1, 1, 0 ),
+ 'NORMINV' => array( 295, 3, 1, 0 ),
+ 'NORMSINV' => array( 296, 1, 1, 0 ),
+ 'STANDARDIZE' => array( 297, 3, 1, 0 ),
+ 'ODD' => array( 298, 1, 1, 0 ),
+ 'PERMUT' => array( 299, 2, 1, 0 ),
+ 'POISSON' => array( 300, 3, 1, 0 ),
+ 'TDIST' => array( 301, 3, 1, 0 ),
+ 'WEIBULL' => array( 302, 4, 1, 0 ),
+ 'SUMXMY2' => array( 303, 2, 2, 0 ),
+ 'SUMX2MY2' => array( 304, 2, 2, 0 ),
+ 'SUMX2PY2' => array( 305, 2, 2, 0 ),
+ 'CHITEST' => array( 306, 2, 2, 0 ),
+ 'CORREL' => array( 307, 2, 2, 0 ),
+ 'COVAR' => array( 308, 2, 2, 0 ),
+ 'FORECAST' => array( 309, 3, 2, 0 ),
+ 'FTEST' => array( 310, 2, 2, 0 ),
+ 'INTERCEPT' => array( 311, 2, 2, 0 ),
+ 'PEARSON' => array( 312, 2, 2, 0 ),
+ 'RSQ' => array( 313, 2, 2, 0 ),
+ 'STEYX' => array( 314, 2, 2, 0 ),
+ 'SLOPE' => array( 315, 2, 2, 0 ),
+ 'TTEST' => array( 316, 4, 2, 0 ),
+ 'PROB' => array( 317, -1, 2, 0 ),
+ 'DEVSQ' => array( 318, -1, 0, 0 ),
+ 'GEOMEAN' => array( 319, -1, 0, 0 ),
+ 'HARMEAN' => array( 320, -1, 0, 0 ),
+ 'SUMSQ' => array( 321, -1, 0, 0 ),
+ 'KURT' => array( 322, -1, 0, 0 ),
+ 'SKEW' => array( 323, -1, 0, 0 ),
+ 'ZTEST' => array( 324, -1, 0, 0 ),
+ 'LARGE' => array( 325, 2, 0, 0 ),
+ 'SMALL' => array( 326, 2, 0, 0 ),
+ 'QUARTILE' => array( 327, 2, 0, 0 ),
+ 'PERCENTILE' => array( 328, 2, 0, 0 ),
+ 'PERCENTRANK' => array( 329, -1, 0, 0 ),
+ 'MODE' => array( 330, -1, 2, 0 ),
+ 'TRIMMEAN' => array( 331, 2, 0, 0 ),
+ 'TINV' => array( 332, 2, 1, 0 ),
+ 'CONCATENATE' => array( 336, -1, 1, 0 ),
+ 'POWER' => array( 337, 2, 1, 0 ),
+ 'RADIANS' => array( 342, 1, 1, 0 ),
+ 'DEGREES' => array( 343, 1, 1, 0 ),
+ 'SUBTOTAL' => array( 344, -1, 0, 0 ),
+ 'SUMIF' => array( 345, -1, 0, 0 ),
+ 'COUNTIF' => array( 346, 2, 0, 0 ),
+ 'COUNTBLANK' => array( 347, 1, 0, 0 ),
+ 'ISPMT' => array( 350, 4, 1, 0 ),
+ 'DATEDIF' => array( 351, 3, 1, 0 ),
+ 'DATESTRING' => array( 352, 1, 1, 0 ),
+ 'NUMBERSTRING' => array( 353, 2, 1, 0 ),
+ 'ROMAN' => array( 354, -1, 1, 0 ),
+ 'GETPIVOTDATA' => array( 358, -1, 0, 0 ),
+ 'HYPERLINK' => array( 359, -1, 1, 0 ),
+ 'PHONETIC' => array( 360, 1, 0, 0 ),
+ 'AVERAGEA' => array( 361, -1, 0, 0 ),
+ 'MAXA' => array( 362, -1, 0, 0 ),
+ 'MINA' => array( 363, -1, 0, 0 ),
+ 'STDEVPA' => array( 364, -1, 0, 0 ),
+ 'VARPA' => array( 365, -1, 0, 0 ),
+ 'STDEVA' => array( 366, -1, 0, 0 ),
+ 'VARA' => array( 367, -1, 0, 0 ),
+ 'BAHTTEXT' => array( 368, 1, 0, 0 ),
+ );
+ }
+
+ /**
+ * Convert a token to the proper ptg value.
+ *
+ * @access private
+ * @param mixed $token The token to convert.
+ * @return mixed the converted token on success
+ */
+ private function convert($token)
+ {
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
+ return $this->convertString($token);
+
+ } elseif (is_numeric($token)) {
+ return $this->convertNumber($token);
+
+ // match references like A1 or $A$1
+ } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
+ return $this->convertRef2d($token);
+
+ // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match ranges like A1:B2 or $A$1:$B$2
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
+ return $this->convertRange2d($token);
+
+ // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // operators (including parentheses)
+ } elseif (isset($this->ptg[$token])) {
+ return pack("C", $this->ptg[$token]);
+
+ // match error codes
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ return $this->convertError($token);
+
+ // commented so argument number can be processed correctly. See toReversePolish().
+ /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
+ {
+ return($this->convertFunction($token, $this->_func_args));
+ }*/
+
+ // if it's an argument, ignore the token (the argument remains)
+ } elseif ($token == 'arg') {
+ return '';
+ }
+
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown token $token");
+ }
+
+ /**
+ * Convert a number token to ptgInt or ptgNum
+ *
+ * @access private
+ * @param mixed $num an integer or double for conversion to its ptg value
+ */
+ private function convertNumber($num)
+ {
+ // Integer in the range 0..2**16-1
+ if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
+ return pack("Cv", $this->ptg['ptgInt'], $num);
+ } else { // A float
+ if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian
+ $num = strrev($num);
+ }
+ return pack("Cd", $this->ptg['ptgNum'], $num);
+ }
+ }
+
+ /**
+ * Convert a string token to ptgStr
+ *
+ * @access private
+ * @param string $string A string for conversion to its ptg value.
+ * @return mixed the converted token on success
+ */
+ private function convertString($string)
+ {
+ // chop away beggining and ending quotes
+ $string = substr($string, 1, strlen($string) - 2);
+ if (strlen($string) > 255) {
+ throw new PHPExcel_Writer_Exception("String is too long");
+ }
+
+ return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string);
+ }
+
+ /**
+ * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
+ * args that it takes.
+ *
+ * @access private
+ * @param string $token The name of the function for convertion to ptg value.
+ * @param integer $num_args The number of arguments the function receives.
+ * @return string The packed ptg for the function
+ */
+ private function convertFunction($token, $num_args)
+ {
+ $args = $this->functions[$token][1];
+// $volatile = $this->functions[$token][3];
+
+ // Fixed number of args eg. TIME($i, $j, $k).
+ if ($args >= 0) {
+ return pack("Cv", $this->ptg['ptgFuncV'], $this->functions[$token][0]);
+ }
+ // Variable number of args eg. SUM($i, $j, $k, ..).
+ if ($args == -1) {
+ return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->functions[$token][0]);
+ }
+ }
+
+ /**
+ * Convert an Excel range such as A1:D4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $range An Excel range in the A1:A2
+ * @param int $class
+ */
+ private function convertRange2d($range, $class = 0)
+ {
+
+ // TODO: possible class value 0,1,2 check Formula.pm
+ // Split the range into 2 cell refs
+ if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) {
+ list($cell1, $cell2) = explode(':', $range);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown range separator");
+ }
+
+ // Convert the cell references
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+
+ // The ptg value depends on the class of the ptg.
+ if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea']);
+ } elseif ($class == 1) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaV']);
+ } elseif ($class == 2) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaA']);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown class $class");
+ }
+ return $ptgArea . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
+ * a ptgArea3d.
+ *
+ * @access private
+ * @param string $token An Excel range in the Sheet1!A1:A2 format.
+ * @return mixed The packed ptgArea3d token on success.
+ */
+ private function convertRange3d($token)
+ {
+// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $range) = explode('!', $token);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Split the range into 2 cell refs
+ list($cell1, $cell2) = explode(':', $range);
+
+ // Convert the cell references
+ if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) {
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+ } else { // It's a rows range (like 26:27)
+ list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2);
+ }
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea3d']);
+// } elseif ($class == 1) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dV']);
+// } elseif ($class == 2) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return string The cell in packed() format with the corresponding ptg
+ */
+ private function convertRef2d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Convert the cell reference
+ $cell_array = $this->cellToPackedRowcol($cell);
+ list($row, $col) = $cell_array;
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRefV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRefA']);
+// } else {
+// // TODO: use real error codes
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+ return $ptgRef.$row.$col;
+ }
+
+ /**
+ * Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
+ * ptgRef3d.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return mixed The packed ptgRef3d token on success.
+ */
+ private function convertRef3d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $cell) = explode('!', $cell);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Convert the cell reference part
+ list($row, $col) = $this->cellToPackedRowcol($cell);
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3d']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3dV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRef3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgRef . $ext_ref. $row . $col;
+ }
+
+ /**
+ * Convert an error code to a ptgErr
+ *
+ * @access private
+ * @param string $errorCode The error code for conversion to its ptg value
+ * @return string The error code ptgErr
+ */
+ private function convertError($errorCode)
+ {
+ switch ($errorCode) {
+ case '#NULL!':
+ return pack("C", 0x00);
+ case '#DIV/0!':
+ return pack("C", 0x07);
+ case '#VALUE!':
+ return pack("C", 0x0F);
+ case '#REF!':
+ return pack("C", 0x17);
+ case '#NAME?':
+ return pack("C", 0x1D);
+ case '#NUM!':
+ return pack("C", 0x24);
+ case '#N/A':
+ return pack("C", 0x2A);
+ }
+ return pack("C", 0xFF);
+ }
+
+ /**
+ * Convert the sheet name part of an external reference, for example "Sheet1" or
+ * "Sheet1:Sheet2", to a packed structure.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return string The reference index in packed() format
+ */
+ private function packExtRef($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // References are stored relative to 0xFFFF.
+ $offset = -1 - $sheet1;
+
+ return pack('vdvv', $offset, 0x00, $sheet1, $sheet2);
+ }
+
+ /**
+ * Look up the REF index that corresponds to an external sheet name
+ * (or range). If it doesn't exist yet add it to the workbook's references
+ * array. It assumes all sheet names given must exist.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return mixed The reference index in packed() format on success
+ */
+ private function getRefIndex($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+ $ext_ref = str_replace('\'\'', '\'', $ext_ref); // Replace escaped '' with '
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // assume all references belong to this document
+ $supbook_index = 0x00;
+ $ref = pack('vvv', $supbook_index, $sheet1, $sheet2);
+ $totalreferences = count($this->references);
+ $index = -1;
+ for ($i = 0; $i < $totalreferences; ++$i) {
+ if ($ref == $this->references[$i]) {
+ $index = $i;
+ break;
+ }
+ }
+ // if REF was not found add it to references array
+ if ($index == -1) {
+ $this->references[$totalreferences] = $ref;
+ $index = $totalreferences;
+ }
+
+ return pack('v', $index);
+ }
+
+ /**
+ * Look up the index that corresponds to an external sheet name. The hash of
+ * sheet names is updated by the addworksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access private
+ * @param string $sheet_name Sheet name
+ * @return integer The sheet index, -1 if the sheet was not found
+ */
+ private function getSheetIndex($sheet_name)
+ {
+ if (!isset($this->externalSheets[$sheet_name])) {
+ return -1;
+ } else {
+ return $this->externalSheets[$sheet_name];
+ }
+ }
+
+ /**
+ * This method is used to update the array of sheet names. It is
+ * called by the addWorksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access public
+ * @see PHPExcel_Writer_Excel5_Workbook::addWorksheet()
+ * @param string $name The name of the worksheet being added
+ * @param integer $index The index of the worksheet being added
+ */
+ public function setExtSheet($name, $index)
+ {
+ $this->externalSheets[$name] = $index;
+ }
+
+ /**
+ * pack() row and column into the required 3 or 4 byte format.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference to be packed
+ * @return array Array containing the row and column in packed() format
+ */
+ private function cellToPackedRowcol($cell)
+ {
+ $cell = strtoupper($cell);
+ list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell);
+ if ($col >= 256) {
+ throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255");
+ }
+ if ($row >= 65536) {
+ throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if row or col are relative.
+ $col |= $col_rel << 14;
+ $col |= $row_rel << 15;
+ $col = pack('v', $col);
+
+ $row = pack('v', $row);
+
+ return array($row, $col);
+ }
+
+ /**
+ * pack() row range into the required 3 or 4 byte format.
+ * Just using maximum col/rows, which is probably not the correct solution
+ *
+ * @access private
+ * @param string $range The Excel range to be packed
+ * @return array Array containing (row1,col1,row2,col2) in packed() format
+ */
+ private function rangeToPackedRange($range)
+ {
+ preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
+ // return absolute rows if there is a $ in the ref
+ $row1_rel = empty($match[1]) ? 1 : 0;
+ $row1 = $match[2];
+ $row2_rel = empty($match[3]) ? 1 : 0;
+ $row2 = $match[4];
+ // Convert 1-index to zero-index
+ --$row1;
+ --$row2;
+ // Trick poor inocent Excel
+ $col1 = 0;
+ $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!)
+
+ // FIXME: this changes for BIFF8
+ if (($row1 >= 65536) or ($row2 >= 65536)) {
+ throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if rows are relative.
+ $col1 |= $row1_rel << 15;
+ $col2 |= $row2_rel << 15;
+ $col1 = pack('v', $col1);
+ $col2 = pack('v', $col2);
+
+ $row1 = pack('v', $row1);
+ $row2 = pack('v', $row2);
+
+ return array($row1, $col1, $row2, $col2);
+ }
+
+ /**
+ * Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
+ * indexed row and column number. Also returns two (0,1) values to indicate
+ * whether the row or column are relative references.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference in A1 format.
+ * @return array
+ */
+ private function cellToRowcol($cell)
+ {
+ preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
+ // return absolute column if there is a $ in the ref
+ $col_rel = empty($match[1]) ? 1 : 0;
+ $col_ref = $match[2];
+ $row_rel = empty($match[3]) ? 1 : 0;
+ $row = $match[4];
+
+ // Convert base26 column string to a number.
+ $expn = strlen($col_ref) - 1;
+ $col = 0;
+ $col_ref_length = strlen($col_ref);
+ for ($i = 0; $i < $col_ref_length; ++$i) {
+ $col += (ord($col_ref[$i]) - 64) * pow(26, $expn);
+ --$expn;
+ }
+
+ // Convert 1-index to zero-index
+ --$row;
+ --$col;
+
+ return array($row, $col, $row_rel, $col_rel);
+ }
+
+ /**
+ * Advance to the next valid token.
+ *
+ * @access private
+ */
+ private function advance()
+ {
+ $i = $this->currentCharacter;
+ $formula_length = strlen($this->formula);
+ // eat up white spaces
+ if ($i < $formula_length) {
+ while ($this->formula[$i] == " ") {
+ ++$i;
+ }
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula[$i+1];
+ }
+ $token = '';
+ }
+
+ while ($i < $formula_length) {
+ $token .= $this->formula[$i];
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula[$i+1];
+ } else {
+ $this->lookAhead = '';
+ }
+
+ if ($this->match($token) != '') {
+ //if ($i < strlen($this->formula) - 1) {
+ // $this->lookAhead = $this->formula[$i+1];
+ //}
+ $this->currentCharacter = $i + 1;
+ $this->currentToken = $token;
+ return 1;
+ }
+
+ if ($i < ($formula_length - 2)) {
+ $this->lookAhead = $this->formula[$i+2];
+ } else { // if we run out of characters lookAhead becomes empty
+ $this->lookAhead = '';
+ }
+ ++$i;
+ }
+ //die("Lexical error ".$this->currentCharacter);
+ }
+
+ /**
+ * Checks if it's a valid token.
+ *
+ * @access private
+ * @param mixed $token The token to check.
+ * @return mixed The checked token or false on failure
+ */
+ private function match($token)
+ {
+ switch ($token) {
+ case "+":
+ case "-":
+ case "*":
+ case "/":
+ case "(":
+ case ")":
+ case ",":
+ case ";":
+ case ">=":
+ case "<=":
+ case "=":
+ case "<>":
+ case "^":
+ case "&":
+ case "%":
+ return $token;
+ break;
+ case ">":
+ if ($this->lookAhead == '=') { // it's a GE token
+ break;
+ }
+ return $token;
+ break;
+ case "<":
+ // it's a LE or a NE token
+ if (($this->lookAhead == '=') or ($this->lookAhead == '>')) {
+ break;
+ }
+ return $token;
+ break;
+ default:
+ // if it's a reference A1 or $A$1 or $A1 or A$1
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.') and ($this->lookAhead != '!')) {
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ return $token;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->lookAhead)) {
+ // if it's a range A1:A2 or $A$1:$A$2
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ return $token;
+ } elseif (is_numeric($token) and (!is_numeric($token.$this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) {
+ // If it's a number (check that it's not a sheet name or range)
+ return $token;
+ } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"')%2 == 0)) {
+ // If it's a string (of maximum 255 characters)
+ return $token;
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ // If it's an error code
+ return $token;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->lookAhead == "(")) {
+ // if it's a function call
+ return $token;
+ } elseif (substr($token, -1) == ')') {
+ // It's an argument of some description (e.g. a named range),
+ // precise nature yet to be determined
+ return $token;
+ }
+ return '';
+ }
+ }
+
+ /**
+ * The parsing method. It parses a formula.
+ *
+ * @access public
+ * @param string $formula The formula to parse, without the initial equal
+ * sign (=).
+ * @return mixed true on success
+ */
+ public function parse($formula)
+ {
+ $this->currentCharacter = 0;
+ $this->formula = $formula;
+ $this->lookAhead = isset($formula[1]) ? $formula[1] : '';
+ $this->advance();
+ $this->parseTree = $this->condition();
+ return true;
+ }
+
+ /**
+ * It parses a condition. It assumes the following rule:
+ * Cond -> Expr [(">" | "<") Expr]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function condition()
+ {
+ $result = $this->expression();
+ if ($this->currentToken == "<") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLT', $result, $result2);
+ } elseif ($this->currentToken == ">") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGT', $result, $result2);
+ } elseif ($this->currentToken == "<=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLE', $result, $result2);
+ } elseif ($this->currentToken == ">=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGE', $result, $result2);
+ } elseif ($this->currentToken == "=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgEQ', $result, $result2);
+ } elseif ($this->currentToken == "<>") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgNE', $result, $result2);
+ } elseif ($this->currentToken == "&") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgConcat', $result, $result2);
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a expression. It assumes the following rule:
+ * Expr -> Term [("+" | "-") Term]
+ * -> "string"
+ * -> "-" Term : Negative value
+ * -> "+" Term : Positive value
+ * -> Error code
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function expression()
+ {
+ // If it's a string return a string node
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->currentToken)) {
+ $tmp = str_replace('""', '"', $this->currentToken);
+ if (($tmp == '"') || ($tmp == '')) {
+ // Trap for "" that has been used for an empty string
+ $tmp = '""';
+ }
+ $result = $this->createTree($tmp, '', '');
+ $this->advance();
+ return $result;
+ // If it's an error code
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->currentToken) or $this->currentToken == '#N/A') {
+ $result = $this->createTree($this->currentToken, 'ptgErr', '');
+ $this->advance();
+ return $result;
+ // If it's a negative value
+ } elseif ($this->currentToken == "-") {
+ // catch "-" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUminus', $result2, '');
+ return $result;
+ // If it's a positive value
+ } elseif ($this->currentToken == "+") {
+ // catch "+" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUplus', $result2, '');
+ return $result;
+ }
+ $result = $this->term();
+ while (($this->currentToken == "+") or
+ ($this->currentToken == "-") or
+ ($this->currentToken == "^")) {
+ /**/
+ if ($this->currentToken == "+") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgAdd', $result, $result2);
+ } elseif ($this->currentToken == "-") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgSub', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgPower', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * This function just introduces a ptgParen element in the tree, so that Excel
+ * doesn't get confused when working with a parenthesized formula afterwards.
+ *
+ * @access private
+ * @see fact()
+ * @return array The parsed ptg'd tree
+ */
+ private function parenthesizedExpression()
+ {
+ $result = $this->createTree('ptgParen', $this->expression(), '');
+ return $result;
+ }
+
+ /**
+ * It parses a term. It assumes the following rule:
+ * Term -> Fact [("*" | "/") Fact]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function term()
+ {
+ $result = $this->fact();
+ while (($this->currentToken == "*") or
+ ($this->currentToken == "/")) {
+ /**/
+ if ($this->currentToken == "*") {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgMul', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgDiv', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a factor. It assumes the following rule:
+ * Fact -> ( Expr )
+ * | CellRef
+ * | CellRange
+ * | Number
+ * | Function
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function fact()
+ {
+ if ($this->currentToken == "(") {
+ $this->advance(); // eat the "("
+ $result = $this->parenthesizedExpression();
+ if ($this->currentToken != ")") {
+ throw new PHPExcel_Writer_Exception("')' token expected.");
+ }
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+ // if it's a reference
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->currentToken)) {
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken) or
+ preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken)) {
+ // if it's a range A1:B2 or $A$1:$B$2
+ // must be an error?
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (is_numeric($this->currentToken)) {
+ // If it's a number or a percent
+ if ($this->lookAhead == '%') {
+ $result = $this->createTree('ptgPercent', $this->currentToken, '');
+ $this->advance(); // Skip the percentage operator once we've pre-built that tree
+ } else {
+ $result = $this->createTree($this->currentToken, '', '');
+ }
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->currentToken)) {
+ // if it's a function call
+ $result = $this->func();
+ return $result;
+ }
+ throw new PHPExcel_Writer_Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter);
+ }
+
+ /**
+ * It parses a function call. It assumes the following rule:
+ * Func -> ( Expr [,Expr]* )
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function func()
+ {
+ $num_args = 0; // number of arguments received
+ $function = strtoupper($this->currentToken);
+ $result = ''; // initialize result
+ $this->advance();
+ $this->advance(); // eat the "("
+ while ($this->currentToken != ')') {
+ /**/
+ if ($num_args > 0) {
+ if ($this->currentToken == "," || $this->currentToken == ";") {
+ $this->advance(); // eat the "," or ";"
+ } else {
+ throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
+ }
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', $result, $result2);
+ } else { // first argument
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', '', $result2);
+ }
+ ++$num_args;
+ }
+ if (!isset($this->functions[$function])) {
+ throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
+ }
+ $args = $this->functions[$function][1];
+ // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
+ if (($args >= 0) and ($args != $num_args)) {
+ throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
+ }
+
+ $result = $this->createTree($function, $result, $num_args);
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+
+ /**
+ * Creates a tree. In fact an array which may have one or two arrays (sub-trees)
+ * as elements.
+ *
+ * @access private
+ * @param mixed $value The value of this node.
+ * @param mixed $left The left array (sub-tree) or a final node.
+ * @param mixed $right The right array (sub-tree) or a final node.
+ * @return array A tree
+ */
+ private function createTree($value, $left, $right)
+ {
+ return array('value' => $value, 'left' => $left, 'right' => $right);
+ }
+
+ /**
+ * Builds a string containing the tree in reverse polish notation (What you
+ * would use in a HP calculator stack).
+ * The following tree:
+ *
+ * +
+ * / \
+ * 2 3
+ *
+ * produces: "23+"
+ *
+ * The following tree:
+ *
+ * +
+ * / \
+ * 3 *
+ * / \
+ * 6 A1
+ *
+ * produces: "36A1*+"
+ *
+ * In fact all operands, functions, references, etc... are written as ptg's
+ *
+ * @access public
+ * @param array $tree The optional tree to convert.
+ * @return string The tree in reverse polish notation
+ */
+ public function toReversePolish($tree = array())
+ {
+ $polish = ""; // the string we are going to return
+ if (empty($tree)) { // If it's the first call use parseTree
+ $tree = $this->parseTree;
+ }
+
+ if (is_array($tree['left'])) {
+ $converted_tree = $this->toReversePolish($tree['left']);
+ $polish .= $converted_tree;
+ } elseif ($tree['left'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['left']);
+ $polish .= $converted_tree;
+ }
+ if (is_array($tree['right'])) {
+ $converted_tree = $this->toReversePolish($tree['right']);
+ $polish .= $converted_tree;
+ } elseif ($tree['right'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['right']);
+ $polish .= $converted_tree;
+ }
+ // if it's a function convert it here (so we can set it's arguments)
+ if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
+ !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
+ !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
+ !is_numeric($tree['value']) and
+ !isset($this->ptg[$tree['value']])) {
+ // left subtree for a function is always an array.
+ if ($tree['left'] != '') {
+ $left_tree = $this->toReversePolish($tree['left']);
+ } else {
+ $left_tree = '';
+ }
+ // add it's left subtree and return.
+ return $left_tree.$this->convertFunction($tree['value'], $tree['right']);
+ } else {
+ $converted_tree = $this->convert($tree['value']);
+ }
+ $polish .= $converted_tree;
+ return $polish;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php b/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php
new file mode 100644
index 0000000..781996f
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php
@@ -0,0 +1,1531 @@
+=,;#()"{}
+ const REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+';
+
+ // Sheet title in quoted form (without surrounding quotes)
+ // Invalid sheet title characters cannot occur in the sheet title:
+ // *:/\?[] (usual invalid sheet title characters)
+ // Single quote is represented as a pair ''
+ const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+';
+
+ /**
+ * The index of the character we are currently looking at
+ * @var integer
+ */
+ public $currentCharacter;
+
+ /**
+ * The token we are working on.
+ * @var string
+ */
+ public $currentToken;
+
+ /**
+ * The formula to parse
+ * @var string
+ */
+ private $formula;
+
+ /**
+ * The character ahead of the current char
+ * @var string
+ */
+ public $lookAhead;
+
+ /**
+ * The parse tree to be generated
+ * @var string
+ */
+ private $parseTree;
+
+ /**
+ * Array of external sheets
+ * @var array
+ */
+ private $externalSheets;
+
+ /**
+ * Array of sheet references in the form of REF structures
+ * @var array
+ */
+ public $references;
+
+ /**
+ * The class constructor
+ *
+ */
+ public function __construct()
+ {
+ $this->currentCharacter = 0;
+ $this->currentToken = ''; // The token we are working on.
+ $this->formula = ''; // The formula to parse.
+ $this->lookAhead = ''; // The character ahead of the current char.
+ $this->parseTree = ''; // The parse tree to be generated.
+ $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's
+ $this->externalSheets = array();
+ $this->references = array();
+ }
+
+ /**
+ * Initialize the ptg and function hashes.
+ *
+ * @access private
+ */
+ private function initializeHashes()
+ {
+ // The Excel ptg indices
+ $this->ptg = array(
+ 'ptgExp' => 0x01,
+ 'ptgTbl' => 0x02,
+ 'ptgAdd' => 0x03,
+ 'ptgSub' => 0x04,
+ 'ptgMul' => 0x05,
+ 'ptgDiv' => 0x06,
+ 'ptgPower' => 0x07,
+ 'ptgConcat' => 0x08,
+ 'ptgLT' => 0x09,
+ 'ptgLE' => 0x0A,
+ 'ptgEQ' => 0x0B,
+ 'ptgGE' => 0x0C,
+ 'ptgGT' => 0x0D,
+ 'ptgNE' => 0x0E,
+ 'ptgIsect' => 0x0F,
+ 'ptgUnion' => 0x10,
+ 'ptgRange' => 0x11,
+ 'ptgUplus' => 0x12,
+ 'ptgUminus' => 0x13,
+ 'ptgPercent' => 0x14,
+ 'ptgParen' => 0x15,
+ 'ptgMissArg' => 0x16,
+ 'ptgStr' => 0x17,
+ 'ptgAttr' => 0x19,
+ 'ptgSheet' => 0x1A,
+ 'ptgEndSheet' => 0x1B,
+ 'ptgErr' => 0x1C,
+ 'ptgBool' => 0x1D,
+ 'ptgInt' => 0x1E,
+ 'ptgNum' => 0x1F,
+ 'ptgArray' => 0x20,
+ 'ptgFunc' => 0x21,
+ 'ptgFuncVar' => 0x22,
+ 'ptgName' => 0x23,
+ 'ptgRef' => 0x24,
+ 'ptgArea' => 0x25,
+ 'ptgMemArea' => 0x26,
+ 'ptgMemErr' => 0x27,
+ 'ptgMemNoMem' => 0x28,
+ 'ptgMemFunc' => 0x29,
+ 'ptgRefErr' => 0x2A,
+ 'ptgAreaErr' => 0x2B,
+ 'ptgRefN' => 0x2C,
+ 'ptgAreaN' => 0x2D,
+ 'ptgMemAreaN' => 0x2E,
+ 'ptgMemNoMemN' => 0x2F,
+ 'ptgNameX' => 0x39,
+ 'ptgRef3d' => 0x3A,
+ 'ptgArea3d' => 0x3B,
+ 'ptgRefErr3d' => 0x3C,
+ 'ptgAreaErr3d' => 0x3D,
+ 'ptgArrayV' => 0x40,
+ 'ptgFuncV' => 0x41,
+ 'ptgFuncVarV' => 0x42,
+ 'ptgNameV' => 0x43,
+ 'ptgRefV' => 0x44,
+ 'ptgAreaV' => 0x45,
+ 'ptgMemAreaV' => 0x46,
+ 'ptgMemErrV' => 0x47,
+ 'ptgMemNoMemV' => 0x48,
+ 'ptgMemFuncV' => 0x49,
+ 'ptgRefErrV' => 0x4A,
+ 'ptgAreaErrV' => 0x4B,
+ 'ptgRefNV' => 0x4C,
+ 'ptgAreaNV' => 0x4D,
+ 'ptgMemAreaNV' => 0x4E,
+ 'ptgMemNoMemN' => 0x4F,
+ 'ptgFuncCEV' => 0x58,
+ 'ptgNameXV' => 0x59,
+ 'ptgRef3dV' => 0x5A,
+ 'ptgArea3dV' => 0x5B,
+ 'ptgRefErr3dV' => 0x5C,
+ 'ptgAreaErr3d' => 0x5D,
+ 'ptgArrayA' => 0x60,
+ 'ptgFuncA' => 0x61,
+ 'ptgFuncVarA' => 0x62,
+ 'ptgNameA' => 0x63,
+ 'ptgRefA' => 0x64,
+ 'ptgAreaA' => 0x65,
+ 'ptgMemAreaA' => 0x66,
+ 'ptgMemErrA' => 0x67,
+ 'ptgMemNoMemA' => 0x68,
+ 'ptgMemFuncA' => 0x69,
+ 'ptgRefErrA' => 0x6A,
+ 'ptgAreaErrA' => 0x6B,
+ 'ptgRefNA' => 0x6C,
+ 'ptgAreaNA' => 0x6D,
+ 'ptgMemAreaNA' => 0x6E,
+ 'ptgMemNoMemN' => 0x6F,
+ 'ptgFuncCEA' => 0x78,
+ 'ptgNameXA' => 0x79,
+ 'ptgRef3dA' => 0x7A,
+ 'ptgArea3dA' => 0x7B,
+ 'ptgRefErr3dA' => 0x7C,
+ 'ptgAreaErr3d' => 0x7D
+ );
+
+ // Thanks to Michael Meeks and Gnumeric for the initial arg values.
+ //
+ // The following hash was generated by "function_locale.pl" in the distro.
+ // Refer to function_locale.pl for non-English function names.
+ //
+ // The array elements are as follow:
+ // ptg: The Excel function ptg code.
+ // args: The number of arguments that the function takes:
+ // >=0 is a fixed number of arguments.
+ // -1 is a variable number of arguments.
+ // class: The reference, value or array class of the function args.
+ // vol: The function is volatile.
+ //
+ $this->functions = array(
+ // function ptg args class vol
+ 'COUNT' => array( 0, -1, 0, 0 ),
+ 'IF' => array( 1, -1, 1, 0 ),
+ 'ISNA' => array( 2, 1, 1, 0 ),
+ 'ISERROR' => array( 3, 1, 1, 0 ),
+ 'SUM' => array( 4, -1, 0, 0 ),
+ 'AVERAGE' => array( 5, -1, 0, 0 ),
+ 'MIN' => array( 6, -1, 0, 0 ),
+ 'MAX' => array( 7, -1, 0, 0 ),
+ 'ROW' => array( 8, -1, 0, 0 ),
+ 'COLUMN' => array( 9, -1, 0, 0 ),
+ 'NA' => array( 10, 0, 0, 0 ),
+ 'NPV' => array( 11, -1, 1, 0 ),
+ 'STDEV' => array( 12, -1, 0, 0 ),
+ 'DOLLAR' => array( 13, -1, 1, 0 ),
+ 'FIXED' => array( 14, -1, 1, 0 ),
+ 'SIN' => array( 15, 1, 1, 0 ),
+ 'COS' => array( 16, 1, 1, 0 ),
+ 'TAN' => array( 17, 1, 1, 0 ),
+ 'ATAN' => array( 18, 1, 1, 0 ),
+ 'PI' => array( 19, 0, 1, 0 ),
+ 'SQRT' => array( 20, 1, 1, 0 ),
+ 'EXP' => array( 21, 1, 1, 0 ),
+ 'LN' => array( 22, 1, 1, 0 ),
+ 'LOG10' => array( 23, 1, 1, 0 ),
+ 'ABS' => array( 24, 1, 1, 0 ),
+ 'INT' => array( 25, 1, 1, 0 ),
+ 'SIGN' => array( 26, 1, 1, 0 ),
+ 'ROUND' => array( 27, 2, 1, 0 ),
+ 'LOOKUP' => array( 28, -1, 0, 0 ),
+ 'INDEX' => array( 29, -1, 0, 1 ),
+ 'REPT' => array( 30, 2, 1, 0 ),
+ 'MID' => array( 31, 3, 1, 0 ),
+ 'LEN' => array( 32, 1, 1, 0 ),
+ 'VALUE' => array( 33, 1, 1, 0 ),
+ 'TRUE' => array( 34, 0, 1, 0 ),
+ 'FALSE' => array( 35, 0, 1, 0 ),
+ 'AND' => array( 36, -1, 0, 0 ),
+ 'OR' => array( 37, -1, 0, 0 ),
+ 'NOT' => array( 38, 1, 1, 0 ),
+ 'MOD' => array( 39, 2, 1, 0 ),
+ 'DCOUNT' => array( 40, 3, 0, 0 ),
+ 'DSUM' => array( 41, 3, 0, 0 ),
+ 'DAVERAGE' => array( 42, 3, 0, 0 ),
+ 'DMIN' => array( 43, 3, 0, 0 ),
+ 'DMAX' => array( 44, 3, 0, 0 ),
+ 'DSTDEV' => array( 45, 3, 0, 0 ),
+ 'VAR' => array( 46, -1, 0, 0 ),
+ 'DVAR' => array( 47, 3, 0, 0 ),
+ 'TEXT' => array( 48, 2, 1, 0 ),
+ 'LINEST' => array( 49, -1, 0, 0 ),
+ 'TREND' => array( 50, -1, 0, 0 ),
+ 'LOGEST' => array( 51, -1, 0, 0 ),
+ 'GROWTH' => array( 52, -1, 0, 0 ),
+ 'PV' => array( 56, -1, 1, 0 ),
+ 'FV' => array( 57, -1, 1, 0 ),
+ 'NPER' => array( 58, -1, 1, 0 ),
+ 'PMT' => array( 59, -1, 1, 0 ),
+ 'RATE' => array( 60, -1, 1, 0 ),
+ 'MIRR' => array( 61, 3, 0, 0 ),
+ 'IRR' => array( 62, -1, 0, 0 ),
+ 'RAND' => array( 63, 0, 1, 1 ),
+ 'MATCH' => array( 64, -1, 0, 0 ),
+ 'DATE' => array( 65, 3, 1, 0 ),
+ 'TIME' => array( 66, 3, 1, 0 ),
+ 'DAY' => array( 67, 1, 1, 0 ),
+ 'MONTH' => array( 68, 1, 1, 0 ),
+ 'YEAR' => array( 69, 1, 1, 0 ),
+ 'WEEKDAY' => array( 70, -1, 1, 0 ),
+ 'HOUR' => array( 71, 1, 1, 0 ),
+ 'MINUTE' => array( 72, 1, 1, 0 ),
+ 'SECOND' => array( 73, 1, 1, 0 ),
+ 'NOW' => array( 74, 0, 1, 1 ),
+ 'AREAS' => array( 75, 1, 0, 1 ),
+ 'ROWS' => array( 76, 1, 0, 1 ),
+ 'COLUMNS' => array( 77, 1, 0, 1 ),
+ 'OFFSET' => array( 78, -1, 0, 1 ),
+ 'SEARCH' => array( 82, -1, 1, 0 ),
+ 'TRANSPOSE' => array( 83, 1, 1, 0 ),
+ 'TYPE' => array( 86, 1, 1, 0 ),
+ 'ATAN2' => array( 97, 2, 1, 0 ),
+ 'ASIN' => array( 98, 1, 1, 0 ),
+ 'ACOS' => array( 99, 1, 1, 0 ),
+ 'CHOOSE' => array( 100, -1, 1, 0 ),
+ 'HLOOKUP' => array( 101, -1, 0, 0 ),
+ 'VLOOKUP' => array( 102, -1, 0, 0 ),
+ 'ISREF' => array( 105, 1, 0, 0 ),
+ 'LOG' => array( 109, -1, 1, 0 ),
+ 'CHAR' => array( 111, 1, 1, 0 ),
+ 'LOWER' => array( 112, 1, 1, 0 ),
+ 'UPPER' => array( 113, 1, 1, 0 ),
+ 'PROPER' => array( 114, 1, 1, 0 ),
+ 'LEFT' => array( 115, -1, 1, 0 ),
+ 'RIGHT' => array( 116, -1, 1, 0 ),
+ 'EXACT' => array( 117, 2, 1, 0 ),
+ 'TRIM' => array( 118, 1, 1, 0 ),
+ 'REPLACE' => array( 119, 4, 1, 0 ),
+ 'SUBSTITUTE' => array( 120, -1, 1, 0 ),
+ 'CODE' => array( 121, 1, 1, 0 ),
+ 'FIND' => array( 124, -1, 1, 0 ),
+ 'CELL' => array( 125, -1, 0, 1 ),
+ 'ISERR' => array( 126, 1, 1, 0 ),
+ 'ISTEXT' => array( 127, 1, 1, 0 ),
+ 'ISNUMBER' => array( 128, 1, 1, 0 ),
+ 'ISBLANK' => array( 129, 1, 1, 0 ),
+ 'T' => array( 130, 1, 0, 0 ),
+ 'N' => array( 131, 1, 0, 0 ),
+ 'DATEVALUE' => array( 140, 1, 1, 0 ),
+ 'TIMEVALUE' => array( 141, 1, 1, 0 ),
+ 'SLN' => array( 142, 3, 1, 0 ),
+ 'SYD' => array( 143, 4, 1, 0 ),
+ 'DDB' => array( 144, -1, 1, 0 ),
+ 'INDIRECT' => array( 148, -1, 1, 1 ),
+ 'CALL' => array( 150, -1, 1, 0 ),
+ 'CLEAN' => array( 162, 1, 1, 0 ),
+ 'MDETERM' => array( 163, 1, 2, 0 ),
+ 'MINVERSE' => array( 164, 1, 2, 0 ),
+ 'MMULT' => array( 165, 2, 2, 0 ),
+ 'IPMT' => array( 167, -1, 1, 0 ),
+ 'PPMT' => array( 168, -1, 1, 0 ),
+ 'COUNTA' => array( 169, -1, 0, 0 ),
+ 'PRODUCT' => array( 183, -1, 0, 0 ),
+ 'FACT' => array( 184, 1, 1, 0 ),
+ 'DPRODUCT' => array( 189, 3, 0, 0 ),
+ 'ISNONTEXT' => array( 190, 1, 1, 0 ),
+ 'STDEVP' => array( 193, -1, 0, 0 ),
+ 'VARP' => array( 194, -1, 0, 0 ),
+ 'DSTDEVP' => array( 195, 3, 0, 0 ),
+ 'DVARP' => array( 196, 3, 0, 0 ),
+ 'TRUNC' => array( 197, -1, 1, 0 ),
+ 'ISLOGICAL' => array( 198, 1, 1, 0 ),
+ 'DCOUNTA' => array( 199, 3, 0, 0 ),
+ 'USDOLLAR' => array( 204, -1, 1, 0 ),
+ 'FINDB' => array( 205, -1, 1, 0 ),
+ 'SEARCHB' => array( 206, -1, 1, 0 ),
+ 'REPLACEB' => array( 207, 4, 1, 0 ),
+ 'LEFTB' => array( 208, -1, 1, 0 ),
+ 'RIGHTB' => array( 209, -1, 1, 0 ),
+ 'MIDB' => array( 210, 3, 1, 0 ),
+ 'LENB' => array( 211, 1, 1, 0 ),
+ 'ROUNDUP' => array( 212, 2, 1, 0 ),
+ 'ROUNDDOWN' => array( 213, 2, 1, 0 ),
+ 'ASC' => array( 214, 1, 1, 0 ),
+ 'DBCS' => array( 215, 1, 1, 0 ),
+ 'RANK' => array( 216, -1, 0, 0 ),
+ 'ADDRESS' => array( 219, -1, 1, 0 ),
+ 'DAYS360' => array( 220, -1, 1, 0 ),
+ 'TODAY' => array( 221, 0, 1, 1 ),
+ 'VDB' => array( 222, -1, 1, 0 ),
+ 'MEDIAN' => array( 227, -1, 0, 0 ),
+ 'SUMPRODUCT' => array( 228, -1, 2, 0 ),
+ 'SINH' => array( 229, 1, 1, 0 ),
+ 'COSH' => array( 230, 1, 1, 0 ),
+ 'TANH' => array( 231, 1, 1, 0 ),
+ 'ASINH' => array( 232, 1, 1, 0 ),
+ 'ACOSH' => array( 233, 1, 1, 0 ),
+ 'ATANH' => array( 234, 1, 1, 0 ),
+ 'DGET' => array( 235, 3, 0, 0 ),
+ 'INFO' => array( 244, 1, 1, 1 ),
+ 'DB' => array( 247, -1, 1, 0 ),
+ 'FREQUENCY' => array( 252, 2, 0, 0 ),
+ 'ERROR.TYPE' => array( 261, 1, 1, 0 ),
+ 'REGISTER.ID' => array( 267, -1, 1, 0 ),
+ 'AVEDEV' => array( 269, -1, 0, 0 ),
+ 'BETADIST' => array( 270, -1, 1, 0 ),
+ 'GAMMALN' => array( 271, 1, 1, 0 ),
+ 'BETAINV' => array( 272, -1, 1, 0 ),
+ 'BINOMDIST' => array( 273, 4, 1, 0 ),
+ 'CHIDIST' => array( 274, 2, 1, 0 ),
+ 'CHIINV' => array( 275, 2, 1, 0 ),
+ 'COMBIN' => array( 276, 2, 1, 0 ),
+ 'CONFIDENCE' => array( 277, 3, 1, 0 ),
+ 'CRITBINOM' => array( 278, 3, 1, 0 ),
+ 'EVEN' => array( 279, 1, 1, 0 ),
+ 'EXPONDIST' => array( 280, 3, 1, 0 ),
+ 'FDIST' => array( 281, 3, 1, 0 ),
+ 'FINV' => array( 282, 3, 1, 0 ),
+ 'FISHER' => array( 283, 1, 1, 0 ),
+ 'FISHERINV' => array( 284, 1, 1, 0 ),
+ 'FLOOR' => array( 285, 2, 1, 0 ),
+ 'GAMMADIST' => array( 286, 4, 1, 0 ),
+ 'GAMMAINV' => array( 287, 3, 1, 0 ),
+ 'CEILING' => array( 288, 2, 1, 0 ),
+ 'HYPGEOMDIST' => array( 289, 4, 1, 0 ),
+ 'LOGNORMDIST' => array( 290, 3, 1, 0 ),
+ 'LOGINV' => array( 291, 3, 1, 0 ),
+ 'NEGBINOMDIST' => array( 292, 3, 1, 0 ),
+ 'NORMDIST' => array( 293, 4, 1, 0 ),
+ 'NORMSDIST' => array( 294, 1, 1, 0 ),
+ 'NORMINV' => array( 295, 3, 1, 0 ),
+ 'NORMSINV' => array( 296, 1, 1, 0 ),
+ 'STANDARDIZE' => array( 297, 3, 1, 0 ),
+ 'ODD' => array( 298, 1, 1, 0 ),
+ 'PERMUT' => array( 299, 2, 1, 0 ),
+ 'POISSON' => array( 300, 3, 1, 0 ),
+ 'TDIST' => array( 301, 3, 1, 0 ),
+ 'WEIBULL' => array( 302, 4, 1, 0 ),
+ 'SUMXMY2' => array( 303, 2, 2, 0 ),
+ 'SUMX2MY2' => array( 304, 2, 2, 0 ),
+ 'SUMX2PY2' => array( 305, 2, 2, 0 ),
+ 'CHITEST' => array( 306, 2, 2, 0 ),
+ 'CORREL' => array( 307, 2, 2, 0 ),
+ 'COVAR' => array( 308, 2, 2, 0 ),
+ 'FORECAST' => array( 309, 3, 2, 0 ),
+ 'FTEST' => array( 310, 2, 2, 0 ),
+ 'INTERCEPT' => array( 311, 2, 2, 0 ),
+ 'PEARSON' => array( 312, 2, 2, 0 ),
+ 'RSQ' => array( 313, 2, 2, 0 ),
+ 'STEYX' => array( 314, 2, 2, 0 ),
+ 'SLOPE' => array( 315, 2, 2, 0 ),
+ 'TTEST' => array( 316, 4, 2, 0 ),
+ 'PROB' => array( 317, -1, 2, 0 ),
+ 'DEVSQ' => array( 318, -1, 0, 0 ),
+ 'GEOMEAN' => array( 319, -1, 0, 0 ),
+ 'HARMEAN' => array( 320, -1, 0, 0 ),
+ 'SUMSQ' => array( 321, -1, 0, 0 ),
+ 'KURT' => array( 322, -1, 0, 0 ),
+ 'SKEW' => array( 323, -1, 0, 0 ),
+ 'ZTEST' => array( 324, -1, 0, 0 ),
+ 'LARGE' => array( 325, 2, 0, 0 ),
+ 'SMALL' => array( 326, 2, 0, 0 ),
+ 'QUARTILE' => array( 327, 2, 0, 0 ),
+ 'PERCENTILE' => array( 328, 2, 0, 0 ),
+ 'PERCENTRANK' => array( 329, -1, 0, 0 ),
+ 'MODE' => array( 330, -1, 2, 0 ),
+ 'TRIMMEAN' => array( 331, 2, 0, 0 ),
+ 'TINV' => array( 332, 2, 1, 0 ),
+ 'CONCATENATE' => array( 336, -1, 1, 0 ),
+ 'POWER' => array( 337, 2, 1, 0 ),
+ 'RADIANS' => array( 342, 1, 1, 0 ),
+ 'DEGREES' => array( 343, 1, 1, 0 ),
+ 'SUBTOTAL' => array( 344, -1, 0, 0 ),
+ 'SUMIF' => array( 345, -1, 0, 0 ),
+ 'COUNTIF' => array( 346, 2, 0, 0 ),
+ 'COUNTBLANK' => array( 347, 1, 0, 0 ),
+ 'ISPMT' => array( 350, 4, 1, 0 ),
+ 'DATEDIF' => array( 351, 3, 1, 0 ),
+ 'DATESTRING' => array( 352, 1, 1, 0 ),
+ 'NUMBERSTRING' => array( 353, 2, 1, 0 ),
+ 'ROMAN' => array( 354, -1, 1, 0 ),
+ 'GETPIVOTDATA' => array( 358, -1, 0, 0 ),
+ 'HYPERLINK' => array( 359, -1, 1, 0 ),
+ 'PHONETIC' => array( 360, 1, 0, 0 ),
+ 'AVERAGEA' => array( 361, -1, 0, 0 ),
+ 'MAXA' => array( 362, -1, 0, 0 ),
+ 'MINA' => array( 363, -1, 0, 0 ),
+ 'STDEVPA' => array( 364, -1, 0, 0 ),
+ 'VARPA' => array( 365, -1, 0, 0 ),
+ 'STDEVA' => array( 366, -1, 0, 0 ),
+ 'VARA' => array( 367, -1, 0, 0 ),
+ 'BAHTTEXT' => array( 368, 1, 0, 0 ),
+ );
+ }
+
+ /**
+ * Convert a token to the proper ptg value.
+ *
+ * @access private
+ * @param mixed $token The token to convert.
+ * @return mixed the converted token on success
+ */
+ private function convert($token)
+ {
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
+ return $this->convertString($token);
+
+ } elseif (is_numeric($token)) {
+ return $this->convertNumber($token);
+
+ // match references like A1 or $A$1
+ } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
+ return $this->convertRef2d($token);
+
+ // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match ranges like A1:B2 or $A$1:$B$2
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
+ return $this->convertRange2d($token);
+
+ // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // operators (including parentheses)
+ } elseif (isset($this->ptg[$token])) {
+ return pack("C", $this->ptg[$token]);
+
+ // match error codes
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ return $this->convertError($token);
+
+ // commented so argument number can be processed correctly. See toReversePolish().
+ /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
+ {
+ return($this->convertFunction($token, $this->_func_args));
+ }*/
+
+ // if it's an argument, ignore the token (the argument remains)
+ } elseif ($token == 'arg') {
+ return '';
+ }
+
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown token $token");
+ }
+
+ /**
+ * Convert a number token to ptgInt or ptgNum
+ *
+ * @access private
+ * @param mixed $num an integer or double for conversion to its ptg value
+ */
+ private function convertNumber($num)
+ {
+ // Integer in the range 0..2**16-1
+ if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
+ return pack("Cv", $this->ptg['ptgInt'], $num);
+ } else { // A float
+ if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian
+ $num = strrev($num);
+ }
+ return pack("Cd", $this->ptg['ptgNum'], $num);
+ }
+ }
+
+ /**
+ * Convert a string token to ptgStr
+ *
+ * @access private
+ * @param string $string A string for conversion to its ptg value.
+ * @return mixed the converted token on success
+ */
+ private function convertString($string)
+ {
+ // chop away beggining and ending quotes
+ $string = substr($string, 1, strlen($string) - 2);
+ if (strlen($string) > 255) {
+ throw new PHPExcel_Writer_Exception("String is too long");
+ }
+
+ return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string);
+ }
+
+ /**
+ * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
+ * args that it takes.
+ *
+ * @access private
+ * @param string $token The name of the function for convertion to ptg value.
+ * @param integer $num_args The number of arguments the function receives.
+ * @return string The packed ptg for the function
+ */
+ private function convertFunction($token, $num_args)
+ {
+ $args = $this->functions[$token][1];
+// $volatile = $this->functions[$token][3];
+
+ // Fixed number of args eg. TIME($i, $j, $k).
+ if ($args >= 0) {
+ return pack("Cv", $this->ptg['ptgFuncV'], $this->functions[$token][0]);
+ }
+ // Variable number of args eg. SUM($i, $j, $k, ..).
+ if ($args == -1) {
+ return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->functions[$token][0]);
+ }
+ }
+
+ /**
+ * Convert an Excel range such as A1:D4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $range An Excel range in the A1:A2
+ * @param int $class
+ */
+ private function convertRange2d($range, $class = 0)
+ {
+
+ // TODO: possible class value 0,1,2 check Formula.pm
+ // Split the range into 2 cell refs
+ if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) {
+ list($cell1, $cell2) = explode(':', $range);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown range separator");
+ }
+
+ // Convert the cell references
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+
+ // The ptg value depends on the class of the ptg.
+ if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea']);
+ } elseif ($class == 1) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaV']);
+ } elseif ($class == 2) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaA']);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown class $class");
+ }
+ return $ptgArea . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
+ * a ptgArea3d.
+ *
+ * @access private
+ * @param string $token An Excel range in the Sheet1!A1:A2 format.
+ * @return mixed The packed ptgArea3d token on success.
+ */
+ private function convertRange3d($token)
+ {
+// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $range) = explode('!', $token);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Split the range into 2 cell refs
+ list($cell1, $cell2) = explode(':', $range);
+
+ // Convert the cell references
+ if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) {
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+ } else { // It's a rows range (like 26:27)
+ list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2);
+ }
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea3d']);
+// } elseif ($class == 1) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dV']);
+// } elseif ($class == 2) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return string The cell in packed() format with the corresponding ptg
+ */
+ private function convertRef2d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Convert the cell reference
+ $cell_array = $this->cellToPackedRowcol($cell);
+ list($row, $col) = $cell_array;
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRefV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRefA']);
+// } else {
+// // TODO: use real error codes
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+ return $ptgRef.$row.$col;
+ }
+
+ /**
+ * Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
+ * ptgRef3d.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return mixed The packed ptgRef3d token on success.
+ */
+ private function convertRef3d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $cell) = explode('!', $cell);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Convert the cell reference part
+ list($row, $col) = $this->cellToPackedRowcol($cell);
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3d']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3dV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRef3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgRef . $ext_ref. $row . $col;
+ }
+
+ /**
+ * Convert an error code to a ptgErr
+ *
+ * @access private
+ * @param string $errorCode The error code for conversion to its ptg value
+ * @return string The error code ptgErr
+ */
+ private function convertError($errorCode)
+ {
+ switch ($errorCode) {
+ case '#NULL!':
+ return pack("C", 0x00);
+ case '#DIV/0!':
+ return pack("C", 0x07);
+ case '#VALUE!':
+ return pack("C", 0x0F);
+ case '#REF!':
+ return pack("C", 0x17);
+ case '#NAME?':
+ return pack("C", 0x1D);
+ case '#NUM!':
+ return pack("C", 0x24);
+ case '#N/A':
+ return pack("C", 0x2A);
+ }
+ return pack("C", 0xFF);
+ }
+
+ /**
+ * Convert the sheet name part of an external reference, for example "Sheet1" or
+ * "Sheet1:Sheet2", to a packed structure.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return string The reference index in packed() format
+ */
+ private function packExtRef($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // References are stored relative to 0xFFFF.
+ $offset = -1 - $sheet1;
+
+ return pack('vdvv', $offset, 0x00, $sheet1, $sheet2);
+ }
+
+ /**
+ * Look up the REF index that corresponds to an external sheet name
+ * (or range). If it doesn't exist yet add it to the workbook's references
+ * array. It assumes all sheet names given must exist.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return mixed The reference index in packed() format on success
+ */
+ private function getRefIndex($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+ $ext_ref = str_replace('\'\'', '\'', $ext_ref); // Replace escaped '' with '
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // assume all references belong to this document
+ $supbook_index = 0x00;
+ $ref = pack('vvv', $supbook_index, $sheet1, $sheet2);
+ $totalreferences = count($this->references);
+ $index = -1;
+ for ($i = 0; $i < $totalreferences; ++$i) {
+ if ($ref == $this->references[$i]) {
+ $index = $i;
+ break;
+ }
+ }
+ // if REF was not found add it to references array
+ if ($index == -1) {
+ $this->references[$totalreferences] = $ref;
+ $index = $totalreferences;
+ }
+
+ return pack('v', $index);
+ }
+
+ /**
+ * Look up the index that corresponds to an external sheet name. The hash of
+ * sheet names is updated by the addworksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access private
+ * @param string $sheet_name Sheet name
+ * @return integer The sheet index, -1 if the sheet was not found
+ */
+ private function getSheetIndex($sheet_name)
+ {
+ if (!isset($this->externalSheets[$sheet_name])) {
+ return -1;
+ } else {
+ return $this->externalSheets[$sheet_name];
+ }
+ }
+
+ /**
+ * This method is used to update the array of sheet names. It is
+ * called by the addWorksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access public
+ * @see PHPExcel_Writer_Excel5_Workbook::addWorksheet()
+ * @param string $name The name of the worksheet being added
+ * @param integer $index The index of the worksheet being added
+ */
+ public function setExtSheet($name, $index)
+ {
+ $this->externalSheets[$name] = $index;
+ }
+
+ /**
+ * pack() row and column into the required 3 or 4 byte format.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference to be packed
+ * @return array Array containing the row and column in packed() format
+ */
+ private function cellToPackedRowcol($cell)
+ {
+ $cell = strtoupper($cell);
+ list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell);
+ if ($col >= 256) {
+ throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255");
+ }
+ if ($row >= 65536) {
+ throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if row or col are relative.
+ $col |= $col_rel << 14;
+ $col |= $row_rel << 15;
+ $col = pack('v', $col);
+
+ $row = pack('v', $row);
+
+ return array($row, $col);
+ }
+
+ /**
+ * pack() row range into the required 3 or 4 byte format.
+ * Just using maximum col/rows, which is probably not the correct solution
+ *
+ * @access private
+ * @param string $range The Excel range to be packed
+ * @return array Array containing (row1,col1,row2,col2) in packed() format
+ */
+ private function rangeToPackedRange($range)
+ {
+ preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
+ // return absolute rows if there is a $ in the ref
+ $row1_rel = empty($match[1]) ? 1 : 0;
+ $row1 = $match[2];
+ $row2_rel = empty($match[3]) ? 1 : 0;
+ $row2 = $match[4];
+ // Convert 1-index to zero-index
+ --$row1;
+ --$row2;
+ // Trick poor inocent Excel
+ $col1 = 0;
+ $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!)
+
+ // FIXME: this changes for BIFF8
+ if (($row1 >= 65536) or ($row2 >= 65536)) {
+ throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if rows are relative.
+ $col1 |= $row1_rel << 15;
+ $col2 |= $row2_rel << 15;
+ $col1 = pack('v', $col1);
+ $col2 = pack('v', $col2);
+
+ $row1 = pack('v', $row1);
+ $row2 = pack('v', $row2);
+
+ return array($row1, $col1, $row2, $col2);
+ }
+
+ /**
+ * Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
+ * indexed row and column number. Also returns two (0,1) values to indicate
+ * whether the row or column are relative references.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference in A1 format.
+ * @return array
+ */
+ private function cellToRowcol($cell)
+ {
+ preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
+ // return absolute column if there is a $ in the ref
+ $col_rel = empty($match[1]) ? 1 : 0;
+ $col_ref = $match[2];
+ $row_rel = empty($match[3]) ? 1 : 0;
+ $row = $match[4];
+
+ // Convert base26 column string to a number.
+ $expn = strlen($col_ref) - 1;
+ $col = 0;
+ $col_ref_length = strlen($col_ref);
+ for ($i = 0; $i < $col_ref_length; ++$i) {
+ $col += (ord($col_ref[$i]) - 64) * pow(26, $expn);
+ --$expn;
+ }
+
+ // Convert 1-index to zero-index
+ --$row;
+ --$col;
+
+ return array($row, $col, $row_rel, $col_rel);
+ }
+
+ /**
+ * Advance to the next valid token.
+ *
+ * @access private
+ */
+ private function advance()
+ {
+ $i = $this->currentCharacter;
+ $formula_length = strlen($this->formula);
+ // eat up white spaces
+ if ($i < $formula_length) {
+ while ($this->formula[$i] == " ") {
+ ++$i;
+ }
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula[$i+1];
+ }
+ $token = '';
+ }
+
+ while ($i < $formula_length) {
+ $token .= $this->formula[$i];
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula[$i+1];
+ } else {
+ $this->lookAhead = '';
+ }
+
+ if ($this->match($token) != '') {
+ //if ($i < strlen($this->formula) - 1) {
+ // $this->lookAhead = $this->formula[$i+1];
+ //}
+ $this->currentCharacter = $i + 1;
+ $this->currentToken = $token;
+ return 1;
+ }
+
+ if ($i < ($formula_length - 2)) {
+ $this->lookAhead = $this->formula[$i+2];
+ } else { // if we run out of characters lookAhead becomes empty
+ $this->lookAhead = '';
+ }
+ ++$i;
+ }
+ //die("Lexical error ".$this->currentCharacter);
+ }
+
+ /**
+ * Checks if it's a valid token.
+ *
+ * @access private
+ * @param mixed $token The token to check.
+ * @return mixed The checked token or false on failure
+ */
+ private function match($token)
+ {
+ switch ($token) {
+ case "+":
+ case "-":
+ case "*":
+ case "/":
+ case "(":
+ case ")":
+ case ",":
+ case ";":
+ case ">=":
+ case "<=":
+ case "=":
+ case "<>":
+ case "^":
+ case "&":
+ case "%":
+ return $token;
+ break;
+ case ">":
+ if ($this->lookAhead == '=') { // it's a GE token
+ break;
+ }
+ return $token;
+ break;
+ case "<":
+ // it's a LE or a NE token
+ if (($this->lookAhead == '=') or ($this->lookAhead == '>')) {
+ break;
+ }
+ return $token;
+ break;
+ default:
+ // if it's a reference A1 or $A$1 or $A1 or A$1
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.') and ($this->lookAhead != '!')) {
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ return $token;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->lookAhead)) {
+ // if it's a range A1:A2 or $A$1:$A$2
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ return $token;
+ } elseif (is_numeric($token) and (!is_numeric($token.$this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) {
+ // If it's a number (check that it's not a sheet name or range)
+ return $token;
+ } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"')%2 == 0)) {
+ // If it's a string (of maximum 255 characters)
+ return $token;
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ // If it's an error code
+ return $token;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->lookAhead == "(")) {
+ // if it's a function call
+ return $token;
+ } elseif (substr($token, -1) == ')') {
+ // It's an argument of some description (e.g. a named range),
+ // precise nature yet to be determined
+ return $token;
+ }
+ return '';
+ }
+ }
+
+ /**
+ * The parsing method. It parses a formula.
+ *
+ * @access public
+ * @param string $formula The formula to parse, without the initial equal
+ * sign (=).
+ * @return mixed true on success
+ */
+ public function parse($formula)
+ {
+ $this->currentCharacter = 0;
+ $this->formula = $formula;
+ $this->lookAhead = isset($formula[1]) ? $formula[1] : '';
+ $this->advance();
+ $this->parseTree = $this->condition();
+ return true;
+ }
+
+ /**
+ * It parses a condition. It assumes the following rule:
+ * Cond -> Expr [(">" | "<") Expr]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function condition()
+ {
+ $result = $this->expression();
+ if ($this->currentToken == "<") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLT', $result, $result2);
+ } elseif ($this->currentToken == ">") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGT', $result, $result2);
+ } elseif ($this->currentToken == "<=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLE', $result, $result2);
+ } elseif ($this->currentToken == ">=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGE', $result, $result2);
+ } elseif ($this->currentToken == "=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgEQ', $result, $result2);
+ } elseif ($this->currentToken == "<>") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgNE', $result, $result2);
+ } elseif ($this->currentToken == "&") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgConcat', $result, $result2);
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a expression. It assumes the following rule:
+ * Expr -> Term [("+" | "-") Term]
+ * -> "string"
+ * -> "-" Term : Negative value
+ * -> "+" Term : Positive value
+ * -> Error code
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function expression()
+ {
+ // If it's a string return a string node
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->currentToken)) {
+ $tmp = str_replace('""', '"', $this->currentToken);
+ if (($tmp == '"') || ($tmp == '')) {
+ // Trap for "" that has been used for an empty string
+ $tmp = '""';
+ }
+ $result = $this->createTree($tmp, '', '');
+ $this->advance();
+ return $result;
+ // If it's an error code
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->currentToken) or $this->currentToken == '#N/A') {
+ $result = $this->createTree($this->currentToken, 'ptgErr', '');
+ $this->advance();
+ return $result;
+ // If it's a negative value
+ } elseif ($this->currentToken == "-") {
+ // catch "-" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUminus', $result2, '');
+ return $result;
+ // If it's a positive value
+ } elseif ($this->currentToken == "+") {
+ // catch "+" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUplus', $result2, '');
+ return $result;
+ }
+ $result = $this->term();
+ while (($this->currentToken == "+") or
+ ($this->currentToken == "-") or
+ ($this->currentToken == "^")) {
+ /**/
+ if ($this->currentToken == "+") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgAdd', $result, $result2);
+ } elseif ($this->currentToken == "-") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgSub', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgPower', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * This function just introduces a ptgParen element in the tree, so that Excel
+ * doesn't get confused when working with a parenthesized formula afterwards.
+ *
+ * @access private
+ * @see fact()
+ * @return array The parsed ptg'd tree
+ */
+ private function parenthesizedExpression()
+ {
+ $result = $this->createTree('ptgParen', $this->expression(), '');
+ return $result;
+ }
+
+ /**
+ * It parses a term. It assumes the following rule:
+ * Term -> Fact [("*" | "/") Fact]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function term()
+ {
+ $result = $this->fact();
+ while (($this->currentToken == "*") or
+ ($this->currentToken == "/")) {
+ /**/
+ if ($this->currentToken == "*") {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgMul', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgDiv', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a factor. It assumes the following rule:
+ * Fact -> ( Expr )
+ * | CellRef
+ * | CellRange
+ * | Number
+ * | Function
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function fact()
+ {
+ if ($this->currentToken == "(") {
+ $this->advance(); // eat the "("
+ $result = $this->parenthesizedExpression();
+ if ($this->currentToken != ")") {
+ throw new PHPExcel_Writer_Exception("')' token expected.");
+ }
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+ // if it's a reference
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->currentToken)) {
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken) or
+ preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken)) {
+ // if it's a range A1:B2 or $A$1:$B$2
+ // must be an error?
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (is_numeric($this->currentToken)) {
+ // If it's a number or a percent
+ if ($this->lookAhead == '%') {
+ $result = $this->createTree('ptgPercent', $this->currentToken, '');
+ $this->advance(); // Skip the percentage operator once we've pre-built that tree
+ } else {
+ $result = $this->createTree($this->currentToken, '', '');
+ }
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->currentToken)) {
+ // if it's a function call
+ $result = $this->func();
+ return $result;
+ }
+ throw new PHPExcel_Writer_Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter);
+ }
+
+ /**
+ * It parses a function call. It assumes the following rule:
+ * Func -> ( Expr [,Expr]* )
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function func()
+ {
+ $num_args = 0; // number of arguments received
+ $function = strtoupper($this->currentToken);
+ $result = ''; // initialize result
+ $this->advance();
+ $this->advance(); // eat the "("
+ while ($this->currentToken != ')') {
+ /**/
+ if ($num_args > 0) {
+ if ($this->currentToken == "," || $this->currentToken == ";") {
+ $this->advance(); // eat the "," or ";"
+ } else {
+ throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
+ }
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', $result, $result2);
+ } else { // first argument
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', '', $result2);
+ }
+ ++$num_args;
+ }
+ if (!isset($this->functions[$function])) {
+ throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
+ }
+ $args = $this->functions[$function][1];
+ // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
+ if (($args >= 0) and ($args != $num_args)) {
+ throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
+ }
+
+ $result = $this->createTree($function, $result, $num_args);
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+
+ /**
+ * Creates a tree. In fact an array which may have one or two arrays (sub-trees)
+ * as elements.
+ *
+ * @access private
+ * @param mixed $value The value of this node.
+ * @param mixed $left The left array (sub-tree) or a final node.
+ * @param mixed $right The right array (sub-tree) or a final node.
+ * @return array A tree
+ */
+ private function createTree($value, $left, $right)
+ {
+ return array('value' => $value, 'left' => $left, 'right' => $right);
+ }
+
+ /**
+ * Builds a string containing the tree in reverse polish notation (What you
+ * would use in a HP calculator stack).
+ * The following tree:
+ *
+ * +
+ * / \
+ * 2 3
+ *
+ * produces: "23+"
+ *
+ * The following tree:
+ *
+ * +
+ * / \
+ * 3 *
+ * / \
+ * 6 A1
+ *
+ * produces: "36A1*+"
+ *
+ * In fact all operands, functions, references, etc... are written as ptg's
+ *
+ * @access public
+ * @param array $tree The optional tree to convert.
+ * @return string The tree in reverse polish notation
+ */
+ public function toReversePolish($tree = array())
+ {
+ $polish = ""; // the string we are going to return
+ if (empty($tree)) { // If it's the first call use parseTree
+ $tree = $this->parseTree;
+ }
+
+ if (is_array($tree['left'])) {
+ $converted_tree = $this->toReversePolish($tree['left']);
+ $polish .= $converted_tree;
+ } elseif ($tree['left'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['left']);
+ $polish .= $converted_tree;
+ }
+ if (is_array($tree['right'])) {
+ $converted_tree = $this->toReversePolish($tree['right']);
+ $polish .= $converted_tree;
+ } elseif ($tree['right'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['right']);
+ $polish .= $converted_tree;
+ }
+ // if it's a function convert it here (so we can set it's arguments)
+ if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
+ !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
+ !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
+ !is_numeric($tree['value']) and
+ !isset($this->ptg[$tree['value']])) {
+ // left subtree for a function is always an array.
+ if ($tree['left'] != '') {
+ $left_tree = $this->toReversePolish($tree['left']);
+ } else {
+ $left_tree = '';
+ }
+ // add it's left subtree and return.
+ return $left_tree.$this->convertFunction($tree['value'], $tree['right']);
+ } else {
+ $converted_tree = $this->convert($tree['value']);
+ }
+ $polish .= $converted_tree;
+ return $polish;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php.bk-aleluya b/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php.bk-aleluya
new file mode 100644
index 0000000..0cf1c1d
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/ParserBakAleluya.php.bk-aleluya
@@ -0,0 +1,1531 @@
+=,;#()"{}
+ const REGEX_SHEET_TITLE_UNQUOTED = '[^\*\:\/\\\\\?\[\]\+\-\% \\\'\^\&\<\>\=\,\;\#\(\)\"\{\}]+';
+
+ // Sheet title in quoted form (without surrounding quotes)
+ // Invalid sheet title characters cannot occur in the sheet title:
+ // *:/\?[] (usual invalid sheet title characters)
+ // Single quote is represented as a pair ''
+ const REGEX_SHEET_TITLE_QUOTED = '(([^\*\:\/\\\\\?\[\]\\\'])+|(\\\'\\\')+)+';
+
+ /**
+ * The index of the character we are currently looking at
+ * @var integer
+ */
+ public $currentCharacter;
+
+ /**
+ * The token we are working on.
+ * @var string
+ */
+ public $currentToken;
+
+ /**
+ * The formula to parse
+ * @var string
+ */
+ private $formula;
+
+ /**
+ * The character ahead of the current char
+ * @var string
+ */
+ public $lookAhead;
+
+ /**
+ * The parse tree to be generated
+ * @var string
+ */
+ private $parseTree;
+
+ /**
+ * Array of external sheets
+ * @var array
+ */
+ private $externalSheets;
+
+ /**
+ * Array of sheet references in the form of REF structures
+ * @var array
+ */
+ public $references;
+
+ /**
+ * The class constructor
+ *
+ */
+ public function __construct()
+ {
+ $this->currentCharacter = 0;
+ $this->currentToken = ''; // The token we are working on.
+ $this->formula = ''; // The formula to parse.
+ $this->lookAhead = ''; // The character ahead of the current char.
+ $this->parseTree = ''; // The parse tree to be generated.
+ $this->initializeHashes(); // Initialize the hashes: ptg's and function's ptg's
+ $this->externalSheets = array();
+ $this->references = array();
+ }
+
+ /**
+ * Initialize the ptg and function hashes.
+ *
+ * @access private
+ */
+ private function initializeHashes()
+ {
+ // The Excel ptg indices
+ $this->ptg = array(
+ 'ptgExp' => 0x01,
+ 'ptgTbl' => 0x02,
+ 'ptgAdd' => 0x03,
+ 'ptgSub' => 0x04,
+ 'ptgMul' => 0x05,
+ 'ptgDiv' => 0x06,
+ 'ptgPower' => 0x07,
+ 'ptgConcat' => 0x08,
+ 'ptgLT' => 0x09,
+ 'ptgLE' => 0x0A,
+ 'ptgEQ' => 0x0B,
+ 'ptgGE' => 0x0C,
+ 'ptgGT' => 0x0D,
+ 'ptgNE' => 0x0E,
+ 'ptgIsect' => 0x0F,
+ 'ptgUnion' => 0x10,
+ 'ptgRange' => 0x11,
+ 'ptgUplus' => 0x12,
+ 'ptgUminus' => 0x13,
+ 'ptgPercent' => 0x14,
+ 'ptgParen' => 0x15,
+ 'ptgMissArg' => 0x16,
+ 'ptgStr' => 0x17,
+ 'ptgAttr' => 0x19,
+ 'ptgSheet' => 0x1A,
+ 'ptgEndSheet' => 0x1B,
+ 'ptgErr' => 0x1C,
+ 'ptgBool' => 0x1D,
+ 'ptgInt' => 0x1E,
+ 'ptgNum' => 0x1F,
+ 'ptgArray' => 0x20,
+ 'ptgFunc' => 0x21,
+ 'ptgFuncVar' => 0x22,
+ 'ptgName' => 0x23,
+ 'ptgRef' => 0x24,
+ 'ptgArea' => 0x25,
+ 'ptgMemArea' => 0x26,
+ 'ptgMemErr' => 0x27,
+ 'ptgMemNoMem' => 0x28,
+ 'ptgMemFunc' => 0x29,
+ 'ptgRefErr' => 0x2A,
+ 'ptgAreaErr' => 0x2B,
+ 'ptgRefN' => 0x2C,
+ 'ptgAreaN' => 0x2D,
+ 'ptgMemAreaN' => 0x2E,
+ 'ptgMemNoMemN' => 0x2F,
+ 'ptgNameX' => 0x39,
+ 'ptgRef3d' => 0x3A,
+ 'ptgArea3d' => 0x3B,
+ 'ptgRefErr3d' => 0x3C,
+ 'ptgAreaErr3d' => 0x3D,
+ 'ptgArrayV' => 0x40,
+ 'ptgFuncV' => 0x41,
+ 'ptgFuncVarV' => 0x42,
+ 'ptgNameV' => 0x43,
+ 'ptgRefV' => 0x44,
+ 'ptgAreaV' => 0x45,
+ 'ptgMemAreaV' => 0x46,
+ 'ptgMemErrV' => 0x47,
+ 'ptgMemNoMemV' => 0x48,
+ 'ptgMemFuncV' => 0x49,
+ 'ptgRefErrV' => 0x4A,
+ 'ptgAreaErrV' => 0x4B,
+ 'ptgRefNV' => 0x4C,
+ 'ptgAreaNV' => 0x4D,
+ 'ptgMemAreaNV' => 0x4E,
+ 'ptgMemNoMemN' => 0x4F,
+ 'ptgFuncCEV' => 0x58,
+ 'ptgNameXV' => 0x59,
+ 'ptgRef3dV' => 0x5A,
+ 'ptgArea3dV' => 0x5B,
+ 'ptgRefErr3dV' => 0x5C,
+ 'ptgAreaErr3d' => 0x5D,
+ 'ptgArrayA' => 0x60,
+ 'ptgFuncA' => 0x61,
+ 'ptgFuncVarA' => 0x62,
+ 'ptgNameA' => 0x63,
+ 'ptgRefA' => 0x64,
+ 'ptgAreaA' => 0x65,
+ 'ptgMemAreaA' => 0x66,
+ 'ptgMemErrA' => 0x67,
+ 'ptgMemNoMemA' => 0x68,
+ 'ptgMemFuncA' => 0x69,
+ 'ptgRefErrA' => 0x6A,
+ 'ptgAreaErrA' => 0x6B,
+ 'ptgRefNA' => 0x6C,
+ 'ptgAreaNA' => 0x6D,
+ 'ptgMemAreaNA' => 0x6E,
+ 'ptgMemNoMemN' => 0x6F,
+ 'ptgFuncCEA' => 0x78,
+ 'ptgNameXA' => 0x79,
+ 'ptgRef3dA' => 0x7A,
+ 'ptgArea3dA' => 0x7B,
+ 'ptgRefErr3dA' => 0x7C,
+ 'ptgAreaErr3d' => 0x7D
+ );
+
+ // Thanks to Michael Meeks and Gnumeric for the initial arg values.
+ //
+ // The following hash was generated by "function_locale.pl" in the distro.
+ // Refer to function_locale.pl for non-English function names.
+ //
+ // The array elements are as follow:
+ // ptg: The Excel function ptg code.
+ // args: The number of arguments that the function takes:
+ // >=0 is a fixed number of arguments.
+ // -1 is a variable number of arguments.
+ // class: The reference, value or array class of the function args.
+ // vol: The function is volatile.
+ //
+ $this->functions = array(
+ // function ptg args class vol
+ 'COUNT' => array( 0, -1, 0, 0 ),
+ 'IF' => array( 1, -1, 1, 0 ),
+ 'ISNA' => array( 2, 1, 1, 0 ),
+ 'ISERROR' => array( 3, 1, 1, 0 ),
+ 'SUM' => array( 4, -1, 0, 0 ),
+ 'AVERAGE' => array( 5, -1, 0, 0 ),
+ 'MIN' => array( 6, -1, 0, 0 ),
+ 'MAX' => array( 7, -1, 0, 0 ),
+ 'ROW' => array( 8, -1, 0, 0 ),
+ 'COLUMN' => array( 9, -1, 0, 0 ),
+ 'NA' => array( 10, 0, 0, 0 ),
+ 'NPV' => array( 11, -1, 1, 0 ),
+ 'STDEV' => array( 12, -1, 0, 0 ),
+ 'DOLLAR' => array( 13, -1, 1, 0 ),
+ 'FIXED' => array( 14, -1, 1, 0 ),
+ 'SIN' => array( 15, 1, 1, 0 ),
+ 'COS' => array( 16, 1, 1, 0 ),
+ 'TAN' => array( 17, 1, 1, 0 ),
+ 'ATAN' => array( 18, 1, 1, 0 ),
+ 'PI' => array( 19, 0, 1, 0 ),
+ 'SQRT' => array( 20, 1, 1, 0 ),
+ 'EXP' => array( 21, 1, 1, 0 ),
+ 'LN' => array( 22, 1, 1, 0 ),
+ 'LOG10' => array( 23, 1, 1, 0 ),
+ 'ABS' => array( 24, 1, 1, 0 ),
+ 'INT' => array( 25, 1, 1, 0 ),
+ 'SIGN' => array( 26, 1, 1, 0 ),
+ 'ROUND' => array( 27, 2, 1, 0 ),
+ 'LOOKUP' => array( 28, -1, 0, 0 ),
+ 'INDEX' => array( 29, -1, 0, 1 ),
+ 'REPT' => array( 30, 2, 1, 0 ),
+ 'MID' => array( 31, 3, 1, 0 ),
+ 'LEN' => array( 32, 1, 1, 0 ),
+ 'VALUE' => array( 33, 1, 1, 0 ),
+ 'TRUE' => array( 34, 0, 1, 0 ),
+ 'FALSE' => array( 35, 0, 1, 0 ),
+ 'AND' => array( 36, -1, 0, 0 ),
+ 'OR' => array( 37, -1, 0, 0 ),
+ 'NOT' => array( 38, 1, 1, 0 ),
+ 'MOD' => array( 39, 2, 1, 0 ),
+ 'DCOUNT' => array( 40, 3, 0, 0 ),
+ 'DSUM' => array( 41, 3, 0, 0 ),
+ 'DAVERAGE' => array( 42, 3, 0, 0 ),
+ 'DMIN' => array( 43, 3, 0, 0 ),
+ 'DMAX' => array( 44, 3, 0, 0 ),
+ 'DSTDEV' => array( 45, 3, 0, 0 ),
+ 'VAR' => array( 46, -1, 0, 0 ),
+ 'DVAR' => array( 47, 3, 0, 0 ),
+ 'TEXT' => array( 48, 2, 1, 0 ),
+ 'LINEST' => array( 49, -1, 0, 0 ),
+ 'TREND' => array( 50, -1, 0, 0 ),
+ 'LOGEST' => array( 51, -1, 0, 0 ),
+ 'GROWTH' => array( 52, -1, 0, 0 ),
+ 'PV' => array( 56, -1, 1, 0 ),
+ 'FV' => array( 57, -1, 1, 0 ),
+ 'NPER' => array( 58, -1, 1, 0 ),
+ 'PMT' => array( 59, -1, 1, 0 ),
+ 'RATE' => array( 60, -1, 1, 0 ),
+ 'MIRR' => array( 61, 3, 0, 0 ),
+ 'IRR' => array( 62, -1, 0, 0 ),
+ 'RAND' => array( 63, 0, 1, 1 ),
+ 'MATCH' => array( 64, -1, 0, 0 ),
+ 'DATE' => array( 65, 3, 1, 0 ),
+ 'TIME' => array( 66, 3, 1, 0 ),
+ 'DAY' => array( 67, 1, 1, 0 ),
+ 'MONTH' => array( 68, 1, 1, 0 ),
+ 'YEAR' => array( 69, 1, 1, 0 ),
+ 'WEEKDAY' => array( 70, -1, 1, 0 ),
+ 'HOUR' => array( 71, 1, 1, 0 ),
+ 'MINUTE' => array( 72, 1, 1, 0 ),
+ 'SECOND' => array( 73, 1, 1, 0 ),
+ 'NOW' => array( 74, 0, 1, 1 ),
+ 'AREAS' => array( 75, 1, 0, 1 ),
+ 'ROWS' => array( 76, 1, 0, 1 ),
+ 'COLUMNS' => array( 77, 1, 0, 1 ),
+ 'OFFSET' => array( 78, -1, 0, 1 ),
+ 'SEARCH' => array( 82, -1, 1, 0 ),
+ 'TRANSPOSE' => array( 83, 1, 1, 0 ),
+ 'TYPE' => array( 86, 1, 1, 0 ),
+ 'ATAN2' => array( 97, 2, 1, 0 ),
+ 'ASIN' => array( 98, 1, 1, 0 ),
+ 'ACOS' => array( 99, 1, 1, 0 ),
+ 'CHOOSE' => array( 100, -1, 1, 0 ),
+ 'HLOOKUP' => array( 101, -1, 0, 0 ),
+ 'VLOOKUP' => array( 102, -1, 0, 0 ),
+ 'ISREF' => array( 105, 1, 0, 0 ),
+ 'LOG' => array( 109, -1, 1, 0 ),
+ 'CHAR' => array( 111, 1, 1, 0 ),
+ 'LOWER' => array( 112, 1, 1, 0 ),
+ 'UPPER' => array( 113, 1, 1, 0 ),
+ 'PROPER' => array( 114, 1, 1, 0 ),
+ 'LEFT' => array( 115, -1, 1, 0 ),
+ 'RIGHT' => array( 116, -1, 1, 0 ),
+ 'EXACT' => array( 117, 2, 1, 0 ),
+ 'TRIM' => array( 118, 1, 1, 0 ),
+ 'REPLACE' => array( 119, 4, 1, 0 ),
+ 'SUBSTITUTE' => array( 120, -1, 1, 0 ),
+ 'CODE' => array( 121, 1, 1, 0 ),
+ 'FIND' => array( 124, -1, 1, 0 ),
+ 'CELL' => array( 125, -1, 0, 1 ),
+ 'ISERR' => array( 126, 1, 1, 0 ),
+ 'ISTEXT' => array( 127, 1, 1, 0 ),
+ 'ISNUMBER' => array( 128, 1, 1, 0 ),
+ 'ISBLANK' => array( 129, 1, 1, 0 ),
+ 'T' => array( 130, 1, 0, 0 ),
+ 'N' => array( 131, 1, 0, 0 ),
+ 'DATEVALUE' => array( 140, 1, 1, 0 ),
+ 'TIMEVALUE' => array( 141, 1, 1, 0 ),
+ 'SLN' => array( 142, 3, 1, 0 ),
+ 'SYD' => array( 143, 4, 1, 0 ),
+ 'DDB' => array( 144, -1, 1, 0 ),
+ 'INDIRECT' => array( 148, -1, 1, 1 ),
+ 'CALL' => array( 150, -1, 1, 0 ),
+ 'CLEAN' => array( 162, 1, 1, 0 ),
+ 'MDETERM' => array( 163, 1, 2, 0 ),
+ 'MINVERSE' => array( 164, 1, 2, 0 ),
+ 'MMULT' => array( 165, 2, 2, 0 ),
+ 'IPMT' => array( 167, -1, 1, 0 ),
+ 'PPMT' => array( 168, -1, 1, 0 ),
+ 'COUNTA' => array( 169, -1, 0, 0 ),
+ 'PRODUCT' => array( 183, -1, 0, 0 ),
+ 'FACT' => array( 184, 1, 1, 0 ),
+ 'DPRODUCT' => array( 189, 3, 0, 0 ),
+ 'ISNONTEXT' => array( 190, 1, 1, 0 ),
+ 'STDEVP' => array( 193, -1, 0, 0 ),
+ 'VARP' => array( 194, -1, 0, 0 ),
+ 'DSTDEVP' => array( 195, 3, 0, 0 ),
+ 'DVARP' => array( 196, 3, 0, 0 ),
+ 'TRUNC' => array( 197, -1, 1, 0 ),
+ 'ISLOGICAL' => array( 198, 1, 1, 0 ),
+ 'DCOUNTA' => array( 199, 3, 0, 0 ),
+ 'USDOLLAR' => array( 204, -1, 1, 0 ),
+ 'FINDB' => array( 205, -1, 1, 0 ),
+ 'SEARCHB' => array( 206, -1, 1, 0 ),
+ 'REPLACEB' => array( 207, 4, 1, 0 ),
+ 'LEFTB' => array( 208, -1, 1, 0 ),
+ 'RIGHTB' => array( 209, -1, 1, 0 ),
+ 'MIDB' => array( 210, 3, 1, 0 ),
+ 'LENB' => array( 211, 1, 1, 0 ),
+ 'ROUNDUP' => array( 212, 2, 1, 0 ),
+ 'ROUNDDOWN' => array( 213, 2, 1, 0 ),
+ 'ASC' => array( 214, 1, 1, 0 ),
+ 'DBCS' => array( 215, 1, 1, 0 ),
+ 'RANK' => array( 216, -1, 0, 0 ),
+ 'ADDRESS' => array( 219, -1, 1, 0 ),
+ 'DAYS360' => array( 220, -1, 1, 0 ),
+ 'TODAY' => array( 221, 0, 1, 1 ),
+ 'VDB' => array( 222, -1, 1, 0 ),
+ 'MEDIAN' => array( 227, -1, 0, 0 ),
+ 'SUMPRODUCT' => array( 228, -1, 2, 0 ),
+ 'SINH' => array( 229, 1, 1, 0 ),
+ 'COSH' => array( 230, 1, 1, 0 ),
+ 'TANH' => array( 231, 1, 1, 0 ),
+ 'ASINH' => array( 232, 1, 1, 0 ),
+ 'ACOSH' => array( 233, 1, 1, 0 ),
+ 'ATANH' => array( 234, 1, 1, 0 ),
+ 'DGET' => array( 235, 3, 0, 0 ),
+ 'INFO' => array( 244, 1, 1, 1 ),
+ 'DB' => array( 247, -1, 1, 0 ),
+ 'FREQUENCY' => array( 252, 2, 0, 0 ),
+ 'ERROR.TYPE' => array( 261, 1, 1, 0 ),
+ 'REGISTER.ID' => array( 267, -1, 1, 0 ),
+ 'AVEDEV' => array( 269, -1, 0, 0 ),
+ 'BETADIST' => array( 270, -1, 1, 0 ),
+ 'GAMMALN' => array( 271, 1, 1, 0 ),
+ 'BETAINV' => array( 272, -1, 1, 0 ),
+ 'BINOMDIST' => array( 273, 4, 1, 0 ),
+ 'CHIDIST' => array( 274, 2, 1, 0 ),
+ 'CHIINV' => array( 275, 2, 1, 0 ),
+ 'COMBIN' => array( 276, 2, 1, 0 ),
+ 'CONFIDENCE' => array( 277, 3, 1, 0 ),
+ 'CRITBINOM' => array( 278, 3, 1, 0 ),
+ 'EVEN' => array( 279, 1, 1, 0 ),
+ 'EXPONDIST' => array( 280, 3, 1, 0 ),
+ 'FDIST' => array( 281, 3, 1, 0 ),
+ 'FINV' => array( 282, 3, 1, 0 ),
+ 'FISHER' => array( 283, 1, 1, 0 ),
+ 'FISHERINV' => array( 284, 1, 1, 0 ),
+ 'FLOOR' => array( 285, 2, 1, 0 ),
+ 'GAMMADIST' => array( 286, 4, 1, 0 ),
+ 'GAMMAINV' => array( 287, 3, 1, 0 ),
+ 'CEILING' => array( 288, 2, 1, 0 ),
+ 'HYPGEOMDIST' => array( 289, 4, 1, 0 ),
+ 'LOGNORMDIST' => array( 290, 3, 1, 0 ),
+ 'LOGINV' => array( 291, 3, 1, 0 ),
+ 'NEGBINOMDIST' => array( 292, 3, 1, 0 ),
+ 'NORMDIST' => array( 293, 4, 1, 0 ),
+ 'NORMSDIST' => array( 294, 1, 1, 0 ),
+ 'NORMINV' => array( 295, 3, 1, 0 ),
+ 'NORMSINV' => array( 296, 1, 1, 0 ),
+ 'STANDARDIZE' => array( 297, 3, 1, 0 ),
+ 'ODD' => array( 298, 1, 1, 0 ),
+ 'PERMUT' => array( 299, 2, 1, 0 ),
+ 'POISSON' => array( 300, 3, 1, 0 ),
+ 'TDIST' => array( 301, 3, 1, 0 ),
+ 'WEIBULL' => array( 302, 4, 1, 0 ),
+ 'SUMXMY2' => array( 303, 2, 2, 0 ),
+ 'SUMX2MY2' => array( 304, 2, 2, 0 ),
+ 'SUMX2PY2' => array( 305, 2, 2, 0 ),
+ 'CHITEST' => array( 306, 2, 2, 0 ),
+ 'CORREL' => array( 307, 2, 2, 0 ),
+ 'COVAR' => array( 308, 2, 2, 0 ),
+ 'FORECAST' => array( 309, 3, 2, 0 ),
+ 'FTEST' => array( 310, 2, 2, 0 ),
+ 'INTERCEPT' => array( 311, 2, 2, 0 ),
+ 'PEARSON' => array( 312, 2, 2, 0 ),
+ 'RSQ' => array( 313, 2, 2, 0 ),
+ 'STEYX' => array( 314, 2, 2, 0 ),
+ 'SLOPE' => array( 315, 2, 2, 0 ),
+ 'TTEST' => array( 316, 4, 2, 0 ),
+ 'PROB' => array( 317, -1, 2, 0 ),
+ 'DEVSQ' => array( 318, -1, 0, 0 ),
+ 'GEOMEAN' => array( 319, -1, 0, 0 ),
+ 'HARMEAN' => array( 320, -1, 0, 0 ),
+ 'SUMSQ' => array( 321, -1, 0, 0 ),
+ 'KURT' => array( 322, -1, 0, 0 ),
+ 'SKEW' => array( 323, -1, 0, 0 ),
+ 'ZTEST' => array( 324, -1, 0, 0 ),
+ 'LARGE' => array( 325, 2, 0, 0 ),
+ 'SMALL' => array( 326, 2, 0, 0 ),
+ 'QUARTILE' => array( 327, 2, 0, 0 ),
+ 'PERCENTILE' => array( 328, 2, 0, 0 ),
+ 'PERCENTRANK' => array( 329, -1, 0, 0 ),
+ 'MODE' => array( 330, -1, 2, 0 ),
+ 'TRIMMEAN' => array( 331, 2, 0, 0 ),
+ 'TINV' => array( 332, 2, 1, 0 ),
+ 'CONCATENATE' => array( 336, -1, 1, 0 ),
+ 'POWER' => array( 337, 2, 1, 0 ),
+ 'RADIANS' => array( 342, 1, 1, 0 ),
+ 'DEGREES' => array( 343, 1, 1, 0 ),
+ 'SUBTOTAL' => array( 344, -1, 0, 0 ),
+ 'SUMIF' => array( 345, -1, 0, 0 ),
+ 'COUNTIF' => array( 346, 2, 0, 0 ),
+ 'COUNTBLANK' => array( 347, 1, 0, 0 ),
+ 'ISPMT' => array( 350, 4, 1, 0 ),
+ 'DATEDIF' => array( 351, 3, 1, 0 ),
+ 'DATESTRING' => array( 352, 1, 1, 0 ),
+ 'NUMBERSTRING' => array( 353, 2, 1, 0 ),
+ 'ROMAN' => array( 354, -1, 1, 0 ),
+ 'GETPIVOTDATA' => array( 358, -1, 0, 0 ),
+ 'HYPERLINK' => array( 359, -1, 1, 0 ),
+ 'PHONETIC' => array( 360, 1, 0, 0 ),
+ 'AVERAGEA' => array( 361, -1, 0, 0 ),
+ 'MAXA' => array( 362, -1, 0, 0 ),
+ 'MINA' => array( 363, -1, 0, 0 ),
+ 'STDEVPA' => array( 364, -1, 0, 0 ),
+ 'VARPA' => array( 365, -1, 0, 0 ),
+ 'STDEVA' => array( 366, -1, 0, 0 ),
+ 'VARA' => array( 367, -1, 0, 0 ),
+ 'BAHTTEXT' => array( 368, 1, 0, 0 ),
+ );
+ }
+
+ /**
+ * Convert a token to the proper ptg value.
+ *
+ * @access private
+ * @param mixed $token The token to convert.
+ * @return mixed the converted token on success
+ */
+ private function convert($token)
+ {
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
+ return $this->convertString($token);
+
+ } elseif (is_numeric($token)) {
+ return $this->convertNumber($token);
+
+ // match references like A1 or $A$1
+ } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
+ return $this->convertRef2d($token);
+
+ // match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
+ return $this->convertRef3d($token);
+
+ // match ranges like A1:B2 or $A$1:$B$2
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)\:(\$)?[A-Ia-i]?[A-Za-z](\$)?(\d+)$/', $token)) {
+ return $this->convertRange2d($token);
+
+ // match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
+ return $this->convertRange3d($token);
+
+ // operators (including parentheses)
+ } elseif (isset($this->ptg[$token])) {
+ return pack("C", $this->ptg[$token]);
+
+ // match error codes
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ return $this->convertError($token);
+
+ // commented so argument number can be processed correctly. See toReversePolish().
+ /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
+ {
+ return($this->convertFunction($token, $this->_func_args));
+ }*/
+
+ // if it's an argument, ignore the token (the argument remains)
+ } elseif ($token == 'arg') {
+ return '';
+ }
+
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown token $token");
+ }
+
+ /**
+ * Convert a number token to ptgInt or ptgNum
+ *
+ * @access private
+ * @param mixed $num an integer or double for conversion to its ptg value
+ */
+ private function convertNumber($num)
+ {
+ // Integer in the range 0..2**16-1
+ if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
+ return pack("Cv", $this->ptg['ptgInt'], $num);
+ } else { // A float
+ if (PHPExcel_Writer_Excel5_BIFFwriter::getByteOrder()) { // if it's Big Endian
+ $num = strrev($num);
+ }
+ return pack("Cd", $this->ptg['ptgNum'], $num);
+ }
+ }
+
+ /**
+ * Convert a string token to ptgStr
+ *
+ * @access private
+ * @param string $string A string for conversion to its ptg value.
+ * @return mixed the converted token on success
+ */
+ private function convertString($string)
+ {
+ // chop away beggining and ending quotes
+ $string = substr($string, 1, strlen($string) - 2);
+ if (strlen($string) > 255) {
+ throw new PHPExcel_Writer_Exception("String is too long");
+ }
+
+ return pack('C', $this->ptg['ptgStr']) . PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($string);
+ }
+
+ /**
+ * Convert a function to a ptgFunc or ptgFuncVarV depending on the number of
+ * args that it takes.
+ *
+ * @access private
+ * @param string $token The name of the function for convertion to ptg value.
+ * @param integer $num_args The number of arguments the function receives.
+ * @return string The packed ptg for the function
+ */
+ private function convertFunction($token, $num_args)
+ {
+ $args = $this->functions[$token][1];
+// $volatile = $this->functions[$token][3];
+
+ // Fixed number of args eg. TIME($i, $j, $k).
+ if ($args >= 0) {
+ return pack("Cv", $this->ptg['ptgFuncV'], $this->functions[$token][0]);
+ }
+ // Variable number of args eg. SUM($i, $j, $k, ..).
+ if ($args == -1) {
+ return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->functions[$token][0]);
+ }
+ }
+
+ /**
+ * Convert an Excel range such as A1:D4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $range An Excel range in the A1:A2
+ * @param int $class
+ */
+ private function convertRange2d($range, $class = 0)
+ {
+
+ // TODO: possible class value 0,1,2 check Formula.pm
+ // Split the range into 2 cell refs
+ if (preg_match('/^(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)\:(\$)?([A-Ia-i]?[A-Za-z])(\$)?(\d+)$/', $range)) {
+ list($cell1, $cell2) = explode(':', $range);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown range separator");
+ }
+
+ // Convert the cell references
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+
+ // The ptg value depends on the class of the ptg.
+ if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea']);
+ } elseif ($class == 1) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaV']);
+ } elseif ($class == 2) {
+ $ptgArea = pack("C", $this->ptg['ptgAreaA']);
+ } else {
+ // TODO: use real error codes
+ throw new PHPExcel_Writer_Exception("Unknown class $class");
+ }
+ return $ptgArea . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel 3d range such as "Sheet1!A1:D4" or "Sheet1:Sheet2!A1:D4" to
+ * a ptgArea3d.
+ *
+ * @access private
+ * @param string $token An Excel range in the Sheet1!A1:A2 format.
+ * @return mixed The packed ptgArea3d token on success.
+ */
+ private function convertRange3d($token)
+ {
+// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $range) = explode('!', $token);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Split the range into 2 cell refs
+ list($cell1, $cell2) = explode(':', $range);
+
+ // Convert the cell references
+ if (preg_match("/^(\\$)?[A-Ia-i]?[A-Za-z](\\$)?(\d+)$/", $cell1)) {
+ list($row1, $col1) = $this->cellToPackedRowcol($cell1);
+ list($row2, $col2) = $this->cellToPackedRowcol($cell2);
+ } else { // It's a rows range (like 26:27)
+ list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1.':'.$cell2);
+ }
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+ $ptgArea = pack("C", $this->ptg['ptgArea3d']);
+// } elseif ($class == 1) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dV']);
+// } elseif ($class == 2) {
+// $ptgArea = pack("C", $this->ptg['ptgArea3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgArea . $ext_ref . $row1 . $row2 . $col1. $col2;
+ }
+
+ /**
+ * Convert an Excel reference such as A1, $B2, C$3 or $D$4 to a ptgRefV.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return string The cell in packed() format with the corresponding ptg
+ */
+ private function convertRef2d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Convert the cell reference
+ $cell_array = $this->cellToPackedRowcol($cell);
+ list($row, $col) = $cell_array;
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRefV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRefA']);
+// } else {
+// // TODO: use real error codes
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+ return $ptgRef.$row.$col;
+ }
+
+ /**
+ * Convert an Excel 3d reference such as "Sheet1!A1" or "Sheet1:Sheet2!A1" to a
+ * ptgRef3d.
+ *
+ * @access private
+ * @param string $cell An Excel cell reference
+ * @return mixed The packed ptgRef3d token on success.
+ */
+ private function convertRef3d($cell)
+ {
+// $class = 2; // as far as I know, this is magick.
+
+ // Split the ref at the ! symbol
+ list($ext_ref, $cell) = explode('!', $cell);
+
+ // Convert the external reference part (different for BIFF8)
+ $ext_ref = $this->getRefIndex($ext_ref);
+
+ // Convert the cell reference part
+ list($row, $col) = $this->cellToPackedRowcol($cell);
+
+ // The ptg value depends on the class of the ptg.
+// if ($class == 0) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3d']);
+// } elseif ($class == 1) {
+// $ptgRef = pack("C", $this->ptg['ptgRef3dV']);
+// } elseif ($class == 2) {
+ $ptgRef = pack("C", $this->ptg['ptgRef3dA']);
+// } else {
+// throw new PHPExcel_Writer_Exception("Unknown class $class");
+// }
+
+ return $ptgRef . $ext_ref. $row . $col;
+ }
+
+ /**
+ * Convert an error code to a ptgErr
+ *
+ * @access private
+ * @param string $errorCode The error code for conversion to its ptg value
+ * @return string The error code ptgErr
+ */
+ private function convertError($errorCode)
+ {
+ switch ($errorCode) {
+ case '#NULL!':
+ return pack("C", 0x00);
+ case '#DIV/0!':
+ return pack("C", 0x07);
+ case '#VALUE!':
+ return pack("C", 0x0F);
+ case '#REF!':
+ return pack("C", 0x17);
+ case '#NAME?':
+ return pack("C", 0x1D);
+ case '#NUM!':
+ return pack("C", 0x24);
+ case '#N/A':
+ return pack("C", 0x2A);
+ }
+ return pack("C", 0xFF);
+ }
+
+ /**
+ * Convert the sheet name part of an external reference, for example "Sheet1" or
+ * "Sheet1:Sheet2", to a packed structure.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return string The reference index in packed() format
+ */
+ private function packExtRef($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // References are stored relative to 0xFFFF.
+ $offset = -1 - $sheet1;
+
+ return pack('vdvv', $offset, 0x00, $sheet1, $sheet2);
+ }
+
+ /**
+ * Look up the REF index that corresponds to an external sheet name
+ * (or range). If it doesn't exist yet add it to the workbook's references
+ * array. It assumes all sheet names given must exist.
+ *
+ * @access private
+ * @param string $ext_ref The name of the external reference
+ * @return mixed The reference index in packed() format on success
+ */
+ private function getRefIndex($ext_ref)
+ {
+ $ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
+ $ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
+ $ext_ref = str_replace('\'\'', '\'', $ext_ref); // Replace escaped '' with '
+
+ // Check if there is a sheet range eg., Sheet1:Sheet2.
+ if (preg_match("/:/", $ext_ref)) {
+ list($sheet_name1, $sheet_name2) = explode(':', $ext_ref);
+
+ $sheet1 = $this->getSheetIndex($sheet_name1);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name1 in formula");
+ }
+ $sheet2 = $this->getSheetIndex($sheet_name2);
+ if ($sheet2 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $sheet_name2 in formula");
+ }
+
+ // Reverse max and min sheet numbers if necessary
+ if ($sheet1 > $sheet2) {
+ list($sheet1, $sheet2) = array($sheet2, $sheet1);
+ }
+ } else { // Single sheet name only.
+ $sheet1 = $this->getSheetIndex($ext_ref);
+ if ($sheet1 == -1) {
+ throw new PHPExcel_Writer_Exception("Unknown sheet name $ext_ref in formula");
+ }
+ $sheet2 = $sheet1;
+ }
+
+ // assume all references belong to this document
+ $supbook_index = 0x00;
+ $ref = pack('vvv', $supbook_index, $sheet1, $sheet2);
+ $totalreferences = count($this->references);
+ $index = -1;
+ for ($i = 0; $i < $totalreferences; ++$i) {
+ if ($ref == $this->references[$i]) {
+ $index = $i;
+ break;
+ }
+ }
+ // if REF was not found add it to references array
+ if ($index == -1) {
+ $this->references[$totalreferences] = $ref;
+ $index = $totalreferences;
+ }
+
+ return pack('v', $index);
+ }
+
+ /**
+ * Look up the index that corresponds to an external sheet name. The hash of
+ * sheet names is updated by the addworksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access private
+ * @param string $sheet_name Sheet name
+ * @return integer The sheet index, -1 if the sheet was not found
+ */
+ private function getSheetIndex($sheet_name)
+ {
+ if (!isset($this->externalSheets[$sheet_name])) {
+ return -1;
+ } else {
+ return $this->externalSheets[$sheet_name];
+ }
+ }
+
+ /**
+ * This method is used to update the array of sheet names. It is
+ * called by the addWorksheet() method of the
+ * PHPExcel_Writer_Excel5_Workbook class.
+ *
+ * @access public
+ * @see PHPExcel_Writer_Excel5_Workbook::addWorksheet()
+ * @param string $name The name of the worksheet being added
+ * @param integer $index The index of the worksheet being added
+ */
+ public function setExtSheet($name, $index)
+ {
+ $this->externalSheets[$name] = $index;
+ }
+
+ /**
+ * pack() row and column into the required 3 or 4 byte format.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference to be packed
+ * @return array Array containing the row and column in packed() format
+ */
+ private function cellToPackedRowcol($cell)
+ {
+ $cell = strtoupper($cell);
+ list($row, $col, $row_rel, $col_rel) = $this->cellToRowcol($cell);
+ if ($col >= 256) {
+ throw new PHPExcel_Writer_Exception("Column in: $cell greater than 255");
+ }
+ if ($row >= 65536) {
+ throw new PHPExcel_Writer_Exception("Row in: $cell greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if row or col are relative.
+ $col |= $col_rel << 14;
+ $col |= $row_rel << 15;
+ $col = pack('v', $col);
+
+ $row = pack('v', $row);
+
+ return array($row, $col);
+ }
+
+ /**
+ * pack() row range into the required 3 or 4 byte format.
+ * Just using maximum col/rows, which is probably not the correct solution
+ *
+ * @access private
+ * @param string $range The Excel range to be packed
+ * @return array Array containing (row1,col1,row2,col2) in packed() format
+ */
+ private function rangeToPackedRange($range)
+ {
+ preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
+ // return absolute rows if there is a $ in the ref
+ $row1_rel = empty($match[1]) ? 1 : 0;
+ $row1 = $match[2];
+ $row2_rel = empty($match[3]) ? 1 : 0;
+ $row2 = $match[4];
+ // Convert 1-index to zero-index
+ --$row1;
+ --$row2;
+ // Trick poor inocent Excel
+ $col1 = 0;
+ $col2 = 65535; // FIXME: maximum possible value for Excel 5 (change this!!!)
+
+ // FIXME: this changes for BIFF8
+ if (($row1 >= 65536) or ($row2 >= 65536)) {
+ throw new PHPExcel_Writer_Exception("Row in: $range greater than 65536 ");
+ }
+
+ // Set the high bits to indicate if rows are relative.
+ $col1 |= $row1_rel << 15;
+ $col2 |= $row2_rel << 15;
+ $col1 = pack('v', $col1);
+ $col2 = pack('v', $col2);
+
+ $row1 = pack('v', $row1);
+ $row2 = pack('v', $row2);
+
+ return array($row1, $col1, $row2, $col2);
+ }
+
+ /**
+ * Convert an Excel cell reference such as A1 or $B2 or C$3 or $D$4 to a zero
+ * indexed row and column number. Also returns two (0,1) values to indicate
+ * whether the row or column are relative references.
+ *
+ * @access private
+ * @param string $cell The Excel cell reference in A1 format.
+ * @return array
+ */
+ private function cellToRowcol($cell)
+ {
+ preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
+ // return absolute column if there is a $ in the ref
+ $col_rel = empty($match[1]) ? 1 : 0;
+ $col_ref = $match[2];
+ $row_rel = empty($match[3]) ? 1 : 0;
+ $row = $match[4];
+
+ // Convert base26 column string to a number.
+ $expn = strlen($col_ref) - 1;
+ $col = 0;
+ $col_ref_length = strlen($col_ref);
+ for ($i = 0; $i < $col_ref_length; ++$i) {
+ $col += (ord($col_ref{$i}) - 64) * pow(26, $expn);
+ --$expn;
+ }
+
+ // Convert 1-index to zero-index
+ --$row;
+ --$col;
+
+ return array($row, $col, $row_rel, $col_rel);
+ }
+
+ /**
+ * Advance to the next valid token.
+ *
+ * @access private
+ */
+ private function advance()
+ {
+ $i = $this->currentCharacter;
+ $formula_length = strlen($this->formula);
+ // eat up white spaces
+ if ($i < $formula_length) {
+ while ($this->formula{$i} == " ") {
+ ++$i;
+ }
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula{$i+1};
+ }
+ $token = '';
+ }
+
+ while ($i < $formula_length) {
+ $token .= $this->formula{$i};
+
+ if ($i < ($formula_length - 1)) {
+ $this->lookAhead = $this->formula{$i+1};
+ } else {
+ $this->lookAhead = '';
+ }
+
+ if ($this->match($token) != '') {
+ //if ($i < strlen($this->formula) - 1) {
+ // $this->lookAhead = $this->formula{$i+1};
+ //}
+ $this->currentCharacter = $i + 1;
+ $this->currentToken = $token;
+ return 1;
+ }
+
+ if ($i < ($formula_length - 2)) {
+ $this->lookAhead = $this->formula{$i+2};
+ } else { // if we run out of characters lookAhead becomes empty
+ $this->lookAhead = '';
+ }
+ ++$i;
+ }
+ //die("Lexical error ".$this->currentCharacter);
+ }
+
+ /**
+ * Checks if it's a valid token.
+ *
+ * @access private
+ * @param mixed $token The token to check.
+ * @return mixed The checked token or false on failure
+ */
+ private function match($token)
+ {
+ switch ($token) {
+ case "+":
+ case "-":
+ case "*":
+ case "/":
+ case "(":
+ case ")":
+ case ",":
+ case ";":
+ case ">=":
+ case "<=":
+ case "=":
+ case "<>":
+ case "^":
+ case "&":
+ case "%":
+ return $token;
+ break;
+ case ">":
+ if ($this->lookAhead == '=') { // it's a GE token
+ break;
+ }
+ return $token;
+ break;
+ case "<":
+ // it's a LE or a NE token
+ if (($this->lookAhead == '=') or ($this->lookAhead == '>')) {
+ break;
+ }
+ return $token;
+ break;
+ default:
+ // if it's a reference A1 or $A$1 or $A1 or A$1
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.') and ($this->lookAhead != '!')) {
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead) and ($this->lookAhead != ':') and ($this->lookAhead != '.')) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ return $token;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->lookAhead)) {
+ // if it's a range A1:A2 or $A$1:$A$2
+ return $token;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
+ return $token;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->lookAhead)) {
+ // If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
+ return $token;
+ } elseif (is_numeric($token) and (!is_numeric($token.$this->lookAhead) or ($this->lookAhead == '')) and ($this->lookAhead != '!') and ($this->lookAhead != ':')) {
+ // If it's a number (check that it's not a sheet name or range)
+ return $token;
+ } elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->lookAhead != '"' and (substr_count($token, '"')%2 == 0)) {
+ // If it's a string (of maximum 255 characters)
+ return $token;
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
+ // If it's an error code
+ return $token;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->lookAhead == "(")) {
+ // if it's a function call
+ return $token;
+ } elseif (substr($token, -1) == ')') {
+ // It's an argument of some description (e.g. a named range),
+ // precise nature yet to be determined
+ return $token;
+ }
+ return '';
+ }
+ }
+
+ /**
+ * The parsing method. It parses a formula.
+ *
+ * @access public
+ * @param string $formula The formula to parse, without the initial equal
+ * sign (=).
+ * @return mixed true on success
+ */
+ public function parse($formula)
+ {
+ $this->currentCharacter = 0;
+ $this->formula = $formula;
+ $this->lookAhead = isset($formula{1}) ? $formula{1} : '';
+ $this->advance();
+ $this->parseTree = $this->condition();
+ return true;
+ }
+
+ /**
+ * It parses a condition. It assumes the following rule:
+ * Cond -> Expr [(">" | "<") Expr]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function condition()
+ {
+ $result = $this->expression();
+ if ($this->currentToken == "<") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLT', $result, $result2);
+ } elseif ($this->currentToken == ">") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGT', $result, $result2);
+ } elseif ($this->currentToken == "<=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgLE', $result, $result2);
+ } elseif ($this->currentToken == ">=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgGE', $result, $result2);
+ } elseif ($this->currentToken == "=") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgEQ', $result, $result2);
+ } elseif ($this->currentToken == "<>") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgNE', $result, $result2);
+ } elseif ($this->currentToken == "&") {
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgConcat', $result, $result2);
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a expression. It assumes the following rule:
+ * Expr -> Term [("+" | "-") Term]
+ * -> "string"
+ * -> "-" Term : Negative value
+ * -> "+" Term : Positive value
+ * -> Error code
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function expression()
+ {
+ // If it's a string return a string node
+ if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->currentToken)) {
+ $tmp = str_replace('""', '"', $this->currentToken);
+ if (($tmp == '"') || ($tmp == '')) {
+ // Trap for "" that has been used for an empty string
+ $tmp = '""';
+ }
+ $result = $this->createTree($tmp, '', '');
+ $this->advance();
+ return $result;
+ // If it's an error code
+ } elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->currentToken) or $this->currentToken == '#N/A') {
+ $result = $this->createTree($this->currentToken, 'ptgErr', '');
+ $this->advance();
+ return $result;
+ // If it's a negative value
+ } elseif ($this->currentToken == "-") {
+ // catch "-" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUminus', $result2, '');
+ return $result;
+ // If it's a positive value
+ } elseif ($this->currentToken == "+") {
+ // catch "+" Term
+ $this->advance();
+ $result2 = $this->expression();
+ $result = $this->createTree('ptgUplus', $result2, '');
+ return $result;
+ }
+ $result = $this->term();
+ while (($this->currentToken == "+") or
+ ($this->currentToken == "-") or
+ ($this->currentToken == "^")) {
+ /**/
+ if ($this->currentToken == "+") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgAdd', $result, $result2);
+ } elseif ($this->currentToken == "-") {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgSub', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->term();
+ $result = $this->createTree('ptgPower', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * This function just introduces a ptgParen element in the tree, so that Excel
+ * doesn't get confused when working with a parenthesized formula afterwards.
+ *
+ * @access private
+ * @see fact()
+ * @return array The parsed ptg'd tree
+ */
+ private function parenthesizedExpression()
+ {
+ $result = $this->createTree('ptgParen', $this->expression(), '');
+ return $result;
+ }
+
+ /**
+ * It parses a term. It assumes the following rule:
+ * Term -> Fact [("*" | "/") Fact]
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function term()
+ {
+ $result = $this->fact();
+ while (($this->currentToken == "*") or
+ ($this->currentToken == "/")) {
+ /**/
+ if ($this->currentToken == "*") {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgMul', $result, $result2);
+ } else {
+ $this->advance();
+ $result2 = $this->fact();
+ $result = $this->createTree('ptgDiv', $result, $result2);
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * It parses a factor. It assumes the following rule:
+ * Fact -> ( Expr )
+ * | CellRef
+ * | CellRange
+ * | Number
+ * | Function
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function fact()
+ {
+ if ($this->currentToken == "(") {
+ $this->advance(); // eat the "("
+ $result = $this->parenthesizedExpression();
+ if ($this->currentToken != ")") {
+ throw new PHPExcel_Writer_Exception("')' token expected.");
+ }
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+ // if it's a reference
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->currentToken)) {
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken) or
+ preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->currentToken)) {
+ // if it's a range A1:B2 or $A$1:$B$2
+ // must be an error?
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->currentToken)) {
+ // If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
+ // must be an error?
+ //$result = $this->currentToken;
+ $result = $this->createTree($this->currentToken, '', '');
+ $this->advance();
+ return $result;
+ } elseif (is_numeric($this->currentToken)) {
+ // If it's a number or a percent
+ if ($this->lookAhead == '%') {
+ $result = $this->createTree('ptgPercent', $this->currentToken, '');
+ $this->advance(); // Skip the percentage operator once we've pre-built that tree
+ } else {
+ $result = $this->createTree($this->currentToken, '', '');
+ }
+ $this->advance();
+ return $result;
+ } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->currentToken)) {
+ // if it's a function call
+ $result = $this->func();
+ return $result;
+ }
+ throw new PHPExcel_Writer_Exception("Syntax error: ".$this->currentToken.", lookahead: ".$this->lookAhead.", current char: ".$this->currentCharacter);
+ }
+
+ /**
+ * It parses a function call. It assumes the following rule:
+ * Func -> ( Expr [,Expr]* )
+ *
+ * @access private
+ * @return mixed The parsed ptg'd tree on success
+ */
+ private function func()
+ {
+ $num_args = 0; // number of arguments received
+ $function = strtoupper($this->currentToken);
+ $result = ''; // initialize result
+ $this->advance();
+ $this->advance(); // eat the "("
+ while ($this->currentToken != ')') {
+ /**/
+ if ($num_args > 0) {
+ if ($this->currentToken == "," || $this->currentToken == ";") {
+ $this->advance(); // eat the "," or ";"
+ } else {
+ throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
+ }
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', $result, $result2);
+ } else { // first argument
+ $result2 = $this->condition();
+ $result = $this->createTree('arg', '', $result2);
+ }
+ ++$num_args;
+ }
+ if (!isset($this->functions[$function])) {
+ throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
+ }
+ $args = $this->functions[$function][1];
+ // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
+ if (($args >= 0) and ($args != $num_args)) {
+ throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
+ }
+
+ $result = $this->createTree($function, $result, $num_args);
+ $this->advance(); // eat the ")"
+ return $result;
+ }
+
+ /**
+ * Creates a tree. In fact an array which may have one or two arrays (sub-trees)
+ * as elements.
+ *
+ * @access private
+ * @param mixed $value The value of this node.
+ * @param mixed $left The left array (sub-tree) or a final node.
+ * @param mixed $right The right array (sub-tree) or a final node.
+ * @return array A tree
+ */
+ private function createTree($value, $left, $right)
+ {
+ return array('value' => $value, 'left' => $left, 'right' => $right);
+ }
+
+ /**
+ * Builds a string containing the tree in reverse polish notation (What you
+ * would use in a HP calculator stack).
+ * The following tree:
+ *
+ * +
+ * / \
+ * 2 3
+ *
+ * produces: "23+"
+ *
+ * The following tree:
+ *
+ * +
+ * / \
+ * 3 *
+ * / \
+ * 6 A1
+ *
+ * produces: "36A1*+"
+ *
+ * In fact all operands, functions, references, etc... are written as ptg's
+ *
+ * @access public
+ * @param array $tree The optional tree to convert.
+ * @return string The tree in reverse polish notation
+ */
+ public function toReversePolish($tree = array())
+ {
+ $polish = ""; // the string we are going to return
+ if (empty($tree)) { // If it's the first call use parseTree
+ $tree = $this->parseTree;
+ }
+
+ if (is_array($tree['left'])) {
+ $converted_tree = $this->toReversePolish($tree['left']);
+ $polish .= $converted_tree;
+ } elseif ($tree['left'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['left']);
+ $polish .= $converted_tree;
+ }
+ if (is_array($tree['right'])) {
+ $converted_tree = $this->toReversePolish($tree['right']);
+ $polish .= $converted_tree;
+ } elseif ($tree['right'] != '') { // It's a final node
+ $converted_tree = $this->convert($tree['right']);
+ $polish .= $converted_tree;
+ }
+ // if it's a function convert it here (so we can set it's arguments)
+ if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
+ !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
+ !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
+ !is_numeric($tree['value']) and
+ !isset($this->ptg[$tree['value']])) {
+ // left subtree for a function is always an array.
+ if ($tree['left'] != '') {
+ $left_tree = $this->toReversePolish($tree['left']);
+ } else {
+ $left_tree = '';
+ }
+ // add it's left subtree and return.
+ return $left_tree.$this->convertFunction($tree['value'], $tree['right']);
+ } else {
+ $converted_tree = $this->convert($tree['value']);
+ }
+ $polish .= $converted_tree;
+ return $polish;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php b/Classes/PHPExcel/Writer/Excel5/Workbook.php
new file mode 100644
index 0000000..5a0cca5
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php
@@ -0,0 +1,1444 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
+{
+ /**
+ * Formula parser
+ *
+ * @var PHPExcel_Writer_Excel5_Parser
+ */
+ private $parser;
+
+ /**
+ * The BIFF file size for the workbook.
+ * @var integer
+ * @see calcSheetOffsets()
+ */
+ private $biffSize;
+
+ /**
+ * XF Writers
+ * @var PHPExcel_Writer_Excel5_Xf[]
+ */
+ private $xfWriters = array();
+
+ /**
+ * Array containing the colour palette
+ * @var array
+ */
+ private $palette;
+
+ /**
+ * The codepage indicates the text encoding used for strings
+ * @var integer
+ */
+ private $codepage;
+
+ /**
+ * The country code used for localization
+ * @var integer
+ */
+ private $countryCode;
+
+ /**
+ * Workbook
+ * @var PHPExcel
+ */
+ private $phpExcel;
+
+ /**
+ * Fonts writers
+ *
+ * @var PHPExcel_Writer_Excel5_Font[]
+ */
+ private $fontWriters = array();
+
+ /**
+ * Added fonts. Maps from font's hash => index in workbook
+ *
+ * @var array
+ */
+ private $addedFonts = array();
+
+ /**
+ * Shared number formats
+ *
+ * @var array
+ */
+ private $numberFormats = array();
+
+ /**
+ * Added number formats. Maps from numberFormat's hash => index in workbook
+ *
+ * @var array
+ */
+ private $addedNumberFormats = array();
+
+ /**
+ * Sizes of the binary worksheet streams
+ *
+ * @var array
+ */
+ private $worksheetSizes = array();
+
+ /**
+ * Offsets of the binary worksheet streams relative to the start of the global workbook stream
+ *
+ * @var array
+ */
+ private $worksheetOffsets = array();
+
+ /**
+ * Total number of shared strings in workbook
+ *
+ * @var int
+ */
+ private $stringTotal;
+
+ /**
+ * Number of unique shared strings in workbook
+ *
+ * @var int
+ */
+ private $stringUnique;
+
+ /**
+ * Array of unique shared strings in workbook
+ *
+ * @var array
+ */
+ private $stringTable;
+
+ /**
+ * Color cache
+ */
+ private $colors;
+
+ /**
+ * Escher object corresponding to MSODRAWINGGROUP
+ *
+ * @var PHPExcel_Shared_Escher
+ */
+ private $escher;
+
+
+ /**
+ * Class constructor
+ *
+ * @param PHPExcel $phpExcel The Workbook
+ * @param int &$str_total Total number of strings
+ * @param int &$str_unique Total number of unique strings
+ * @param array &$str_table String Table
+ * @param array &$colors Colour Table
+ * @param mixed $parser The formula parser created for the Workbook
+ */
+ public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
+ {
+ // It needs to call its parent's constructor explicitly
+ parent::__construct();
+
+ $this->parser = $parser;
+ $this->biffSize = 0;
+ $this->palette = array();
+ $this->countryCode = -1;
+
+ $this->stringTotal = &$str_total;
+ $this->stringUnique = &$str_unique;
+ $this->stringTable = &$str_table;
+ $this->colors = &$colors;
+ $this->setPaletteXl97();
+
+ $this->phpExcel = $phpExcel;
+
+ // set BIFFwriter limit for CONTINUE records
+ // $this->_limit = 8224;
+ $this->codepage = 0x04B0;
+
+ // Add empty sheets and Build color cache
+ $countSheets = $phpExcel->getSheetCount();
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $phpSheet = $phpExcel->getSheet($i);
+
+ $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser
+
+ $supbook_index = 0x00;
+ $ref = pack('vvv', $supbook_index, $i, $i);
+ $this->parser->references[] = $ref; // Register reference with parser
+
+ // Sheet tab colors?
+ if ($phpSheet->isTabColorSet()) {
+ $this->addColor($phpSheet->getTabColor()->getRGB());
+ }
+ }
+
+ }
+
+ /**
+ * Add a new XF writer
+ *
+ * @param PHPExcel_Style
+ * @param boolean Is it a style XF?
+ * @return int Index to XF record
+ */
+ public function addXfWriter($style, $isStyleXf = false)
+ {
+ $xfWriter = new PHPExcel_Writer_Excel5_Xf($style);
+ $xfWriter->setIsStyleXf($isStyleXf);
+
+ // Add the font if not already added
+ $fontIndex = $this->addFont($style->getFont());
+
+ // Assign the font index to the xf record
+ $xfWriter->setFontIndex($fontIndex);
+
+ // Background colors, best to treat these after the font so black will come after white in custom palette
+ $xfWriter->setFgColor($this->addColor($style->getFill()->getStartColor()->getRGB()));
+ $xfWriter->setBgColor($this->addColor($style->getFill()->getEndColor()->getRGB()));
+ $xfWriter->setBottomColor($this->addColor($style->getBorders()->getBottom()->getColor()->getRGB()));
+ $xfWriter->setTopColor($this->addColor($style->getBorders()->getTop()->getColor()->getRGB()));
+ $xfWriter->setRightColor($this->addColor($style->getBorders()->getRight()->getColor()->getRGB()));
+ $xfWriter->setLeftColor($this->addColor($style->getBorders()->getLeft()->getColor()->getRGB()));
+ $xfWriter->setDiagColor($this->addColor($style->getBorders()->getDiagonal()->getColor()->getRGB()));
+
+ // Add the number format if it is not a built-in one and not already added
+ if ($style->getNumberFormat()->getBuiltInFormatCode() === false) {
+ $numberFormatHashCode = $style->getNumberFormat()->getHashCode();
+
+ if (isset($this->addedNumberFormats[$numberFormatHashCode])) {
+ $numberFormatIndex = $this->addedNumberFormats[$numberFormatHashCode];
+ } else {
+ $numberFormatIndex = 164 + count($this->numberFormats);
+ $this->numberFormats[$numberFormatIndex] = $style->getNumberFormat();
+ $this->addedNumberFormats[$numberFormatHashCode] = $numberFormatIndex;
+ }
+ } else {
+ $numberFormatIndex = (int) $style->getNumberFormat()->getBuiltInFormatCode();
+ }
+
+ // Assign the number format index to xf record
+ $xfWriter->setNumberFormatIndex($numberFormatIndex);
+
+ $this->xfWriters[] = $xfWriter;
+
+ $xfIndex = count($this->xfWriters) - 1;
+ return $xfIndex;
+ }
+
+ /**
+ * Add a font to added fonts
+ *
+ * @param PHPExcel_Style_Font $font
+ * @return int Index to FONT record
+ */
+ public function addFont(PHPExcel_Style_Font $font)
+ {
+ $fontHashCode = $font->getHashCode();
+ if (isset($this->addedFonts[$fontHashCode])) {
+ $fontIndex = $this->addedFonts[$fontHashCode];
+ } else {
+ $countFonts = count($this->fontWriters);
+ $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1;
+
+ $fontWriter = new PHPExcel_Writer_Excel5_Font($font);
+ $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB()));
+ $this->fontWriters[] = $fontWriter;
+
+ $this->addedFonts[$fontHashCode] = $fontIndex;
+ }
+ return $fontIndex;
+ }
+
+ /**
+ * Alter color palette adding a custom color
+ *
+ * @param string $rgb E.g. 'FF00AA'
+ * @return int Color index
+ */
+ private function addColor($rgb)
+ {
+ if (!isset($this->colors[$rgb])) {
+ if (count($this->colors) < 57) {
+ // then we add a custom color altering the palette
+ $colorIndex = 8 + count($this->colors);
+ $this->palette[$colorIndex] =
+ array(
+ hexdec(substr($rgb, 0, 2)),
+ hexdec(substr($rgb, 2, 2)),
+ hexdec(substr($rgb, 4)),
+ 0
+ );
+ $this->colors[$rgb] = $colorIndex;
+ } else {
+ // no room for more custom colors, just map to black
+ $colorIndex = 0;
+ }
+ } else {
+ // fetch already added custom color
+ $colorIndex = $this->colors[$rgb];
+ }
+
+ return $colorIndex;
+ }
+
+ /**
+ * Sets the colour palette to the Excel 97+ default.
+ *
+ * @access private
+ */
+ private function setPaletteXl97()
+ {
+ $this->palette = array(
+ 0x08 => array(0x00, 0x00, 0x00, 0x00),
+ 0x09 => array(0xff, 0xff, 0xff, 0x00),
+ 0x0A => array(0xff, 0x00, 0x00, 0x00),
+ 0x0B => array(0x00, 0xff, 0x00, 0x00),
+ 0x0C => array(0x00, 0x00, 0xff, 0x00),
+ 0x0D => array(0xff, 0xff, 0x00, 0x00),
+ 0x0E => array(0xff, 0x00, 0xff, 0x00),
+ 0x0F => array(0x00, 0xff, 0xff, 0x00),
+ 0x10 => array(0x80, 0x00, 0x00, 0x00),
+ 0x11 => array(0x00, 0x80, 0x00, 0x00),
+ 0x12 => array(0x00, 0x00, 0x80, 0x00),
+ 0x13 => array(0x80, 0x80, 0x00, 0x00),
+ 0x14 => array(0x80, 0x00, 0x80, 0x00),
+ 0x15 => array(0x00, 0x80, 0x80, 0x00),
+ 0x16 => array(0xc0, 0xc0, 0xc0, 0x00),
+ 0x17 => array(0x80, 0x80, 0x80, 0x00),
+ 0x18 => array(0x99, 0x99, 0xff, 0x00),
+ 0x19 => array(0x99, 0x33, 0x66, 0x00),
+ 0x1A => array(0xff, 0xff, 0xcc, 0x00),
+ 0x1B => array(0xcc, 0xff, 0xff, 0x00),
+ 0x1C => array(0x66, 0x00, 0x66, 0x00),
+ 0x1D => array(0xff, 0x80, 0x80, 0x00),
+ 0x1E => array(0x00, 0x66, 0xcc, 0x00),
+ 0x1F => array(0xcc, 0xcc, 0xff, 0x00),
+ 0x20 => array(0x00, 0x00, 0x80, 0x00),
+ 0x21 => array(0xff, 0x00, 0xff, 0x00),
+ 0x22 => array(0xff, 0xff, 0x00, 0x00),
+ 0x23 => array(0x00, 0xff, 0xff, 0x00),
+ 0x24 => array(0x80, 0x00, 0x80, 0x00),
+ 0x25 => array(0x80, 0x00, 0x00, 0x00),
+ 0x26 => array(0x00, 0x80, 0x80, 0x00),
+ 0x27 => array(0x00, 0x00, 0xff, 0x00),
+ 0x28 => array(0x00, 0xcc, 0xff, 0x00),
+ 0x29 => array(0xcc, 0xff, 0xff, 0x00),
+ 0x2A => array(0xcc, 0xff, 0xcc, 0x00),
+ 0x2B => array(0xff, 0xff, 0x99, 0x00),
+ 0x2C => array(0x99, 0xcc, 0xff, 0x00),
+ 0x2D => array(0xff, 0x99, 0xcc, 0x00),
+ 0x2E => array(0xcc, 0x99, 0xff, 0x00),
+ 0x2F => array(0xff, 0xcc, 0x99, 0x00),
+ 0x30 => array(0x33, 0x66, 0xff, 0x00),
+ 0x31 => array(0x33, 0xcc, 0xcc, 0x00),
+ 0x32 => array(0x99, 0xcc, 0x00, 0x00),
+ 0x33 => array(0xff, 0xcc, 0x00, 0x00),
+ 0x34 => array(0xff, 0x99, 0x00, 0x00),
+ 0x35 => array(0xff, 0x66, 0x00, 0x00),
+ 0x36 => array(0x66, 0x66, 0x99, 0x00),
+ 0x37 => array(0x96, 0x96, 0x96, 0x00),
+ 0x38 => array(0x00, 0x33, 0x66, 0x00),
+ 0x39 => array(0x33, 0x99, 0x66, 0x00),
+ 0x3A => array(0x00, 0x33, 0x00, 0x00),
+ 0x3B => array(0x33, 0x33, 0x00, 0x00),
+ 0x3C => array(0x99, 0x33, 0x00, 0x00),
+ 0x3D => array(0x99, 0x33, 0x66, 0x00),
+ 0x3E => array(0x33, 0x33, 0x99, 0x00),
+ 0x3F => array(0x33, 0x33, 0x33, 0x00),
+ );
+ }
+
+ /**
+ * Assemble worksheets into a workbook and send the BIFF data to an OLE
+ * storage.
+ *
+ * @param array $pWorksheetSizes The sizes in bytes of the binary worksheet streams
+ * @return string Binary data for workbook stream
+ */
+ public function writeWorkbook($pWorksheetSizes = null)
+ {
+ $this->worksheetSizes = $pWorksheetSizes;
+
+ // Calculate the number of selected worksheet tabs and call the finalization
+ // methods for each worksheet
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // Add part 1 of the Workbook globals, what goes before the SHEET records
+ $this->storeBof(0x0005);
+ $this->writeCodepage();
+ $this->writeWindow1();
+
+ $this->writeDateMode();
+ $this->writeAllFonts();
+ $this->writeAllNumberFormats();
+ $this->writeAllXfs();
+ $this->writeAllStyles();
+ $this->writePalette();
+
+ // Prepare part 3 of the workbook global stream, what goes after the SHEET records
+ $part3 = '';
+ if ($this->countryCode != -1) {
+ $part3 .= $this->writeCountry();
+ }
+ $part3 .= $this->writeRecalcId();
+
+ $part3 .= $this->writeSupbookInternal();
+ /* TODO: store external SUPBOOK records and XCT and CRN records
+ in case of external references for BIFF8 */
+ $part3 .= $this->writeExternalsheetBiff8();
+ $part3 .= $this->writeAllDefinedNamesBiff8();
+ $part3 .= $this->writeMsoDrawingGroup();
+ $part3 .= $this->writeSharedStringsTable();
+
+ $part3 .= $this->writeEof();
+
+ // Add part 2 of the Workbook globals, the SHEET records
+ $this->calcSheetOffsets();
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $this->writeBoundSheet($this->phpExcel->getSheet($i), $this->worksheetOffsets[$i]);
+ }
+
+ // Add part 3 of the Workbook globals
+ $this->_data .= $part3;
+
+ return $this->_data;
+ }
+
+ /**
+ * Calculate offsets for Worksheet BOF records.
+ *
+ * @access private
+ */
+ private function calcSheetOffsets()
+ {
+ $boundsheet_length = 10; // fixed length for a BOUNDSHEET record
+
+ // size of Workbook globals part 1 + 3
+ $offset = $this->_datasize;
+
+ // add size of Workbook globals part 2, the length of the SHEET records
+ $total_worksheets = count($this->phpExcel->getAllSheets());
+ foreach ($this->phpExcel->getWorksheetIterator() as $sheet) {
+ $offset += $boundsheet_length + strlen(PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle()));
+ }
+
+ // add the sizes of each of the Sheet substreams, respectively
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $this->worksheetOffsets[$i] = $offset;
+ $offset += $this->worksheetSizes[$i];
+ }
+ $this->biffSize = $offset;
+ }
+
+ /**
+ * Store the Excel FONT records.
+ */
+ private function writeAllFonts()
+ {
+ foreach ($this->fontWriters as $fontWriter) {
+ $this->append($fontWriter->writeFont());
+ }
+ }
+
+ /**
+ * Store user defined numerical formats i.e. FORMAT records
+ */
+ private function writeAllNumberFormats()
+ {
+ foreach ($this->numberFormats as $numberFormatIndex => $numberFormat) {
+ $this->writeNumberFormat($numberFormat->getFormatCode(), $numberFormatIndex);
+ }
+ }
+
+ /**
+ * Write all XF records.
+ */
+ private function writeAllXfs()
+ {
+ foreach ($this->xfWriters as $xfWriter) {
+ $this->append($xfWriter->writeXf());
+ }
+ }
+
+ /**
+ * Write all STYLE records.
+ */
+ private function writeAllStyles()
+ {
+ $this->writeStyle();
+ }
+
+ /**
+ * Write the EXTERNCOUNT and EXTERNSHEET records. These are used as indexes for
+ * the NAME records.
+ */
+ private function writeExternals()
+ {
+ $countSheets = $this->phpExcel->getSheetCount();
+ // Create EXTERNCOUNT with number of worksheets
+ $this->writeExternalCount($countSheets);
+
+ // Create EXTERNSHEET for each worksheet
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $this->writeExternalSheet($this->phpExcel->getSheet($i)->getTitle());
+ }
+ }
+
+ /**
+ * Write the NAME record to define the print area and the repeat rows and cols.
+ */
+ private function writeNames()
+ {
+ // total number of sheets
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // Create the print area NAME records
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ // Write a Name record if the print area has been defined
+ if ($sheetSetup->isPrintAreaSet()) {
+ // Print area
+ $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
+ $printArea = $printArea[0];
+ $printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]);
+ $printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]);
+
+ $print_rowmin = $printArea[0][1] - 1;
+ $print_rowmax = $printArea[1][1] - 1;
+ $print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1;
+ $print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1;
+
+ $this->writeNameShort(
+ $i, // sheet index
+ 0x06, // NAME type
+ $print_rowmin,
+ $print_rowmax,
+ $print_colmin,
+ $print_colmax
+ );
+ }
+ }
+
+ // Create the print title NAME records
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+
+ // simultaneous repeatColumns repeatRows
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+
+ $this->writeNameLong(
+ $i, // sheet index
+ 0x07, // NAME type
+ $rowmin,
+ $rowmax,
+ $colmin,
+ $colmax
+ );
+
+ // (exclusive) either repeatColumns or repeatRows
+ } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
+ // Columns to repeat
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+ } else {
+ $colmin = 0;
+ $colmax = 255;
+ }
+
+ // Rows to repeat
+ if ($sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+ } else {
+ $rowmin = 0;
+ $rowmax = 65535;
+ }
+
+ $this->writeNameShort(
+ $i, // sheet index
+ 0x07, // NAME type
+ $rowmin,
+ $rowmax,
+ $colmin,
+ $colmax
+ );
+ }
+ }
+ }
+
+ /**
+ * Writes all the DEFINEDNAME records (BIFF8).
+ * So far this is only used for repeating rows/columns (print titles) and print areas
+ */
+ private function writeAllDefinedNamesBiff8()
+ {
+ $chunk = '';
+
+ // Named ranges
+ if (count($this->phpExcel->getNamedRanges()) > 0) {
+ // Loop named ranges
+ $namedRanges = $this->phpExcel->getNamedRanges();
+ foreach ($namedRanges as $namedRange) {
+ // Create absolute coordinate
+ $range = PHPExcel_Cell::splitRange($namedRange->getRange());
+ for ($i = 0; $i < count($range); $i++) {
+ $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]);
+ if (isset($range[$i][1])) {
+ $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]);
+ }
+ }
+ $range = PHPExcel_Cell::buildRange($range); // e.g. Sheet1!$A$1:$B$2
+
+ // parse formula
+ try {
+ $error = $this->parser->parse($range);
+ $formulaData = $this->parser->toReversePolish();
+
+ // make sure tRef3d is of type tRef3dR (0x3A)
+ if (isset($formulaData[0]) and ($formulaData[0] == "\x7A" or $formulaData[0] == "\x5A")) {
+ $formulaData = "\x3A" . substr($formulaData, 1);
+ }
+
+ if ($namedRange->getLocalOnly()) {
+ // local scope
+ $scope = $this->phpExcel->getIndex($namedRange->getScope()) + 1;
+ } else {
+ // global scope
+ $scope = 0;
+ }
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
+
+ } catch (PHPExcel_Exception $e) {
+ // do nothing
+ }
+ }
+ }
+
+ // total number of sheets
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // write the print titles (repeating rows, columns), if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ // simultaneous repeatColumns repeatRows
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+
+ // construct formula data manually
+ $formulaData = pack('Cv', 0x29, 0x17); // tMemFunc
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, 0, 65535, $colmin, $colmax); // tArea3d
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, 0, 255); // tArea3d
+ $formulaData .= pack('C', 0x10); // tList
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
+
+ // (exclusive) either repeatColumns or repeatRows
+ } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
+ // Columns to repeat
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+ } else {
+ $colmin = 0;
+ $colmax = 255;
+ }
+ // Rows to repeat
+ if ($sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+ } else {
+ $rowmin = 0;
+ $rowmax = 65535;
+ }
+
+ // construct formula data manually because parser does not recognize absolute 3d cell references
+ $formulaData = pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, $colmin, $colmax);
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
+ }
+ }
+
+ // write the print areas, if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ if ($sheetSetup->isPrintAreaSet()) {
+ // Print area, e.g. A3:J6,H1:X20
+ $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
+ $countPrintArea = count($printArea);
+
+ $formulaData = '';
+ for ($j = 0; $j < $countPrintArea; ++$j) {
+ $printAreaRect = $printArea[$j]; // e.g. A3:J6
+ $printAreaRect[0] = PHPExcel_Cell::coordinateFromString($printAreaRect[0]);
+ $printAreaRect[1] = PHPExcel_Cell::coordinateFromString($printAreaRect[1]);
+
+ $print_rowmin = $printAreaRect[0][1] - 1;
+ $print_rowmax = $printAreaRect[1][1] - 1;
+ $print_colmin = PHPExcel_Cell::columnIndexFromString($printAreaRect[0][0]) - 1;
+ $print_colmax = PHPExcel_Cell::columnIndexFromString($printAreaRect[1][0]) - 1;
+
+ // construct formula data manually because parser does not recognize absolute 3d cell references
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax);
+
+ if ($j > 0) {
+ $formulaData .= pack('C', 0x10); // list operator token ','
+ }
+ }
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x06), $formulaData, $i + 1, true));
+ }
+ }
+
+ // write autofilters, if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetAutoFilter = $this->phpExcel->getSheet($i)->getAutoFilter();
+ $autoFilterRange = $sheetAutoFilter->getRange();
+ if (!empty($autoFilterRange)) {
+ $rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
+
+ //Autofilter built in name
+ $name = pack('C', 0x0D);
+
+ $chunk .= $this->writeData($this->writeShortNameBiff8($name, $i + 1, $rangeBounds, true));
+ }
+ }
+
+ return $chunk;
+ }
+
+ /**
+ * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data
+ *
+ * @param string $name The name in UTF-8
+ * @param string $formulaData The binary formula data
+ * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
+ * @param boolean $isBuiltIn Built-in name?
+ * @return string Complete binary record data
+ */
+ private function writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false)
+ {
+ $record = 0x0018;
+
+ // option flags
+ $options = $isBuiltIn ? 0x20 : 0x00;
+
+ // length of the name, character count
+ $nlen = PHPExcel_Shared_String::CountCharacters($name);
+
+ // name with stripped length field
+ $name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2);
+
+ // size of the formula (in bytes)
+ $sz = strlen($formulaData);
+
+ // combine the parts
+ $data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0)
+ . $name . $formulaData;
+ $length = strlen($data);
+
+ $header = pack('vv', $record, $length);
+
+ return $header . $data;
+ }
+
+ /**
+ * Write a short NAME record
+ *
+ * @param string $name
+ * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
+ * @param integer[][] $rangeBounds range boundaries
+ * @param boolean $isHidden
+ * @return string Complete binary record data
+ * */
+ private function writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
+ {
+ $record = 0x0018;
+
+ // option flags
+ $options = ($isHidden ? 0x21 : 0x00);
+
+ $extra = pack(
+ 'Cvvvvv',
+ 0x3B,
+ $sheetIndex - 1,
+ $rangeBounds[0][1] - 1,
+ $rangeBounds[1][1] - 1,
+ $rangeBounds[0][0] - 1,
+ $rangeBounds[1][0] - 1
+ );
+
+ // size of the formula (in bytes)
+ $sz = strlen($extra);
+
+ // combine the parts
+ $data = pack('vCCvvvCCCCC', $options, 0, 1, $sz, 0, $sheetIndex, 0, 0, 0, 0, 0)
+ . $name . $extra;
+ $length = strlen($data);
+
+ $header = pack('vv', $record, $length);
+
+ return $header . $data;
+ }
+
+ /**
+ * Stores the CODEPAGE biff record.
+ */
+ private function writeCodepage()
+ {
+ $record = 0x0042; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+ $cv = $this->codepage; // The code page
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', $cv);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write Excel BIFF WINDOW1 record.
+ */
+ private function writeWindow1()
+ {
+ $record = 0x003D; // Record identifier
+ $length = 0x0012; // Number of bytes to follow
+
+ $xWn = 0x0000; // Horizontal position of window
+ $yWn = 0x0000; // Vertical position of window
+ $dxWn = 0x25BC; // Width of window
+ $dyWn = 0x1572; // Height of window
+
+ $grbit = 0x0038; // Option flags
+
+ // not supported by PHPExcel, so there is only one selected sheet, the active
+ $ctabsel = 1; // Number of workbook tabs selected
+
+ $wTabRatio = 0x0258; // Tab to scrollbar ratio
+
+ // not supported by PHPExcel, set to 0
+ $itabFirst = 0; // 1st displayed worksheet
+ $itabCur = $this->phpExcel->getActiveSheetIndex(); // Active worksheet
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes Excel BIFF BOUNDSHEET record.
+ *
+ * @param PHPExcel_Worksheet $sheet Worksheet name
+ * @param integer $offset Location of worksheet BOF
+ */
+ private function writeBoundSheet($sheet, $offset)
+ {
+ $sheetname = $sheet->getTitle();
+ $record = 0x0085; // Record identifier
+
+ // sheet state
+ switch ($sheet->getSheetState()) {
+ case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
+ $ss = 0x00;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
+ $ss = 0x01;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
+ $ss = 0x02;
+ break;
+ default:
+ $ss = 0x00;
+ break;
+ }
+
+ // sheet type
+ $st = 0x00;
+
+ $grbit = 0x0000; // Visibility and sheet type
+
+ $data = pack("VCC", $offset, $ss, $st);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
+
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write Internal SUPBOOK record
+ */
+ private function writeSupbookInternal()
+ {
+ $record = 0x01AE; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", $this->phpExcel->getSheetCount(), 0x0401);
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas.
+ *
+ */
+ private function writeExternalsheetBiff8()
+ {
+ $totalReferences = count($this->parser->references);
+ $record = 0x0017; // Record identifier
+ $length = 2 + 6 * $totalReferences; // Number of bytes to follow
+
+ $supbook_index = 0; // FIXME: only using internal SUPBOOK record
+ $header = pack("vv", $record, $length);
+ $data = pack('v', $totalReferences);
+ for ($i = 0; $i < $totalReferences; ++$i) {
+ $data .= $this->parser->references[$i];
+ }
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Write Excel BIFF STYLE records.
+ */
+ private function writeStyle()
+ {
+ $record = 0x0293; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $ixfe = 0x8000; // Index to cell style XF
+ $BuiltIn = 0x00; // Built-in style
+ $iLevel = 0xff; // Outline style level
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes Excel FORMAT record for non "built-in" numerical formats.
+ *
+ * @param string $format Custom format string
+ * @param integer $ifmt Format index code
+ */
+ private function writeNumberFormat($format, $ifmt)
+ {
+ $record = 0x041E; // Record identifier
+
+ $numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
+ $length = 2 + strlen($numberFormatString); // Number of bytes to follow
+
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $ifmt) . $numberFormatString;
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write DATEMODE record to indicate the date system in use (1904 or 1900).
+ */
+ private function writeDateMode()
+ {
+ $record = 0x0022; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904)
+ ? 1
+ : 0; // Flag for 1904 date system
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $f1904);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record EXTERNCOUNT to indicate the number of external sheet
+ * references in the workbook.
+ *
+ * Excel only stores references to external sheets that are used in NAME.
+ * The workbook NAME record is required to define the print area and the repeat
+ * rows and columns.
+ *
+ * A similar method is used in Worksheet.php for a slightly different purpose.
+ *
+ * @param integer $cxals Number of external references
+ */
+ private function writeExternalCount($cxals)
+ {
+ $record = 0x0016; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cxals);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas. NAME record is required to define the print area and the repeat
+ * rows and columns.
+ *
+ * A similar method is used in Worksheet.php for a slightly different purpose.
+ *
+ * @param string $sheetname Worksheet name
+ */
+ private function writeExternalSheet($sheetname)
+ {
+ $record = 0x0017; // Record identifier
+ $length = 0x02 + strlen($sheetname); // Number of bytes to follow
+
+ $cch = strlen($sheetname); // Length of sheet name
+ $rgch = 0x03; // Filename encoding
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CC", $cch, $rgch);
+ $this->append($header . $data . $sheetname);
+ }
+
+ /**
+ * Store the NAME record in the short format that is used for storing the print
+ * area, repeat rows only and repeat columns only.
+ *
+ * @param integer $index Sheet index
+ * @param integer $type Built-in name type
+ * @param integer $rowmin Start row
+ * @param integer $rowmax End row
+ * @param integer $colmin Start colum
+ * @param integer $colmax End column
+ */
+ private function writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax)
+ {
+ $record = 0x0018; // Record identifier
+ $length = 0x0024; // Number of bytes to follow
+
+ $grbit = 0x0020; // Option flags
+ $chKey = 0x00; // Keyboard shortcut
+ $cch = 0x01; // Length of text name
+ $cce = 0x0015; // Length of text definition
+ $ixals = $index + 1; // Sheet index
+ $itab = $ixals; // Equal to ixals
+ $cchCustMenu = 0x00; // Length of cust menu text
+ $cchDescription = 0x00; // Length of description text
+ $cchHelptopic = 0x00; // Length of help topic text
+ $cchStatustext = 0x00; // Length of status bar text
+ $rgch = $type; // Built-in name type
+
+ $unknown03 = 0x3b;
+ $unknown04 = 0xffff - $index;
+ $unknown05 = 0x0000;
+ $unknown06 = 0x0000;
+ $unknown07 = 0x1087;
+ $unknown08 = 0x8005;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $data .= pack("C", $chKey);
+ $data .= pack("C", $cch);
+ $data .= pack("v", $cce);
+ $data .= pack("v", $ixals);
+ $data .= pack("v", $itab);
+ $data .= pack("C", $cchCustMenu);
+ $data .= pack("C", $cchDescription);
+ $data .= pack("C", $cchHelptopic);
+ $data .= pack("C", $cchStatustext);
+ $data .= pack("C", $rgch);
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", $rowmin);
+ $data .= pack("v", $rowmax);
+ $data .= pack("C", $colmin);
+ $data .= pack("C", $colmax);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the NAME record in the long format that is used for storing the repeat
+ * rows and columns when both are specified. This shares a lot of code with
+ * writeNameShort() but we use a separate method to keep the code clean.
+ * Code abstraction for reuse can be carried too far, and I should know. ;-)
+ *
+ * @param integer $index Sheet index
+ * @param integer $type Built-in name type
+ * @param integer $rowmin Start row
+ * @param integer $rowmax End row
+ * @param integer $colmin Start colum
+ * @param integer $colmax End column
+ */
+ private function writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax)
+ {
+ $record = 0x0018; // Record identifier
+ $length = 0x003d; // Number of bytes to follow
+ $grbit = 0x0020; // Option flags
+ $chKey = 0x00; // Keyboard shortcut
+ $cch = 0x01; // Length of text name
+ $cce = 0x002e; // Length of text definition
+ $ixals = $index + 1; // Sheet index
+ $itab = $ixals; // Equal to ixals
+ $cchCustMenu = 0x00; // Length of cust menu text
+ $cchDescription = 0x00; // Length of description text
+ $cchHelptopic = 0x00; // Length of help topic text
+ $cchStatustext = 0x00; // Length of status bar text
+ $rgch = $type; // Built-in name type
+
+ $unknown01 = 0x29;
+ $unknown02 = 0x002b;
+ $unknown03 = 0x3b;
+ $unknown04 = 0xffff-$index;
+ $unknown05 = 0x0000;
+ $unknown06 = 0x0000;
+ $unknown07 = 0x1087;
+ $unknown08 = 0x8008;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $data .= pack("C", $chKey);
+ $data .= pack("C", $cch);
+ $data .= pack("v", $cce);
+ $data .= pack("v", $ixals);
+ $data .= pack("v", $itab);
+ $data .= pack("C", $cchCustMenu);
+ $data .= pack("C", $cchDescription);
+ $data .= pack("C", $cchHelptopic);
+ $data .= pack("C", $cchStatustext);
+ $data .= pack("C", $rgch);
+ $data .= pack("C", $unknown01);
+ $data .= pack("v", $unknown02);
+ // Column definition
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", 0x0000);
+ $data .= pack("v", 0x3fff);
+ $data .= pack("C", $colmin);
+ $data .= pack("C", $colmax);
+ // Row definition
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", $rowmin);
+ $data .= pack("v", $rowmax);
+ $data .= pack("C", 0x00);
+ $data .= pack("C", 0xff);
+ // End of data
+ $data .= pack("C", 0x10);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Stores the COUNTRY record for localization
+ *
+ * @return string
+ */
+ private function writeCountry()
+ {
+ $record = 0x008C; // Record identifier
+ $length = 4; // Number of bytes to follow
+
+ $header = pack('vv', $record, $length);
+ /* using the same country code always for simplicity */
+ $data = pack('vv', $this->countryCode, $this->countryCode);
+ //$this->append($header . $data);
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Write the RECALCID record
+ *
+ * @return string
+ */
+ private function writeRecalcId()
+ {
+ $record = 0x01C1; // Record identifier
+ $length = 8; // Number of bytes to follow
+
+ $header = pack('vv', $record, $length);
+
+ // by inspection of real Excel files, MS Office Excel 2007 writes this
+ $data = pack('VV', 0x000001C1, 0x00001E667);
+
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Stores the PALETTE biff record.
+ */
+ private function writePalette()
+ {
+ $aref = $this->palette;
+
+ $record = 0x0092; // Record identifier
+ $length = 2 + 4 * count($aref); // Number of bytes to follow
+ $ccv = count($aref); // Number of RGB values to follow
+ $data = ''; // The RGB data
+
+ // Pack the RGB data
+ foreach ($aref as $color) {
+ foreach ($color as $byte) {
+ $data .= pack("C", $byte);
+ }
+ }
+
+ $header = pack("vvv", $record, $length, $ccv);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Handling of the SST continue blocks is complicated by the need to include an
+ * additional continuation byte depending on whether the string is split between
+ * blocks or whether it starts at the beginning of the block. (There are also
+ * additional complications that will arise later when/if Rich Strings are
+ * supported).
+ *
+ * The Excel documentation says that the SST record should be followed by an
+ * EXTSST record. The EXTSST record is a hash table that is used to optimise
+ * access to SST. However, despite the documentation it doesn't seem to be
+ * required so we will ignore it.
+ *
+ * @return string Binary data
+ */
+ private function writeSharedStringsTable()
+ {
+ // maximum size of record data (excluding record header)
+ $continue_limit = 8224;
+
+ // initialize array of record data blocks
+ $recordDatas = array();
+
+ // start SST record data block with total number of strings, total number of unique strings
+ $recordData = pack("VV", $this->stringTotal, $this->stringUnique);
+
+ // loop through all (unique) strings in shared strings table
+ foreach (array_keys($this->stringTable) as $string) {
+ // here $string is a BIFF8 encoded string
+
+ // length = character count
+ $headerinfo = unpack("vlength/Cencoding", $string);
+
+ // currently, this is always 1 = uncompressed
+ $encoding = $headerinfo["encoding"];
+
+ // initialize finished writing current $string
+ $finished = false;
+
+ while ($finished === false) {
+ // normally, there will be only one cycle, but if string cannot immediately be written as is
+ // there will be need for more than one cylcle, if string longer than one record data block, there
+ // may be need for even more cycles
+
+ if (strlen($recordData) + strlen($string) <= $continue_limit) {
+ // then we can write the string (or remainder of string) without any problems
+ $recordData .= $string;
+
+ if (strlen($recordData) + strlen($string) == $continue_limit) {
+ // we close the record data block, and initialize a new one
+ $recordDatas[] = $recordData;
+ $recordData = '';
+ }
+
+ // we are finished writing this string
+ $finished = true;
+ } else {
+ // special treatment writing the string (or remainder of the string)
+ // If the string is very long it may need to be written in more than one CONTINUE record.
+
+ // check how many bytes more there is room for in the current record
+ $space_remaining = $continue_limit - strlen($recordData);
+
+ // minimum space needed
+ // uncompressed: 2 byte string length length field + 1 byte option flags + 2 byte character
+ // compressed: 2 byte string length length field + 1 byte option flags + 1 byte character
+ $min_space_needed = ($encoding == 1) ? 5 : 4;
+
+ // We have two cases
+ // 1. space remaining is less than minimum space needed
+ // here we must waste the space remaining and move to next record data block
+ // 2. space remaining is greater than or equal to minimum space needed
+ // here we write as much as we can in the current block, then move to next record data block
+
+ // 1. space remaining is less than minimum space needed
+ if ($space_remaining < $min_space_needed) {
+ // we close the block, store the block data
+ $recordDatas[] = $recordData;
+
+ // and start new record data block where we start writing the string
+ $recordData = '';
+
+ // 2. space remaining is greater than or equal to minimum space needed
+ } else {
+ // initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below
+ $effective_space_remaining = $space_remaining;
+
+ // for uncompressed strings, sometimes effective space remaining is reduced by 1
+ if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
+ --$effective_space_remaining;
+ }
+
+ // one block fininshed, store the block data
+ $recordData .= substr($string, 0, $effective_space_remaining);
+
+ $string = substr($string, $effective_space_remaining); // for next cycle in while loop
+ $recordDatas[] = $recordData;
+
+ // start new record data block with the repeated option flags
+ $recordData = pack('C', $encoding);
+ }
+ }
+ }
+ }
+
+ // Store the last record data block unless it is empty
+ // if there was no need for any continue records, this will be the for SST record data block itself
+ if (strlen($recordData) > 0) {
+ $recordDatas[] = $recordData;
+ }
+
+ // combine into one chunk with all the blocks SST, CONTINUE,...
+ $chunk = '';
+ foreach ($recordDatas as $i => $recordData) {
+ // first block should have the SST record header, remaing should have CONTINUE header
+ $record = ($i == 0) ? 0x00FC : 0x003C;
+
+ $header = pack("vv", $record, strlen($recordData));
+ $data = $header . $recordData;
+
+ $chunk .= $this->writeData($data);
+ }
+
+ return $chunk;
+ }
+
+ /**
+ * Writes the MSODRAWINGGROUP record if needed. Possibly split using CONTINUE records.
+ */
+ private function writeMsoDrawingGroup()
+ {
+ // write the Escher stream if necessary
+ if (isset($this->escher)) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($this->escher);
+ $data = $writer->close();
+
+ $record = 0x00EB;
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ return $this->writeData($header . $data);
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * Get Escher object
+ *
+ * @return PHPExcel_Shared_Escher
+ */
+ public function getEscher()
+ {
+ return $this->escher;
+ }
+
+ /**
+ * Set Escher object
+ *
+ * @param PHPExcel_Shared_Escher $pValue
+ */
+ public function setEscher(PHPExcel_Shared_Escher $pValue = null)
+ {
+ $this->escher = $pValue;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php.bk-aleluya b/Classes/PHPExcel/Writer/Excel5/Workbook.php.bk-aleluya
new file mode 100644
index 0000000..8b06843
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php.bk-aleluya
@@ -0,0 +1,1444 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
+{
+ /**
+ * Formula parser
+ *
+ * @var PHPExcel_Writer_Excel5_Parser
+ */
+ private $parser;
+
+ /**
+ * The BIFF file size for the workbook.
+ * @var integer
+ * @see calcSheetOffsets()
+ */
+ private $biffSize;
+
+ /**
+ * XF Writers
+ * @var PHPExcel_Writer_Excel5_Xf[]
+ */
+ private $xfWriters = array();
+
+ /**
+ * Array containing the colour palette
+ * @var array
+ */
+ private $palette;
+
+ /**
+ * The codepage indicates the text encoding used for strings
+ * @var integer
+ */
+ private $codepage;
+
+ /**
+ * The country code used for localization
+ * @var integer
+ */
+ private $countryCode;
+
+ /**
+ * Workbook
+ * @var PHPExcel
+ */
+ private $phpExcel;
+
+ /**
+ * Fonts writers
+ *
+ * @var PHPExcel_Writer_Excel5_Font[]
+ */
+ private $fontWriters = array();
+
+ /**
+ * Added fonts. Maps from font's hash => index in workbook
+ *
+ * @var array
+ */
+ private $addedFonts = array();
+
+ /**
+ * Shared number formats
+ *
+ * @var array
+ */
+ private $numberFormats = array();
+
+ /**
+ * Added number formats. Maps from numberFormat's hash => index in workbook
+ *
+ * @var array
+ */
+ private $addedNumberFormats = array();
+
+ /**
+ * Sizes of the binary worksheet streams
+ *
+ * @var array
+ */
+ private $worksheetSizes = array();
+
+ /**
+ * Offsets of the binary worksheet streams relative to the start of the global workbook stream
+ *
+ * @var array
+ */
+ private $worksheetOffsets = array();
+
+ /**
+ * Total number of shared strings in workbook
+ *
+ * @var int
+ */
+ private $stringTotal;
+
+ /**
+ * Number of unique shared strings in workbook
+ *
+ * @var int
+ */
+ private $stringUnique;
+
+ /**
+ * Array of unique shared strings in workbook
+ *
+ * @var array
+ */
+ private $stringTable;
+
+ /**
+ * Color cache
+ */
+ private $colors;
+
+ /**
+ * Escher object corresponding to MSODRAWINGGROUP
+ *
+ * @var PHPExcel_Shared_Escher
+ */
+ private $escher;
+
+
+ /**
+ * Class constructor
+ *
+ * @param PHPExcel $phpExcel The Workbook
+ * @param int &$str_total Total number of strings
+ * @param int &$str_unique Total number of unique strings
+ * @param array &$str_table String Table
+ * @param array &$colors Colour Table
+ * @param mixed $parser The formula parser created for the Workbook
+ */
+ public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
+ {
+ // It needs to call its parent's constructor explicitly
+ parent::__construct();
+
+ $this->parser = $parser;
+ $this->biffSize = 0;
+ $this->palette = array();
+ $this->countryCode = -1;
+
+ $this->stringTotal = &$str_total;
+ $this->stringUnique = &$str_unique;
+ $this->stringTable = &$str_table;
+ $this->colors = &$colors;
+ $this->setPaletteXl97();
+
+ $this->phpExcel = $phpExcel;
+
+ // set BIFFwriter limit for CONTINUE records
+ // $this->_limit = 8224;
+ $this->codepage = 0x04B0;
+
+ // Add empty sheets and Build color cache
+ $countSheets = $phpExcel->getSheetCount();
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $phpSheet = $phpExcel->getSheet($i);
+
+ $this->parser->setExtSheet($phpSheet->getTitle(), $i); // Register worksheet name with parser
+
+ $supbook_index = 0x00;
+ $ref = pack('vvv', $supbook_index, $i, $i);
+ $this->parser->references[] = $ref; // Register reference with parser
+
+ // Sheet tab colors?
+ if ($phpSheet->isTabColorSet()) {
+ $this->addColor($phpSheet->getTabColor()->getRGB());
+ }
+ }
+
+ }
+
+ /**
+ * Add a new XF writer
+ *
+ * @param PHPExcel_Style
+ * @param boolean Is it a style XF?
+ * @return int Index to XF record
+ */
+ public function addXfWriter($style, $isStyleXf = false)
+ {
+ $xfWriter = new PHPExcel_Writer_Excel5_Xf($style);
+ $xfWriter->setIsStyleXf($isStyleXf);
+
+ // Add the font if not already added
+ $fontIndex = $this->addFont($style->getFont());
+
+ // Assign the font index to the xf record
+ $xfWriter->setFontIndex($fontIndex);
+
+ // Background colors, best to treat these after the font so black will come after white in custom palette
+ $xfWriter->setFgColor($this->addColor($style->getFill()->getStartColor()->getRGB()));
+ $xfWriter->setBgColor($this->addColor($style->getFill()->getEndColor()->getRGB()));
+ $xfWriter->setBottomColor($this->addColor($style->getBorders()->getBottom()->getColor()->getRGB()));
+ $xfWriter->setTopColor($this->addColor($style->getBorders()->getTop()->getColor()->getRGB()));
+ $xfWriter->setRightColor($this->addColor($style->getBorders()->getRight()->getColor()->getRGB()));
+ $xfWriter->setLeftColor($this->addColor($style->getBorders()->getLeft()->getColor()->getRGB()));
+ $xfWriter->setDiagColor($this->addColor($style->getBorders()->getDiagonal()->getColor()->getRGB()));
+
+ // Add the number format if it is not a built-in one and not already added
+ if ($style->getNumberFormat()->getBuiltInFormatCode() === false) {
+ $numberFormatHashCode = $style->getNumberFormat()->getHashCode();
+
+ if (isset($this->addedNumberFormats[$numberFormatHashCode])) {
+ $numberFormatIndex = $this->addedNumberFormats[$numberFormatHashCode];
+ } else {
+ $numberFormatIndex = 164 + count($this->numberFormats);
+ $this->numberFormats[$numberFormatIndex] = $style->getNumberFormat();
+ $this->addedNumberFormats[$numberFormatHashCode] = $numberFormatIndex;
+ }
+ } else {
+ $numberFormatIndex = (int) $style->getNumberFormat()->getBuiltInFormatCode();
+ }
+
+ // Assign the number format index to xf record
+ $xfWriter->setNumberFormatIndex($numberFormatIndex);
+
+ $this->xfWriters[] = $xfWriter;
+
+ $xfIndex = count($this->xfWriters) - 1;
+ return $xfIndex;
+ }
+
+ /**
+ * Add a font to added fonts
+ *
+ * @param PHPExcel_Style_Font $font
+ * @return int Index to FONT record
+ */
+ public function addFont(PHPExcel_Style_Font $font)
+ {
+ $fontHashCode = $font->getHashCode();
+ if (isset($this->addedFonts[$fontHashCode])) {
+ $fontIndex = $this->addedFonts[$fontHashCode];
+ } else {
+ $countFonts = count($this->fontWriters);
+ $fontIndex = ($countFonts < 4) ? $countFonts : $countFonts + 1;
+
+ $fontWriter = new PHPExcel_Writer_Excel5_Font($font);
+ $fontWriter->setColorIndex($this->addColor($font->getColor()->getRGB()));
+ $this->fontWriters[] = $fontWriter;
+
+ $this->addedFonts[$fontHashCode] = $fontIndex;
+ }
+ return $fontIndex;
+ }
+
+ /**
+ * Alter color palette adding a custom color
+ *
+ * @param string $rgb E.g. 'FF00AA'
+ * @return int Color index
+ */
+ private function addColor($rgb)
+ {
+ if (!isset($this->colors[$rgb])) {
+ if (count($this->colors) < 57) {
+ // then we add a custom color altering the palette
+ $colorIndex = 8 + count($this->colors);
+ $this->palette[$colorIndex] =
+ array(
+ hexdec(substr($rgb, 0, 2)),
+ hexdec(substr($rgb, 2, 2)),
+ hexdec(substr($rgb, 4)),
+ 0
+ );
+ $this->colors[$rgb] = $colorIndex;
+ } else {
+ // no room for more custom colors, just map to black
+ $colorIndex = 0;
+ }
+ } else {
+ // fetch already added custom color
+ $colorIndex = $this->colors[$rgb];
+ }
+
+ return $colorIndex;
+ }
+
+ /**
+ * Sets the colour palette to the Excel 97+ default.
+ *
+ * @access private
+ */
+ private function setPaletteXl97()
+ {
+ $this->palette = array(
+ 0x08 => array(0x00, 0x00, 0x00, 0x00),
+ 0x09 => array(0xff, 0xff, 0xff, 0x00),
+ 0x0A => array(0xff, 0x00, 0x00, 0x00),
+ 0x0B => array(0x00, 0xff, 0x00, 0x00),
+ 0x0C => array(0x00, 0x00, 0xff, 0x00),
+ 0x0D => array(0xff, 0xff, 0x00, 0x00),
+ 0x0E => array(0xff, 0x00, 0xff, 0x00),
+ 0x0F => array(0x00, 0xff, 0xff, 0x00),
+ 0x10 => array(0x80, 0x00, 0x00, 0x00),
+ 0x11 => array(0x00, 0x80, 0x00, 0x00),
+ 0x12 => array(0x00, 0x00, 0x80, 0x00),
+ 0x13 => array(0x80, 0x80, 0x00, 0x00),
+ 0x14 => array(0x80, 0x00, 0x80, 0x00),
+ 0x15 => array(0x00, 0x80, 0x80, 0x00),
+ 0x16 => array(0xc0, 0xc0, 0xc0, 0x00),
+ 0x17 => array(0x80, 0x80, 0x80, 0x00),
+ 0x18 => array(0x99, 0x99, 0xff, 0x00),
+ 0x19 => array(0x99, 0x33, 0x66, 0x00),
+ 0x1A => array(0xff, 0xff, 0xcc, 0x00),
+ 0x1B => array(0xcc, 0xff, 0xff, 0x00),
+ 0x1C => array(0x66, 0x00, 0x66, 0x00),
+ 0x1D => array(0xff, 0x80, 0x80, 0x00),
+ 0x1E => array(0x00, 0x66, 0xcc, 0x00),
+ 0x1F => array(0xcc, 0xcc, 0xff, 0x00),
+ 0x20 => array(0x00, 0x00, 0x80, 0x00),
+ 0x21 => array(0xff, 0x00, 0xff, 0x00),
+ 0x22 => array(0xff, 0xff, 0x00, 0x00),
+ 0x23 => array(0x00, 0xff, 0xff, 0x00),
+ 0x24 => array(0x80, 0x00, 0x80, 0x00),
+ 0x25 => array(0x80, 0x00, 0x00, 0x00),
+ 0x26 => array(0x00, 0x80, 0x80, 0x00),
+ 0x27 => array(0x00, 0x00, 0xff, 0x00),
+ 0x28 => array(0x00, 0xcc, 0xff, 0x00),
+ 0x29 => array(0xcc, 0xff, 0xff, 0x00),
+ 0x2A => array(0xcc, 0xff, 0xcc, 0x00),
+ 0x2B => array(0xff, 0xff, 0x99, 0x00),
+ 0x2C => array(0x99, 0xcc, 0xff, 0x00),
+ 0x2D => array(0xff, 0x99, 0xcc, 0x00),
+ 0x2E => array(0xcc, 0x99, 0xff, 0x00),
+ 0x2F => array(0xff, 0xcc, 0x99, 0x00),
+ 0x30 => array(0x33, 0x66, 0xff, 0x00),
+ 0x31 => array(0x33, 0xcc, 0xcc, 0x00),
+ 0x32 => array(0x99, 0xcc, 0x00, 0x00),
+ 0x33 => array(0xff, 0xcc, 0x00, 0x00),
+ 0x34 => array(0xff, 0x99, 0x00, 0x00),
+ 0x35 => array(0xff, 0x66, 0x00, 0x00),
+ 0x36 => array(0x66, 0x66, 0x99, 0x00),
+ 0x37 => array(0x96, 0x96, 0x96, 0x00),
+ 0x38 => array(0x00, 0x33, 0x66, 0x00),
+ 0x39 => array(0x33, 0x99, 0x66, 0x00),
+ 0x3A => array(0x00, 0x33, 0x00, 0x00),
+ 0x3B => array(0x33, 0x33, 0x00, 0x00),
+ 0x3C => array(0x99, 0x33, 0x00, 0x00),
+ 0x3D => array(0x99, 0x33, 0x66, 0x00),
+ 0x3E => array(0x33, 0x33, 0x99, 0x00),
+ 0x3F => array(0x33, 0x33, 0x33, 0x00),
+ );
+ }
+
+ /**
+ * Assemble worksheets into a workbook and send the BIFF data to an OLE
+ * storage.
+ *
+ * @param array $pWorksheetSizes The sizes in bytes of the binary worksheet streams
+ * @return string Binary data for workbook stream
+ */
+ public function writeWorkbook($pWorksheetSizes = null)
+ {
+ $this->worksheetSizes = $pWorksheetSizes;
+
+ // Calculate the number of selected worksheet tabs and call the finalization
+ // methods for each worksheet
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // Add part 1 of the Workbook globals, what goes before the SHEET records
+ $this->storeBof(0x0005);
+ $this->writeCodepage();
+ $this->writeWindow1();
+
+ $this->writeDateMode();
+ $this->writeAllFonts();
+ $this->writeAllNumberFormats();
+ $this->writeAllXfs();
+ $this->writeAllStyles();
+ $this->writePalette();
+
+ // Prepare part 3 of the workbook global stream, what goes after the SHEET records
+ $part3 = '';
+ if ($this->countryCode != -1) {
+ $part3 .= $this->writeCountry();
+ }
+ $part3 .= $this->writeRecalcId();
+
+ $part3 .= $this->writeSupbookInternal();
+ /* TODO: store external SUPBOOK records and XCT and CRN records
+ in case of external references for BIFF8 */
+ $part3 .= $this->writeExternalsheetBiff8();
+ $part3 .= $this->writeAllDefinedNamesBiff8();
+ $part3 .= $this->writeMsoDrawingGroup();
+ $part3 .= $this->writeSharedStringsTable();
+
+ $part3 .= $this->writeEof();
+
+ // Add part 2 of the Workbook globals, the SHEET records
+ $this->calcSheetOffsets();
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $this->writeBoundSheet($this->phpExcel->getSheet($i), $this->worksheetOffsets[$i]);
+ }
+
+ // Add part 3 of the Workbook globals
+ $this->_data .= $part3;
+
+ return $this->_data;
+ }
+
+ /**
+ * Calculate offsets for Worksheet BOF records.
+ *
+ * @access private
+ */
+ private function calcSheetOffsets()
+ {
+ $boundsheet_length = 10; // fixed length for a BOUNDSHEET record
+
+ // size of Workbook globals part 1 + 3
+ $offset = $this->_datasize;
+
+ // add size of Workbook globals part 2, the length of the SHEET records
+ $total_worksheets = count($this->phpExcel->getAllSheets());
+ foreach ($this->phpExcel->getWorksheetIterator() as $sheet) {
+ $offset += $boundsheet_length + strlen(PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheet->getTitle()));
+ }
+
+ // add the sizes of each of the Sheet substreams, respectively
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $this->worksheetOffsets[$i] = $offset;
+ $offset += $this->worksheetSizes[$i];
+ }
+ $this->biffSize = $offset;
+ }
+
+ /**
+ * Store the Excel FONT records.
+ */
+ private function writeAllFonts()
+ {
+ foreach ($this->fontWriters as $fontWriter) {
+ $this->append($fontWriter->writeFont());
+ }
+ }
+
+ /**
+ * Store user defined numerical formats i.e. FORMAT records
+ */
+ private function writeAllNumberFormats()
+ {
+ foreach ($this->numberFormats as $numberFormatIndex => $numberFormat) {
+ $this->writeNumberFormat($numberFormat->getFormatCode(), $numberFormatIndex);
+ }
+ }
+
+ /**
+ * Write all XF records.
+ */
+ private function writeAllXfs()
+ {
+ foreach ($this->xfWriters as $xfWriter) {
+ $this->append($xfWriter->writeXf());
+ }
+ }
+
+ /**
+ * Write all STYLE records.
+ */
+ private function writeAllStyles()
+ {
+ $this->writeStyle();
+ }
+
+ /**
+ * Write the EXTERNCOUNT and EXTERNSHEET records. These are used as indexes for
+ * the NAME records.
+ */
+ private function writeExternals()
+ {
+ $countSheets = $this->phpExcel->getSheetCount();
+ // Create EXTERNCOUNT with number of worksheets
+ $this->writeExternalCount($countSheets);
+
+ // Create EXTERNSHEET for each worksheet
+ for ($i = 0; $i < $countSheets; ++$i) {
+ $this->writeExternalSheet($this->phpExcel->getSheet($i)->getTitle());
+ }
+ }
+
+ /**
+ * Write the NAME record to define the print area and the repeat rows and cols.
+ */
+ private function writeNames()
+ {
+ // total number of sheets
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // Create the print area NAME records
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ // Write a Name record if the print area has been defined
+ if ($sheetSetup->isPrintAreaSet()) {
+ // Print area
+ $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
+ $printArea = $printArea[0];
+ $printArea[0] = PHPExcel_Cell::coordinateFromString($printArea[0]);
+ $printArea[1] = PHPExcel_Cell::coordinateFromString($printArea[1]);
+
+ $print_rowmin = $printArea[0][1] - 1;
+ $print_rowmax = $printArea[1][1] - 1;
+ $print_colmin = PHPExcel_Cell::columnIndexFromString($printArea[0][0]) - 1;
+ $print_colmax = PHPExcel_Cell::columnIndexFromString($printArea[1][0]) - 1;
+
+ $this->writeNameShort(
+ $i, // sheet index
+ 0x06, // NAME type
+ $print_rowmin,
+ $print_rowmax,
+ $print_colmin,
+ $print_colmax
+ );
+ }
+ }
+
+ // Create the print title NAME records
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+
+ // simultaneous repeatColumns repeatRows
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+
+ $this->writeNameLong(
+ $i, // sheet index
+ 0x07, // NAME type
+ $rowmin,
+ $rowmax,
+ $colmin,
+ $colmax
+ );
+
+ // (exclusive) either repeatColumns or repeatRows
+ } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
+ // Columns to repeat
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+ } else {
+ $colmin = 0;
+ $colmax = 255;
+ }
+
+ // Rows to repeat
+ if ($sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+ } else {
+ $rowmin = 0;
+ $rowmax = 65535;
+ }
+
+ $this->writeNameShort(
+ $i, // sheet index
+ 0x07, // NAME type
+ $rowmin,
+ $rowmax,
+ $colmin,
+ $colmax
+ );
+ }
+ }
+ }
+
+ /**
+ * Writes all the DEFINEDNAME records (BIFF8).
+ * So far this is only used for repeating rows/columns (print titles) and print areas
+ */
+ private function writeAllDefinedNamesBiff8()
+ {
+ $chunk = '';
+
+ // Named ranges
+ if (count($this->phpExcel->getNamedRanges()) > 0) {
+ // Loop named ranges
+ $namedRanges = $this->phpExcel->getNamedRanges();
+ foreach ($namedRanges as $namedRange) {
+ // Create absolute coordinate
+ $range = PHPExcel_Cell::splitRange($namedRange->getRange());
+ for ($i = 0; $i < count($range); $i++) {
+ $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]);
+ if (isset($range[$i][1])) {
+ $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]);
+ }
+ }
+ $range = PHPExcel_Cell::buildRange($range); // e.g. Sheet1!$A$1:$B$2
+
+ // parse formula
+ try {
+ $error = $this->parser->parse($range);
+ $formulaData = $this->parser->toReversePolish();
+
+ // make sure tRef3d is of type tRef3dR (0x3A)
+ if (isset($formulaData{0}) and ($formulaData{0} == "\x7A" or $formulaData{0} == "\x5A")) {
+ $formulaData = "\x3A" . substr($formulaData, 1);
+ }
+
+ if ($namedRange->getLocalOnly()) {
+ // local scope
+ $scope = $this->phpExcel->getIndex($namedRange->getScope()) + 1;
+ } else {
+ // global scope
+ $scope = 0;
+ }
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
+
+ } catch (PHPExcel_Exception $e) {
+ // do nothing
+ }
+ }
+ }
+
+ // total number of sheets
+ $total_worksheets = $this->phpExcel->getSheetCount();
+
+ // write the print titles (repeating rows, columns), if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ // simultaneous repeatColumns repeatRows
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+
+ // construct formula data manually
+ $formulaData = pack('Cv', 0x29, 0x17); // tMemFunc
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, 0, 65535, $colmin, $colmax); // tArea3d
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, 0, 255); // tArea3d
+ $formulaData .= pack('C', 0x10); // tList
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
+
+ // (exclusive) either repeatColumns or repeatRows
+ } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
+ // Columns to repeat
+ if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
+ $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
+ $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
+ $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
+ } else {
+ $colmin = 0;
+ $colmax = 255;
+ }
+ // Rows to repeat
+ if ($sheetSetup->isRowsToRepeatAtTopSet()) {
+ $repeat = $sheetSetup->getRowsToRepeatAtTop();
+ $rowmin = $repeat[0] - 1;
+ $rowmax = $repeat[1] - 1;
+ } else {
+ $rowmin = 0;
+ $rowmax = 65535;
+ }
+
+ // construct formula data manually because parser does not recognize absolute 3d cell references
+ $formulaData = pack('Cvvvvv', 0x3B, $i, $rowmin, $rowmax, $colmin, $colmax);
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x07), $formulaData, $i + 1, true));
+ }
+ }
+
+ // write the print areas, if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
+ if ($sheetSetup->isPrintAreaSet()) {
+ // Print area, e.g. A3:J6,H1:X20
+ $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
+ $countPrintArea = count($printArea);
+
+ $formulaData = '';
+ for ($j = 0; $j < $countPrintArea; ++$j) {
+ $printAreaRect = $printArea[$j]; // e.g. A3:J6
+ $printAreaRect[0] = PHPExcel_Cell::coordinateFromString($printAreaRect[0]);
+ $printAreaRect[1] = PHPExcel_Cell::coordinateFromString($printAreaRect[1]);
+
+ $print_rowmin = $printAreaRect[0][1] - 1;
+ $print_rowmax = $printAreaRect[1][1] - 1;
+ $print_colmin = PHPExcel_Cell::columnIndexFromString($printAreaRect[0][0]) - 1;
+ $print_colmax = PHPExcel_Cell::columnIndexFromString($printAreaRect[1][0]) - 1;
+
+ // construct formula data manually because parser does not recognize absolute 3d cell references
+ $formulaData .= pack('Cvvvvv', 0x3B, $i, $print_rowmin, $print_rowmax, $print_colmin, $print_colmax);
+
+ if ($j > 0) {
+ $formulaData .= pack('C', 0x10); // list operator token ','
+ }
+ }
+
+ // store the DEFINEDNAME record
+ $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x06), $formulaData, $i + 1, true));
+ }
+ }
+
+ // write autofilters, if any
+ for ($i = 0; $i < $total_worksheets; ++$i) {
+ $sheetAutoFilter = $this->phpExcel->getSheet($i)->getAutoFilter();
+ $autoFilterRange = $sheetAutoFilter->getRange();
+ if (!empty($autoFilterRange)) {
+ $rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
+
+ //Autofilter built in name
+ $name = pack('C', 0x0D);
+
+ $chunk .= $this->writeData($this->writeShortNameBiff8($name, $i + 1, $rangeBounds, true));
+ }
+ }
+
+ return $chunk;
+ }
+
+ /**
+ * Write a DEFINEDNAME record for BIFF8 using explicit binary formula data
+ *
+ * @param string $name The name in UTF-8
+ * @param string $formulaData The binary formula data
+ * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
+ * @param boolean $isBuiltIn Built-in name?
+ * @return string Complete binary record data
+ */
+ private function writeDefinedNameBiff8($name, $formulaData, $sheetIndex = 0, $isBuiltIn = false)
+ {
+ $record = 0x0018;
+
+ // option flags
+ $options = $isBuiltIn ? 0x20 : 0x00;
+
+ // length of the name, character count
+ $nlen = PHPExcel_Shared_String::CountCharacters($name);
+
+ // name with stripped length field
+ $name = substr(PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($name), 2);
+
+ // size of the formula (in bytes)
+ $sz = strlen($formulaData);
+
+ // combine the parts
+ $data = pack('vCCvvvCCCC', $options, 0, $nlen, $sz, 0, $sheetIndex, 0, 0, 0, 0)
+ . $name . $formulaData;
+ $length = strlen($data);
+
+ $header = pack('vv', $record, $length);
+
+ return $header . $data;
+ }
+
+ /**
+ * Write a short NAME record
+ *
+ * @param string $name
+ * @param string $sheetIndex 1-based sheet index the defined name applies to. 0 = global
+ * @param integer[][] $rangeBounds range boundaries
+ * @param boolean $isHidden
+ * @return string Complete binary record data
+ * */
+ private function writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
+ {
+ $record = 0x0018;
+
+ // option flags
+ $options = ($isHidden ? 0x21 : 0x00);
+
+ $extra = pack(
+ 'Cvvvvv',
+ 0x3B,
+ $sheetIndex - 1,
+ $rangeBounds[0][1] - 1,
+ $rangeBounds[1][1] - 1,
+ $rangeBounds[0][0] - 1,
+ $rangeBounds[1][0] - 1
+ );
+
+ // size of the formula (in bytes)
+ $sz = strlen($extra);
+
+ // combine the parts
+ $data = pack('vCCvvvCCCCC', $options, 0, 1, $sz, 0, $sheetIndex, 0, 0, 0, 0, 0)
+ . $name . $extra;
+ $length = strlen($data);
+
+ $header = pack('vv', $record, $length);
+
+ return $header . $data;
+ }
+
+ /**
+ * Stores the CODEPAGE biff record.
+ */
+ private function writeCodepage()
+ {
+ $record = 0x0042; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+ $cv = $this->codepage; // The code page
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', $cv);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write Excel BIFF WINDOW1 record.
+ */
+ private function writeWindow1()
+ {
+ $record = 0x003D; // Record identifier
+ $length = 0x0012; // Number of bytes to follow
+
+ $xWn = 0x0000; // Horizontal position of window
+ $yWn = 0x0000; // Vertical position of window
+ $dxWn = 0x25BC; // Width of window
+ $dyWn = 0x1572; // Height of window
+
+ $grbit = 0x0038; // Option flags
+
+ // not supported by PHPExcel, so there is only one selected sheet, the active
+ $ctabsel = 1; // Number of workbook tabs selected
+
+ $wTabRatio = 0x0258; // Tab to scrollbar ratio
+
+ // not supported by PHPExcel, set to 0
+ $itabFirst = 0; // 1st displayed worksheet
+ $itabCur = $this->phpExcel->getActiveSheetIndex(); // Active worksheet
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes Excel BIFF BOUNDSHEET record.
+ *
+ * @param PHPExcel_Worksheet $sheet Worksheet name
+ * @param integer $offset Location of worksheet BOF
+ */
+ private function writeBoundSheet($sheet, $offset)
+ {
+ $sheetname = $sheet->getTitle();
+ $record = 0x0085; // Record identifier
+
+ // sheet state
+ switch ($sheet->getSheetState()) {
+ case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
+ $ss = 0x00;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
+ $ss = 0x01;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
+ $ss = 0x02;
+ break;
+ default:
+ $ss = 0x00;
+ break;
+ }
+
+ // sheet type
+ $st = 0x00;
+
+ $grbit = 0x0000; // Visibility and sheet type
+
+ $data = pack("VCC", $offset, $ss, $st);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
+
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write Internal SUPBOOK record
+ */
+ private function writeSupbookInternal()
+ {
+ $record = 0x01AE; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", $this->phpExcel->getSheetCount(), 0x0401);
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas.
+ *
+ */
+ private function writeExternalsheetBiff8()
+ {
+ $totalReferences = count($this->parser->references);
+ $record = 0x0017; // Record identifier
+ $length = 2 + 6 * $totalReferences; // Number of bytes to follow
+
+ $supbook_index = 0; // FIXME: only using internal SUPBOOK record
+ $header = pack("vv", $record, $length);
+ $data = pack('v', $totalReferences);
+ for ($i = 0; $i < $totalReferences; ++$i) {
+ $data .= $this->parser->references[$i];
+ }
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Write Excel BIFF STYLE records.
+ */
+ private function writeStyle()
+ {
+ $record = 0x0293; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $ixfe = 0x8000; // Index to cell style XF
+ $BuiltIn = 0x00; // Built-in style
+ $iLevel = 0xff; // Outline style level
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes Excel FORMAT record for non "built-in" numerical formats.
+ *
+ * @param string $format Custom format string
+ * @param integer $ifmt Format index code
+ */
+ private function writeNumberFormat($format, $ifmt)
+ {
+ $record = 0x041E; // Record identifier
+
+ $numberFormatString = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($format);
+ $length = 2 + strlen($numberFormatString); // Number of bytes to follow
+
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $ifmt) . $numberFormatString;
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write DATEMODE record to indicate the date system in use (1904 or 1900).
+ */
+ private function writeDateMode()
+ {
+ $record = 0x0022; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $f1904 = (PHPExcel_Shared_Date::getExcelCalendar() == PHPExcel_Shared_Date::CALENDAR_MAC_1904)
+ ? 1
+ : 0; // Flag for 1904 date system
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $f1904);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record EXTERNCOUNT to indicate the number of external sheet
+ * references in the workbook.
+ *
+ * Excel only stores references to external sheets that are used in NAME.
+ * The workbook NAME record is required to define the print area and the repeat
+ * rows and columns.
+ *
+ * A similar method is used in Worksheet.php for a slightly different purpose.
+ *
+ * @param integer $cxals Number of external references
+ */
+ private function writeExternalCount($cxals)
+ {
+ $record = 0x0016; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cxals);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas. NAME record is required to define the print area and the repeat
+ * rows and columns.
+ *
+ * A similar method is used in Worksheet.php for a slightly different purpose.
+ *
+ * @param string $sheetname Worksheet name
+ */
+ private function writeExternalSheet($sheetname)
+ {
+ $record = 0x0017; // Record identifier
+ $length = 0x02 + strlen($sheetname); // Number of bytes to follow
+
+ $cch = strlen($sheetname); // Length of sheet name
+ $rgch = 0x03; // Filename encoding
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CC", $cch, $rgch);
+ $this->append($header . $data . $sheetname);
+ }
+
+ /**
+ * Store the NAME record in the short format that is used for storing the print
+ * area, repeat rows only and repeat columns only.
+ *
+ * @param integer $index Sheet index
+ * @param integer $type Built-in name type
+ * @param integer $rowmin Start row
+ * @param integer $rowmax End row
+ * @param integer $colmin Start colum
+ * @param integer $colmax End column
+ */
+ private function writeNameShort($index, $type, $rowmin, $rowmax, $colmin, $colmax)
+ {
+ $record = 0x0018; // Record identifier
+ $length = 0x0024; // Number of bytes to follow
+
+ $grbit = 0x0020; // Option flags
+ $chKey = 0x00; // Keyboard shortcut
+ $cch = 0x01; // Length of text name
+ $cce = 0x0015; // Length of text definition
+ $ixals = $index + 1; // Sheet index
+ $itab = $ixals; // Equal to ixals
+ $cchCustMenu = 0x00; // Length of cust menu text
+ $cchDescription = 0x00; // Length of description text
+ $cchHelptopic = 0x00; // Length of help topic text
+ $cchStatustext = 0x00; // Length of status bar text
+ $rgch = $type; // Built-in name type
+
+ $unknown03 = 0x3b;
+ $unknown04 = 0xffff - $index;
+ $unknown05 = 0x0000;
+ $unknown06 = 0x0000;
+ $unknown07 = 0x1087;
+ $unknown08 = 0x8005;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $data .= pack("C", $chKey);
+ $data .= pack("C", $cch);
+ $data .= pack("v", $cce);
+ $data .= pack("v", $ixals);
+ $data .= pack("v", $itab);
+ $data .= pack("C", $cchCustMenu);
+ $data .= pack("C", $cchDescription);
+ $data .= pack("C", $cchHelptopic);
+ $data .= pack("C", $cchStatustext);
+ $data .= pack("C", $rgch);
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", $rowmin);
+ $data .= pack("v", $rowmax);
+ $data .= pack("C", $colmin);
+ $data .= pack("C", $colmax);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the NAME record in the long format that is used for storing the repeat
+ * rows and columns when both are specified. This shares a lot of code with
+ * writeNameShort() but we use a separate method to keep the code clean.
+ * Code abstraction for reuse can be carried too far, and I should know. ;-)
+ *
+ * @param integer $index Sheet index
+ * @param integer $type Built-in name type
+ * @param integer $rowmin Start row
+ * @param integer $rowmax End row
+ * @param integer $colmin Start colum
+ * @param integer $colmax End column
+ */
+ private function writeNameLong($index, $type, $rowmin, $rowmax, $colmin, $colmax)
+ {
+ $record = 0x0018; // Record identifier
+ $length = 0x003d; // Number of bytes to follow
+ $grbit = 0x0020; // Option flags
+ $chKey = 0x00; // Keyboard shortcut
+ $cch = 0x01; // Length of text name
+ $cce = 0x002e; // Length of text definition
+ $ixals = $index + 1; // Sheet index
+ $itab = $ixals; // Equal to ixals
+ $cchCustMenu = 0x00; // Length of cust menu text
+ $cchDescription = 0x00; // Length of description text
+ $cchHelptopic = 0x00; // Length of help topic text
+ $cchStatustext = 0x00; // Length of status bar text
+ $rgch = $type; // Built-in name type
+
+ $unknown01 = 0x29;
+ $unknown02 = 0x002b;
+ $unknown03 = 0x3b;
+ $unknown04 = 0xffff-$index;
+ $unknown05 = 0x0000;
+ $unknown06 = 0x0000;
+ $unknown07 = 0x1087;
+ $unknown08 = 0x8008;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $data .= pack("C", $chKey);
+ $data .= pack("C", $cch);
+ $data .= pack("v", $cce);
+ $data .= pack("v", $ixals);
+ $data .= pack("v", $itab);
+ $data .= pack("C", $cchCustMenu);
+ $data .= pack("C", $cchDescription);
+ $data .= pack("C", $cchHelptopic);
+ $data .= pack("C", $cchStatustext);
+ $data .= pack("C", $rgch);
+ $data .= pack("C", $unknown01);
+ $data .= pack("v", $unknown02);
+ // Column definition
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", 0x0000);
+ $data .= pack("v", 0x3fff);
+ $data .= pack("C", $colmin);
+ $data .= pack("C", $colmax);
+ // Row definition
+ $data .= pack("C", $unknown03);
+ $data .= pack("v", $unknown04);
+ $data .= pack("v", $unknown05);
+ $data .= pack("v", $unknown06);
+ $data .= pack("v", $unknown07);
+ $data .= pack("v", $unknown08);
+ $data .= pack("v", $index);
+ $data .= pack("v", $index);
+ $data .= pack("v", $rowmin);
+ $data .= pack("v", $rowmax);
+ $data .= pack("C", 0x00);
+ $data .= pack("C", 0xff);
+ // End of data
+ $data .= pack("C", 0x10);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Stores the COUNTRY record for localization
+ *
+ * @return string
+ */
+ private function writeCountry()
+ {
+ $record = 0x008C; // Record identifier
+ $length = 4; // Number of bytes to follow
+
+ $header = pack('vv', $record, $length);
+ /* using the same country code always for simplicity */
+ $data = pack('vv', $this->countryCode, $this->countryCode);
+ //$this->append($header . $data);
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Write the RECALCID record
+ *
+ * @return string
+ */
+ private function writeRecalcId()
+ {
+ $record = 0x01C1; // Record identifier
+ $length = 8; // Number of bytes to follow
+
+ $header = pack('vv', $record, $length);
+
+ // by inspection of real Excel files, MS Office Excel 2007 writes this
+ $data = pack('VV', 0x000001C1, 0x00001E667);
+
+ return $this->writeData($header . $data);
+ }
+
+ /**
+ * Stores the PALETTE biff record.
+ */
+ private function writePalette()
+ {
+ $aref = $this->palette;
+
+ $record = 0x0092; // Record identifier
+ $length = 2 + 4 * count($aref); // Number of bytes to follow
+ $ccv = count($aref); // Number of RGB values to follow
+ $data = ''; // The RGB data
+
+ // Pack the RGB data
+ foreach ($aref as $color) {
+ foreach ($color as $byte) {
+ $data .= pack("C", $byte);
+ }
+ }
+
+ $header = pack("vvv", $record, $length, $ccv);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Handling of the SST continue blocks is complicated by the need to include an
+ * additional continuation byte depending on whether the string is split between
+ * blocks or whether it starts at the beginning of the block. (There are also
+ * additional complications that will arise later when/if Rich Strings are
+ * supported).
+ *
+ * The Excel documentation says that the SST record should be followed by an
+ * EXTSST record. The EXTSST record is a hash table that is used to optimise
+ * access to SST. However, despite the documentation it doesn't seem to be
+ * required so we will ignore it.
+ *
+ * @return string Binary data
+ */
+ private function writeSharedStringsTable()
+ {
+ // maximum size of record data (excluding record header)
+ $continue_limit = 8224;
+
+ // initialize array of record data blocks
+ $recordDatas = array();
+
+ // start SST record data block with total number of strings, total number of unique strings
+ $recordData = pack("VV", $this->stringTotal, $this->stringUnique);
+
+ // loop through all (unique) strings in shared strings table
+ foreach (array_keys($this->stringTable) as $string) {
+ // here $string is a BIFF8 encoded string
+
+ // length = character count
+ $headerinfo = unpack("vlength/Cencoding", $string);
+
+ // currently, this is always 1 = uncompressed
+ $encoding = $headerinfo["encoding"];
+
+ // initialize finished writing current $string
+ $finished = false;
+
+ while ($finished === false) {
+ // normally, there will be only one cycle, but if string cannot immediately be written as is
+ // there will be need for more than one cylcle, if string longer than one record data block, there
+ // may be need for even more cycles
+
+ if (strlen($recordData) + strlen($string) <= $continue_limit) {
+ // then we can write the string (or remainder of string) without any problems
+ $recordData .= $string;
+
+ if (strlen($recordData) + strlen($string) == $continue_limit) {
+ // we close the record data block, and initialize a new one
+ $recordDatas[] = $recordData;
+ $recordData = '';
+ }
+
+ // we are finished writing this string
+ $finished = true;
+ } else {
+ // special treatment writing the string (or remainder of the string)
+ // If the string is very long it may need to be written in more than one CONTINUE record.
+
+ // check how many bytes more there is room for in the current record
+ $space_remaining = $continue_limit - strlen($recordData);
+
+ // minimum space needed
+ // uncompressed: 2 byte string length length field + 1 byte option flags + 2 byte character
+ // compressed: 2 byte string length length field + 1 byte option flags + 1 byte character
+ $min_space_needed = ($encoding == 1) ? 5 : 4;
+
+ // We have two cases
+ // 1. space remaining is less than minimum space needed
+ // here we must waste the space remaining and move to next record data block
+ // 2. space remaining is greater than or equal to minimum space needed
+ // here we write as much as we can in the current block, then move to next record data block
+
+ // 1. space remaining is less than minimum space needed
+ if ($space_remaining < $min_space_needed) {
+ // we close the block, store the block data
+ $recordDatas[] = $recordData;
+
+ // and start new record data block where we start writing the string
+ $recordData = '';
+
+ // 2. space remaining is greater than or equal to minimum space needed
+ } else {
+ // initialize effective remaining space, for Unicode strings this may need to be reduced by 1, see below
+ $effective_space_remaining = $space_remaining;
+
+ // for uncompressed strings, sometimes effective space remaining is reduced by 1
+ if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
+ --$effective_space_remaining;
+ }
+
+ // one block fininshed, store the block data
+ $recordData .= substr($string, 0, $effective_space_remaining);
+
+ $string = substr($string, $effective_space_remaining); // for next cycle in while loop
+ $recordDatas[] = $recordData;
+
+ // start new record data block with the repeated option flags
+ $recordData = pack('C', $encoding);
+ }
+ }
+ }
+ }
+
+ // Store the last record data block unless it is empty
+ // if there was no need for any continue records, this will be the for SST record data block itself
+ if (strlen($recordData) > 0) {
+ $recordDatas[] = $recordData;
+ }
+
+ // combine into one chunk with all the blocks SST, CONTINUE,...
+ $chunk = '';
+ foreach ($recordDatas as $i => $recordData) {
+ // first block should have the SST record header, remaing should have CONTINUE header
+ $record = ($i == 0) ? 0x00FC : 0x003C;
+
+ $header = pack("vv", $record, strlen($recordData));
+ $data = $header . $recordData;
+
+ $chunk .= $this->writeData($data);
+ }
+
+ return $chunk;
+ }
+
+ /**
+ * Writes the MSODRAWINGGROUP record if needed. Possibly split using CONTINUE records.
+ */
+ private function writeMsoDrawingGroup()
+ {
+ // write the Escher stream if necessary
+ if (isset($this->escher)) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($this->escher);
+ $data = $writer->close();
+
+ $record = 0x00EB;
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ return $this->writeData($header . $data);
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * Get Escher object
+ *
+ * @return PHPExcel_Shared_Escher
+ */
+ public function getEscher()
+ {
+ return $this->escher;
+ }
+
+ /**
+ * Set Escher object
+ *
+ * @param PHPExcel_Shared_Escher $pValue
+ */
+ public function setEscher(PHPExcel_Shared_Escher $pValue = null)
+ {
+ $this->escher = $pValue;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php
new file mode 100644
index 0000000..5ff0806
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php
@@ -0,0 +1,4240 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
+{
+ /**
+ * Formula parser
+ *
+ * @var PHPExcel_Writer_Excel5_Parser
+ */
+ private $parser;
+
+ /**
+ * Maximum number of characters for a string (LABEL record in BIFF5)
+ * @var integer
+ */
+ private $xlsStringMaxLength;
+
+ /**
+ * Array containing format information for columns
+ * @var array
+ */
+ private $columnInfo;
+
+ /**
+ * Array containing the selected area for the worksheet
+ * @var array
+ */
+ private $selection;
+
+ /**
+ * The active pane for the worksheet
+ * @var integer
+ */
+ private $activePane;
+
+ /**
+ * Whether to use outline.
+ * @var integer
+ */
+ private $outlineOn;
+
+ /**
+ * Auto outline styles.
+ * @var bool
+ */
+ private $outlineStyle;
+
+ /**
+ * Whether to have outline summary below.
+ * @var bool
+ */
+ private $outlineBelow;
+
+ /**
+ * Whether to have outline summary at the right.
+ * @var bool
+ */
+ private $outlineRight;
+
+ /**
+ * Reference to the total number of strings in the workbook
+ * @var integer
+ */
+ private $stringTotal;
+
+ /**
+ * Reference to the number of unique strings in the workbook
+ * @var integer
+ */
+ private $stringUnique;
+
+ /**
+ * Reference to the array containing all the unique strings in the workbook
+ * @var array
+ */
+ private $stringTable;
+
+ /**
+ * Color cache
+ */
+ private $colors;
+
+ /**
+ * Index of first used row (at least 0)
+ * @var int
+ */
+ private $firstRowIndex;
+
+ /**
+ * Index of last used row. (no used rows means -1)
+ * @var int
+ */
+ private $lastRowIndex;
+
+ /**
+ * Index of first used column (at least 0)
+ * @var int
+ */
+ private $firstColumnIndex;
+
+ /**
+ * Index of last used column (no used columns means -1)
+ * @var int
+ */
+ private $lastColumnIndex;
+
+ /**
+ * Sheet object
+ * @var PHPExcel_Worksheet
+ */
+ public $phpSheet;
+
+ /**
+ * Count cell style Xfs
+ *
+ * @var int
+ */
+ private $countCellStyleXfs;
+
+ /**
+ * Escher object corresponding to MSODRAWING
+ *
+ * @var PHPExcel_Shared_Escher
+ */
+ private $escher;
+
+ /**
+ * Array of font hashes associated to FONT records index
+ *
+ * @var array
+ */
+ public $fontHashIndex;
+
+ /**
+ * Constructor
+ *
+ * @param int &$str_total Total number of strings
+ * @param int &$str_unique Total number of unique strings
+ * @param array &$str_table String Table
+ * @param array &$colors Colour Table
+ * @param mixed $parser The formula parser created for the Workbook
+ * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written
+ * @param string $phpSheet The worksheet to write
+ * @param PHPExcel_Worksheet $phpSheet
+ */
+ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet)
+ {
+ // It needs to call its parent's constructor explicitly
+ parent::__construct();
+
+ // change BIFFwriter limit for CONTINUE records
+// $this->_limit = 8224;
+
+
+ $this->_preCalculateFormulas = $preCalculateFormulas;
+ $this->stringTotal = &$str_total;
+ $this->stringUnique = &$str_unique;
+ $this->stringTable = &$str_table;
+ $this->colors = &$colors;
+ $this->parser = $parser;
+
+ $this->phpSheet = $phpSheet;
+
+ //$this->ext_sheets = array();
+ //$this->offset = 0;
+ $this->xlsStringMaxLength = 255;
+ $this->columnInfo = array();
+ $this->selection = array(0,0,0,0);
+ $this->activePane = 3;
+
+ $this->_print_headers = 0;
+
+ $this->outlineStyle = 0;
+ $this->outlineBelow = 1;
+ $this->outlineRight = 1;
+ $this->outlineOn = 1;
+
+ $this->fontHashIndex = array();
+
+ // calculate values for DIMENSIONS record
+ $minR = 1;
+ $minC = 'A';
+
+ $maxR = $this->phpSheet->getHighestRow();
+ $maxC = $this->phpSheet->getHighestColumn();
+
+ // Determine lowest and highest column and row
+// $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
+ $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ;
+
+ $this->firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC);
+ $this->lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC);
+
+// if ($this->firstColumnIndex > 255) $this->firstColumnIndex = 255;
+ if ($this->lastColumnIndex > 255) {
+ $this->lastColumnIndex = 255;
+ }
+
+ $this->countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
+ }
+
+ /**
+ * Add data to the beginning of the workbook (note the reverse order)
+ * and to the end of the workbook.
+ *
+ * @access public
+ * @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook()
+ */
+ public function close()
+ {
+ $phpSheet = $this->phpSheet;
+
+ $num_sheets = $phpSheet->getParent()->getSheetCount();
+
+ // Write BOF record
+ $this->storeBof(0x0010);
+
+ // Write PRINTHEADERS
+ $this->writePrintHeaders();
+
+ // Write PRINTGRIDLINES
+ $this->writePrintGridlines();
+
+ // Write GRIDSET
+ $this->writeGridset();
+
+ // Calculate column widths
+ $phpSheet->calculateColumnWidths();
+
+ // Column dimensions
+ if (($defaultWidth = $phpSheet->getDefaultColumnDimension()->getWidth()) < 0) {
+ $defaultWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($phpSheet->getParent()->getDefaultStyle()->getFont());
+ }
+
+ $columnDimensions = $phpSheet->getColumnDimensions();
+ $maxCol = $this->lastColumnIndex -1;
+ for ($i = 0; $i <= $maxCol; ++$i) {
+ $hidden = 0;
+ $level = 0;
+ $xfIndex = 15; // there are 15 cell style Xfs
+
+ $width = $defaultWidth;
+
+ $columnLetter = PHPExcel_Cell::stringFromColumnIndex($i);
+ if (isset($columnDimensions[$columnLetter])) {
+ $columnDimension = $columnDimensions[$columnLetter];
+ if ($columnDimension->getWidth() >= 0) {
+ $width = $columnDimension->getWidth();
+ }
+ $hidden = $columnDimension->getVisible() ? 0 : 1;
+ $level = $columnDimension->getOutlineLevel();
+ $xfIndex = $columnDimension->getXfIndex() + 15; // there are 15 cell style Xfs
+ }
+
+ // Components of columnInfo:
+ // $firstcol first column on the range
+ // $lastcol last column on the range
+ // $width width to set
+ // $xfIndex The optional cell style Xf index to apply to the columns
+ // $hidden The optional hidden atribute
+ // $level The optional outline level
+ $this->columnInfo[] = array($i, $i, $width, $xfIndex, $hidden, $level);
+ }
+
+ // Write GUTS
+ $this->writeGuts();
+
+ // Write DEFAULTROWHEIGHT
+ $this->writeDefaultRowHeight();
+ // Write WSBOOL
+ $this->writeWsbool();
+ // Write horizontal and vertical page breaks
+ $this->writeBreaks();
+ // Write page header
+ $this->writeHeader();
+ // Write page footer
+ $this->writeFooter();
+ // Write page horizontal centering
+ $this->writeHcenter();
+ // Write page vertical centering
+ $this->writeVcenter();
+ // Write left margin
+ $this->writeMarginLeft();
+ // Write right margin
+ $this->writeMarginRight();
+ // Write top margin
+ $this->writeMarginTop();
+ // Write bottom margin
+ $this->writeMarginBottom();
+ // Write page setup
+ $this->writeSetup();
+ // Write sheet protection
+ $this->writeProtect();
+ // Write SCENPROTECT
+ $this->writeScenProtect();
+ // Write OBJECTPROTECT
+ $this->writeObjectProtect();
+ // Write sheet password
+ $this->writePassword();
+ // Write DEFCOLWIDTH record
+ $this->writeDefcol();
+
+ // Write the COLINFO records if they exist
+ if (!empty($this->columnInfo)) {
+ $colcount = count($this->columnInfo);
+ for ($i = 0; $i < $colcount; ++$i) {
+ $this->writeColinfo($this->columnInfo[$i]);
+ }
+ }
+ $autoFilterRange = $phpSheet->getAutoFilter()->getRange();
+ if (!empty($autoFilterRange)) {
+ // Write AUTOFILTERINFO
+ $this->writeAutoFilterInfo();
+ }
+
+ // Write sheet dimensions
+ $this->writeDimensions();
+
+ // Row dimensions
+ foreach ($phpSheet->getRowDimensions() as $rowDimension) {
+ $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
+ $this->writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel());
+ }
+
+ // Write Cells
+ foreach ($phpSheet->getCellCollection() as $cellID) {
+ $cell = $phpSheet->getCell($cellID);
+ $row = $cell->getRow() - 1;
+ $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;
+
+ // Don't break Excel!
+// if ($row + 1 > 65536 or $column + 1 > 256) {
+ if ($row > 65535 || $column > 255) {
+ break;
+ }
+
+ // Write cell value
+ $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs
+
+ $cVal = $cell->getValue();
+ if ($cVal instanceof PHPExcel_RichText) {
+ // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
+ $arrcRun = array();
+ $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
+ $str_pos = 0;
+ $elements = $cVal->getRichTextElements();
+ foreach ($elements as $element) {
+ // FONT Index
+ if ($element instanceof PHPExcel_RichText_Run) {
+ $str_fontidx = $this->fontHashIndex[$element->getFont()->getHashCode()];
+ } else {
+ $str_fontidx = 0;
+ }
+ $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
+ // Position FROM
+ $str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
+ }
+ $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
+ } else {
+ switch ($cell->getDatatype()) {
+ case PHPExcel_Cell_DataType::TYPE_STRING:
+ case PHPExcel_Cell_DataType::TYPE_NULL:
+ if ($cVal === '' || $cVal === null) {
+ $this->writeBlank($row, $column, $xfIndex);
+ } else {
+ $this->writeString($row, $column, $cVal, $xfIndex);
+ }
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_NUMERIC:
+ $this->writeNumber($row, $column, $cVal, $xfIndex);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_FORMULA:
+ $calculatedValue = $this->_preCalculateFormulas ?
+ $cell->getCalculatedValue() : null;
+ $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_BOOL:
+ $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_ERROR:
+ $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex);
+ break;
+
+ }
+ }
+ }
+
+ // Append
+ $this->writeMsoDrawing();
+
+ // Write WINDOW2 record
+ $this->writeWindow2();
+
+ // Write PLV record
+ $this->writePageLayoutView();
+
+ // Write ZOOM record
+ $this->writeZoom();
+ if ($phpSheet->getFreezePane()) {
+ $this->writePanes();
+ }
+
+ // Write SELECTION record
+ $this->writeSelection();
+
+ // Write MergedCellsTable Record
+ $this->writeMergedCells();
+
+ // Hyperlinks
+ foreach ($phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) {
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinate);
+
+ $url = $hyperlink->getUrl();
+
+ if (strpos($url, 'sheet://') !== false) {
+ // internal to current workbook
+ $url = str_replace('sheet://', 'internal:', $url);
+
+ } elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
+ // URL
+ // $url = $url;
+
+ } else {
+ // external (local file)
+ $url = 'external:' . $url;
+ }
+
+ $this->writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url);
+ }
+
+ $this->writeDataValidity();
+ $this->writeSheetLayout();
+
+ // Write SHEETPROTECTION record
+ $this->writeSheetProtection();
+ $this->writeRangeProtection();
+
+ $arrConditionalStyles = $phpSheet->getConditionalStylesCollection();
+ if (!empty($arrConditionalStyles)) {
+ $arrConditional = array();
+ // @todo CFRule & CFHeader
+ // Write CFHEADER record
+ $this->writeCFHeader();
+ // Write ConditionalFormattingTable records
+ foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
+ foreach ($conditionalStyles as $conditional) {
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
+ $arrConditional[] = $conditional->getHashCode();
+ // Write CFRULE record
+ $this->writeCFRule($conditional);
+ }
+ }
+ }
+ }
+ }
+
+ $this->storeEof();
+ }
+
+ /**
+ * Write a cell range address in BIFF8
+ * always fixed range
+ * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format
+ *
+ * @param string $range E.g. 'A1' or 'A1:B6'
+ * @return string Binary data
+ */
+ private function writeBIFF8CellRangeAddressFixed($range = 'A1')
+ {
+ $explodes = explode(':', $range);
+
+ // extract first cell, e.g. 'A1'
+ $firstCell = $explodes[0];
+
+ // extract last cell, e.g. 'B6'
+ if (count($explodes) == 1) {
+ $lastCell = $firstCell;
+ } else {
+ $lastCell = $explodes[1];
+ }
+
+ $firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
+ $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
+
+ return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1);
+ }
+
+ /**
+ * Retrieves data from memory in one chunk, or from disk in $buffer
+ * sized chunks.
+ *
+ * @return string The data
+ */
+ public function getData()
+ {
+ $buffer = 4096;
+
+ // Return data stored in memory
+ if (isset($this->_data)) {
+ $tmp = $this->_data;
+ unset($this->_data);
+ return $tmp;
+ }
+ // No data to return
+ return false;
+ }
+
+ /**
+ * Set the option to print the row and column headers on the printed page.
+ *
+ * @access public
+ * @param integer $print Whether to print the headers or not. Defaults to 1 (print).
+ */
+ public function printRowColHeaders($print = 1)
+ {
+ $this->_print_headers = $print;
+ }
+
+ /**
+ * This method sets the properties for outlining and grouping. The defaults
+ * correspond to Excel's defaults.
+ *
+ * @param bool $visible
+ * @param bool $symbols_below
+ * @param bool $symbols_right
+ * @param bool $auto_style
+ */
+ public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false)
+ {
+ $this->outlineOn = $visible;
+ $this->outlineBelow = $symbols_below;
+ $this->outlineRight = $symbols_right;
+ $this->outlineStyle = $auto_style;
+
+ // Ensure this is a boolean vale for Window2
+ if ($this->outlineOn) {
+ $this->outlineOn = 1;
+ }
+ }
+
+ /**
+ * Write a double to the specified row and column (zero indexed).
+ * An integer can be written as a double. Excel will display an
+ * integer. $format is optional.
+ *
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param float $num The number to write
+ * @param mixed $xfIndex The optional XF format
+ * @return integer
+ */
+ private function writeNumber($row, $col, $num, $xfIndex)
+ {
+ $record = 0x0203; // Record identifier
+ $length = 0x000E; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $xfIndex);
+ $xl_double = pack("d", $num);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $xl_double = strrev($xl_double);
+ }
+
+ $this->append($header.$data.$xl_double);
+ return(0);
+ }
+
+ /**
+ * Write a LABELSST record or a LABEL record. Which one depends on BIFF version
+ *
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param string $str The string
+ * @param int $xfIndex Index to XF record
+ */
+ private function writeString($row, $col, $str, $xfIndex)
+ {
+ $this->writeLabelSst($row, $col, $str, $xfIndex);
+ }
+
+ /**
+ * Write a LABELSST record or a LABEL record. Which one depends on BIFF version
+ * It differs from writeString by the writing of rich text strings.
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param string $str The string
+ * @param mixed $xfIndex The XF format index for the cell
+ * @param array $arrcRun Index to Font record and characters beginning
+ */
+ private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
+ {
+ $record = 0x00FD; // Record identifier
+ $length = 0x000A; // Bytes to follow
+ $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun);
+
+ /* check if string is already present */
+ if (!isset($this->stringTable[$str])) {
+ $this->stringTable[$str] = $this->stringUnique++;
+ }
+ $this->stringTotal++;
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write a string to the specified row and column (zero indexed).
+ * NOTE: there is an Excel 5 defined limit of 255 characters.
+ * $format is optional.
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @access public
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $str The string to write
+ * @param mixed $xfIndex The XF format index for the cell
+ * @return integer
+ */
+ private function writeLabel($row, $col, $str, $xfIndex)
+ {
+ $strlen = strlen($str);
+ $record = 0x0204; // Record identifier
+ $length = 0x0008 + $strlen; // Bytes to follow
+
+ $str_error = 0;
+
+ if ($strlen > $this->xlsStringMaxLength) { // LABEL must be < 255 chars
+ $str = substr($str, 0, $this->xlsStringMaxLength);
+ $length = 0x0008 + $this->xlsStringMaxLength;
+ $strlen = $this->xlsStringMaxLength;
+ $str_error = -3;
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row, $col, $xfIndex, $strlen);
+ $this->append($header . $data . $str);
+ return($str_error);
+ }
+
+ /**
+ * Write a string to the specified row and column (zero indexed).
+ * This is the BIFF8 version (no 255 chars limit).
+ * $format is optional.
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @access public
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $str The string to write
+ * @param mixed $xfIndex The XF format index for the cell
+ * @return integer
+ */
+ private function writeLabelSst($row, $col, $str, $xfIndex)
+ {
+ $record = 0x00FD; // Record identifier
+ $length = 0x000A; // Bytes to follow
+
+ $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str);
+
+ /* check if string is already present */
+ if (!isset($this->stringTable[$str])) {
+ $this->stringTable[$str] = $this->stringUnique++;
+ }
+ $this->stringTotal++;
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Writes a note associated with the cell given by the row and column.
+ * NOTE records don't have a length limit.
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $note The note to write
+ */
+ private function writeNote($row, $col, $note)
+ {
+ $note_length = strlen($note);
+ $record = 0x001C; // Record identifier
+ $max_length = 2048; // Maximun length for a NOTE record
+
+ // Length for this record is no more than 2048 + 6
+ $length = 0x0006 + min($note_length, 2048);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $note_length);
+ $this->append($header . $data . substr($note, 0, 2048));
+
+ for ($i = $max_length; $i < $note_length; $i += $max_length) {
+ $chunk = substr($note, $i, $max_length);
+ $length = 0x0006 + strlen($chunk);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", -1, 0, strlen($chunk));
+ $this->append($header.$data.$chunk);
+ }
+ return(0);
+ }
+
+ /**
+ * Write a blank cell to the specified row and column (zero indexed).
+ * A blank cell is used to specify formatting without adding a string
+ * or a number.
+ *
+ * A blank cell without a format serves no purpose. Therefore, we don't write
+ * a BLANK record unless a format is specified.
+ *
+ * Returns 0 : normal termination (including no format)
+ * -1 : insufficient number of arguments
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param mixed $xfIndex The XF format index
+ */
+ public function writeBlank($row, $col, $xfIndex)
+ {
+ $record = 0x0201; // Record identifier
+ $length = 0x0006; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $xfIndex);
+ $this->append($header . $data);
+ return 0;
+ }
+
+ /**
+ * Write a boolean or an error type to the specified row and column (zero indexed)
+ *
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param int $value
+ * @param boolean $isError Error or Boolean?
+ * @param int $xfIndex
+ */
+ private function writeBoolErr($row, $col, $value, $isError, $xfIndex)
+ {
+ $record = 0x0205;
+ $length = 8;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError);
+ $this->append($header . $data);
+ return 0;
+ }
+
+ /**
+ * Write a formula to the specified row and column (zero indexed).
+ * The textual representation of the formula is passed to the parser in
+ * Parser.php which returns a packed binary string.
+ *
+ * Returns 0 : normal termination
+ * -1 : formula errors (bad formula)
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $formula The formula text string
+ * @param mixed $xfIndex The XF format index
+ * @param mixed $calculatedValue Calculated value
+ * @return integer
+ */
+ private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue)
+ {
+ $record = 0x0006; // Record identifier
+
+ // Initialize possible additional value for STRING record that should be written after the FORMULA record?
+ $stringValue = null;
+
+ // calculated value
+ if (isset($calculatedValue)) {
+ // Since we can't yet get the data type of the calculated value,
+ // we use best effort to determine data type
+ if (is_bool($calculatedValue)) {
+ // Boolean value
+ $num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF);
+ } elseif (is_int($calculatedValue) || is_float($calculatedValue)) {
+ // Numeric value
+ $num = pack('d', $calculatedValue);
+ } elseif (is_string($calculatedValue)) {
+ if (array_key_exists($calculatedValue, PHPExcel_Cell_DataType::getErrorCodes())) {
+ // Error value
+ $num = pack('CCCvCv', 0x02, 0x00, self::mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF);
+ } elseif ($calculatedValue === '') {
+ // Empty string (and BIFF8)
+ $num = pack('CCCvCv', 0x03, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
+ } else {
+ // Non-empty string value (or empty string BIFF5)
+ $stringValue = $calculatedValue;
+ $num = pack('CCCvCv', 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
+ }
+ } else {
+ // We are really not supposed to reach here
+ $num = pack('d', 0x00);
+ }
+ } else {
+ $num = pack('d', 0x00);
+ }
+
+ $grbit = 0x03; // Option flags
+ $unknown = 0x0000; // Must be zero
+
+ // Strip the '=' or '@' sign at the beginning of the formula string
+ if ($formula[0] == '=') {
+ $formula = substr($formula, 1);
+ } else {
+ // Error handling
+ $this->writeString($row, $col, 'Unrecognised character for formula');
+ return -1;
+ }
+
+ // Parse the formula using the parser in Parser.php
+ try {
+ $error = $this->parser->parse($formula);
+ $formula = $this->parser->toReversePolish();
+
+ $formlen = strlen($formula); // Length of the binary string
+ $length = 0x16 + $formlen; // Length of the record data
+
+ $header = pack("vv", $record, $length);
+
+ $data = pack("vvv", $row, $col, $xfIndex)
+ . $num
+ . pack("vVv", $grbit, $unknown, $formlen);
+ $this->append($header . $data . $formula);
+
+ // Append also a STRING record if necessary
+ if ($stringValue !== null) {
+ $this->writeStringRecord($stringValue);
+ }
+
+ return 0;
+
+ } catch (PHPExcel_Exception $e) {
+ // do nothing
+ }
+
+ }
+
+ /**
+ * Write a STRING record. This
+ *
+ * @param string $stringValue
+ */
+ private function writeStringRecord($stringValue)
+ {
+ $record = 0x0207; // Record identifier
+ $data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue);
+
+ $length = strlen($data);
+ $header = pack('vv', $record, $length);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write a hyperlink.
+ * This is comprised of two elements: the visible label and
+ * the invisible link. The visible label is the same as the link unless an
+ * alternative string is specified. The label is written using the
+ * writeString() method. Therefore the 255 characters string limit applies.
+ * $string and $format are optional.
+ *
+ * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external
+ * directory url.
+ *
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @param integer $row Row
+ * @param integer $col Column
+ * @param string $url URL string
+ * @return integer
+ */
+ private function writeUrl($row, $col, $url)
+ {
+ // Add start row and col to arg list
+ return($this->writeUrlRange($row, $col, $row, $col, $url));
+ }
+
+ /**
+ * This is the more general form of writeUrl(). It allows a hyperlink to be
+ * written to a range of cells. This function also decides the type of hyperlink
+ * to be written. These are either, Web (http, ftp, mailto), Internal
+ * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlRange($row1, $col1, $row2, $col2, $url)
+ {
+ // Check for internal/external sheet links or default to web link
+ if (preg_match('[^internal:]', $url)) {
+ return($this->writeUrlInternal($row1, $col1, $row2, $col2, $url));
+ }
+ if (preg_match('[^external:]', $url)) {
+ return($this->writeUrlExternal($row1, $col1, $row2, $col2, $url));
+ }
+ return($this->writeUrlWeb($row1, $col1, $row2, $col2, $url));
+ }
+
+ /**
+ * Used to write http, ftp and mailto hyperlinks.
+ * The link type ($options) is 0x03 is the same as absolute dir ref without
+ * sheet. However it is differentiated by the $unknown2 data stream.
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlWeb($row1, $col1, $row2, $col2, $url)
+ {
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+ $unknown2 = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B");
+
+ // Pack the option flags
+ $options = pack("V", 0x03);
+
+ // Convert URL to a null terminated wchar string
+ $url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
+ $url = $url . "\0\0\0";
+
+ // Pack the length of the URL
+ $url_len = pack("V", strlen($url));
+
+ // Calculate the data length
+ $length = 0x34 + strlen($url);
+
+ // Pack the header data
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row1, $row2, $col1, $col2);
+
+ // Write the packed data
+ $this->append($header . $data .
+ $unknown1 . $options .
+ $unknown2 . $url_len . $url);
+ return 0;
+ }
+
+ /**
+ * Used to write internal reference hyperlinks such as "Sheet1!A1".
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlInternal($row1, $col1, $row2, $col2, $url)
+ {
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Strip URL type
+ $url = preg_replace('/^internal:/', '', $url);
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+
+ // Pack the option flags
+ $options = pack("V", 0x08);
+
+ // Convert the URL type and to a null terminated wchar string
+ $url .= "\0";
+
+ // character count
+ $url_len = PHPExcel_Shared_String::CountCharacters($url);
+ $url_len = pack('V', $url_len);
+
+ $url = PHPExcel_Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
+
+ // Calculate the data length
+ $length = 0x24 + strlen($url);
+
+ // Pack the header data
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row1, $row2, $col1, $col2);
+
+ // Write the packed data
+ $this->append($header . $data .
+ $unknown1 . $options .
+ $url_len . $url);
+ return 0;
+ }
+
+ /**
+ * Write links to external directory names such as 'c:\foo.xls',
+ * c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
+ *
+ * Note: Excel writes some relative links with the $dir_long string. We ignore
+ * these cases for the sake of simpler code.
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlExternal($row1, $col1, $row2, $col2, $url)
+ {
+ // Network drives are different. We will handle them separately
+ // MS/Novell network drives and shares start with \\
+ if (preg_match('[^external:\\\\]', $url)) {
+ return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format));
+ }
+
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Strip URL type and change Unix dir separator to Dos style (if needed)
+ //
+ $url = preg_replace('/^external:/', '', $url);
+ $url = preg_replace('/\//', "\\", $url);
+
+ // Determine if the link is relative or absolute:
+ // relative if link contains no dir separator, "somefile.xls"
+ // relative if link starts with up-dir, "..\..\somefile.xls"
+ // otherwise, absolute
+
+ $absolute = 0x00; // relative path
+ if (preg_match('/^[A-Z]:/', $url)) {
+ $absolute = 0x02; // absolute path on Windows, e.g. C:\...
+ }
+ $link_type = 0x01 | $absolute;
+
+ // Determine if the link contains a sheet reference and change some of the
+ // parameters accordingly.
+ // Split the dir name and sheet name (if it exists)
+ $dir_long = $url;
+ if (preg_match("/\#/", $url)) {
+ $link_type |= 0x08;
+ }
+
+
+ // Pack the link type
+ $link_type = pack("V", $link_type);
+
+ // Calculate the up-level dir count e.g.. (..\..\..\ == 3)
+ $up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless);
+ $up_count = pack("v", $up_count);
+
+ // Store the short dos dir name (null terminated)
+ $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
+
+ // Store the long dir name as a wchar string (non-null terminated)
+ $dir_long = $dir_long . "\0";
+
+ // Pack the lengths of the dir strings
+ $dir_short_len = pack("V", strlen($dir_short));
+ $dir_long_len = pack("V", strlen($dir_long));
+ $stream_len = pack("V", 0); //strlen($dir_long) + 0x06);
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", 'D0C9EA79F9BACE118C8200AA004BA90B02000000');
+ $unknown2 = pack("H*", '0303000000000000C000000000000046');
+ $unknown3 = pack("H*", 'FFFFADDE000000000000000000000000000000000000000');
+ $unknown4 = pack("v", 0x03);
+
+ // Pack the main data stream
+ $data = pack("vvvv", $row1, $row2, $col1, $col2) .
+ $unknown1 .
+ $link_type .
+ $unknown2 .
+ $up_count .
+ $dir_short_len.
+ $dir_short .
+ $unknown3 .
+ $stream_len ;/*.
+ $dir_long_len .
+ $unknown4 .
+ $dir_long .
+ $sheet_len .
+ $sheet ;*/
+
+ // Pack the header data
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ // Write the packed data
+ $this->append($header. $data);
+ return 0;
+ }
+
+ /**
+ * This method is used to set the height and format for a row.
+ *
+ * @param integer $row The row to set
+ * @param integer $height Height we are giving to the row.
+ * Use null to set XF without setting height
+ * @param integer $xfIndex The optional cell style Xf index to apply to the columns
+ * @param bool $hidden The optional hidden attribute
+ * @param integer $level The optional outline level for row, in range [0,7]
+ */
+ private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0)
+ {
+ $record = 0x0208; // Record identifier
+ $length = 0x0010; // Number of bytes to follow
+
+ $colMic = 0x0000; // First defined column
+ $colMac = 0x0000; // Last defined column
+ $irwMac = 0x0000; // Used by Excel to optimise loading
+ $reserved = 0x0000; // Reserved
+ $grbit = 0x0000; // Option flags
+ $ixfe = $xfIndex;
+
+ if ($height < 0) {
+ $height = null;
+ }
+
+ // Use writeRow($row, null, $XF) to set XF format without setting height
+ if ($height != null) {
+ $miyRw = $height * 20; // row height
+ } else {
+ $miyRw = 0xff; // default row height is 256
+ }
+
+ // Set the options flags. fUnsynced is used to show that the font and row
+ // heights are not compatible. This is usually the case for WriteExcel.
+ // The collapsed flag 0x10 doesn't seem to be used to indicate that a row
+ // is collapsed. Instead it is used to indicate that the previous row is
+ // collapsed. The zero height flag, 0x20, is used to collapse a row.
+
+ $grbit |= $level;
+ if ($hidden) {
+ $grbit |= 0x0030;
+ }
+ if ($height !== null) {
+ $grbit |= 0x0040; // fUnsynced
+ }
+ if ($xfIndex !== 0xF) {
+ $grbit |= 0x0080;
+ }
+ $grbit |= 0x0100;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Writes Excel DIMENSIONS to define the area in which there is data.
+ */
+ private function writeDimensions()
+ {
+ $record = 0x0200; // Record identifier
+
+ $length = 0x000E;
+ $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved
+
+ $header = pack("vv", $record, $length);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record Window2.
+ */
+ private function writeWindow2()
+ {
+ $record = 0x023E; // Record identifier
+ $length = 0x0012;
+
+ $grbit = 0x00B6; // Option flags
+ $rwTop = 0x0000; // Top row visible in window
+ $colLeft = 0x0000; // Leftmost column visible in window
+
+
+ // The options flags that comprise $grbit
+ $fDspFmla = 0; // 0 - bit
+ $fDspGrid = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1
+ $fDspRwCol = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2
+ $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3
+ $fDspZeros = 1; // 4
+ $fDefaultHdr = 1; // 5
+ $fArabic = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6
+ $fDspGuts = $this->outlineOn; // 7
+ $fFrozenNoSplit = 0; // 0 - bit
+ // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
+ $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
+ $fPaged = 1; // 2
+ $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
+
+ $grbit = $fDspFmla;
+ $grbit |= $fDspGrid << 1;
+ $grbit |= $fDspRwCol << 2;
+ $grbit |= $fFrozen << 3;
+ $grbit |= $fDspZeros << 4;
+ $grbit |= $fDefaultHdr << 5;
+ $grbit |= $fArabic << 6;
+ $grbit |= $fDspGuts << 7;
+ $grbit |= $fFrozenNoSplit << 8;
+ $grbit |= $fSelected << 9;
+ $grbit |= $fPaged << 10;
+ $grbit |= $fPageBreakPreview << 11;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $grbit, $rwTop, $colLeft);
+
+ // FIXME !!!
+ $rgbHdr = 0x0040; // Row/column heading and gridline color index
+ $zoom_factor_page_break = ($fPageBreakPreview ? $this->phpSheet->getSheetView()->getZoomScale() : 0x0000);
+ $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal();
+
+ $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record DEFAULTROWHEIGHT.
+ */
+ private function writeDefaultRowHeight()
+ {
+ $defaultRowHeight = $this->phpSheet->getDefaultRowDimension()->getRowHeight();
+
+ if ($defaultRowHeight < 0) {
+ return;
+ }
+
+ // convert to twips
+ $defaultRowHeight = (int) 20 * $defaultRowHeight;
+
+ $record = 0x0225; // Record identifier
+ $length = 0x0004; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", 1, $defaultRowHeight);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
+ */
+ private function writeDefcol()
+ {
+ $defaultColWidth = 8;
+
+ $record = 0x0055; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $defaultColWidth);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record COLINFO to define column widths
+ *
+ * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C
+ * length record.
+ *
+ * @param array $col_array This is the only parameter received and is composed of the following:
+ * 0 => First formatted column,
+ * 1 => Last formatted column,
+ * 2 => Col width (8.43 is Excel default),
+ * 3 => The optional XF format of the column,
+ * 4 => Option flags.
+ * 5 => Optional outline level
+ */
+ private function writeColinfo($col_array)
+ {
+ if (isset($col_array[0])) {
+ $colFirst = $col_array[0];
+ }
+ if (isset($col_array[1])) {
+ $colLast = $col_array[1];
+ }
+ if (isset($col_array[2])) {
+ $coldx = $col_array[2];
+ } else {
+ $coldx = 8.43;
+ }
+ if (isset($col_array[3])) {
+ $xfIndex = $col_array[3];
+ } else {
+ $xfIndex = 15;
+ }
+ if (isset($col_array[4])) {
+ $grbit = $col_array[4];
+ } else {
+ $grbit = 0;
+ }
+ if (isset($col_array[5])) {
+ $level = $col_array[5];
+ } else {
+ $level = 0;
+ }
+ $record = 0x007D; // Record identifier
+ $length = 0x000C; // Number of bytes to follow
+
+ $coldx *= 256; // Convert to units of 1/256 of a char
+
+ $ixfe = $xfIndex;
+ $reserved = 0x0000; // Reserved
+
+ $level = max(0, min($level, 7));
+ $grbit |= $level << 8;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record SELECTION.
+ */
+ private function writeSelection()
+ {
+ // look up the selected cell range
+ $selectedCells = $this->phpSheet->getSelectedCells();
+ $selectedCells = PHPExcel_Cell::splitRange($this->phpSheet->getSelectedCells());
+ $selectedCells = $selectedCells[0];
+ if (count($selectedCells) == 2) {
+ list($first, $last) = $selectedCells;
+ } else {
+ $first = $selectedCells[0];
+ $last = $selectedCells[0];
+ }
+
+ list($colFirst, $rwFirst) = PHPExcel_Cell::coordinateFromString($first);
+ $colFirst = PHPExcel_Cell::columnIndexFromString($colFirst) - 1; // base 0 column index
+ --$rwFirst; // base 0 row index
+
+ list($colLast, $rwLast) = PHPExcel_Cell::coordinateFromString($last);
+ $colLast = PHPExcel_Cell::columnIndexFromString($colLast) - 1; // base 0 column index
+ --$rwLast; // base 0 row index
+
+ // make sure we are not out of bounds
+ $colFirst = min($colFirst, 255);
+ $colLast = min($colLast, 255);
+
+ $rwFirst = min($rwFirst, 65535);
+ $rwLast = min($rwLast, 65535);
+
+ $record = 0x001D; // Record identifier
+ $length = 0x000F; // Number of bytes to follow
+
+ $pnn = $this->activePane; // Pane position
+ $rwAct = $rwFirst; // Active row
+ $colAct = $colFirst; // Active column
+ $irefAct = 0; // Active cell ref
+ $cref = 1; // Number of refs
+
+ if (!isset($rwLast)) {
+ $rwLast = $rwFirst; // Last row in reference
+ }
+ if (!isset($colLast)) {
+ $colLast = $colFirst; // Last col in reference
+ }
+
+ // Swap last row/col for first row/col as necessary
+ if ($rwFirst > $rwLast) {
+ list($rwFirst, $rwLast) = array($rwLast, $rwFirst);
+ }
+
+ if ($colFirst > $colLast) {
+ list($colFirst, $colLast) = array($colLast, $colFirst);
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, $irefAct, $cref, $rwFirst, $rwLast, $colFirst, $colLast);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the MERGEDCELLS records for all ranges of merged cells
+ */
+ private function writeMergedCells()
+ {
+ $mergeCells = $this->phpSheet->getMergeCells();
+ $countMergeCells = count($mergeCells);
+
+ if ($countMergeCells == 0) {
+ return;
+ }
+
+ // maximum allowed number of merged cells per record
+ $maxCountMergeCellsPerRecord = 1027;
+
+ // record identifier
+ $record = 0x00E5;
+
+ // counter for total number of merged cells treated so far by the writer
+ $i = 0;
+
+ // counter for number of merged cells written in record currently being written
+ $j = 0;
+
+ // initialize record data
+ $recordData = '';
+
+ // loop through the merged cells
+ foreach ($mergeCells as $mergeCell) {
+ ++$i;
+ ++$j;
+
+ // extract the row and column indexes
+ $range = PHPExcel_Cell::splitRange($mergeCell);
+ list($first, $last) = $range[0];
+ list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first);
+ list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last);
+
+ $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1);
+
+ // flush record if we have reached limit for number of merged cells, or reached final merged cell
+ if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
+ $recordData = pack('v', $j) . $recordData;
+ $length = strlen($recordData);
+ $header = pack('vv', $record, $length);
+ $this->append($header . $recordData);
+
+ // initialize for next record, if any
+ $recordData = '';
+ $j = 0;
+ }
+ }
+ }
+
+ /**
+ * Write SHEETLAYOUT record
+ */
+ private function writeSheetLayout()
+ {
+ if (!$this->phpSheet->isTabColorSet()) {
+ return;
+ }
+
+ $recordData = pack(
+ 'vvVVVvv',
+ 0x0862,
+ 0x0000, // unused
+ 0x00000000, // unused
+ 0x00000000, // unused
+ 0x00000014, // size of record data
+ $this->colors[$this->phpSheet->getTabColor()->getRGB()], // color index
+ 0x0000 // unused
+ );
+
+ $length = strlen($recordData);
+
+ $record = 0x0862; // Record identifier
+ $header = pack('vv', $record, $length);
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Write SHEETPROTECTION
+ */
+ private function writeSheetProtection()
+ {
+ // record identifier
+ $record = 0x0867;
+
+ // prepare options
+ $options = (int) !$this->phpSheet->getProtection()->getObjects()
+ | (int) !$this->phpSheet->getProtection()->getScenarios() << 1
+ | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2
+ | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3
+ | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4
+ | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5
+ | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6
+ | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7
+ | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8
+ | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9
+ | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10
+ | (int) !$this->phpSheet->getProtection()->getSort() << 11
+ | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12
+ | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13
+ | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14 ;
+
+ // record data
+ $recordData = pack(
+ 'vVVCVVvv',
+ 0x0867, // repeated record identifier
+ 0x0000, // not used
+ 0x0000, // not used
+ 0x00, // not used
+ 0x01000200, // unknown data
+ 0xFFFFFFFF, // unknown data
+ $options, // options
+ 0x0000 // not used
+ );
+
+ $length = strlen($recordData);
+ $header = pack('vv', $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Write BIFF record RANGEPROTECTION
+ *
+ * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records
+ * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records
+ */
+ private function writeRangeProtection()
+ {
+ foreach ($this->phpSheet->getProtectedCells() as $range => $password) {
+ // number of ranges, e.g. 'A1:B3 C20:D25'
+ $cellRanges = explode(' ', $range);
+ $cref = count($cellRanges);
+
+ $recordData = pack(
+ 'vvVVvCVvVv',
+ 0x0868,
+ 0x00,
+ 0x0000,
+ 0x0000,
+ 0x02,
+ 0x0,
+ 0x0000,
+ $cref,
+ 0x0000,
+ 0x00
+ );
+
+ foreach ($cellRanges as $cellRange) {
+ $recordData .= $this->writeBIFF8CellRangeAddressFixed($cellRange);
+ }
+
+ // the rgbFeat structure
+ $recordData .= pack(
+ 'VV',
+ 0x0000,
+ hexdec($password)
+ );
+
+ $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData));
+
+ $length = strlen($recordData);
+
+ $record = 0x0868; // Record identifier
+ $header = pack("vv", $record, $length);
+ $this->append($header . $recordData);
+ }
+ }
+
+ /**
+ * Write BIFF record EXTERNCOUNT to indicate the number of external sheet
+ * references in a worksheet.
+ *
+ * Excel only stores references to external sheets that are used in formulas.
+ * For simplicity we store references to all the sheets in the workbook
+ * regardless of whether they are used or not. This reduces the overall
+ * complexity and eliminates the need for a two way dialogue between the formula
+ * parser the worksheet objects.
+ *
+ * @param integer $count The number of external sheet references in this worksheet
+ */
+ private function writeExterncount($count)
+ {
+ $record = 0x0016; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $count);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas. A formula references a sheet name via an index. Since we store a
+ * reference to all of the external worksheets the EXTERNSHEET index is the same
+ * as the worksheet index.
+ *
+ * @param string $sheetname The name of a external worksheet
+ */
+ private function writeExternsheet($sheetname)
+ {
+ $record = 0x0017; // Record identifier
+
+ // References to the current sheet are encoded differently to references to
+ // external sheets.
+ //
+ if ($this->phpSheet->getTitle() == $sheetname) {
+ $sheetname = '';
+ $length = 0x02; // The following 2 bytes
+ $cch = 1; // The following byte
+ $rgch = 0x02; // Self reference
+ } else {
+ $length = 0x02 + strlen($sheetname);
+ $cch = strlen($sheetname);
+ $rgch = 0x03; // Reference to a sheet in the current workbook
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CC", $cch, $rgch);
+ $this->append($header . $data . $sheetname);
+ }
+
+ /**
+ * Writes the Excel BIFF PANE record.
+ * The panes can either be frozen or thawed (unfrozen).
+ * Frozen panes are specified in terms of an integer number of rows and columns.
+ * Thawed panes are specified in terms of Excel's units for rows and columns.
+ */
+ private function writePanes()
+ {
+ $panes = array();
+ if ($freezePane = $this->phpSheet->getFreezePane()) {
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($freezePane);
+ $panes[0] = $row - 1;
+ $panes[1] = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ } else {
+ // thaw panes
+ return;
+ }
+
+ $y = isset($panes[0]) ? $panes[0] : null;
+ $x = isset($panes[1]) ? $panes[1] : null;
+ $rwTop = isset($panes[2]) ? $panes[2] : null;
+ $colLeft = isset($panes[3]) ? $panes[3] : null;
+ if (count($panes) > 4) { // if Active pane was received
+ $pnnAct = $panes[4];
+ } else {
+ $pnnAct = null;
+ }
+ $record = 0x0041; // Record identifier
+ $length = 0x000A; // Number of bytes to follow
+
+ // Code specific to frozen or thawed panes.
+ if ($this->phpSheet->getFreezePane()) {
+ // Set default values for $rwTop and $colLeft
+ if (!isset($rwTop)) {
+ $rwTop = $y;
+ }
+ if (!isset($colLeft)) {
+ $colLeft = $x;
+ }
+ } else {
+ // Set default values for $rwTop and $colLeft
+ if (!isset($rwTop)) {
+ $rwTop = 0;
+ }
+ if (!isset($colLeft)) {
+ $colLeft = 0;
+ }
+
+ // Convert Excel's row and column units to the internal units.
+ // The default row height is 12.75
+ // The default column width is 8.43
+ // The following slope and intersection values were interpolated.
+ //
+ $y = 20*$y + 255;
+ $x = 113.879*$x + 390;
+ }
+
+
+ // Determine which pane should be active. There is also the undocumented
+ // option to override this should it be necessary: may be removed later.
+ //
+ if (!isset($pnnAct)) {
+ if ($x != 0 && $y != 0) {
+ $pnnAct = 0; // Bottom right
+ }
+ if ($x != 0 && $y == 0) {
+ $pnnAct = 1; // Top right
+ }
+ if ($x == 0 && $y != 0) {
+ $pnnAct = 2; // Bottom left
+ }
+ if ($x == 0 && $y == 0) {
+ $pnnAct = 3; // Top left
+ }
+ }
+
+ $this->activePane = $pnnAct; // Used in writeSelection
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the page setup SETUP BIFF record.
+ */
+ private function writeSetup()
+ {
+ $record = 0x00A1; // Record identifier
+ $length = 0x0022; // Number of bytes to follow
+
+ $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size
+
+ $iScale = $this->phpSheet->getPageSetup()->getScale() ?
+ $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor
+
+ $iPageStart = 0x01; // Starting page number
+ $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
+ $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
+ $grbit = 0x00; // Option flags
+ $iRes = 0x0258; // Print resolution
+ $iVRes = 0x0258; // Vertical print resolution
+
+ $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin
+
+ $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin
+ $iCopies = 0x01; // Number of copies
+
+ $fLeftToRight = 0x0; // Print over then down
+
+ // Page orientation
+ $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ?
+ 0x0 : 0x1;
+
+ $fNoPls = 0x0; // Setup not read from printer
+ $fNoColor = 0x0; // Print black and white
+ $fDraft = 0x0; // Print draft quality
+ $fNotes = 0x0; // Print notes
+ $fNoOrient = 0x0; // Orientation not set
+ $fUsePage = 0x0; // Use custom starting page
+
+ $grbit = $fLeftToRight;
+ $grbit |= $fLandscape << 1;
+ $grbit |= $fNoPls << 2;
+ $grbit |= $fNoColor << 3;
+ $grbit |= $fDraft << 4;
+ $grbit |= $fNotes << 5;
+ $grbit |= $fNoOrient << 6;
+ $grbit |= $fUsePage << 7;
+
+ $numHdr = pack("d", $numHdr);
+ $numFtr = pack("d", $numFtr);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $numHdr = strrev($numHdr);
+ $numFtr = strrev($numFtr);
+ }
+
+ $header = pack("vv", $record, $length);
+ $data1 = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
+ $data2 = $numHdr.$numFtr;
+ $data3 = pack("v", $iCopies);
+ $this->append($header . $data1 . $data2 . $data3);
+ }
+
+ /**
+ * Store the header caption BIFF record.
+ */
+ private function writeHeader()
+ {
+ $record = 0x0014; // Record identifier
+
+ /* removing for now
+ // need to fix character count (multibyte!)
+ if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {
+ $str = $this->phpSheet->getHeaderFooter()->getOddHeader(); // header string
+ } else {
+ $str = '';
+ }
+ */
+
+ $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
+ $length = strlen($recordData);
+
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Store the footer caption BIFF record.
+ */
+ private function writeFooter()
+ {
+ $record = 0x0015; // Record identifier
+
+ /* removing for now
+ // need to fix character count (multibyte!)
+ if (strlen($this->phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
+ $str = $this->phpSheet->getHeaderFooter()->getOddFooter();
+ } else {
+ $str = '';
+ }
+ */
+
+ $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
+ $length = strlen($recordData);
+
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Store the horizontal centering HCENTER BIFF record.
+ *
+ * @access private
+ */
+ private function writeHcenter()
+ {
+ $record = 0x0083; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fHCenter);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Store the vertical centering VCENTER BIFF record.
+ */
+ private function writeVcenter()
+ {
+ $record = 0x0084; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fVCenter);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the LEFTMARGIN BIFF record.
+ */
+ private function writeMarginLeft()
+ {
+ $record = 0x0026; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the RIGHTMARGIN BIFF record.
+ */
+ private function writeMarginRight()
+ {
+ $record = 0x0027; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the TOPMARGIN BIFF record.
+ */
+ private function writeMarginTop()
+ {
+ $record = 0x0028; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the BOTTOMMARGIN BIFF record.
+ */
+ private function writeMarginBottom()
+ {
+ $record = 0x0029; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the PRINTHEADERS BIFF record.
+ */
+ private function writePrintHeaders()
+ {
+ $record = 0x002a; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fPrintRwCol = $this->_print_headers; // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fPrintRwCol);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
+ * GRIDSET record.
+ */
+ private function writePrintGridlines()
+ {
+ $record = 0x002b; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fPrintGrid);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the GRIDSET BIFF record. Must be used in conjunction with the
+ * PRINTGRIDLINES record.
+ */
+ private function writeGridset()
+ {
+ $record = 0x0082; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fGridSet);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet.
+ */
+ private function writeAutoFilterInfo()
+ {
+ $record = 0x009D; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $rangeBounds = PHPExcel_Cell::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange());
+ $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0];
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $iNumFilters);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the GUTS BIFF record. This is used to configure the gutter margins
+ * where Excel outline symbols are displayed. The visibility of the gutters is
+ * controlled by a flag in WSBOOL.
+ *
+ * @see writeWsbool()
+ */
+ private function writeGuts()
+ {
+ $record = 0x0080; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $dxRwGut = 0x0000; // Size of row gutter
+ $dxColGut = 0x0000; // Size of col gutter
+
+ // determine maximum row outline level
+ $maxRowOutlineLevel = 0;
+ foreach ($this->phpSheet->getRowDimensions() as $rowDimension) {
+ $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel());
+ }
+
+ $col_level = 0;
+
+ // Calculate the maximum column outline level. The equivalent calculation
+ // for the row outline level is carried out in writeRow().
+ $colcount = count($this->columnInfo);
+ for ($i = 0; $i < $colcount; ++$i) {
+ $col_level = max($this->columnInfo[$i][5], $col_level);
+ }
+
+ // Set the limits for the outline levels (0 <= x <= 7).
+ $col_level = max(0, min($col_level, 7));
+
+ // The displayed level is one greater than the max outline levels
+ if ($maxRowOutlineLevel) {
+ ++$maxRowOutlineLevel;
+ }
+ if ($col_level) {
+ ++$col_level;
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
+ * with the SETUP record.
+ */
+ private function writeWsbool()
+ {
+ $record = 0x0081; // Record identifier
+ $length = 0x0002; // Bytes to follow
+ $grbit = 0x0000;
+
+ // The only option that is of interest is the flag for fit to page. So we
+ // set all the options in one go.
+ //
+ // Set the option flags
+ $grbit |= 0x0001; // Auto page breaks visible
+ if ($this->outlineStyle) {
+ $grbit |= 0x0020; // Auto outline styles
+ }
+ if ($this->phpSheet->getShowSummaryBelow()) {
+ $grbit |= 0x0040; // Outline summary below
+ }
+ if ($this->phpSheet->getShowSummaryRight()) {
+ $grbit |= 0x0080; // Outline summary right
+ }
+ if ($this->phpSheet->getPageSetup()->getFitToPage()) {
+ $grbit |= 0x0100; // Page setup fit to page
+ }
+ if ($this->outlineOn) {
+ $grbit |= 0x0400; // Outline symbols displayed
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records.
+ */
+ private function writeBreaks()
+ {
+ // initialize
+ $vbreaks = array();
+ $hbreaks = array();
+
+ foreach ($this->phpSheet->getBreaks() as $cell => $breakType) {
+ // Fetch coordinates
+ $coordinates = PHPExcel_Cell::coordinateFromString($cell);
+
+ // Decide what to do by the type of break
+ switch ($breakType) {
+ case PHPExcel_Worksheet::BREAK_COLUMN:
+ // Add to list of vertical breaks
+ $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
+ break;
+ case PHPExcel_Worksheet::BREAK_ROW:
+ // Add to list of horizontal breaks
+ $hbreaks[] = $coordinates[1];
+ break;
+ case PHPExcel_Worksheet::BREAK_NONE:
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ //horizontal page breaks
+ if (!empty($hbreaks)) {
+ // Sort and filter array of page breaks
+ sort($hbreaks, SORT_NUMERIC);
+ if ($hbreaks[0] == 0) { // don't use first break if it's 0
+ array_shift($hbreaks);
+ }
+
+ $record = 0x001b; // Record identifier
+ $cbrk = count($hbreaks); // Number of page breaks
+ $length = 2 + 6 * $cbrk; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cbrk);
+
+ // Append each page break
+ foreach ($hbreaks as $hbreak) {
+ $data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
+ }
+
+ $this->append($header . $data);
+ }
+
+ // vertical page breaks
+ if (!empty($vbreaks)) {
+ // 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
+ // It is slightly higher in Excel 97/200, approx. 1026
+ $vbreaks = array_slice($vbreaks, 0, 1000);
+
+ // Sort and filter array of page breaks
+ sort($vbreaks, SORT_NUMERIC);
+ if ($vbreaks[0] == 0) { // don't use first break if it's 0
+ array_shift($vbreaks);
+ }
+
+ $record = 0x001a; // Record identifier
+ $cbrk = count($vbreaks); // Number of page breaks
+ $length = 2 + 6 * $cbrk; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cbrk);
+
+ // Append each page break
+ foreach ($vbreaks as $vbreak) {
+ $data .= pack("vvv", $vbreak, 0x0000, 0xffff);
+ }
+
+ $this->append($header . $data);
+ }
+ }
+
+ /**
+ * Set the Biff PROTECT record to indicate that the worksheet is protected.
+ */
+ private function writeProtect()
+ {
+ // Exit unless sheet protection has been specified
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ $record = 0x0012; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fLock = 1; // Worksheet is protected
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fLock);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write SCENPROTECT
+ */
+ private function writeScenProtect()
+ {
+ // Exit if sheet protection is not active
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ // Exit if scenarios are not protected
+ if (!$this->phpSheet->getProtection()->getScenarios()) {
+ return;
+ }
+
+ $record = 0x00DD; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', 1);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write OBJECTPROTECT
+ */
+ private function writeObjectProtect()
+ {
+ // Exit if sheet protection is not active
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ // Exit if objects are not protected
+ if (!$this->phpSheet->getProtection()->getObjects()) {
+ return;
+ }
+
+ $record = 0x0063; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', 1);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the worksheet PASSWORD record.
+ */
+ private function writePassword()
+ {
+ // Exit unless sheet protection and password have been specified
+ if (!$this->phpSheet->getProtection()->getSheet() || !$this->phpSheet->getProtection()->getPassword()) {
+ return;
+ }
+
+ $record = 0x0013; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $wPassword);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Insert a 24bit bitmap image in a worksheet.
+ *
+ * @access public
+ * @param integer $row The row we are going to insert the bitmap into
+ * @param integer $col The column we are going to insert the bitmap into
+ * @param mixed $bitmap The bitmap filename or GD-image resource
+ * @param integer $x The horizontal position (offset) of the image inside the cell.
+ * @param integer $y The vertical position (offset) of the image inside the cell.
+ * @param float $scale_x The horizontal scale
+ * @param float $scale_y The vertical scale
+ */
+ public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
+ {
+ $bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap));
+ list($width, $height, $size, $data) = $bitmap_array; //$this->processBitmap($bitmap);
+
+ // Scale the frame of the image.
+ $width *= $scale_x;
+ $height *= $scale_y;
+
+ // Calculate the vertices of the image and write the OBJ record
+ $this->positionImage($col, $row, $x, $y, $width, $height);
+
+ // Write the IMDATA record to store the bitmap data
+ $record = 0x007f;
+ $length = 8 + $size;
+ $cf = 0x09;
+ $env = 0x01;
+ $lcb = $size;
+
+ $header = pack("vvvvV", $record, $length, $cf, $env, $lcb);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Calculate the vertices that define the position of the image as required by
+ * the OBJ record.
+ *
+ * +------------+------------+
+ * | A | B |
+ * +-----+------------+------------+
+ * | |(x1,y1) | |
+ * | 1 |(A1)._______|______ |
+ * | | | | |
+ * | | | | |
+ * +-----+----| BITMAP |-----+
+ * | | | | |
+ * | 2 | |______________. |
+ * | | | (B2)|
+ * | | | (x2,y2)|
+ * +---- +------------+------------+
+ *
+ * Example of a bitmap that covers some of the area from cell A1 to cell B2.
+ *
+ * Based on the width and height of the bitmap we need to calculate 8 vars:
+ * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
+ * The width and height of the cells are also variable and have to be taken into
+ * account.
+ * The values of $col_start and $row_start are passed in from the calling
+ * function. The values of $col_end and $row_end are calculated by subtracting
+ * the width and height of the bitmap from the width and height of the
+ * underlying cells.
+ * The vertices are expressed as a percentage of the underlying cell width as
+ * follows (rhs values are in pixels):
+ *
+ * x1 = X / W *1024
+ * y1 = Y / H *256
+ * x2 = (X-1) / W *1024
+ * y2 = (Y-1) / H *256
+ *
+ * Where: X is distance from the left side of the underlying cell
+ * Y is distance from the top of the underlying cell
+ * W is the width of the cell
+ * H is the height of the cell
+ * The SDK incorrectly states that the height should be expressed as a
+ * percentage of 1024.
+ *
+ * @access private
+ * @param integer $col_start Col containing upper left corner of object
+ * @param integer $row_start Row containing top left corner of object
+ * @param integer $x1 Distance to left side of object
+ * @param integer $y1 Distance to top of object
+ * @param integer $width Width of image frame
+ * @param integer $height Height of image frame
+ */
+ public function positionImage($col_start, $row_start, $x1, $y1, $width, $height)
+ {
+ // Initialise end cell to the same as the start cell
+ $col_end = $col_start; // Col containing lower right corner of object
+ $row_end = $row_start; // Row containing bottom right corner of object
+
+ // Zero the specified offset if greater than the cell dimensions
+ if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
+ $x1 = 0;
+ }
+ if ($y1 >= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1)) {
+ $y1 = 0;
+ }
+
+ $width = $width + $x1 -1;
+ $height = $height + $y1 -1;
+
+ // Subtract the underlying cell widths to find the end cell of the image
+ while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
+ $width -= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
+ ++$col_end;
+ }
+
+ // Subtract the underlying cell heights to find the end cell of the image
+ while ($height >= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1)) {
+ $height -= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1);
+ ++$row_end;
+ }
+
+ // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
+ // with zero eight or width.
+ //
+ if (PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) {
+ return;
+ }
+
+ // Convert the pixel values to the percentage value expected by Excel
+ $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
+ $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256;
+ $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
+ $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object
+
+ $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2);
+ }
+
+ /**
+ * Store the OBJ record that precedes an IMDATA record. This could be generalise
+ * to support other Excel objects.
+ *
+ * @param integer $colL Column containing upper left corner of object
+ * @param integer $dxL Distance from left side of cell
+ * @param integer $rwT Row containing top left corner of object
+ * @param integer $dyT Distance from top of cell
+ * @param integer $colR Column containing lower right corner of object
+ * @param integer $dxR Distance from right of cell
+ * @param integer $rwB Row containing bottom right corner of object
+ * @param integer $dyB Distance from bottom of cell
+ */
+ private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB)
+ {
+ $record = 0x005d; // Record identifier
+ $length = 0x003c; // Bytes to follow
+
+ $cObj = 0x0001; // Count of objects in file (set to 1)
+ $OT = 0x0008; // Object type. 8 = Picture
+ $id = 0x0001; // Object ID
+ $grbit = 0x0614; // Option flags
+
+ $cbMacro = 0x0000; // Length of FMLA structure
+ $Reserved1 = 0x0000; // Reserved
+ $Reserved2 = 0x0000; // Reserved
+
+ $icvBack = 0x09; // Background colour
+ $icvFore = 0x09; // Foreground colour
+ $fls = 0x00; // Fill pattern
+ $fAuto = 0x00; // Automatic fill
+ $icv = 0x08; // Line colour
+ $lns = 0xff; // Line style
+ $lnw = 0x01; // Line weight
+ $fAutoB = 0x00; // Automatic border
+ $frs = 0x0000; // Frame style
+ $cf = 0x0009; // Image format, 9 = bitmap
+ $Reserved3 = 0x0000; // Reserved
+ $cbPictFmla = 0x0000; // Length of FMLA structure
+ $Reserved4 = 0x0000; // Reserved
+ $grbit2 = 0x0001; // Option flags
+ $Reserved5 = 0x0000; // Reserved
+
+
+ $header = pack("vv", $record, $length);
+ $data = pack("V", $cObj);
+ $data .= pack("v", $OT);
+ $data .= pack("v", $id);
+ $data .= pack("v", $grbit);
+ $data .= pack("v", $colL);
+ $data .= pack("v", $dxL);
+ $data .= pack("v", $rwT);
+ $data .= pack("v", $dyT);
+ $data .= pack("v", $colR);
+ $data .= pack("v", $dxR);
+ $data .= pack("v", $rwB);
+ $data .= pack("v", $dyB);
+ $data .= pack("v", $cbMacro);
+ $data .= pack("V", $Reserved1);
+ $data .= pack("v", $Reserved2);
+ $data .= pack("C", $icvBack);
+ $data .= pack("C", $icvFore);
+ $data .= pack("C", $fls);
+ $data .= pack("C", $fAuto);
+ $data .= pack("C", $icv);
+ $data .= pack("C", $lns);
+ $data .= pack("C", $lnw);
+ $data .= pack("C", $fAutoB);
+ $data .= pack("v", $frs);
+ $data .= pack("V", $cf);
+ $data .= pack("v", $Reserved3);
+ $data .= pack("v", $cbPictFmla);
+ $data .= pack("v", $Reserved4);
+ $data .= pack("v", $grbit2);
+ $data .= pack("V", $Reserved5);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Convert a GD-image into the internal format.
+ *
+ * @access private
+ * @param resource $image The image to process
+ * @return array Array with data and properties of the bitmap
+ */
+ public function processBitmapGd($image)
+ {
+ $width = imagesx($image);
+ $height = imagesy($image);
+
+ $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
+ for ($j=$height; $j--;) {
+ for ($i=0; $i < $width; ++$i) {
+ $color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
+ foreach (array("red", "green", "blue") as $key) {
+ $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127);
+ }
+ $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
+ }
+ if (3*$width % 4) {
+ $data .= str_repeat("\x00", 4 - 3*$width % 4);
+ }
+ }
+
+ return array($width, $height, strlen($data), $data);
+ }
+
+ /**
+ * Convert a 24 bit bitmap into the modified internal format used by Windows.
+ * This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the
+ * MSDN library.
+ *
+ * @access private
+ * @param string $bitmap The bitmap to process
+ * @return array Array with data and properties of the bitmap
+ */
+ public function processBitmap($bitmap)
+ {
+ // Open file.
+ $bmp_fd = @fopen($bitmap, "rb");
+ if (!$bmp_fd) {
+ throw new PHPExcel_Writer_Exception("Couldn't import $bitmap");
+ }
+
+ // Slurp the file into a string.
+ $data = fread($bmp_fd, filesize($bitmap));
+
+ // Check that the file is big enough to be a bitmap.
+ if (strlen($data) <= 0x36) {
+ throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n");
+ }
+
+ // The first 2 bytes are used to identify the bitmap.
+ $identity = unpack("A2ident", $data);
+ if ($identity['ident'] != "BM") {
+ throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n");
+ }
+
+ // Remove bitmap data: ID.
+ $data = substr($data, 2);
+
+ // Read and remove the bitmap size. This is more reliable than reading
+ // the data size at offset 0x22.
+ //
+ $size_array = unpack("Vsa", substr($data, 0, 4));
+ $size = $size_array['sa'];
+ $data = substr($data, 4);
+ $size -= 0x36; // Subtract size of bitmap header.
+ $size += 0x0C; // Add size of BIFF header.
+
+ // Remove bitmap data: reserved, offset, header length.
+ $data = substr($data, 12);
+
+ // Read and remove the bitmap width and height. Verify the sizes.
+ $width_and_height = unpack("V2", substr($data, 0, 8));
+ $width = $width_and_height[1];
+ $height = $width_and_height[2];
+ $data = substr($data, 8);
+ if ($width > 0xFFFF) {
+ throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n");
+ }
+ if ($height > 0xFFFF) {
+ throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n");
+ }
+
+ // Read and remove the bitmap planes and bpp data. Verify them.
+ $planes_and_bitcount = unpack("v2", substr($data, 0, 4));
+ $data = substr($data, 4);
+ if ($planes_and_bitcount[2] != 24) { // Bitcount
+ throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n");
+ }
+ if ($planes_and_bitcount[1] != 1) {
+ throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n");
+ }
+
+ // Read and remove the bitmap compression. Verify compression.
+ $compression = unpack("Vcomp", substr($data, 0, 4));
+ $data = substr($data, 4);
+
+ //$compression = 0;
+ if ($compression['comp'] != 0) {
+ throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n");
+ }
+
+ // Remove bitmap data: data size, hres, vres, colours, imp. colours.
+ $data = substr($data, 20);
+
+ // Add the BITMAPCOREHEADER data
+ $header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
+ $data = $header . $data;
+
+ return (array($width, $height, $size, $data));
+ }
+
+ /**
+ * Store the window zoom factor. This should be a reduced fraction but for
+ * simplicity we will store all fractions with a numerator of 100.
+ */
+ private function writeZoom()
+ {
+ // If scale is 100 we don't need to write a record
+ if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
+ return;
+ }
+
+ $record = 0x00A0; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", $this->phpSheet->getSheetView()->getZoomScale(), 100);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Get Escher object
+ *
+ * @return PHPExcel_Shared_Escher
+ */
+ public function getEscher()
+ {
+ return $this->escher;
+ }
+
+ /**
+ * Set Escher object
+ *
+ * @param PHPExcel_Shared_Escher $pValue
+ */
+ public function setEscher(PHPExcel_Shared_Escher $pValue = null)
+ {
+ $this->escher = $pValue;
+ }
+
+ /**
+ * Write MSODRAWING record
+ */
+ private function writeMsoDrawing()
+ {
+ // write the Escher stream if necessary
+ if (isset($this->escher)) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($this->escher);
+ $data = $writer->close();
+ $spOffsets = $writer->getSpOffsets();
+ $spTypes = $writer->getSpTypes();
+ // write the neccesary MSODRAWING, OBJ records
+
+ // split the Escher stream
+ $spOffsets[0] = 0;
+ $nm = count($spOffsets) - 1; // number of shapes excluding first shape
+ for ($i = 1; $i <= $nm; ++$i) {
+ // MSODRAWING record
+ $record = 0x00EC; // Record identifier
+
+ // chunk of Escher stream for one shape
+ $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]);
+
+ $length = strlen($dataChunk);
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $dataChunk);
+
+ // OBJ record
+ $record = 0x005D; // record identifier
+ $objData = '';
+
+ // ftCmo
+ if ($spTypes[$i] == 0x00C9) {
+ // Add ftCmo (common object data) subobject
+ $objData .=
+ pack(
+ 'vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0014, // object type, 0x0014 = filter
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x2101, // option flags, 0x2001 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
+ );
+
+ // Add ftSbs Scroll bar subobject
+ $objData .= pack('vv', 0x00C, 0x0014);
+ $objData .= pack('H*', '0000000000000000640001000A00000010000100');
+ // Add ftLbsData (List box data) subobject
+ $objData .= pack('vv', 0x0013, 0x1FEE);
+ $objData .= pack('H*', '00000000010001030000020008005700');
+ } else {
+ // Add ftCmo (common object data) subobject
+ $objData .=
+ pack(
+ 'vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0008, // object type, 0x0008 = picture
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x6011, // option flags, 0x6011 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
+ );
+ }
+
+ // ftEnd
+ $objData .=
+ pack(
+ 'vv',
+ 0x0000, // 0x0000 = ftEnd
+ 0x0000 // length of ftEnd data
+ );
+
+ $length = strlen($objData);
+ $header = pack('vv', $record, $length);
+ $this->append($header . $objData);
+ }
+ }
+ }
+
+ /**
+ * Store the DATAVALIDATIONS and DATAVALIDATION records.
+ */
+ private function writeDataValidity()
+ {
+ // Datavalidation collection
+ $dataValidationCollection = $this->phpSheet->getDataValidationCollection();
+
+ // Write data validations?
+ if (!empty($dataValidationCollection)) {
+ // DATAVALIDATIONS record
+ $record = 0x01B2; // Record identifier
+ $length = 0x0012; // Bytes to follow
+
+ $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
+ $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
+ $verPos = 0x00000000; // Vertical position of prompt box, if fixed position
+ $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection));
+ $this->append($header.$data);
+
+ // DATAVALIDATION records
+ $record = 0x01BE; // Record identifier
+
+ foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) {
+ // initialize record data
+ $data = '';
+
+ // options
+ $options = 0x00000000;
+
+ // data type
+ $type = $dataValidation->getType();
+ switch ($type) {
+ case PHPExcel_Cell_DataValidation::TYPE_NONE:
+ $type = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_WHOLE:
+ $type = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DECIMAL:
+ $type = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_LIST:
+ $type = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DATE:
+ $type = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TIME:
+ $type = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH:
+ $type = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_CUSTOM:
+ $type = 0x07;
+ break;
+ }
+ $options |= $type << 0;
+
+ // error style
+ $errorStyle = $dataValidation->getType();
+ switch ($errorStyle) {
+ case PHPExcel_Cell_DataValidation::STYLE_STOP:
+ $errorStyle = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_WARNING:
+ $errorStyle = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_INFORMATION:
+ $errorStyle = 0x02;
+ break;
+ }
+ $options |= $errorStyle << 4;
+
+ // explicit formula?
+ if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) {
+ $options |= 0x01 << 7;
+ }
+
+ // empty cells allowed
+ $options |= $dataValidation->getAllowBlank() << 8;
+
+ // show drop down
+ $options |= (!$dataValidation->getShowDropDown()) << 9;
+
+ // show input message
+ $options |= $dataValidation->getShowInputMessage() << 18;
+
+ // show error message
+ $options |= $dataValidation->getShowErrorMessage() << 19;
+
+ // condition operator
+ $operator = $dataValidation->getOperator();
+ switch ($operator) {
+ case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN:
+ $operator = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN:
+ $operator = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL:
+ $operator = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL:
+ $operator = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN:
+ $operator = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN:
+ $operator = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL:
+ $operator = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL:
+ $operator = 0x07;
+ break;
+ }
+ $options |= $operator << 20;
+
+ $data = pack('V', $options);
+
+ // prompt title
+ $promptTitle = $dataValidation->getPromptTitle() !== '' ?
+ $dataValidation->getPromptTitle() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($promptTitle);
+
+ // error title
+ $errorTitle = $dataValidation->getErrorTitle() !== '' ?
+ $dataValidation->getErrorTitle() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($errorTitle);
+
+ // prompt text
+ $prompt = $dataValidation->getPrompt() !== '' ?
+ $dataValidation->getPrompt() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($prompt);
+
+ // error text
+ $error = $dataValidation->getError() !== '' ?
+ $dataValidation->getError() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($error);
+
+ // formula 1
+ try {
+ $formula1 = $dataValidation->getFormula1();
+ if ($type == 0x03) { // list type
+ $formula1 = str_replace(',', chr(0), $formula1);
+ }
+ $this->parser->parse($formula1);
+ $formula1 = $this->parser->toReversePolish();
+ $sz1 = strlen($formula1);
+ } catch (PHPExcel_Exception $e) {
+ $sz1 = 0;
+ $formula1 = '';
+ }
+ $data .= pack('vv', $sz1, 0x0000);
+ $data .= $formula1;
+
+ // formula 2
+ try {
+ $formula2 = $dataValidation->getFormula2();
+ if ($formula2 === '') {
+ throw new PHPExcel_Writer_Exception('No formula2');
+ }
+ $this->parser->parse($formula2);
+ $formula2 = $this->parser->toReversePolish();
+ $sz2 = strlen($formula2);
+ } catch (PHPExcel_Exception $e) {
+ $sz2 = 0;
+ $formula2 = '';
+ }
+ $data .= pack('vv', $sz2, 0x0000);
+ $data .= $formula2;
+
+ // cell range address list
+ $data .= pack('v', 0x0001);
+ $data .= $this->writeBIFF8CellRangeAddressFixed($cellCoordinate);
+
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $data);
+ }
+ }
+ }
+
+ /**
+ * Map Error code
+ *
+ * @param string $errorCode
+ * @return int
+ */
+ private static function mapErrorCode($errorCode)
+ {
+ switch ($errorCode) {
+ case '#NULL!':
+ return 0x00;
+ case '#DIV/0!':
+ return 0x07;
+ case '#VALUE!':
+ return 0x0F;
+ case '#REF!':
+ return 0x17;
+ case '#NAME?':
+ return 0x1D;
+ case '#NUM!':
+ return 0x24;
+ case '#N/A':
+ return 0x2A;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Write PLV Record
+ */
+ private function writePageLayoutView()
+ {
+ $record = 0x088B; // Record identifier
+ $length = 0x0010; // Bytes to follow
+
+ $rt = 0x088B; // 2
+ $grbitFrt = 0x0000; // 2
+ $reserved = 0x0000000000000000; // 8
+ $wScalvePLV = $this->phpSheet->getSheetView()->getZoomScale(); // 2
+
+ // The options flags that comprise $grbit
+ if ($this->phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) {
+ $fPageLayoutView = 1;
+ } else {
+ $fPageLayoutView = 0;
+ }
+ $fRulerVisible = 0;
+ $fWhitespaceHidden = 0;
+
+ $grbit = $fPageLayoutView; // 2
+ $grbit |= $fRulerVisible << 1;
+ $grbit |= $fWhitespaceHidden << 3;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write CFRule Record
+ * @param PHPExcel_Style_Conditional $conditional
+ */
+ private function writeCFRule(PHPExcel_Style_Conditional $conditional)
+ {
+ $record = 0x01B1; // Record identifier
+
+ // $type : Type of the CF
+ // $operatorType : Comparison operator
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
+ $type = 0x02;
+ $operatorType = 0x00;
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ $type = 0x01;
+
+ switch ($conditional->getOperatorType()) {
+ case PHPExcel_Style_Conditional::OPERATOR_NONE:
+ $operatorType = 0x00;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_EQUAL:
+ $operatorType = 0x03;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN:
+ $operatorType = 0x05;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL:
+ $operatorType = 0x07;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN:
+ $operatorType = 0x06;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL:
+ $operatorType = 0x08;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL:
+ $operatorType = 0x04;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_BETWEEN:
+ $operatorType = 0x01;
+ break;
+ // not OPERATOR_NOTBETWEEN 0x02
+ }
+ }
+
+ // $szValue1 : size of the formula data for first value or formula
+ // $szValue2 : size of the formula data for second value or formula
+ $arrConditions = $conditional->getConditions();
+ $numConditions = sizeof($arrConditions);
+ if ($numConditions == 1) {
+ $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
+ $szValue2 = 0x0000;
+ $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
+ $operand2 = null;
+ } elseif ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
+ $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
+ $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
+ $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
+ $operand2 = pack('Cv', 0x1E, $arrConditions[1]);
+ } else {
+ $szValue1 = 0x0000;
+ $szValue2 = 0x0000;
+ $operand1 = null;
+ $operand2 = null;
+ }
+
+ // $flags : Option flags
+ // Alignment
+ $bAlignHz = ($conditional->getStyle()->getAlignment()->getHorizontal() == null ? 1 : 0);
+ $bAlignVt = ($conditional->getStyle()->getAlignment()->getVertical() == null ? 1 : 0);
+ $bAlignWrapTx = ($conditional->getStyle()->getAlignment()->getWrapText() == false ? 1 : 0);
+ $bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0);
+ $bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0);
+ $bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0);
+ if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) {
+ $bFormatAlign = 1;
+ } else {
+ $bFormatAlign = 0;
+ }
+ // Protection
+ $bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0);
+ $bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0);
+ if ($bProtLocked == 0 || $bProtHidden == 0) {
+ $bFormatProt = 1;
+ } else {
+ $bFormatProt = 0;
+ }
+ // Border
+ $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) {
+ $bFormatBorder = 1;
+ } else {
+ $bFormatBorder = 0;
+ }
+ // Pattern
+ $bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1);
+ $bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1);
+ $bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1);
+ if ($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0) {
+ $bFormatFill = 1;
+ } else {
+ $bFormatFill = 0;
+ }
+ // Font
+ if ($conditional->getStyle()->getFont()->getName() != null
+ || $conditional->getStyle()->getFont()->getSize() != null
+ || $conditional->getStyle()->getFont()->getBold() != null
+ || $conditional->getStyle()->getFont()->getItalic() != null
+ || $conditional->getStyle()->getFont()->getSuperScript() != null
+ || $conditional->getStyle()->getFont()->getSubScript() != null
+ || $conditional->getStyle()->getFont()->getUnderline() != null
+ || $conditional->getStyle()->getFont()->getStrikethrough() != null
+ || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) {
+ $bFormatFont = 1;
+ } else {
+ $bFormatFont = 0;
+ }
+ // Alignment
+ $flags = 0;
+ $flags |= (1 == $bAlignHz ? 0x00000001 : 0);
+ $flags |= (1 == $bAlignVt ? 0x00000002 : 0);
+ $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0);
+ $flags |= (1 == $bTxRotation ? 0x00000008 : 0);
+ // Justify last line flag
+ $flags |= (1 == 1 ? 0x00000010 : 0);
+ $flags |= (1 == $bIndent ? 0x00000020 : 0);
+ $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0);
+ // Default
+ $flags |= (1 == 1 ? 0x00000080 : 0);
+ // Protection
+ $flags |= (1 == $bProtLocked ? 0x00000100 : 0);
+ $flags |= (1 == $bProtHidden ? 0x00000200 : 0);
+ // Border
+ $flags |= (1 == $bBorderLeft ? 0x00000400 : 0);
+ $flags |= (1 == $bBorderRight ? 0x00000800 : 0);
+ $flags |= (1 == $bBorderTop ? 0x00001000 : 0);
+ $flags |= (1 == $bBorderBottom ? 0x00002000 : 0);
+ $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border
+ $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border
+ // Pattern
+ $flags |= (1 == $bFillStyle ? 0x00010000 : 0);
+ $flags |= (1 == $bFillColor ? 0x00020000 : 0);
+ $flags |= (1 == $bFillColorBg ? 0x00040000 : 0);
+ $flags |= (1 == 1 ? 0x00380000 : 0);
+ // Font
+ $flags |= (1 == $bFormatFont ? 0x04000000 : 0);
+ // Alignment:
+ $flags |= (1 == $bFormatAlign ? 0x08000000 : 0);
+ // Border
+ $flags |= (1 == $bFormatBorder ? 0x10000000 : 0);
+ // Pattern
+ $flags |= (1 == $bFormatFill ? 0x20000000 : 0);
+ // Protection
+ $flags |= (1 == $bFormatProt ? 0x40000000 : 0);
+ // Text direction
+ $flags |= (1 == 0 ? 0x80000000 : 0);
+
+ // Data Blocks
+ if ($bFormatFont == 1) {
+ // Font Name
+ if ($conditional->getStyle()->getFont()->getName() == null) {
+ $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
+ $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
+ } else {
+ $dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
+ }
+ // Font Size
+ if ($conditional->getStyle()->getFont()->getSize() == null) {
+ $dataBlockFont .= pack('V', 20 * 11);
+ } else {
+ $dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize());
+ }
+ // Font Options
+ $dataBlockFont .= pack('V', 0);
+ // Font weight
+ if ($conditional->getStyle()->getFont()->getBold() == true) {
+ $dataBlockFont .= pack('v', 0x02BC);
+ } else {
+ $dataBlockFont .= pack('v', 0x0190);
+ }
+ // Escapement type
+ if ($conditional->getStyle()->getFont()->getSubScript() == true) {
+ $dataBlockFont .= pack('v', 0x02);
+ $fontEscapement = 0;
+ } elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) {
+ $dataBlockFont .= pack('v', 0x01);
+ $fontEscapement = 0;
+ } else {
+ $dataBlockFont .= pack('v', 0x00);
+ $fontEscapement = 1;
+ }
+ // Underline type
+ switch ($conditional->getStyle()->getFont()->getUnderline()) {
+ case PHPExcel_Style_Font::UNDERLINE_NONE:
+ $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLE:
+ $dataBlockFont .= pack('C', 0x02);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x22);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLE:
+ $dataBlockFont .= pack('C', 0x01);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x21);
+ $fontUnderline = 0;
+ break;
+ default: $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 1;
+ break;
+ }
+ // Not used (3)
+ $dataBlockFont .= pack('vC', 0x0000, 0x00);
+ // Font color index
+ switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) {
+ case '000000':
+ $colorIdx = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdx = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdx = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdx = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdx = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x0F;
+ break;
+ case '800000':
+ $colorIdx = 0x10;
+ break;
+ case '008000':
+ $colorIdx = 0x11;
+ break;
+ case '000080':
+ $colorIdx = 0x12;
+ break;
+ case '808000':
+ $colorIdx = 0x13;
+ break;
+ case '800080':
+ $colorIdx = 0x14;
+ break;
+ case '008080':
+ $colorIdx = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdx = 0x16;
+ break;
+ case '808080':
+ $colorIdx = 0x17;
+ break;
+ case '9999FF':
+ $colorIdx = 0x18;
+ break;
+ case '993366':
+ $colorIdx = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdx = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x1B;
+ break;
+ case '660066':
+ $colorIdx = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdx = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdx = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdx = 0x1F;
+ break;
+ case '000080':
+ $colorIdx = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x23;
+ break;
+ case '800080':
+ $colorIdx = 0x24;
+ break;
+ case '800000':
+ $colorIdx = 0x25;
+ break;
+ case '008080':
+ $colorIdx = 0x26;
+ break;
+ case '0000FF':
+ $colorIdx = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdx = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdx = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdx = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdx = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdx = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdx = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdx = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdx = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdx = 0x31;
+ break;
+ case '99CC00':
+ $colorIdx = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdx = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdx = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdx = 0x35;
+ break;
+ case '666699':
+ $colorIdx = 0x36;
+ break;
+ case '969696':
+ $colorIdx = 0x37;
+ break;
+ case '003366':
+ $colorIdx = 0x38;
+ break;
+ case '339966':
+ $colorIdx = 0x39;
+ break;
+ case '003300':
+ $colorIdx = 0x3A;
+ break;
+ case '333300':
+ $colorIdx = 0x3B;
+ break;
+ case '993300':
+ $colorIdx = 0x3C;
+ break;
+ case '993366':
+ $colorIdx = 0x3D;
+ break;
+ case '333399':
+ $colorIdx = 0x3E;
+ break;
+ case '333333':
+ $colorIdx = 0x3F;
+ break;
+ default:
+ $colorIdx = 0x00;
+ break;
+ }
+ $dataBlockFont .= pack('V', $colorIdx);
+ // Not used (4)
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Options flags for modified font attributes
+ $optionsFlags = 0;
+ $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0);
+ $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000008 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000010 : 0);
+ $optionsFlags |= (1 == 0 ? 0x00000020 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000080 : 0);
+ $dataBlockFont .= pack('V', $optionsFlags);
+ // Escapement type
+ $dataBlockFont .= pack('V', $fontEscapement);
+ // Underline type
+ $dataBlockFont .= pack('V', $fontUnderline);
+ // Always
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Always
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Not used (8)
+ $dataBlockFont .= pack('VV', 0x00000000, 0x00000000);
+ // Always
+ $dataBlockFont .= pack('v', 0x0001);
+ }
+ if ($bFormatAlign == 1) {
+ $blockAlign = 0;
+ // Alignment and text break
+ switch ($conditional->getStyle()->getAlignment()->getHorizontal()) {
+ case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
+ $blockAlign = 0;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_LEFT:
+ $blockAlign = 1;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT:
+ $blockAlign = 3;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER:
+ $blockAlign = 2;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
+ $blockAlign = 6;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY:
+ $blockAlign = 5;
+ break;
+ }
+ if ($conditional->getStyle()->getAlignment()->getWrapText() == true) {
+ $blockAlign |= 1 << 3;
+ } else {
+ $blockAlign |= 0 << 3;
+ }
+ switch ($conditional->getStyle()->getAlignment()->getVertical()) {
+ case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
+ $blockAlign = 2 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_TOP:
+ $blockAlign = 0 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_CENTER:
+ $blockAlign = 1 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
+ $blockAlign = 3 << 4;
+ break;
+ }
+ $blockAlign |= 0 << 7;
+
+ // Text rotation angle
+ $blockRotation = $conditional->getStyle()->getAlignment()->getTextRotation();
+
+ // Indentation
+ $blockIndent = $conditional->getStyle()->getAlignment()->getIndent();
+ if ($conditional->getStyle()->getAlignment()->getShrinkToFit() == true) {
+ $blockIndent |= 1 << 4;
+ } else {
+ $blockIndent |= 0 << 4;
+ }
+ $blockIndent |= 0 << 6;
+
+ // Relative indentation
+ $blockIndentRelative = 255;
+
+ $dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000);
+ }
+ if ($bFormatBorder == 1) {
+ $blockLineStyle = 0;
+ switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 4;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 8;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 12;
+ break;
+ }
+ //@todo writeCFRule() => $blockLineStyle => Index Color for left line
+ //@todo writeCFRule() => $blockLineStyle => Index Color for right line
+ //@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off
+ //@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off
+ $blockColor = 0;
+ //@todo writeCFRule() => $blockColor => Index Color for top line
+ //@todo writeCFRule() => $blockColor => Index Color for bottom line
+ //@todo writeCFRule() => $blockColor => Index Color for diagonal line
+ switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockColor |= 0x00 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockColor |= 0x01 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockColor |= 0x02 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockColor |= 0x03 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockColor |= 0x04 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockColor |= 0x05 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockColor |= 0x06 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockColor |= 0x07 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockColor |= 0x08 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockColor |= 0x09 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockColor |= 0x0A << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockColor |= 0x0B << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockColor |= 0x0C << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockColor |= 0x0D << 21;
+ break;
+ }
+ $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor);
+ }
+ if ($bFormatFill == 1) {
+ // Fill Patern Style
+ $blockFillPatternStyle = 0;
+ switch ($conditional->getStyle()->getFill()->getFillType()) {
+ case PHPExcel_Style_Fill::FILL_NONE:
+ $blockFillPatternStyle = 0x00;
+ break;
+ case PHPExcel_Style_Fill::FILL_SOLID:
+ $blockFillPatternStyle = 0x01;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY:
+ $blockFillPatternStyle = 0x02;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY:
+ $blockFillPatternStyle = 0x03;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY:
+ $blockFillPatternStyle = 0x04;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL:
+ $blockFillPatternStyle = 0x05;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL:
+ $blockFillPatternStyle = 0x06;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN:
+ $blockFillPatternStyle = 0x07;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP:
+ $blockFillPatternStyle = 0x08;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID:
+ $blockFillPatternStyle = 0x09;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS:
+ $blockFillPatternStyle = 0x0A;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL:
+ $blockFillPatternStyle = 0x0B;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL:
+ $blockFillPatternStyle = 0x0C;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN:
+ $blockFillPatternStyle = 0x0D;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP:
+ $blockFillPatternStyle = 0x0E;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID:
+ $blockFillPatternStyle = 0x0F;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS:
+ $blockFillPatternStyle = 0x10;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125:
+ $blockFillPatternStyle = 0x11;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625:
+ $blockFillPatternStyle = 0x12;
+ break;
+ case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ case PHPExcel_Style_Fill::FILL_GRADIENT_PATH:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ default:
+ $blockFillPatternStyle = 0x00;
+ break;
+ }
+ // Color
+ switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) {
+ case '000000':
+ $colorIdxBg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxBg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxBg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxBg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxBg = 0x10;
+ break;
+ case '008000':
+ $colorIdxBg = 0x11;
+ break;
+ case '000080':
+ $colorIdxBg = 0x12;
+ break;
+ case '808000':
+ $colorIdxBg = 0x13;
+ break;
+ case '800080':
+ $colorIdxBg = 0x14;
+ break;
+ case '008080':
+ $colorIdxBg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxBg = 0x16;
+ break;
+ case '808080':
+ $colorIdxBg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxBg = 0x18;
+ break;
+ case '993366':
+ $colorIdxBg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxBg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxBg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxBg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxBg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxBg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxBg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x23;
+ break;
+ case '800080':
+ $colorIdxBg = 0x24;
+ break;
+ case '800000':
+ $colorIdxBg = 0x25;
+ break;
+ case '008080':
+ $colorIdxBg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxBg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxBg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxBg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxBg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxBg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxBg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxBg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxBg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxBg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxBg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxBg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxBg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxBg = 0x35;
+ break;
+ case '666699':
+ $colorIdxBg = 0x36;
+ break;
+ case '969696':
+ $colorIdxBg = 0x37;
+ break;
+ case '003366':
+ $colorIdxBg = 0x38;
+ break;
+ case '339966':
+ $colorIdxBg = 0x39;
+ break;
+ case '003300':
+ $colorIdxBg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxBg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxBg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxBg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxBg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxBg = 0x3F;
+ break;
+ default:
+ $colorIdxBg = 0x41;
+ break;
+ }
+ // Fg Color
+ switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) {
+ case '000000':
+ $colorIdxFg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxFg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxFg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxFg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxFg = 0x10;
+ break;
+ case '008000':
+ $colorIdxFg = 0x11;
+ break;
+ case '000080':
+ $colorIdxFg = 0x12;
+ break;
+ case '808000':
+ $colorIdxFg = 0x13;
+ break;
+ case '800080':
+ $colorIdxFg = 0x14;
+ break;
+ case '008080':
+ $colorIdxFg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxFg = 0x16;
+ break;
+ case '808080':
+ $colorIdxFg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxFg = 0x18;
+ break;
+ case '993366':
+ $colorIdxFg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxFg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxFg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxFg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxFg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxFg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxFg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x23;
+ break;
+ case '800080':
+ $colorIdxFg = 0x24;
+ break;
+ case '800000':
+ $colorIdxFg = 0x25;
+ break;
+ case '008080':
+ $colorIdxFg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxFg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxFg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxFg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxFg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxFg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxFg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxFg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxFg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxFg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxFg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxFg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxFg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxFg = 0x35;
+ break;
+ case '666699':
+ $colorIdxFg = 0x36;
+ break;
+ case '969696':
+ $colorIdxFg = 0x37;
+ break;
+ case '003366':
+ $colorIdxFg = 0x38;
+ break;
+ case '339966':
+ $colorIdxFg = 0x39;
+ break;
+ case '003300':
+ $colorIdxFg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxFg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxFg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxFg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxFg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxFg = 0x3F;
+ break;
+ default:
+ $colorIdxFg = 0x40;
+ break;
+ }
+ $dataBlockFill = pack('v', $blockFillPatternStyle);
+ $dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7));
+ }
+ if ($bFormatProt == 1) {
+ $dataBlockProtection = 0;
+ if ($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
+ $dataBlockProtection = 1;
+ }
+ if ($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
+ $dataBlockProtection = 1 << 1;
+ }
+ }
+
+ $data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000);
+ if ($bFormatFont == 1) { // Block Formatting : OK
+ $data .= $dataBlockFont;
+ }
+ if ($bFormatAlign == 1) {
+ $data .= $dataBlockAlign;
+ }
+ if ($bFormatBorder == 1) {
+ $data .= $dataBlockBorder;
+ }
+ if ($bFormatFill == 1) { // Block Formatting : OK
+ $data .= $dataBlockFill;
+ }
+ if ($bFormatProt == 1) {
+ $data .= $dataBlockProtection;
+ }
+ if (!is_null($operand1)) {
+ $data .= $operand1;
+ }
+ if (!is_null($operand2)) {
+ $data .= $operand2;
+ }
+ $header = pack('vv', $record, strlen($data));
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write CFHeader record
+ */
+ private function writeCFHeader()
+ {
+ $record = 0x01B0; // Record identifier
+ $length = 0x0016; // Bytes to follow
+
+ $numColumnMin = null;
+ $numColumnMax = null;
+ $numRowMin = null;
+ $numRowMax = null;
+ $arrConditional = array();
+ foreach ($this->phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
+ foreach ($conditionalStyles as $conditional) {
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
+ $arrConditional[] = $conditional->getHashCode();
+ }
+ // Cells
+ $arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate);
+ if (!is_numeric($arrCoord[0])) {
+ $arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]);
+ }
+ if (is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])) {
+ $numColumnMin = $arrCoord[0];
+ }
+ if (is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])) {
+ $numColumnMax = $arrCoord[0];
+ }
+ if (is_null($numRowMin) || ($numRowMin > $arrCoord[1])) {
+ $numRowMin = $arrCoord[1];
+ }
+ if (is_null($numRowMax) || ($numRowMax < $arrCoord[1])) {
+ $numRowMax = $arrCoord[1];
+ }
+ }
+ }
+ }
+ $needRedraw = 1;
+ $cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1);
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vv', count($arrConditional), $needRedraw);
+ $data .= $cellRange;
+ $data .= pack('v', 0x0001);
+ $data .= $cellRange;
+ $this->append($header . $data);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php.bk-aleluya b/Classes/PHPExcel/Writer/Excel5/Worksheet.php.bk-aleluya
new file mode 100644
index 0000000..be965e2
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php.bk-aleluya
@@ -0,0 +1,4240 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
+{
+ /**
+ * Formula parser
+ *
+ * @var PHPExcel_Writer_Excel5_Parser
+ */
+ private $parser;
+
+ /**
+ * Maximum number of characters for a string (LABEL record in BIFF5)
+ * @var integer
+ */
+ private $xlsStringMaxLength;
+
+ /**
+ * Array containing format information for columns
+ * @var array
+ */
+ private $columnInfo;
+
+ /**
+ * Array containing the selected area for the worksheet
+ * @var array
+ */
+ private $selection;
+
+ /**
+ * The active pane for the worksheet
+ * @var integer
+ */
+ private $activePane;
+
+ /**
+ * Whether to use outline.
+ * @var integer
+ */
+ private $outlineOn;
+
+ /**
+ * Auto outline styles.
+ * @var bool
+ */
+ private $outlineStyle;
+
+ /**
+ * Whether to have outline summary below.
+ * @var bool
+ */
+ private $outlineBelow;
+
+ /**
+ * Whether to have outline summary at the right.
+ * @var bool
+ */
+ private $outlineRight;
+
+ /**
+ * Reference to the total number of strings in the workbook
+ * @var integer
+ */
+ private $stringTotal;
+
+ /**
+ * Reference to the number of unique strings in the workbook
+ * @var integer
+ */
+ private $stringUnique;
+
+ /**
+ * Reference to the array containing all the unique strings in the workbook
+ * @var array
+ */
+ private $stringTable;
+
+ /**
+ * Color cache
+ */
+ private $colors;
+
+ /**
+ * Index of first used row (at least 0)
+ * @var int
+ */
+ private $firstRowIndex;
+
+ /**
+ * Index of last used row. (no used rows means -1)
+ * @var int
+ */
+ private $lastRowIndex;
+
+ /**
+ * Index of first used column (at least 0)
+ * @var int
+ */
+ private $firstColumnIndex;
+
+ /**
+ * Index of last used column (no used columns means -1)
+ * @var int
+ */
+ private $lastColumnIndex;
+
+ /**
+ * Sheet object
+ * @var PHPExcel_Worksheet
+ */
+ public $phpSheet;
+
+ /**
+ * Count cell style Xfs
+ *
+ * @var int
+ */
+ private $countCellStyleXfs;
+
+ /**
+ * Escher object corresponding to MSODRAWING
+ *
+ * @var PHPExcel_Shared_Escher
+ */
+ private $escher;
+
+ /**
+ * Array of font hashes associated to FONT records index
+ *
+ * @var array
+ */
+ public $fontHashIndex;
+
+ /**
+ * Constructor
+ *
+ * @param int &$str_total Total number of strings
+ * @param int &$str_unique Total number of unique strings
+ * @param array &$str_table String Table
+ * @param array &$colors Colour Table
+ * @param mixed $parser The formula parser created for the Workbook
+ * @param boolean $preCalculateFormulas Flag indicating whether formulas should be calculated or just written
+ * @param string $phpSheet The worksheet to write
+ * @param PHPExcel_Worksheet $phpSheet
+ */
+ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet)
+ {
+ // It needs to call its parent's constructor explicitly
+ parent::__construct();
+
+ // change BIFFwriter limit for CONTINUE records
+// $this->_limit = 8224;
+
+
+ $this->_preCalculateFormulas = $preCalculateFormulas;
+ $this->stringTotal = &$str_total;
+ $this->stringUnique = &$str_unique;
+ $this->stringTable = &$str_table;
+ $this->colors = &$colors;
+ $this->parser = $parser;
+
+ $this->phpSheet = $phpSheet;
+
+ //$this->ext_sheets = array();
+ //$this->offset = 0;
+ $this->xlsStringMaxLength = 255;
+ $this->columnInfo = array();
+ $this->selection = array(0,0,0,0);
+ $this->activePane = 3;
+
+ $this->_print_headers = 0;
+
+ $this->outlineStyle = 0;
+ $this->outlineBelow = 1;
+ $this->outlineRight = 1;
+ $this->outlineOn = 1;
+
+ $this->fontHashIndex = array();
+
+ // calculate values for DIMENSIONS record
+ $minR = 1;
+ $minC = 'A';
+
+ $maxR = $this->phpSheet->getHighestRow();
+ $maxC = $this->phpSheet->getHighestColumn();
+
+ // Determine lowest and highest column and row
+// $this->firstRowIndex = ($minR > 65535) ? 65535 : $minR;
+ $this->lastRowIndex = ($maxR > 65535) ? 65535 : $maxR ;
+
+ $this->firstColumnIndex = PHPExcel_Cell::columnIndexFromString($minC);
+ $this->lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC);
+
+// if ($this->firstColumnIndex > 255) $this->firstColumnIndex = 255;
+ if ($this->lastColumnIndex > 255) {
+ $this->lastColumnIndex = 255;
+ }
+
+ $this->countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
+ }
+
+ /**
+ * Add data to the beginning of the workbook (note the reverse order)
+ * and to the end of the workbook.
+ *
+ * @access public
+ * @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook()
+ */
+ public function close()
+ {
+ $phpSheet = $this->phpSheet;
+
+ $num_sheets = $phpSheet->getParent()->getSheetCount();
+
+ // Write BOF record
+ $this->storeBof(0x0010);
+
+ // Write PRINTHEADERS
+ $this->writePrintHeaders();
+
+ // Write PRINTGRIDLINES
+ $this->writePrintGridlines();
+
+ // Write GRIDSET
+ $this->writeGridset();
+
+ // Calculate column widths
+ $phpSheet->calculateColumnWidths();
+
+ // Column dimensions
+ if (($defaultWidth = $phpSheet->getDefaultColumnDimension()->getWidth()) < 0) {
+ $defaultWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($phpSheet->getParent()->getDefaultStyle()->getFont());
+ }
+
+ $columnDimensions = $phpSheet->getColumnDimensions();
+ $maxCol = $this->lastColumnIndex -1;
+ for ($i = 0; $i <= $maxCol; ++$i) {
+ $hidden = 0;
+ $level = 0;
+ $xfIndex = 15; // there are 15 cell style Xfs
+
+ $width = $defaultWidth;
+
+ $columnLetter = PHPExcel_Cell::stringFromColumnIndex($i);
+ if (isset($columnDimensions[$columnLetter])) {
+ $columnDimension = $columnDimensions[$columnLetter];
+ if ($columnDimension->getWidth() >= 0) {
+ $width = $columnDimension->getWidth();
+ }
+ $hidden = $columnDimension->getVisible() ? 0 : 1;
+ $level = $columnDimension->getOutlineLevel();
+ $xfIndex = $columnDimension->getXfIndex() + 15; // there are 15 cell style Xfs
+ }
+
+ // Components of columnInfo:
+ // $firstcol first column on the range
+ // $lastcol last column on the range
+ // $width width to set
+ // $xfIndex The optional cell style Xf index to apply to the columns
+ // $hidden The optional hidden atribute
+ // $level The optional outline level
+ $this->columnInfo[] = array($i, $i, $width, $xfIndex, $hidden, $level);
+ }
+
+ // Write GUTS
+ $this->writeGuts();
+
+ // Write DEFAULTROWHEIGHT
+ $this->writeDefaultRowHeight();
+ // Write WSBOOL
+ $this->writeWsbool();
+ // Write horizontal and vertical page breaks
+ $this->writeBreaks();
+ // Write page header
+ $this->writeHeader();
+ // Write page footer
+ $this->writeFooter();
+ // Write page horizontal centering
+ $this->writeHcenter();
+ // Write page vertical centering
+ $this->writeVcenter();
+ // Write left margin
+ $this->writeMarginLeft();
+ // Write right margin
+ $this->writeMarginRight();
+ // Write top margin
+ $this->writeMarginTop();
+ // Write bottom margin
+ $this->writeMarginBottom();
+ // Write page setup
+ $this->writeSetup();
+ // Write sheet protection
+ $this->writeProtect();
+ // Write SCENPROTECT
+ $this->writeScenProtect();
+ // Write OBJECTPROTECT
+ $this->writeObjectProtect();
+ // Write sheet password
+ $this->writePassword();
+ // Write DEFCOLWIDTH record
+ $this->writeDefcol();
+
+ // Write the COLINFO records if they exist
+ if (!empty($this->columnInfo)) {
+ $colcount = count($this->columnInfo);
+ for ($i = 0; $i < $colcount; ++$i) {
+ $this->writeColinfo($this->columnInfo[$i]);
+ }
+ }
+ $autoFilterRange = $phpSheet->getAutoFilter()->getRange();
+ if (!empty($autoFilterRange)) {
+ // Write AUTOFILTERINFO
+ $this->writeAutoFilterInfo();
+ }
+
+ // Write sheet dimensions
+ $this->writeDimensions();
+
+ // Row dimensions
+ foreach ($phpSheet->getRowDimensions() as $rowDimension) {
+ $xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
+ $this->writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel());
+ }
+
+ // Write Cells
+ foreach ($phpSheet->getCellCollection() as $cellID) {
+ $cell = $phpSheet->getCell($cellID);
+ $row = $cell->getRow() - 1;
+ $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;
+
+ // Don't break Excel!
+// if ($row + 1 > 65536 or $column + 1 > 256) {
+ if ($row > 65535 || $column > 255) {
+ break;
+ }
+
+ // Write cell value
+ $xfIndex = $cell->getXfIndex() + 15; // there are 15 cell style Xfs
+
+ $cVal = $cell->getValue();
+ if ($cVal instanceof PHPExcel_RichText) {
+ // $this->writeString($row, $column, $cVal->getPlainText(), $xfIndex);
+ $arrcRun = array();
+ $str_len = PHPExcel_Shared_String::CountCharacters($cVal->getPlainText(), 'UTF-8');
+ $str_pos = 0;
+ $elements = $cVal->getRichTextElements();
+ foreach ($elements as $element) {
+ // FONT Index
+ if ($element instanceof PHPExcel_RichText_Run) {
+ $str_fontidx = $this->fontHashIndex[$element->getFont()->getHashCode()];
+ } else {
+ $str_fontidx = 0;
+ }
+ $arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
+ // Position FROM
+ $str_pos += PHPExcel_Shared_String::CountCharacters($element->getText(), 'UTF-8');
+ }
+ $this->writeRichTextString($row, $column, $cVal->getPlainText(), $xfIndex, $arrcRun);
+ } else {
+ switch ($cell->getDatatype()) {
+ case PHPExcel_Cell_DataType::TYPE_STRING:
+ case PHPExcel_Cell_DataType::TYPE_NULL:
+ if ($cVal === '' || $cVal === null) {
+ $this->writeBlank($row, $column, $xfIndex);
+ } else {
+ $this->writeString($row, $column, $cVal, $xfIndex);
+ }
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_NUMERIC:
+ $this->writeNumber($row, $column, $cVal, $xfIndex);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_FORMULA:
+ $calculatedValue = $this->_preCalculateFormulas ?
+ $cell->getCalculatedValue() : null;
+ $this->writeFormula($row, $column, $cVal, $xfIndex, $calculatedValue);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_BOOL:
+ $this->writeBoolErr($row, $column, $cVal, 0, $xfIndex);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_ERROR:
+ $this->writeBoolErr($row, $column, self::mapErrorCode($cVal), 1, $xfIndex);
+ break;
+
+ }
+ }
+ }
+
+ // Append
+ $this->writeMsoDrawing();
+
+ // Write WINDOW2 record
+ $this->writeWindow2();
+
+ // Write PLV record
+ $this->writePageLayoutView();
+
+ // Write ZOOM record
+ $this->writeZoom();
+ if ($phpSheet->getFreezePane()) {
+ $this->writePanes();
+ }
+
+ // Write SELECTION record
+ $this->writeSelection();
+
+ // Write MergedCellsTable Record
+ $this->writeMergedCells();
+
+ // Hyperlinks
+ foreach ($phpSheet->getHyperLinkCollection() as $coordinate => $hyperlink) {
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($coordinate);
+
+ $url = $hyperlink->getUrl();
+
+ if (strpos($url, 'sheet://') !== false) {
+ // internal to current workbook
+ $url = str_replace('sheet://', 'internal:', $url);
+
+ } elseif (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
+ // URL
+ // $url = $url;
+
+ } else {
+ // external (local file)
+ $url = 'external:' . $url;
+ }
+
+ $this->writeUrl($row - 1, PHPExcel_Cell::columnIndexFromString($column) - 1, $url);
+ }
+
+ $this->writeDataValidity();
+ $this->writeSheetLayout();
+
+ // Write SHEETPROTECTION record
+ $this->writeSheetProtection();
+ $this->writeRangeProtection();
+
+ $arrConditionalStyles = $phpSheet->getConditionalStylesCollection();
+ if (!empty($arrConditionalStyles)) {
+ $arrConditional = array();
+ // @todo CFRule & CFHeader
+ // Write CFHEADER record
+ $this->writeCFHeader();
+ // Write ConditionalFormattingTable records
+ foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
+ foreach ($conditionalStyles as $conditional) {
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
+ $arrConditional[] = $conditional->getHashCode();
+ // Write CFRULE record
+ $this->writeCFRule($conditional);
+ }
+ }
+ }
+ }
+ }
+
+ $this->storeEof();
+ }
+
+ /**
+ * Write a cell range address in BIFF8
+ * always fixed range
+ * See section 2.5.14 in OpenOffice.org's Documentation of the Microsoft Excel File Format
+ *
+ * @param string $range E.g. 'A1' or 'A1:B6'
+ * @return string Binary data
+ */
+ private function writeBIFF8CellRangeAddressFixed($range = 'A1')
+ {
+ $explodes = explode(':', $range);
+
+ // extract first cell, e.g. 'A1'
+ $firstCell = $explodes[0];
+
+ // extract last cell, e.g. 'B6'
+ if (count($explodes) == 1) {
+ $lastCell = $firstCell;
+ } else {
+ $lastCell = $explodes[1];
+ }
+
+ $firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
+ $lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
+
+ return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1);
+ }
+
+ /**
+ * Retrieves data from memory in one chunk, or from disk in $buffer
+ * sized chunks.
+ *
+ * @return string The data
+ */
+ public function getData()
+ {
+ $buffer = 4096;
+
+ // Return data stored in memory
+ if (isset($this->_data)) {
+ $tmp = $this->_data;
+ unset($this->_data);
+ return $tmp;
+ }
+ // No data to return
+ return false;
+ }
+
+ /**
+ * Set the option to print the row and column headers on the printed page.
+ *
+ * @access public
+ * @param integer $print Whether to print the headers or not. Defaults to 1 (print).
+ */
+ public function printRowColHeaders($print = 1)
+ {
+ $this->_print_headers = $print;
+ }
+
+ /**
+ * This method sets the properties for outlining and grouping. The defaults
+ * correspond to Excel's defaults.
+ *
+ * @param bool $visible
+ * @param bool $symbols_below
+ * @param bool $symbols_right
+ * @param bool $auto_style
+ */
+ public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false)
+ {
+ $this->outlineOn = $visible;
+ $this->outlineBelow = $symbols_below;
+ $this->outlineRight = $symbols_right;
+ $this->outlineStyle = $auto_style;
+
+ // Ensure this is a boolean vale for Window2
+ if ($this->outlineOn) {
+ $this->outlineOn = 1;
+ }
+ }
+
+ /**
+ * Write a double to the specified row and column (zero indexed).
+ * An integer can be written as a double. Excel will display an
+ * integer. $format is optional.
+ *
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param float $num The number to write
+ * @param mixed $xfIndex The optional XF format
+ * @return integer
+ */
+ private function writeNumber($row, $col, $num, $xfIndex)
+ {
+ $record = 0x0203; // Record identifier
+ $length = 0x000E; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $xfIndex);
+ $xl_double = pack("d", $num);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $xl_double = strrev($xl_double);
+ }
+
+ $this->append($header.$data.$xl_double);
+ return(0);
+ }
+
+ /**
+ * Write a LABELSST record or a LABEL record. Which one depends on BIFF version
+ *
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param string $str The string
+ * @param int $xfIndex Index to XF record
+ */
+ private function writeString($row, $col, $str, $xfIndex)
+ {
+ $this->writeLabelSst($row, $col, $str, $xfIndex);
+ }
+
+ /**
+ * Write a LABELSST record or a LABEL record. Which one depends on BIFF version
+ * It differs from writeString by the writing of rich text strings.
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param string $str The string
+ * @param mixed $xfIndex The XF format index for the cell
+ * @param array $arrcRun Index to Font record and characters beginning
+ */
+ private function writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
+ {
+ $record = 0x00FD; // Record identifier
+ $length = 0x000A; // Bytes to follow
+ $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun);
+
+ /* check if string is already present */
+ if (!isset($this->stringTable[$str])) {
+ $this->stringTable[$str] = $this->stringUnique++;
+ }
+ $this->stringTotal++;
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write a string to the specified row and column (zero indexed).
+ * NOTE: there is an Excel 5 defined limit of 255 characters.
+ * $format is optional.
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @access public
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $str The string to write
+ * @param mixed $xfIndex The XF format index for the cell
+ * @return integer
+ */
+ private function writeLabel($row, $col, $str, $xfIndex)
+ {
+ $strlen = strlen($str);
+ $record = 0x0204; // Record identifier
+ $length = 0x0008 + $strlen; // Bytes to follow
+
+ $str_error = 0;
+
+ if ($strlen > $this->xlsStringMaxLength) { // LABEL must be < 255 chars
+ $str = substr($str, 0, $this->xlsStringMaxLength);
+ $length = 0x0008 + $this->xlsStringMaxLength;
+ $strlen = $this->xlsStringMaxLength;
+ $str_error = -3;
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row, $col, $xfIndex, $strlen);
+ $this->append($header . $data . $str);
+ return($str_error);
+ }
+
+ /**
+ * Write a string to the specified row and column (zero indexed).
+ * This is the BIFF8 version (no 255 chars limit).
+ * $format is optional.
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @access public
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $str The string to write
+ * @param mixed $xfIndex The XF format index for the cell
+ * @return integer
+ */
+ private function writeLabelSst($row, $col, $str, $xfIndex)
+ {
+ $record = 0x00FD; // Record identifier
+ $length = 0x000A; // Bytes to follow
+
+ $str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($str);
+
+ /* check if string is already present */
+ if (!isset($this->stringTable[$str])) {
+ $this->stringTable[$str] = $this->stringUnique++;
+ }
+ $this->stringTotal++;
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vvvV', $row, $col, $xfIndex, $this->stringTable[$str]);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Writes a note associated with the cell given by the row and column.
+ * NOTE records don't have a length limit.
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $note The note to write
+ */
+ private function writeNote($row, $col, $note)
+ {
+ $note_length = strlen($note);
+ $record = 0x001C; // Record identifier
+ $max_length = 2048; // Maximun length for a NOTE record
+
+ // Length for this record is no more than 2048 + 6
+ $length = 0x0006 + min($note_length, 2048);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $note_length);
+ $this->append($header . $data . substr($note, 0, 2048));
+
+ for ($i = $max_length; $i < $note_length; $i += $max_length) {
+ $chunk = substr($note, $i, $max_length);
+ $length = 0x0006 + strlen($chunk);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", -1, 0, strlen($chunk));
+ $this->append($header.$data.$chunk);
+ }
+ return(0);
+ }
+
+ /**
+ * Write a blank cell to the specified row and column (zero indexed).
+ * A blank cell is used to specify formatting without adding a string
+ * or a number.
+ *
+ * A blank cell without a format serves no purpose. Therefore, we don't write
+ * a BLANK record unless a format is specified.
+ *
+ * Returns 0 : normal termination (including no format)
+ * -1 : insufficient number of arguments
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param mixed $xfIndex The XF format index
+ */
+ public function writeBlank($row, $col, $xfIndex)
+ {
+ $record = 0x0201; // Record identifier
+ $length = 0x0006; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $row, $col, $xfIndex);
+ $this->append($header . $data);
+ return 0;
+ }
+
+ /**
+ * Write a boolean or an error type to the specified row and column (zero indexed)
+ *
+ * @param int $row Row index (0-based)
+ * @param int $col Column index (0-based)
+ * @param int $value
+ * @param boolean $isError Error or Boolean?
+ * @param int $xfIndex
+ */
+ private function writeBoolErr($row, $col, $value, $isError, $xfIndex)
+ {
+ $record = 0x0205;
+ $length = 8;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError);
+ $this->append($header . $data);
+ return 0;
+ }
+
+ /**
+ * Write a formula to the specified row and column (zero indexed).
+ * The textual representation of the formula is passed to the parser in
+ * Parser.php which returns a packed binary string.
+ *
+ * Returns 0 : normal termination
+ * -1 : formula errors (bad formula)
+ * -2 : row or column out of range
+ *
+ * @param integer $row Zero indexed row
+ * @param integer $col Zero indexed column
+ * @param string $formula The formula text string
+ * @param mixed $xfIndex The XF format index
+ * @param mixed $calculatedValue Calculated value
+ * @return integer
+ */
+ private function writeFormula($row, $col, $formula, $xfIndex, $calculatedValue)
+ {
+ $record = 0x0006; // Record identifier
+
+ // Initialize possible additional value for STRING record that should be written after the FORMULA record?
+ $stringValue = null;
+
+ // calculated value
+ if (isset($calculatedValue)) {
+ // Since we can't yet get the data type of the calculated value,
+ // we use best effort to determine data type
+ if (is_bool($calculatedValue)) {
+ // Boolean value
+ $num = pack('CCCvCv', 0x01, 0x00, (int)$calculatedValue, 0x00, 0x00, 0xFFFF);
+ } elseif (is_int($calculatedValue) || is_float($calculatedValue)) {
+ // Numeric value
+ $num = pack('d', $calculatedValue);
+ } elseif (is_string($calculatedValue)) {
+ if (array_key_exists($calculatedValue, PHPExcel_Cell_DataType::getErrorCodes())) {
+ // Error value
+ $num = pack('CCCvCv', 0x02, 0x00, self::mapErrorCode($calculatedValue), 0x00, 0x00, 0xFFFF);
+ } elseif ($calculatedValue === '') {
+ // Empty string (and BIFF8)
+ $num = pack('CCCvCv', 0x03, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
+ } else {
+ // Non-empty string value (or empty string BIFF5)
+ $stringValue = $calculatedValue;
+ $num = pack('CCCvCv', 0x00, 0x00, 0x00, 0x00, 0x00, 0xFFFF);
+ }
+ } else {
+ // We are really not supposed to reach here
+ $num = pack('d', 0x00);
+ }
+ } else {
+ $num = pack('d', 0x00);
+ }
+
+ $grbit = 0x03; // Option flags
+ $unknown = 0x0000; // Must be zero
+
+ // Strip the '=' or '@' sign at the beginning of the formula string
+ if ($formula{0} == '=') {
+ $formula = substr($formula, 1);
+ } else {
+ // Error handling
+ $this->writeString($row, $col, 'Unrecognised character for formula');
+ return -1;
+ }
+
+ // Parse the formula using the parser in Parser.php
+ try {
+ $error = $this->parser->parse($formula);
+ $formula = $this->parser->toReversePolish();
+
+ $formlen = strlen($formula); // Length of the binary string
+ $length = 0x16 + $formlen; // Length of the record data
+
+ $header = pack("vv", $record, $length);
+
+ $data = pack("vvv", $row, $col, $xfIndex)
+ . $num
+ . pack("vVv", $grbit, $unknown, $formlen);
+ $this->append($header . $data . $formula);
+
+ // Append also a STRING record if necessary
+ if ($stringValue !== null) {
+ $this->writeStringRecord($stringValue);
+ }
+
+ return 0;
+
+ } catch (PHPExcel_Exception $e) {
+ // do nothing
+ }
+
+ }
+
+ /**
+ * Write a STRING record. This
+ *
+ * @param string $stringValue
+ */
+ private function writeStringRecord($stringValue)
+ {
+ $record = 0x0207; // Record identifier
+ $data = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($stringValue);
+
+ $length = strlen($data);
+ $header = pack('vv', $record, $length);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write a hyperlink.
+ * This is comprised of two elements: the visible label and
+ * the invisible link. The visible label is the same as the link unless an
+ * alternative string is specified. The label is written using the
+ * writeString() method. Therefore the 255 characters string limit applies.
+ * $string and $format are optional.
+ *
+ * The hyperlink can be to a http, ftp, mail, internal sheet (not yet), or external
+ * directory url.
+ *
+ * Returns 0 : normal termination
+ * -2 : row or column out of range
+ * -3 : long string truncated to 255 chars
+ *
+ * @param integer $row Row
+ * @param integer $col Column
+ * @param string $url URL string
+ * @return integer
+ */
+ private function writeUrl($row, $col, $url)
+ {
+ // Add start row and col to arg list
+ return($this->writeUrlRange($row, $col, $row, $col, $url));
+ }
+
+ /**
+ * This is the more general form of writeUrl(). It allows a hyperlink to be
+ * written to a range of cells. This function also decides the type of hyperlink
+ * to be written. These are either, Web (http, ftp, mailto), Internal
+ * (Sheet1!A1) or external ('c:\temp\foo.xls#Sheet1!A1').
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlRange($row1, $col1, $row2, $col2, $url)
+ {
+ // Check for internal/external sheet links or default to web link
+ if (preg_match('[^internal:]', $url)) {
+ return($this->writeUrlInternal($row1, $col1, $row2, $col2, $url));
+ }
+ if (preg_match('[^external:]', $url)) {
+ return($this->writeUrlExternal($row1, $col1, $row2, $col2, $url));
+ }
+ return($this->writeUrlWeb($row1, $col1, $row2, $col2, $url));
+ }
+
+ /**
+ * Used to write http, ftp and mailto hyperlinks.
+ * The link type ($options) is 0x03 is the same as absolute dir ref without
+ * sheet. However it is differentiated by the $unknown2 data stream.
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlWeb($row1, $col1, $row2, $col2, $url)
+ {
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+ $unknown2 = pack("H*", "E0C9EA79F9BACE118C8200AA004BA90B");
+
+ // Pack the option flags
+ $options = pack("V", 0x03);
+
+ // Convert URL to a null terminated wchar string
+ $url = join("\0", preg_split("''", $url, -1, PREG_SPLIT_NO_EMPTY));
+ $url = $url . "\0\0\0";
+
+ // Pack the length of the URL
+ $url_len = pack("V", strlen($url));
+
+ // Calculate the data length
+ $length = 0x34 + strlen($url);
+
+ // Pack the header data
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row1, $row2, $col1, $col2);
+
+ // Write the packed data
+ $this->append($header . $data .
+ $unknown1 . $options .
+ $unknown2 . $url_len . $url);
+ return 0;
+ }
+
+ /**
+ * Used to write internal reference hyperlinks such as "Sheet1!A1".
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlInternal($row1, $col1, $row2, $col2, $url)
+ {
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Strip URL type
+ $url = preg_replace('/^internal:/', '', $url);
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", "D0C9EA79F9BACE118C8200AA004BA90B02000000");
+
+ // Pack the option flags
+ $options = pack("V", 0x08);
+
+ // Convert the URL type and to a null terminated wchar string
+ $url .= "\0";
+
+ // character count
+ $url_len = PHPExcel_Shared_String::CountCharacters($url);
+ $url_len = pack('V', $url_len);
+
+ $url = PHPExcel_Shared_String::ConvertEncoding($url, 'UTF-16LE', 'UTF-8');
+
+ // Calculate the data length
+ $length = 0x24 + strlen($url);
+
+ // Pack the header data
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $row1, $row2, $col1, $col2);
+
+ // Write the packed data
+ $this->append($header . $data .
+ $unknown1 . $options .
+ $url_len . $url);
+ return 0;
+ }
+
+ /**
+ * Write links to external directory names such as 'c:\foo.xls',
+ * c:\foo.xls#Sheet1!A1', '../../foo.xls'. and '../../foo.xls#Sheet1!A1'.
+ *
+ * Note: Excel writes some relative links with the $dir_long string. We ignore
+ * these cases for the sake of simpler code.
+ *
+ * @access private
+ * @see writeUrl()
+ * @param integer $row1 Start row
+ * @param integer $col1 Start column
+ * @param integer $row2 End row
+ * @param integer $col2 End column
+ * @param string $url URL string
+ * @return integer
+ */
+ public function writeUrlExternal($row1, $col1, $row2, $col2, $url)
+ {
+ // Network drives are different. We will handle them separately
+ // MS/Novell network drives and shares start with \\
+ if (preg_match('[^external:\\\\]', $url)) {
+ return; //($this->writeUrlExternal_net($row1, $col1, $row2, $col2, $url, $str, $format));
+ }
+
+ $record = 0x01B8; // Record identifier
+ $length = 0x00000; // Bytes to follow
+
+ // Strip URL type and change Unix dir separator to Dos style (if needed)
+ //
+ $url = preg_replace('/^external:/', '', $url);
+ $url = preg_replace('/\//', "\\", $url);
+
+ // Determine if the link is relative or absolute:
+ // relative if link contains no dir separator, "somefile.xls"
+ // relative if link starts with up-dir, "..\..\somefile.xls"
+ // otherwise, absolute
+
+ $absolute = 0x00; // relative path
+ if (preg_match('/^[A-Z]:/', $url)) {
+ $absolute = 0x02; // absolute path on Windows, e.g. C:\...
+ }
+ $link_type = 0x01 | $absolute;
+
+ // Determine if the link contains a sheet reference and change some of the
+ // parameters accordingly.
+ // Split the dir name and sheet name (if it exists)
+ $dir_long = $url;
+ if (preg_match("/\#/", $url)) {
+ $link_type |= 0x08;
+ }
+
+
+ // Pack the link type
+ $link_type = pack("V", $link_type);
+
+ // Calculate the up-level dir count e.g.. (..\..\..\ == 3)
+ $up_count = preg_match_all("/\.\.\\\/", $dir_long, $useless);
+ $up_count = pack("v", $up_count);
+
+ // Store the short dos dir name (null terminated)
+ $dir_short = preg_replace("/\.\.\\\/", '', $dir_long) . "\0";
+
+ // Store the long dir name as a wchar string (non-null terminated)
+ $dir_long = $dir_long . "\0";
+
+ // Pack the lengths of the dir strings
+ $dir_short_len = pack("V", strlen($dir_short));
+ $dir_long_len = pack("V", strlen($dir_long));
+ $stream_len = pack("V", 0); //strlen($dir_long) + 0x06);
+
+ // Pack the undocumented parts of the hyperlink stream
+ $unknown1 = pack("H*", 'D0C9EA79F9BACE118C8200AA004BA90B02000000');
+ $unknown2 = pack("H*", '0303000000000000C000000000000046');
+ $unknown3 = pack("H*", 'FFFFADDE000000000000000000000000000000000000000');
+ $unknown4 = pack("v", 0x03);
+
+ // Pack the main data stream
+ $data = pack("vvvv", $row1, $row2, $col1, $col2) .
+ $unknown1 .
+ $link_type .
+ $unknown2 .
+ $up_count .
+ $dir_short_len.
+ $dir_short .
+ $unknown3 .
+ $stream_len ;/*.
+ $dir_long_len .
+ $unknown4 .
+ $dir_long .
+ $sheet_len .
+ $sheet ;*/
+
+ // Pack the header data
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ // Write the packed data
+ $this->append($header. $data);
+ return 0;
+ }
+
+ /**
+ * This method is used to set the height and format for a row.
+ *
+ * @param integer $row The row to set
+ * @param integer $height Height we are giving to the row.
+ * Use null to set XF without setting height
+ * @param integer $xfIndex The optional cell style Xf index to apply to the columns
+ * @param bool $hidden The optional hidden attribute
+ * @param integer $level The optional outline level for row, in range [0,7]
+ */
+ private function writeRow($row, $height, $xfIndex, $hidden = false, $level = 0)
+ {
+ $record = 0x0208; // Record identifier
+ $length = 0x0010; // Number of bytes to follow
+
+ $colMic = 0x0000; // First defined column
+ $colMac = 0x0000; // Last defined column
+ $irwMac = 0x0000; // Used by Excel to optimise loading
+ $reserved = 0x0000; // Reserved
+ $grbit = 0x0000; // Option flags
+ $ixfe = $xfIndex;
+
+ if ($height < 0) {
+ $height = null;
+ }
+
+ // Use writeRow($row, null, $XF) to set XF format without setting height
+ if ($height != null) {
+ $miyRw = $height * 20; // row height
+ } else {
+ $miyRw = 0xff; // default row height is 256
+ }
+
+ // Set the options flags. fUnsynced is used to show that the font and row
+ // heights are not compatible. This is usually the case for WriteExcel.
+ // The collapsed flag 0x10 doesn't seem to be used to indicate that a row
+ // is collapsed. Instead it is used to indicate that the previous row is
+ // collapsed. The zero height flag, 0x20, is used to collapse a row.
+
+ $grbit |= $level;
+ if ($hidden) {
+ $grbit |= 0x0030;
+ }
+ if ($height !== null) {
+ $grbit |= 0x0040; // fUnsynced
+ }
+ if ($xfIndex !== 0xF) {
+ $grbit |= 0x0080;
+ }
+ $grbit |= 0x0100;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Writes Excel DIMENSIONS to define the area in which there is data.
+ */
+ private function writeDimensions()
+ {
+ $record = 0x0200; // Record identifier
+
+ $length = 0x000E;
+ $data = pack('VVvvv', $this->firstRowIndex, $this->lastRowIndex + 1, $this->firstColumnIndex, $this->lastColumnIndex + 1, 0x0000); // reserved
+
+ $header = pack("vv", $record, $length);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record Window2.
+ */
+ private function writeWindow2()
+ {
+ $record = 0x023E; // Record identifier
+ $length = 0x0012;
+
+ $grbit = 0x00B6; // Option flags
+ $rwTop = 0x0000; // Top row visible in window
+ $colLeft = 0x0000; // Leftmost column visible in window
+
+
+ // The options flags that comprise $grbit
+ $fDspFmla = 0; // 0 - bit
+ $fDspGrid = $this->phpSheet->getShowGridlines() ? 1 : 0; // 1
+ $fDspRwCol = $this->phpSheet->getShowRowColHeaders() ? 1 : 0; // 2
+ $fFrozen = $this->phpSheet->getFreezePane() ? 1 : 0; // 3
+ $fDspZeros = 1; // 4
+ $fDefaultHdr = 1; // 5
+ $fArabic = $this->phpSheet->getRightToLeft() ? 1 : 0; // 6
+ $fDspGuts = $this->outlineOn; // 7
+ $fFrozenNoSplit = 0; // 0 - bit
+ // no support in PHPExcel for selected sheet, therefore sheet is only selected if it is the active sheet
+ $fSelected = ($this->phpSheet === $this->phpSheet->getParent()->getActiveSheet()) ? 1 : 0;
+ $fPaged = 1; // 2
+ $fPageBreakPreview = $this->phpSheet->getSheetView()->getView() === PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_BREAK_PREVIEW;
+
+ $grbit = $fDspFmla;
+ $grbit |= $fDspGrid << 1;
+ $grbit |= $fDspRwCol << 2;
+ $grbit |= $fFrozen << 3;
+ $grbit |= $fDspZeros << 4;
+ $grbit |= $fDefaultHdr << 5;
+ $grbit |= $fArabic << 6;
+ $grbit |= $fDspGuts << 7;
+ $grbit |= $fFrozenNoSplit << 8;
+ $grbit |= $fSelected << 9;
+ $grbit |= $fPaged << 10;
+ $grbit |= $fPageBreakPreview << 11;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvv", $grbit, $rwTop, $colLeft);
+
+ // FIXME !!!
+ $rgbHdr = 0x0040; // Row/column heading and gridline color index
+ $zoom_factor_page_break = ($fPageBreakPreview ? $this->phpSheet->getSheetView()->getZoomScale() : 0x0000);
+ $zoom_factor_normal = $this->phpSheet->getSheetView()->getZoomScaleNormal();
+
+ $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record DEFAULTROWHEIGHT.
+ */
+ private function writeDefaultRowHeight()
+ {
+ $defaultRowHeight = $this->phpSheet->getDefaultRowDimension()->getRowHeight();
+
+ if ($defaultRowHeight < 0) {
+ return;
+ }
+
+ // convert to twips
+ $defaultRowHeight = (int) 20 * $defaultRowHeight;
+
+ $record = 0x0225; // Record identifier
+ $length = 0x0004; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", 1, $defaultRowHeight);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
+ */
+ private function writeDefcol()
+ {
+ $defaultColWidth = 8;
+
+ $record = 0x0055; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $defaultColWidth);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write BIFF record COLINFO to define column widths
+ *
+ * Note: The SDK says the record length is 0x0B but Excel writes a 0x0C
+ * length record.
+ *
+ * @param array $col_array This is the only parameter received and is composed of the following:
+ * 0 => First formatted column,
+ * 1 => Last formatted column,
+ * 2 => Col width (8.43 is Excel default),
+ * 3 => The optional XF format of the column,
+ * 4 => Option flags.
+ * 5 => Optional outline level
+ */
+ private function writeColinfo($col_array)
+ {
+ if (isset($col_array[0])) {
+ $colFirst = $col_array[0];
+ }
+ if (isset($col_array[1])) {
+ $colLast = $col_array[1];
+ }
+ if (isset($col_array[2])) {
+ $coldx = $col_array[2];
+ } else {
+ $coldx = 8.43;
+ }
+ if (isset($col_array[3])) {
+ $xfIndex = $col_array[3];
+ } else {
+ $xfIndex = 15;
+ }
+ if (isset($col_array[4])) {
+ $grbit = $col_array[4];
+ } else {
+ $grbit = 0;
+ }
+ if (isset($col_array[5])) {
+ $level = $col_array[5];
+ } else {
+ $level = 0;
+ }
+ $record = 0x007D; // Record identifier
+ $length = 0x000C; // Number of bytes to follow
+
+ $coldx *= 256; // Convert to units of 1/256 of a char
+
+ $ixfe = $xfIndex;
+ $reserved = 0x0000; // Reserved
+
+ $level = max(0, min($level, 7));
+ $grbit |= $level << 8;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write BIFF record SELECTION.
+ */
+ private function writeSelection()
+ {
+ // look up the selected cell range
+ $selectedCells = $this->phpSheet->getSelectedCells();
+ $selectedCells = PHPExcel_Cell::splitRange($this->phpSheet->getSelectedCells());
+ $selectedCells = $selectedCells[0];
+ if (count($selectedCells) == 2) {
+ list($first, $last) = $selectedCells;
+ } else {
+ $first = $selectedCells[0];
+ $last = $selectedCells[0];
+ }
+
+ list($colFirst, $rwFirst) = PHPExcel_Cell::coordinateFromString($first);
+ $colFirst = PHPExcel_Cell::columnIndexFromString($colFirst) - 1; // base 0 column index
+ --$rwFirst; // base 0 row index
+
+ list($colLast, $rwLast) = PHPExcel_Cell::coordinateFromString($last);
+ $colLast = PHPExcel_Cell::columnIndexFromString($colLast) - 1; // base 0 column index
+ --$rwLast; // base 0 row index
+
+ // make sure we are not out of bounds
+ $colFirst = min($colFirst, 255);
+ $colLast = min($colLast, 255);
+
+ $rwFirst = min($rwFirst, 65535);
+ $rwLast = min($rwLast, 65535);
+
+ $record = 0x001D; // Record identifier
+ $length = 0x000F; // Number of bytes to follow
+
+ $pnn = $this->activePane; // Pane position
+ $rwAct = $rwFirst; // Active row
+ $colAct = $colFirst; // Active column
+ $irefAct = 0; // Active cell ref
+ $cref = 1; // Number of refs
+
+ if (!isset($rwLast)) {
+ $rwLast = $rwFirst; // Last row in reference
+ }
+ if (!isset($colLast)) {
+ $colLast = $colFirst; // Last col in reference
+ }
+
+ // Swap last row/col for first row/col as necessary
+ if ($rwFirst > $rwLast) {
+ list($rwFirst, $rwLast) = array($rwLast, $rwFirst);
+ }
+
+ if ($colFirst > $colLast) {
+ list($colFirst, $colLast) = array($colLast, $colFirst);
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, $irefAct, $cref, $rwFirst, $rwLast, $colFirst, $colLast);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the MERGEDCELLS records for all ranges of merged cells
+ */
+ private function writeMergedCells()
+ {
+ $mergeCells = $this->phpSheet->getMergeCells();
+ $countMergeCells = count($mergeCells);
+
+ if ($countMergeCells == 0) {
+ return;
+ }
+
+ // maximum allowed number of merged cells per record
+ $maxCountMergeCellsPerRecord = 1027;
+
+ // record identifier
+ $record = 0x00E5;
+
+ // counter for total number of merged cells treated so far by the writer
+ $i = 0;
+
+ // counter for number of merged cells written in record currently being written
+ $j = 0;
+
+ // initialize record data
+ $recordData = '';
+
+ // loop through the merged cells
+ foreach ($mergeCells as $mergeCell) {
+ ++$i;
+ ++$j;
+
+ // extract the row and column indexes
+ $range = PHPExcel_Cell::splitRange($mergeCell);
+ list($first, $last) = $range[0];
+ list($firstColumn, $firstRow) = PHPExcel_Cell::coordinateFromString($first);
+ list($lastColumn, $lastRow) = PHPExcel_Cell::coordinateFromString($last);
+
+ $recordData .= pack('vvvv', $firstRow - 1, $lastRow - 1, PHPExcel_Cell::columnIndexFromString($firstColumn) - 1, PHPExcel_Cell::columnIndexFromString($lastColumn) - 1);
+
+ // flush record if we have reached limit for number of merged cells, or reached final merged cell
+ if ($j == $maxCountMergeCellsPerRecord or $i == $countMergeCells) {
+ $recordData = pack('v', $j) . $recordData;
+ $length = strlen($recordData);
+ $header = pack('vv', $record, $length);
+ $this->append($header . $recordData);
+
+ // initialize for next record, if any
+ $recordData = '';
+ $j = 0;
+ }
+ }
+ }
+
+ /**
+ * Write SHEETLAYOUT record
+ */
+ private function writeSheetLayout()
+ {
+ if (!$this->phpSheet->isTabColorSet()) {
+ return;
+ }
+
+ $recordData = pack(
+ 'vvVVVvv',
+ 0x0862,
+ 0x0000, // unused
+ 0x00000000, // unused
+ 0x00000000, // unused
+ 0x00000014, // size of record data
+ $this->colors[$this->phpSheet->getTabColor()->getRGB()], // color index
+ 0x0000 // unused
+ );
+
+ $length = strlen($recordData);
+
+ $record = 0x0862; // Record identifier
+ $header = pack('vv', $record, $length);
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Write SHEETPROTECTION
+ */
+ private function writeSheetProtection()
+ {
+ // record identifier
+ $record = 0x0867;
+
+ // prepare options
+ $options = (int) !$this->phpSheet->getProtection()->getObjects()
+ | (int) !$this->phpSheet->getProtection()->getScenarios() << 1
+ | (int) !$this->phpSheet->getProtection()->getFormatCells() << 2
+ | (int) !$this->phpSheet->getProtection()->getFormatColumns() << 3
+ | (int) !$this->phpSheet->getProtection()->getFormatRows() << 4
+ | (int) !$this->phpSheet->getProtection()->getInsertColumns() << 5
+ | (int) !$this->phpSheet->getProtection()->getInsertRows() << 6
+ | (int) !$this->phpSheet->getProtection()->getInsertHyperlinks() << 7
+ | (int) !$this->phpSheet->getProtection()->getDeleteColumns() << 8
+ | (int) !$this->phpSheet->getProtection()->getDeleteRows() << 9
+ | (int) !$this->phpSheet->getProtection()->getSelectLockedCells() << 10
+ | (int) !$this->phpSheet->getProtection()->getSort() << 11
+ | (int) !$this->phpSheet->getProtection()->getAutoFilter() << 12
+ | (int) !$this->phpSheet->getProtection()->getPivotTables() << 13
+ | (int) !$this->phpSheet->getProtection()->getSelectUnlockedCells() << 14 ;
+
+ // record data
+ $recordData = pack(
+ 'vVVCVVvv',
+ 0x0867, // repeated record identifier
+ 0x0000, // not used
+ 0x0000, // not used
+ 0x00, // not used
+ 0x01000200, // unknown data
+ 0xFFFFFFFF, // unknown data
+ $options, // options
+ 0x0000 // not used
+ );
+
+ $length = strlen($recordData);
+ $header = pack('vv', $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Write BIFF record RANGEPROTECTION
+ *
+ * Openoffice.org's Documentaion of the Microsoft Excel File Format uses term RANGEPROTECTION for these records
+ * Microsoft Office Excel 97-2007 Binary File Format Specification uses term FEAT for these records
+ */
+ private function writeRangeProtection()
+ {
+ foreach ($this->phpSheet->getProtectedCells() as $range => $password) {
+ // number of ranges, e.g. 'A1:B3 C20:D25'
+ $cellRanges = explode(' ', $range);
+ $cref = count($cellRanges);
+
+ $recordData = pack(
+ 'vvVVvCVvVv',
+ 0x0868,
+ 0x00,
+ 0x0000,
+ 0x0000,
+ 0x02,
+ 0x0,
+ 0x0000,
+ $cref,
+ 0x0000,
+ 0x00
+ );
+
+ foreach ($cellRanges as $cellRange) {
+ $recordData .= $this->writeBIFF8CellRangeAddressFixed($cellRange);
+ }
+
+ // the rgbFeat structure
+ $recordData .= pack(
+ 'VV',
+ 0x0000,
+ hexdec($password)
+ );
+
+ $recordData .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong('p' . md5($recordData));
+
+ $length = strlen($recordData);
+
+ $record = 0x0868; // Record identifier
+ $header = pack("vv", $record, $length);
+ $this->append($header . $recordData);
+ }
+ }
+
+ /**
+ * Write BIFF record EXTERNCOUNT to indicate the number of external sheet
+ * references in a worksheet.
+ *
+ * Excel only stores references to external sheets that are used in formulas.
+ * For simplicity we store references to all the sheets in the workbook
+ * regardless of whether they are used or not. This reduces the overall
+ * complexity and eliminates the need for a two way dialogue between the formula
+ * parser the worksheet objects.
+ *
+ * @param integer $count The number of external sheet references in this worksheet
+ */
+ private function writeExterncount($count)
+ {
+ $record = 0x0016; // Record identifier
+ $length = 0x0002; // Number of bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $count);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Writes the Excel BIFF EXTERNSHEET record. These references are used by
+ * formulas. A formula references a sheet name via an index. Since we store a
+ * reference to all of the external worksheets the EXTERNSHEET index is the same
+ * as the worksheet index.
+ *
+ * @param string $sheetname The name of a external worksheet
+ */
+ private function writeExternsheet($sheetname)
+ {
+ $record = 0x0017; // Record identifier
+
+ // References to the current sheet are encoded differently to references to
+ // external sheets.
+ //
+ if ($this->phpSheet->getTitle() == $sheetname) {
+ $sheetname = '';
+ $length = 0x02; // The following 2 bytes
+ $cch = 1; // The following byte
+ $rgch = 0x02; // Self reference
+ } else {
+ $length = 0x02 + strlen($sheetname);
+ $cch = strlen($sheetname);
+ $rgch = 0x03; // Reference to a sheet in the current workbook
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("CC", $cch, $rgch);
+ $this->append($header . $data . $sheetname);
+ }
+
+ /**
+ * Writes the Excel BIFF PANE record.
+ * The panes can either be frozen or thawed (unfrozen).
+ * Frozen panes are specified in terms of an integer number of rows and columns.
+ * Thawed panes are specified in terms of Excel's units for rows and columns.
+ */
+ private function writePanes()
+ {
+ $panes = array();
+ if ($freezePane = $this->phpSheet->getFreezePane()) {
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($freezePane);
+ $panes[0] = $row - 1;
+ $panes[1] = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ } else {
+ // thaw panes
+ return;
+ }
+
+ $y = isset($panes[0]) ? $panes[0] : null;
+ $x = isset($panes[1]) ? $panes[1] : null;
+ $rwTop = isset($panes[2]) ? $panes[2] : null;
+ $colLeft = isset($panes[3]) ? $panes[3] : null;
+ if (count($panes) > 4) { // if Active pane was received
+ $pnnAct = $panes[4];
+ } else {
+ $pnnAct = null;
+ }
+ $record = 0x0041; // Record identifier
+ $length = 0x000A; // Number of bytes to follow
+
+ // Code specific to frozen or thawed panes.
+ if ($this->phpSheet->getFreezePane()) {
+ // Set default values for $rwTop and $colLeft
+ if (!isset($rwTop)) {
+ $rwTop = $y;
+ }
+ if (!isset($colLeft)) {
+ $colLeft = $x;
+ }
+ } else {
+ // Set default values for $rwTop and $colLeft
+ if (!isset($rwTop)) {
+ $rwTop = 0;
+ }
+ if (!isset($colLeft)) {
+ $colLeft = 0;
+ }
+
+ // Convert Excel's row and column units to the internal units.
+ // The default row height is 12.75
+ // The default column width is 8.43
+ // The following slope and intersection values were interpolated.
+ //
+ $y = 20*$y + 255;
+ $x = 113.879*$x + 390;
+ }
+
+
+ // Determine which pane should be active. There is also the undocumented
+ // option to override this should it be necessary: may be removed later.
+ //
+ if (!isset($pnnAct)) {
+ if ($x != 0 && $y != 0) {
+ $pnnAct = 0; // Bottom right
+ }
+ if ($x != 0 && $y == 0) {
+ $pnnAct = 1; // Top right
+ }
+ if ($x == 0 && $y != 0) {
+ $pnnAct = 2; // Bottom left
+ }
+ if ($x == 0 && $y == 0) {
+ $pnnAct = 3; // Top left
+ }
+ }
+
+ $this->activePane = $pnnAct; // Used in writeSelection
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the page setup SETUP BIFF record.
+ */
+ private function writeSetup()
+ {
+ $record = 0x00A1; // Record identifier
+ $length = 0x0022; // Number of bytes to follow
+
+ $iPaperSize = $this->phpSheet->getPageSetup()->getPaperSize(); // Paper size
+
+ $iScale = $this->phpSheet->getPageSetup()->getScale() ?
+ $this->phpSheet->getPageSetup()->getScale() : 100; // Print scaling factor
+
+ $iPageStart = 0x01; // Starting page number
+ $iFitWidth = (int) $this->phpSheet->getPageSetup()->getFitToWidth(); // Fit to number of pages wide
+ $iFitHeight = (int) $this->phpSheet->getPageSetup()->getFitToHeight(); // Fit to number of pages high
+ $grbit = 0x00; // Option flags
+ $iRes = 0x0258; // Print resolution
+ $iVRes = 0x0258; // Vertical print resolution
+
+ $numHdr = $this->phpSheet->getPageMargins()->getHeader(); // Header Margin
+
+ $numFtr = $this->phpSheet->getPageMargins()->getFooter(); // Footer Margin
+ $iCopies = 0x01; // Number of copies
+
+ $fLeftToRight = 0x0; // Print over then down
+
+ // Page orientation
+ $fLandscape = ($this->phpSheet->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ?
+ 0x0 : 0x1;
+
+ $fNoPls = 0x0; // Setup not read from printer
+ $fNoColor = 0x0; // Print black and white
+ $fDraft = 0x0; // Print draft quality
+ $fNotes = 0x0; // Print notes
+ $fNoOrient = 0x0; // Orientation not set
+ $fUsePage = 0x0; // Use custom starting page
+
+ $grbit = $fLeftToRight;
+ $grbit |= $fLandscape << 1;
+ $grbit |= $fNoPls << 2;
+ $grbit |= $fNoColor << 3;
+ $grbit |= $fDraft << 4;
+ $grbit |= $fNotes << 5;
+ $grbit |= $fNoOrient << 6;
+ $grbit |= $fUsePage << 7;
+
+ $numHdr = pack("d", $numHdr);
+ $numFtr = pack("d", $numFtr);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $numHdr = strrev($numHdr);
+ $numFtr = strrev($numFtr);
+ }
+
+ $header = pack("vv", $record, $length);
+ $data1 = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
+ $data2 = $numHdr.$numFtr;
+ $data3 = pack("v", $iCopies);
+ $this->append($header . $data1 . $data2 . $data3);
+ }
+
+ /**
+ * Store the header caption BIFF record.
+ */
+ private function writeHeader()
+ {
+ $record = 0x0014; // Record identifier
+
+ /* removing for now
+ // need to fix character count (multibyte!)
+ if (strlen($this->phpSheet->getHeaderFooter()->getOddHeader()) <= 255) {
+ $str = $this->phpSheet->getHeaderFooter()->getOddHeader(); // header string
+ } else {
+ $str = '';
+ }
+ */
+
+ $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddHeader());
+ $length = strlen($recordData);
+
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Store the footer caption BIFF record.
+ */
+ private function writeFooter()
+ {
+ $record = 0x0015; // Record identifier
+
+ /* removing for now
+ // need to fix character count (multibyte!)
+ if (strlen($this->phpSheet->getHeaderFooter()->getOddFooter()) <= 255) {
+ $str = $this->phpSheet->getHeaderFooter()->getOddFooter();
+ } else {
+ $str = '';
+ }
+ */
+
+ $recordData = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($this->phpSheet->getHeaderFooter()->getOddFooter());
+ $length = strlen($recordData);
+
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $recordData);
+ }
+
+ /**
+ * Store the horizontal centering HCENTER BIFF record.
+ *
+ * @access private
+ */
+ private function writeHcenter()
+ {
+ $record = 0x0083; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fHCenter = $this->phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fHCenter);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Store the vertical centering VCENTER BIFF record.
+ */
+ private function writeVcenter()
+ {
+ $record = 0x0084; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fVCenter = $this->phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fVCenter);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the LEFTMARGIN BIFF record.
+ */
+ private function writeMarginLeft()
+ {
+ $record = 0x0026; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getLeft(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the RIGHTMARGIN BIFF record.
+ */
+ private function writeMarginRight()
+ {
+ $record = 0x0027; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getRight(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the TOPMARGIN BIFF record.
+ */
+ private function writeMarginTop()
+ {
+ $record = 0x0028; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getTop(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Store the BOTTOMMARGIN BIFF record.
+ */
+ private function writeMarginBottom()
+ {
+ $record = 0x0029; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $margin = $this->phpSheet->getPageMargins()->getBottom(); // Margin in inches
+
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
+ if (self::getByteOrder()) { // if it's Big Endian
+ $data = strrev($data);
+ }
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the PRINTHEADERS BIFF record.
+ */
+ private function writePrintHeaders()
+ {
+ $record = 0x002a; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fPrintRwCol = $this->_print_headers; // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fPrintRwCol);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the PRINTGRIDLINES BIFF record. Must be used in conjunction with the
+ * GRIDSET record.
+ */
+ private function writePrintGridlines()
+ {
+ $record = 0x002b; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fPrintGrid = $this->phpSheet->getPrintGridlines() ? 1 : 0; // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fPrintGrid);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the GRIDSET BIFF record. Must be used in conjunction with the
+ * PRINTGRIDLINES record.
+ */
+ private function writeGridset()
+ {
+ $record = 0x0082; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fGridSet = !$this->phpSheet->getPrintGridlines(); // Boolean flag
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fGridSet);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet.
+ */
+ private function writeAutoFilterInfo()
+ {
+ $record = 0x009D; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $rangeBounds = PHPExcel_Cell::rangeBoundaries($this->phpSheet->getAutoFilter()->getRange());
+ $iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0];
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $iNumFilters);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the GUTS BIFF record. This is used to configure the gutter margins
+ * where Excel outline symbols are displayed. The visibility of the gutters is
+ * controlled by a flag in WSBOOL.
+ *
+ * @see writeWsbool()
+ */
+ private function writeGuts()
+ {
+ $record = 0x0080; // Record identifier
+ $length = 0x0008; // Bytes to follow
+
+ $dxRwGut = 0x0000; // Size of row gutter
+ $dxColGut = 0x0000; // Size of col gutter
+
+ // determine maximum row outline level
+ $maxRowOutlineLevel = 0;
+ foreach ($this->phpSheet->getRowDimensions() as $rowDimension) {
+ $maxRowOutlineLevel = max($maxRowOutlineLevel, $rowDimension->getOutlineLevel());
+ }
+
+ $col_level = 0;
+
+ // Calculate the maximum column outline level. The equivalent calculation
+ // for the row outline level is carried out in writeRow().
+ $colcount = count($this->columnInfo);
+ for ($i = 0; $i < $colcount; ++$i) {
+ $col_level = max($this->columnInfo[$i][5], $col_level);
+ }
+
+ // Set the limits for the outline levels (0 <= x <= 7).
+ $col_level = max(0, min($col_level, 7));
+
+ // The displayed level is one greater than the max outline levels
+ if ($maxRowOutlineLevel) {
+ ++$maxRowOutlineLevel;
+ }
+ if ($col_level) {
+ ++$col_level;
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
+ * with the SETUP record.
+ */
+ private function writeWsbool()
+ {
+ $record = 0x0081; // Record identifier
+ $length = 0x0002; // Bytes to follow
+ $grbit = 0x0000;
+
+ // The only option that is of interest is the flag for fit to page. So we
+ // set all the options in one go.
+ //
+ // Set the option flags
+ $grbit |= 0x0001; // Auto page breaks visible
+ if ($this->outlineStyle) {
+ $grbit |= 0x0020; // Auto outline styles
+ }
+ if ($this->phpSheet->getShowSummaryBelow()) {
+ $grbit |= 0x0040; // Outline summary below
+ }
+ if ($this->phpSheet->getShowSummaryRight()) {
+ $grbit |= 0x0080; // Outline summary right
+ }
+ if ($this->phpSheet->getPageSetup()->getFitToPage()) {
+ $grbit |= 0x0100; // Page setup fit to page
+ }
+ if ($this->outlineOn) {
+ $grbit |= 0x0400; // Outline symbols displayed
+ }
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $grbit);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the HORIZONTALPAGEBREAKS and VERTICALPAGEBREAKS BIFF records.
+ */
+ private function writeBreaks()
+ {
+ // initialize
+ $vbreaks = array();
+ $hbreaks = array();
+
+ foreach ($this->phpSheet->getBreaks() as $cell => $breakType) {
+ // Fetch coordinates
+ $coordinates = PHPExcel_Cell::coordinateFromString($cell);
+
+ // Decide what to do by the type of break
+ switch ($breakType) {
+ case PHPExcel_Worksheet::BREAK_COLUMN:
+ // Add to list of vertical breaks
+ $vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
+ break;
+ case PHPExcel_Worksheet::BREAK_ROW:
+ // Add to list of horizontal breaks
+ $hbreaks[] = $coordinates[1];
+ break;
+ case PHPExcel_Worksheet::BREAK_NONE:
+ default:
+ // Nothing to do
+ break;
+ }
+ }
+
+ //horizontal page breaks
+ if (!empty($hbreaks)) {
+ // Sort and filter array of page breaks
+ sort($hbreaks, SORT_NUMERIC);
+ if ($hbreaks[0] == 0) { // don't use first break if it's 0
+ array_shift($hbreaks);
+ }
+
+ $record = 0x001b; // Record identifier
+ $cbrk = count($hbreaks); // Number of page breaks
+ $length = 2 + 6 * $cbrk; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cbrk);
+
+ // Append each page break
+ foreach ($hbreaks as $hbreak) {
+ $data .= pack("vvv", $hbreak, 0x0000, 0x00ff);
+ }
+
+ $this->append($header . $data);
+ }
+
+ // vertical page breaks
+ if (!empty($vbreaks)) {
+ // 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
+ // It is slightly higher in Excel 97/200, approx. 1026
+ $vbreaks = array_slice($vbreaks, 0, 1000);
+
+ // Sort and filter array of page breaks
+ sort($vbreaks, SORT_NUMERIC);
+ if ($vbreaks[0] == 0) { // don't use first break if it's 0
+ array_shift($vbreaks);
+ }
+
+ $record = 0x001a; // Record identifier
+ $cbrk = count($vbreaks); // Number of page breaks
+ $length = 2 + 6 * $cbrk; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cbrk);
+
+ // Append each page break
+ foreach ($vbreaks as $vbreak) {
+ $data .= pack("vvv", $vbreak, 0x0000, 0xffff);
+ }
+
+ $this->append($header . $data);
+ }
+ }
+
+ /**
+ * Set the Biff PROTECT record to indicate that the worksheet is protected.
+ */
+ private function writeProtect()
+ {
+ // Exit unless sheet protection has been specified
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ $record = 0x0012; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $fLock = 1; // Worksheet is protected
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fLock);
+
+ $this->append($header.$data);
+ }
+
+ /**
+ * Write SCENPROTECT
+ */
+ private function writeScenProtect()
+ {
+ // Exit if sheet protection is not active
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ // Exit if scenarios are not protected
+ if (!$this->phpSheet->getProtection()->getScenarios()) {
+ return;
+ }
+
+ $record = 0x00DD; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', 1);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write OBJECTPROTECT
+ */
+ private function writeObjectProtect()
+ {
+ // Exit if sheet protection is not active
+ if (!$this->phpSheet->getProtection()->getSheet()) {
+ return;
+ }
+
+ // Exit if objects are not protected
+ if (!$this->phpSheet->getProtection()->getObjects()) {
+ return;
+ }
+
+ $record = 0x0063; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $header = pack('vv', $record, $length);
+ $data = pack('v', 1);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write the worksheet PASSWORD record.
+ */
+ private function writePassword()
+ {
+ // Exit unless sheet protection and password have been specified
+ if (!$this->phpSheet->getProtection()->getSheet() || !$this->phpSheet->getProtection()->getPassword()) {
+ return;
+ }
+
+ $record = 0x0013; // Record identifier
+ $length = 0x0002; // Bytes to follow
+
+ $wPassword = hexdec($this->phpSheet->getProtection()->getPassword()); // Encoded password
+
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $wPassword);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Insert a 24bit bitmap image in a worksheet.
+ *
+ * @access public
+ * @param integer $row The row we are going to insert the bitmap into
+ * @param integer $col The column we are going to insert the bitmap into
+ * @param mixed $bitmap The bitmap filename or GD-image resource
+ * @param integer $x The horizontal position (offset) of the image inside the cell.
+ * @param integer $y The vertical position (offset) of the image inside the cell.
+ * @param float $scale_x The horizontal scale
+ * @param float $scale_y The vertical scale
+ */
+ public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
+ {
+ $bitmap_array = (is_resource($bitmap) ? $this->processBitmapGd($bitmap) : $this->processBitmap($bitmap));
+ list($width, $height, $size, $data) = $bitmap_array; //$this->processBitmap($bitmap);
+
+ // Scale the frame of the image.
+ $width *= $scale_x;
+ $height *= $scale_y;
+
+ // Calculate the vertices of the image and write the OBJ record
+ $this->positionImage($col, $row, $x, $y, $width, $height);
+
+ // Write the IMDATA record to store the bitmap data
+ $record = 0x007f;
+ $length = 8 + $size;
+ $cf = 0x09;
+ $env = 0x01;
+ $lcb = $size;
+
+ $header = pack("vvvvV", $record, $length, $cf, $env, $lcb);
+ $this->append($header.$data);
+ }
+
+ /**
+ * Calculate the vertices that define the position of the image as required by
+ * the OBJ record.
+ *
+ * +------------+------------+
+ * | A | B |
+ * +-----+------------+------------+
+ * | |(x1,y1) | |
+ * | 1 |(A1)._______|______ |
+ * | | | | |
+ * | | | | |
+ * +-----+----| BITMAP |-----+
+ * | | | | |
+ * | 2 | |______________. |
+ * | | | (B2)|
+ * | | | (x2,y2)|
+ * +---- +------------+------------+
+ *
+ * Example of a bitmap that covers some of the area from cell A1 to cell B2.
+ *
+ * Based on the width and height of the bitmap we need to calculate 8 vars:
+ * $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
+ * The width and height of the cells are also variable and have to be taken into
+ * account.
+ * The values of $col_start and $row_start are passed in from the calling
+ * function. The values of $col_end and $row_end are calculated by subtracting
+ * the width and height of the bitmap from the width and height of the
+ * underlying cells.
+ * The vertices are expressed as a percentage of the underlying cell width as
+ * follows (rhs values are in pixels):
+ *
+ * x1 = X / W *1024
+ * y1 = Y / H *256
+ * x2 = (X-1) / W *1024
+ * y2 = (Y-1) / H *256
+ *
+ * Where: X is distance from the left side of the underlying cell
+ * Y is distance from the top of the underlying cell
+ * W is the width of the cell
+ * H is the height of the cell
+ * The SDK incorrectly states that the height should be expressed as a
+ * percentage of 1024.
+ *
+ * @access private
+ * @param integer $col_start Col containing upper left corner of object
+ * @param integer $row_start Row containing top left corner of object
+ * @param integer $x1 Distance to left side of object
+ * @param integer $y1 Distance to top of object
+ * @param integer $width Width of image frame
+ * @param integer $height Height of image frame
+ */
+ public function positionImage($col_start, $row_start, $x1, $y1, $width, $height)
+ {
+ // Initialise end cell to the same as the start cell
+ $col_end = $col_start; // Col containing lower right corner of object
+ $row_end = $row_start; // Row containing bottom right corner of object
+
+ // Zero the specified offset if greater than the cell dimensions
+ if ($x1 >= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start))) {
+ $x1 = 0;
+ }
+ if ($y1 >= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1)) {
+ $y1 = 0;
+ }
+
+ $width = $width + $x1 -1;
+ $height = $height + $y1 -1;
+
+ // Subtract the underlying cell widths to find the end cell of the image
+ while ($width >= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end))) {
+ $width -= PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end));
+ ++$col_end;
+ }
+
+ // Subtract the underlying cell heights to find the end cell of the image
+ while ($height >= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1)) {
+ $height -= PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1);
+ ++$row_end;
+ }
+
+ // Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
+ // with zero eight or width.
+ //
+ if (PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1) == 0) {
+ return;
+ }
+ if (PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1) == 0) {
+ return;
+ }
+
+ // Convert the pixel values to the percentage value expected by Excel
+ $x1 = $x1 / PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
+ $y1 = $y1 / PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_start + 1) * 256;
+ $x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
+ $y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->phpSheet, $row_end + 1) * 256; // Distance to bottom of object
+
+ $this->writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2);
+ }
+
+ /**
+ * Store the OBJ record that precedes an IMDATA record. This could be generalise
+ * to support other Excel objects.
+ *
+ * @param integer $colL Column containing upper left corner of object
+ * @param integer $dxL Distance from left side of cell
+ * @param integer $rwT Row containing top left corner of object
+ * @param integer $dyT Distance from top of cell
+ * @param integer $colR Column containing lower right corner of object
+ * @param integer $dxR Distance from right of cell
+ * @param integer $rwB Row containing bottom right corner of object
+ * @param integer $dyB Distance from bottom of cell
+ */
+ private function writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB)
+ {
+ $record = 0x005d; // Record identifier
+ $length = 0x003c; // Bytes to follow
+
+ $cObj = 0x0001; // Count of objects in file (set to 1)
+ $OT = 0x0008; // Object type. 8 = Picture
+ $id = 0x0001; // Object ID
+ $grbit = 0x0614; // Option flags
+
+ $cbMacro = 0x0000; // Length of FMLA structure
+ $Reserved1 = 0x0000; // Reserved
+ $Reserved2 = 0x0000; // Reserved
+
+ $icvBack = 0x09; // Background colour
+ $icvFore = 0x09; // Foreground colour
+ $fls = 0x00; // Fill pattern
+ $fAuto = 0x00; // Automatic fill
+ $icv = 0x08; // Line colour
+ $lns = 0xff; // Line style
+ $lnw = 0x01; // Line weight
+ $fAutoB = 0x00; // Automatic border
+ $frs = 0x0000; // Frame style
+ $cf = 0x0009; // Image format, 9 = bitmap
+ $Reserved3 = 0x0000; // Reserved
+ $cbPictFmla = 0x0000; // Length of FMLA structure
+ $Reserved4 = 0x0000; // Reserved
+ $grbit2 = 0x0001; // Option flags
+ $Reserved5 = 0x0000; // Reserved
+
+
+ $header = pack("vv", $record, $length);
+ $data = pack("V", $cObj);
+ $data .= pack("v", $OT);
+ $data .= pack("v", $id);
+ $data .= pack("v", $grbit);
+ $data .= pack("v", $colL);
+ $data .= pack("v", $dxL);
+ $data .= pack("v", $rwT);
+ $data .= pack("v", $dyT);
+ $data .= pack("v", $colR);
+ $data .= pack("v", $dxR);
+ $data .= pack("v", $rwB);
+ $data .= pack("v", $dyB);
+ $data .= pack("v", $cbMacro);
+ $data .= pack("V", $Reserved1);
+ $data .= pack("v", $Reserved2);
+ $data .= pack("C", $icvBack);
+ $data .= pack("C", $icvFore);
+ $data .= pack("C", $fls);
+ $data .= pack("C", $fAuto);
+ $data .= pack("C", $icv);
+ $data .= pack("C", $lns);
+ $data .= pack("C", $lnw);
+ $data .= pack("C", $fAutoB);
+ $data .= pack("v", $frs);
+ $data .= pack("V", $cf);
+ $data .= pack("v", $Reserved3);
+ $data .= pack("v", $cbPictFmla);
+ $data .= pack("v", $Reserved4);
+ $data .= pack("v", $grbit2);
+ $data .= pack("V", $Reserved5);
+
+ $this->append($header . $data);
+ }
+
+ /**
+ * Convert a GD-image into the internal format.
+ *
+ * @access private
+ * @param resource $image The image to process
+ * @return array Array with data and properties of the bitmap
+ */
+ public function processBitmapGd($image)
+ {
+ $width = imagesx($image);
+ $height = imagesy($image);
+
+ $data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
+ for ($j=$height; $j--;) {
+ for ($i=0; $i < $width; ++$i) {
+ $color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
+ foreach (array("red", "green", "blue") as $key) {
+ $color[$key] = $color[$key] + round((255 - $color[$key]) * $color["alpha"] / 127);
+ }
+ $data .= chr($color["blue"]) . chr($color["green"]) . chr($color["red"]);
+ }
+ if (3*$width % 4) {
+ $data .= str_repeat("\x00", 4 - 3*$width % 4);
+ }
+ }
+
+ return array($width, $height, strlen($data), $data);
+ }
+
+ /**
+ * Convert a 24 bit bitmap into the modified internal format used by Windows.
+ * This is described in BITMAPCOREHEADER and BITMAPCOREINFO structures in the
+ * MSDN library.
+ *
+ * @access private
+ * @param string $bitmap The bitmap to process
+ * @return array Array with data and properties of the bitmap
+ */
+ public function processBitmap($bitmap)
+ {
+ // Open file.
+ $bmp_fd = @fopen($bitmap, "rb");
+ if (!$bmp_fd) {
+ throw new PHPExcel_Writer_Exception("Couldn't import $bitmap");
+ }
+
+ // Slurp the file into a string.
+ $data = fread($bmp_fd, filesize($bitmap));
+
+ // Check that the file is big enough to be a bitmap.
+ if (strlen($data) <= 0x36) {
+ throw new PHPExcel_Writer_Exception("$bitmap doesn't contain enough data.\n");
+ }
+
+ // The first 2 bytes are used to identify the bitmap.
+ $identity = unpack("A2ident", $data);
+ if ($identity['ident'] != "BM") {
+ throw new PHPExcel_Writer_Exception("$bitmap doesn't appear to be a valid bitmap image.\n");
+ }
+
+ // Remove bitmap data: ID.
+ $data = substr($data, 2);
+
+ // Read and remove the bitmap size. This is more reliable than reading
+ // the data size at offset 0x22.
+ //
+ $size_array = unpack("Vsa", substr($data, 0, 4));
+ $size = $size_array['sa'];
+ $data = substr($data, 4);
+ $size -= 0x36; // Subtract size of bitmap header.
+ $size += 0x0C; // Add size of BIFF header.
+
+ // Remove bitmap data: reserved, offset, header length.
+ $data = substr($data, 12);
+
+ // Read and remove the bitmap width and height. Verify the sizes.
+ $width_and_height = unpack("V2", substr($data, 0, 8));
+ $width = $width_and_height[1];
+ $height = $width_and_height[2];
+ $data = substr($data, 8);
+ if ($width > 0xFFFF) {
+ throw new PHPExcel_Writer_Exception("$bitmap: largest image width supported is 65k.\n");
+ }
+ if ($height > 0xFFFF) {
+ throw new PHPExcel_Writer_Exception("$bitmap: largest image height supported is 65k.\n");
+ }
+
+ // Read and remove the bitmap planes and bpp data. Verify them.
+ $planes_and_bitcount = unpack("v2", substr($data, 0, 4));
+ $data = substr($data, 4);
+ if ($planes_and_bitcount[2] != 24) { // Bitcount
+ throw new PHPExcel_Writer_Exception("$bitmap isn't a 24bit true color bitmap.\n");
+ }
+ if ($planes_and_bitcount[1] != 1) {
+ throw new PHPExcel_Writer_Exception("$bitmap: only 1 plane supported in bitmap image.\n");
+ }
+
+ // Read and remove the bitmap compression. Verify compression.
+ $compression = unpack("Vcomp", substr($data, 0, 4));
+ $data = substr($data, 4);
+
+ //$compression = 0;
+ if ($compression['comp'] != 0) {
+ throw new PHPExcel_Writer_Exception("$bitmap: compression not supported in bitmap image.\n");
+ }
+
+ // Remove bitmap data: data size, hres, vres, colours, imp. colours.
+ $data = substr($data, 20);
+
+ // Add the BITMAPCOREHEADER data
+ $header = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
+ $data = $header . $data;
+
+ return (array($width, $height, $size, $data));
+ }
+
+ /**
+ * Store the window zoom factor. This should be a reduced fraction but for
+ * simplicity we will store all fractions with a numerator of 100.
+ */
+ private function writeZoom()
+ {
+ // If scale is 100 we don't need to write a record
+ if ($this->phpSheet->getSheetView()->getZoomScale() == 100) {
+ return;
+ }
+
+ $record = 0x00A0; // Record identifier
+ $length = 0x0004; // Bytes to follow
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vv", $this->phpSheet->getSheetView()->getZoomScale(), 100);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Get Escher object
+ *
+ * @return PHPExcel_Shared_Escher
+ */
+ public function getEscher()
+ {
+ return $this->escher;
+ }
+
+ /**
+ * Set Escher object
+ *
+ * @param PHPExcel_Shared_Escher $pValue
+ */
+ public function setEscher(PHPExcel_Shared_Escher $pValue = null)
+ {
+ $this->escher = $pValue;
+ }
+
+ /**
+ * Write MSODRAWING record
+ */
+ private function writeMsoDrawing()
+ {
+ // write the Escher stream if necessary
+ if (isset($this->escher)) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($this->escher);
+ $data = $writer->close();
+ $spOffsets = $writer->getSpOffsets();
+ $spTypes = $writer->getSpTypes();
+ // write the neccesary MSODRAWING, OBJ records
+
+ // split the Escher stream
+ $spOffsets[0] = 0;
+ $nm = count($spOffsets) - 1; // number of shapes excluding first shape
+ for ($i = 1; $i <= $nm; ++$i) {
+ // MSODRAWING record
+ $record = 0x00EC; // Record identifier
+
+ // chunk of Escher stream for one shape
+ $dataChunk = substr($data, $spOffsets[$i -1], $spOffsets[$i] - $spOffsets[$i - 1]);
+
+ $length = strlen($dataChunk);
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $dataChunk);
+
+ // OBJ record
+ $record = 0x005D; // record identifier
+ $objData = '';
+
+ // ftCmo
+ if ($spTypes[$i] == 0x00C9) {
+ // Add ftCmo (common object data) subobject
+ $objData .=
+ pack(
+ 'vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0014, // object type, 0x0014 = filter
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x2101, // option flags, 0x2001 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
+ );
+
+ // Add ftSbs Scroll bar subobject
+ $objData .= pack('vv', 0x00C, 0x0014);
+ $objData .= pack('H*', '0000000000000000640001000A00000010000100');
+ // Add ftLbsData (List box data) subobject
+ $objData .= pack('vv', 0x0013, 0x1FEE);
+ $objData .= pack('H*', '00000000010001030000020008005700');
+ } else {
+ // Add ftCmo (common object data) subobject
+ $objData .=
+ pack(
+ 'vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0008, // object type, 0x0008 = picture
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x6011, // option flags, 0x6011 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
+ );
+ }
+
+ // ftEnd
+ $objData .=
+ pack(
+ 'vv',
+ 0x0000, // 0x0000 = ftEnd
+ 0x0000 // length of ftEnd data
+ );
+
+ $length = strlen($objData);
+ $header = pack('vv', $record, $length);
+ $this->append($header . $objData);
+ }
+ }
+ }
+
+ /**
+ * Store the DATAVALIDATIONS and DATAVALIDATION records.
+ */
+ private function writeDataValidity()
+ {
+ // Datavalidation collection
+ $dataValidationCollection = $this->phpSheet->getDataValidationCollection();
+
+ // Write data validations?
+ if (!empty($dataValidationCollection)) {
+ // DATAVALIDATIONS record
+ $record = 0x01B2; // Record identifier
+ $length = 0x0012; // Bytes to follow
+
+ $grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
+ $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
+ $verPos = 0x00000000; // Vertical position of prompt box, if fixed position
+ $objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection));
+ $this->append($header.$data);
+
+ // DATAVALIDATION records
+ $record = 0x01BE; // Record identifier
+
+ foreach ($dataValidationCollection as $cellCoordinate => $dataValidation) {
+ // initialize record data
+ $data = '';
+
+ // options
+ $options = 0x00000000;
+
+ // data type
+ $type = $dataValidation->getType();
+ switch ($type) {
+ case PHPExcel_Cell_DataValidation::TYPE_NONE:
+ $type = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_WHOLE:
+ $type = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DECIMAL:
+ $type = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_LIST:
+ $type = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DATE:
+ $type = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TIME:
+ $type = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH:
+ $type = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_CUSTOM:
+ $type = 0x07;
+ break;
+ }
+ $options |= $type << 0;
+
+ // error style
+ $errorStyle = $dataValidation->getType();
+ switch ($errorStyle) {
+ case PHPExcel_Cell_DataValidation::STYLE_STOP:
+ $errorStyle = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_WARNING:
+ $errorStyle = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_INFORMATION:
+ $errorStyle = 0x02;
+ break;
+ }
+ $options |= $errorStyle << 4;
+
+ // explicit formula?
+ if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) {
+ $options |= 0x01 << 7;
+ }
+
+ // empty cells allowed
+ $options |= $dataValidation->getAllowBlank() << 8;
+
+ // show drop down
+ $options |= (!$dataValidation->getShowDropDown()) << 9;
+
+ // show input message
+ $options |= $dataValidation->getShowInputMessage() << 18;
+
+ // show error message
+ $options |= $dataValidation->getShowErrorMessage() << 19;
+
+ // condition operator
+ $operator = $dataValidation->getOperator();
+ switch ($operator) {
+ case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN:
+ $operator = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN:
+ $operator = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL:
+ $operator = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL:
+ $operator = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN:
+ $operator = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN:
+ $operator = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL:
+ $operator = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL:
+ $operator = 0x07;
+ break;
+ }
+ $options |= $operator << 20;
+
+ $data = pack('V', $options);
+
+ // prompt title
+ $promptTitle = $dataValidation->getPromptTitle() !== '' ?
+ $dataValidation->getPromptTitle() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($promptTitle);
+
+ // error title
+ $errorTitle = $dataValidation->getErrorTitle() !== '' ?
+ $dataValidation->getErrorTitle() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($errorTitle);
+
+ // prompt text
+ $prompt = $dataValidation->getPrompt() !== '' ?
+ $dataValidation->getPrompt() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($prompt);
+
+ // error text
+ $error = $dataValidation->getError() !== '' ?
+ $dataValidation->getError() : chr(0);
+ $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($error);
+
+ // formula 1
+ try {
+ $formula1 = $dataValidation->getFormula1();
+ if ($type == 0x03) { // list type
+ $formula1 = str_replace(',', chr(0), $formula1);
+ }
+ $this->parser->parse($formula1);
+ $formula1 = $this->parser->toReversePolish();
+ $sz1 = strlen($formula1);
+ } catch (PHPExcel_Exception $e) {
+ $sz1 = 0;
+ $formula1 = '';
+ }
+ $data .= pack('vv', $sz1, 0x0000);
+ $data .= $formula1;
+
+ // formula 2
+ try {
+ $formula2 = $dataValidation->getFormula2();
+ if ($formula2 === '') {
+ throw new PHPExcel_Writer_Exception('No formula2');
+ }
+ $this->parser->parse($formula2);
+ $formula2 = $this->parser->toReversePolish();
+ $sz2 = strlen($formula2);
+ } catch (PHPExcel_Exception $e) {
+ $sz2 = 0;
+ $formula2 = '';
+ }
+ $data .= pack('vv', $sz2, 0x0000);
+ $data .= $formula2;
+
+ // cell range address list
+ $data .= pack('v', 0x0001);
+ $data .= $this->writeBIFF8CellRangeAddressFixed($cellCoordinate);
+
+ $length = strlen($data);
+ $header = pack("vv", $record, $length);
+
+ $this->append($header . $data);
+ }
+ }
+ }
+
+ /**
+ * Map Error code
+ *
+ * @param string $errorCode
+ * @return int
+ */
+ private static function mapErrorCode($errorCode)
+ {
+ switch ($errorCode) {
+ case '#NULL!':
+ return 0x00;
+ case '#DIV/0!':
+ return 0x07;
+ case '#VALUE!':
+ return 0x0F;
+ case '#REF!':
+ return 0x17;
+ case '#NAME?':
+ return 0x1D;
+ case '#NUM!':
+ return 0x24;
+ case '#N/A':
+ return 0x2A;
+ }
+
+ return 0;
+ }
+
+ /**
+ * Write PLV Record
+ */
+ private function writePageLayoutView()
+ {
+ $record = 0x088B; // Record identifier
+ $length = 0x0010; // Bytes to follow
+
+ $rt = 0x088B; // 2
+ $grbitFrt = 0x0000; // 2
+ $reserved = 0x0000000000000000; // 8
+ $wScalvePLV = $this->phpSheet->getSheetView()->getZoomScale(); // 2
+
+ // The options flags that comprise $grbit
+ if ($this->phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) {
+ $fPageLayoutView = 1;
+ } else {
+ $fPageLayoutView = 0;
+ }
+ $fRulerVisible = 0;
+ $fWhitespaceHidden = 0;
+
+ $grbit = $fPageLayoutView; // 2
+ $grbit |= $fRulerVisible << 1;
+ $grbit |= $fWhitespaceHidden << 3;
+
+ $header = pack("vv", $record, $length);
+ $data = pack("vvVVvv", $rt, $grbitFrt, 0x00000000, 0x00000000, $wScalvePLV, $grbit);
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write CFRule Record
+ * @param PHPExcel_Style_Conditional $conditional
+ */
+ private function writeCFRule(PHPExcel_Style_Conditional $conditional)
+ {
+ $record = 0x01B1; // Record identifier
+
+ // $type : Type of the CF
+ // $operatorType : Comparison operator
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
+ $type = 0x02;
+ $operatorType = 0x00;
+ } elseif ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ $type = 0x01;
+
+ switch ($conditional->getOperatorType()) {
+ case PHPExcel_Style_Conditional::OPERATOR_NONE:
+ $operatorType = 0x00;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_EQUAL:
+ $operatorType = 0x03;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_GREATERTHAN:
+ $operatorType = 0x05;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL:
+ $operatorType = 0x07;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_LESSTHAN:
+ $operatorType = 0x06;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_LESSTHANOREQUAL:
+ $operatorType = 0x08;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_NOTEQUAL:
+ $operatorType = 0x04;
+ break;
+ case PHPExcel_Style_Conditional::OPERATOR_BETWEEN:
+ $operatorType = 0x01;
+ break;
+ // not OPERATOR_NOTBETWEEN 0x02
+ }
+ }
+
+ // $szValue1 : size of the formula data for first value or formula
+ // $szValue2 : size of the formula data for second value or formula
+ $arrConditions = $conditional->getConditions();
+ $numConditions = sizeof($arrConditions);
+ if ($numConditions == 1) {
+ $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
+ $szValue2 = 0x0000;
+ $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
+ $operand2 = null;
+ } elseif ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
+ $szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
+ $szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
+ $operand1 = pack('Cv', 0x1E, $arrConditions[0]);
+ $operand2 = pack('Cv', 0x1E, $arrConditions[1]);
+ } else {
+ $szValue1 = 0x0000;
+ $szValue2 = 0x0000;
+ $operand1 = null;
+ $operand2 = null;
+ }
+
+ // $flags : Option flags
+ // Alignment
+ $bAlignHz = ($conditional->getStyle()->getAlignment()->getHorizontal() == null ? 1 : 0);
+ $bAlignVt = ($conditional->getStyle()->getAlignment()->getVertical() == null ? 1 : 0);
+ $bAlignWrapTx = ($conditional->getStyle()->getAlignment()->getWrapText() == false ? 1 : 0);
+ $bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0);
+ $bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0);
+ $bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0);
+ if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) {
+ $bFormatAlign = 1;
+ } else {
+ $bFormatAlign = 0;
+ }
+ // Protection
+ $bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0);
+ $bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0);
+ if ($bProtLocked == 0 || $bProtHidden == 0) {
+ $bFormatProt = 1;
+ } else {
+ $bFormatProt = 0;
+ }
+ // Border
+ $bBorderLeft = ($conditional->getStyle()->getBorders()->getLeft()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getLeft()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderRight = ($conditional->getStyle()->getBorders()->getRight()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getRight()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderTop = ($conditional->getStyle()->getBorders()->getTop()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ $bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
+ && $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
+ if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) {
+ $bFormatBorder = 1;
+ } else {
+ $bFormatBorder = 0;
+ }
+ // Pattern
+ $bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1);
+ $bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1);
+ $bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1);
+ if ($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0) {
+ $bFormatFill = 1;
+ } else {
+ $bFormatFill = 0;
+ }
+ // Font
+ if ($conditional->getStyle()->getFont()->getName() != null
+ || $conditional->getStyle()->getFont()->getSize() != null
+ || $conditional->getStyle()->getFont()->getBold() != null
+ || $conditional->getStyle()->getFont()->getItalic() != null
+ || $conditional->getStyle()->getFont()->getSuperScript() != null
+ || $conditional->getStyle()->getFont()->getSubScript() != null
+ || $conditional->getStyle()->getFont()->getUnderline() != null
+ || $conditional->getStyle()->getFont()->getStrikethrough() != null
+ || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) {
+ $bFormatFont = 1;
+ } else {
+ $bFormatFont = 0;
+ }
+ // Alignment
+ $flags = 0;
+ $flags |= (1 == $bAlignHz ? 0x00000001 : 0);
+ $flags |= (1 == $bAlignVt ? 0x00000002 : 0);
+ $flags |= (1 == $bAlignWrapTx ? 0x00000004 : 0);
+ $flags |= (1 == $bTxRotation ? 0x00000008 : 0);
+ // Justify last line flag
+ $flags |= (1 == 1 ? 0x00000010 : 0);
+ $flags |= (1 == $bIndent ? 0x00000020 : 0);
+ $flags |= (1 == $bShrinkToFit ? 0x00000040 : 0);
+ // Default
+ $flags |= (1 == 1 ? 0x00000080 : 0);
+ // Protection
+ $flags |= (1 == $bProtLocked ? 0x00000100 : 0);
+ $flags |= (1 == $bProtHidden ? 0x00000200 : 0);
+ // Border
+ $flags |= (1 == $bBorderLeft ? 0x00000400 : 0);
+ $flags |= (1 == $bBorderRight ? 0x00000800 : 0);
+ $flags |= (1 == $bBorderTop ? 0x00001000 : 0);
+ $flags |= (1 == $bBorderBottom ? 0x00002000 : 0);
+ $flags |= (1 == 1 ? 0x00004000 : 0); // Top left to Bottom right border
+ $flags |= (1 == 1 ? 0x00008000 : 0); // Bottom left to Top right border
+ // Pattern
+ $flags |= (1 == $bFillStyle ? 0x00010000 : 0);
+ $flags |= (1 == $bFillColor ? 0x00020000 : 0);
+ $flags |= (1 == $bFillColorBg ? 0x00040000 : 0);
+ $flags |= (1 == 1 ? 0x00380000 : 0);
+ // Font
+ $flags |= (1 == $bFormatFont ? 0x04000000 : 0);
+ // Alignment:
+ $flags |= (1 == $bFormatAlign ? 0x08000000 : 0);
+ // Border
+ $flags |= (1 == $bFormatBorder ? 0x10000000 : 0);
+ // Pattern
+ $flags |= (1 == $bFormatFill ? 0x20000000 : 0);
+ // Protection
+ $flags |= (1 == $bFormatProt ? 0x40000000 : 0);
+ // Text direction
+ $flags |= (1 == 0 ? 0x80000000 : 0);
+
+ // Data Blocks
+ if ($bFormatFont == 1) {
+ // Font Name
+ if ($conditional->getStyle()->getFont()->getName() == null) {
+ $dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
+ $dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
+ } else {
+ $dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
+ }
+ // Font Size
+ if ($conditional->getStyle()->getFont()->getSize() == null) {
+ $dataBlockFont .= pack('V', 20 * 11);
+ } else {
+ $dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize());
+ }
+ // Font Options
+ $dataBlockFont .= pack('V', 0);
+ // Font weight
+ if ($conditional->getStyle()->getFont()->getBold() == true) {
+ $dataBlockFont .= pack('v', 0x02BC);
+ } else {
+ $dataBlockFont .= pack('v', 0x0190);
+ }
+ // Escapement type
+ if ($conditional->getStyle()->getFont()->getSubScript() == true) {
+ $dataBlockFont .= pack('v', 0x02);
+ $fontEscapement = 0;
+ } elseif ($conditional->getStyle()->getFont()->getSuperScript() == true) {
+ $dataBlockFont .= pack('v', 0x01);
+ $fontEscapement = 0;
+ } else {
+ $dataBlockFont .= pack('v', 0x00);
+ $fontEscapement = 1;
+ }
+ // Underline type
+ switch ($conditional->getStyle()->getFont()->getUnderline()) {
+ case PHPExcel_Style_Font::UNDERLINE_NONE:
+ $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLE:
+ $dataBlockFont .= pack('C', 0x02);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x22);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLE:
+ $dataBlockFont .= pack('C', 0x01);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x21);
+ $fontUnderline = 0;
+ break;
+ default: $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 1;
+ break;
+ }
+ // Not used (3)
+ $dataBlockFont .= pack('vC', 0x0000, 0x00);
+ // Font color index
+ switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) {
+ case '000000':
+ $colorIdx = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdx = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdx = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdx = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdx = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x0F;
+ break;
+ case '800000':
+ $colorIdx = 0x10;
+ break;
+ case '008000':
+ $colorIdx = 0x11;
+ break;
+ case '000080':
+ $colorIdx = 0x12;
+ break;
+ case '808000':
+ $colorIdx = 0x13;
+ break;
+ case '800080':
+ $colorIdx = 0x14;
+ break;
+ case '008080':
+ $colorIdx = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdx = 0x16;
+ break;
+ case '808080':
+ $colorIdx = 0x17;
+ break;
+ case '9999FF':
+ $colorIdx = 0x18;
+ break;
+ case '993366':
+ $colorIdx = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdx = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x1B;
+ break;
+ case '660066':
+ $colorIdx = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdx = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdx = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdx = 0x1F;
+ break;
+ case '000080':
+ $colorIdx = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x23;
+ break;
+ case '800080':
+ $colorIdx = 0x24;
+ break;
+ case '800000':
+ $colorIdx = 0x25;
+ break;
+ case '008080':
+ $colorIdx = 0x26;
+ break;
+ case '0000FF':
+ $colorIdx = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdx = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdx = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdx = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdx = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdx = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdx = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdx = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdx = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdx = 0x31;
+ break;
+ case '99CC00':
+ $colorIdx = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdx = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdx = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdx = 0x35;
+ break;
+ case '666699':
+ $colorIdx = 0x36;
+ break;
+ case '969696':
+ $colorIdx = 0x37;
+ break;
+ case '003366':
+ $colorIdx = 0x38;
+ break;
+ case '339966':
+ $colorIdx = 0x39;
+ break;
+ case '003300':
+ $colorIdx = 0x3A;
+ break;
+ case '333300':
+ $colorIdx = 0x3B;
+ break;
+ case '993300':
+ $colorIdx = 0x3C;
+ break;
+ case '993366':
+ $colorIdx = 0x3D;
+ break;
+ case '333399':
+ $colorIdx = 0x3E;
+ break;
+ case '333333':
+ $colorIdx = 0x3F;
+ break;
+ default:
+ $colorIdx = 0x00;
+ break;
+ }
+ $dataBlockFont .= pack('V', $colorIdx);
+ // Not used (4)
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Options flags for modified font attributes
+ $optionsFlags = 0;
+ $optionsFlagsBold = ($conditional->getStyle()->getFont()->getBold() == null ? 1 : 0);
+ $optionsFlags |= (1 == $optionsFlagsBold ? 0x00000002 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000008 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000010 : 0);
+ $optionsFlags |= (1 == 0 ? 0x00000020 : 0);
+ $optionsFlags |= (1 == 1 ? 0x00000080 : 0);
+ $dataBlockFont .= pack('V', $optionsFlags);
+ // Escapement type
+ $dataBlockFont .= pack('V', $fontEscapement);
+ // Underline type
+ $dataBlockFont .= pack('V', $fontUnderline);
+ // Always
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Always
+ $dataBlockFont .= pack('V', 0x00000000);
+ // Not used (8)
+ $dataBlockFont .= pack('VV', 0x00000000, 0x00000000);
+ // Always
+ $dataBlockFont .= pack('v', 0x0001);
+ }
+ if ($bFormatAlign == 1) {
+ $blockAlign = 0;
+ // Alignment and text break
+ switch ($conditional->getStyle()->getAlignment()->getHorizontal()) {
+ case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
+ $blockAlign = 0;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_LEFT:
+ $blockAlign = 1;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT:
+ $blockAlign = 3;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER:
+ $blockAlign = 2;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
+ $blockAlign = 6;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY:
+ $blockAlign = 5;
+ break;
+ }
+ if ($conditional->getStyle()->getAlignment()->getWrapText() == true) {
+ $blockAlign |= 1 << 3;
+ } else {
+ $blockAlign |= 0 << 3;
+ }
+ switch ($conditional->getStyle()->getAlignment()->getVertical()) {
+ case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
+ $blockAlign = 2 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_TOP:
+ $blockAlign = 0 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_CENTER:
+ $blockAlign = 1 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
+ $blockAlign = 3 << 4;
+ break;
+ }
+ $blockAlign |= 0 << 7;
+
+ // Text rotation angle
+ $blockRotation = $conditional->getStyle()->getAlignment()->getTextRotation();
+
+ // Indentation
+ $blockIndent = $conditional->getStyle()->getAlignment()->getIndent();
+ if ($conditional->getStyle()->getAlignment()->getShrinkToFit() == true) {
+ $blockIndent |= 1 << 4;
+ } else {
+ $blockIndent |= 0 << 4;
+ }
+ $blockIndent |= 0 << 6;
+
+ // Relative indentation
+ $blockIndentRelative = 255;
+
+ $dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000);
+ }
+ if ($bFormatBorder == 1) {
+ $blockLineStyle = 0;
+ switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 4;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 8;
+ break;
+ }
+ switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 12;
+ break;
+ }
+ //@todo writeCFRule() => $blockLineStyle => Index Color for left line
+ //@todo writeCFRule() => $blockLineStyle => Index Color for right line
+ //@todo writeCFRule() => $blockLineStyle => Top-left to bottom-right on/off
+ //@todo writeCFRule() => $blockLineStyle => Bottom-left to top-right on/off
+ $blockColor = 0;
+ //@todo writeCFRule() => $blockColor => Index Color for top line
+ //@todo writeCFRule() => $blockColor => Index Color for bottom line
+ //@todo writeCFRule() => $blockColor => Index Color for diagonal line
+ switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockColor |= 0x00 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockColor |= 0x01 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockColor |= 0x02 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockColor |= 0x03 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockColor |= 0x04 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockColor |= 0x05 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockColor |= 0x06 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockColor |= 0x07 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockColor |= 0x08 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockColor |= 0x09 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockColor |= 0x0A << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockColor |= 0x0B << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockColor |= 0x0C << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockColor |= 0x0D << 21;
+ break;
+ }
+ $dataBlockBorder = pack('vv', $blockLineStyle, $blockColor);
+ }
+ if ($bFormatFill == 1) {
+ // Fill Patern Style
+ $blockFillPatternStyle = 0;
+ switch ($conditional->getStyle()->getFill()->getFillType()) {
+ case PHPExcel_Style_Fill::FILL_NONE:
+ $blockFillPatternStyle = 0x00;
+ break;
+ case PHPExcel_Style_Fill::FILL_SOLID:
+ $blockFillPatternStyle = 0x01;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY:
+ $blockFillPatternStyle = 0x02;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY:
+ $blockFillPatternStyle = 0x03;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY:
+ $blockFillPatternStyle = 0x04;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL:
+ $blockFillPatternStyle = 0x05;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL:
+ $blockFillPatternStyle = 0x06;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN:
+ $blockFillPatternStyle = 0x07;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP:
+ $blockFillPatternStyle = 0x08;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID:
+ $blockFillPatternStyle = 0x09;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS:
+ $blockFillPatternStyle = 0x0A;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL:
+ $blockFillPatternStyle = 0x0B;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL:
+ $blockFillPatternStyle = 0x0C;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN:
+ $blockFillPatternStyle = 0x0D;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP:
+ $blockFillPatternStyle = 0x0E;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID:
+ $blockFillPatternStyle = 0x0F;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS:
+ $blockFillPatternStyle = 0x10;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125:
+ $blockFillPatternStyle = 0x11;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625:
+ $blockFillPatternStyle = 0x12;
+ break;
+ case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ case PHPExcel_Style_Fill::FILL_GRADIENT_PATH:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ default:
+ $blockFillPatternStyle = 0x00;
+ break;
+ }
+ // Color
+ switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) {
+ case '000000':
+ $colorIdxBg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxBg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxBg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxBg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxBg = 0x10;
+ break;
+ case '008000':
+ $colorIdxBg = 0x11;
+ break;
+ case '000080':
+ $colorIdxBg = 0x12;
+ break;
+ case '808000':
+ $colorIdxBg = 0x13;
+ break;
+ case '800080':
+ $colorIdxBg = 0x14;
+ break;
+ case '008080':
+ $colorIdxBg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxBg = 0x16;
+ break;
+ case '808080':
+ $colorIdxBg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxBg = 0x18;
+ break;
+ case '993366':
+ $colorIdxBg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxBg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxBg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxBg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxBg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxBg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxBg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x23;
+ break;
+ case '800080':
+ $colorIdxBg = 0x24;
+ break;
+ case '800000':
+ $colorIdxBg = 0x25;
+ break;
+ case '008080':
+ $colorIdxBg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxBg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxBg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxBg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxBg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxBg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxBg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxBg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxBg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxBg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxBg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxBg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxBg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxBg = 0x35;
+ break;
+ case '666699':
+ $colorIdxBg = 0x36;
+ break;
+ case '969696':
+ $colorIdxBg = 0x37;
+ break;
+ case '003366':
+ $colorIdxBg = 0x38;
+ break;
+ case '339966':
+ $colorIdxBg = 0x39;
+ break;
+ case '003300':
+ $colorIdxBg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxBg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxBg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxBg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxBg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxBg = 0x3F;
+ break;
+ default:
+ $colorIdxBg = 0x41;
+ break;
+ }
+ // Fg Color
+ switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) {
+ case '000000':
+ $colorIdxFg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxFg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxFg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxFg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxFg = 0x10;
+ break;
+ case '008000':
+ $colorIdxFg = 0x11;
+ break;
+ case '000080':
+ $colorIdxFg = 0x12;
+ break;
+ case '808000':
+ $colorIdxFg = 0x13;
+ break;
+ case '800080':
+ $colorIdxFg = 0x14;
+ break;
+ case '008080':
+ $colorIdxFg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxFg = 0x16;
+ break;
+ case '808080':
+ $colorIdxFg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxFg = 0x18;
+ break;
+ case '993366':
+ $colorIdxFg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxFg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxFg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxFg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxFg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxFg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxFg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x23;
+ break;
+ case '800080':
+ $colorIdxFg = 0x24;
+ break;
+ case '800000':
+ $colorIdxFg = 0x25;
+ break;
+ case '008080':
+ $colorIdxFg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxFg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxFg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxFg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxFg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxFg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxFg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxFg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxFg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxFg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxFg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxFg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxFg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxFg = 0x35;
+ break;
+ case '666699':
+ $colorIdxFg = 0x36;
+ break;
+ case '969696':
+ $colorIdxFg = 0x37;
+ break;
+ case '003366':
+ $colorIdxFg = 0x38;
+ break;
+ case '339966':
+ $colorIdxFg = 0x39;
+ break;
+ case '003300':
+ $colorIdxFg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxFg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxFg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxFg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxFg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxFg = 0x3F;
+ break;
+ default:
+ $colorIdxFg = 0x40;
+ break;
+ }
+ $dataBlockFill = pack('v', $blockFillPatternStyle);
+ $dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7));
+ }
+ if ($bFormatProt == 1) {
+ $dataBlockProtection = 0;
+ if ($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
+ $dataBlockProtection = 1;
+ }
+ if ($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
+ $dataBlockProtection = 1 << 1;
+ }
+ }
+
+ $data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000);
+ if ($bFormatFont == 1) { // Block Formatting : OK
+ $data .= $dataBlockFont;
+ }
+ if ($bFormatAlign == 1) {
+ $data .= $dataBlockAlign;
+ }
+ if ($bFormatBorder == 1) {
+ $data .= $dataBlockBorder;
+ }
+ if ($bFormatFill == 1) { // Block Formatting : OK
+ $data .= $dataBlockFill;
+ }
+ if ($bFormatProt == 1) {
+ $data .= $dataBlockProtection;
+ }
+ if (!is_null($operand1)) {
+ $data .= $operand1;
+ }
+ if (!is_null($operand2)) {
+ $data .= $operand2;
+ }
+ $header = pack('vv', $record, strlen($data));
+ $this->append($header . $data);
+ }
+
+ /**
+ * Write CFHeader record
+ */
+ private function writeCFHeader()
+ {
+ $record = 0x01B0; // Record identifier
+ $length = 0x0016; // Bytes to follow
+
+ $numColumnMin = null;
+ $numColumnMax = null;
+ $numRowMin = null;
+ $numRowMax = null;
+ $arrConditional = array();
+ foreach ($this->phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
+ foreach ($conditionalStyles as $conditional) {
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
+ $arrConditional[] = $conditional->getHashCode();
+ }
+ // Cells
+ $arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate);
+ if (!is_numeric($arrCoord[0])) {
+ $arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]);
+ }
+ if (is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])) {
+ $numColumnMin = $arrCoord[0];
+ }
+ if (is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])) {
+ $numColumnMax = $arrCoord[0];
+ }
+ if (is_null($numRowMin) || ($numRowMin > $arrCoord[1])) {
+ $numRowMin = $arrCoord[1];
+ }
+ if (is_null($numRowMax) || ($numRowMax < $arrCoord[1])) {
+ $numRowMax = $arrCoord[1];
+ }
+ }
+ }
+ }
+ $needRedraw = 1;
+ $cellRange = pack('vvvv', $numRowMin-1, $numRowMax-1, $numColumnMin-1, $numColumnMax-1);
+
+ $header = pack('vv', $record, $length);
+ $data = pack('vv', count($arrConditional), $needRedraw);
+ $data .= $cellRange;
+ $data .= pack('v', 0x0001);
+ $data .= $cellRange;
+ $this->append($header . $data);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Xf.php b/Classes/PHPExcel/Writer/Excel5/Xf.php
new file mode 100644
index 0000000..e41589a
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Excel5/Xf.php
@@ -0,0 +1,557 @@
+
+// *
+// * The majority of this is _NOT_ my code. I simply ported it from the
+// * PERL Spreadsheet::WriteExcel module.
+// *
+// * The author of the Spreadsheet::WriteExcel module is John McNamara
+// *
+// *
+// * I _DO_ maintain this code, and John McNamara has nothing to do with the
+// * porting of this code to PHP. Any questions directly related to this
+// * class library should be directed to me.
+// *
+// * License Information:
+// *
+// * Spreadsheet_Excel_Writer: A library for generating Excel Spreadsheets
+// * Copyright (c) 2002-2003 Xavier Noguer xnoguer@rezebra.com
+// *
+// * This library is free software; you can redistribute it and/or
+// * modify it under the terms of the GNU Lesser General Public
+// * License as published by the Free Software Foundation; either
+// * version 2.1 of the License, or (at your option) any later version.
+// *
+// * This library is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// * Lesser General Public License for more details.
+// *
+// * You should have received a copy of the GNU Lesser General Public
+// * License along with this library; if not, write to the Free Software
+// * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// */
+class PHPExcel_Writer_Excel5_Xf
+{
+ /**
+ * Style XF or a cell XF ?
+ *
+ * @var boolean
+ */
+ private $isStyleXf;
+
+ /**
+ * Index to the FONT record. Index 4 does not exist
+ * @var integer
+ */
+ private $fontIndex;
+
+ /**
+ * An index (2 bytes) to a FORMAT record (number format).
+ * @var integer
+ */
+ private $numberFormatIndex;
+
+ /**
+ * 1 bit, apparently not used.
+ * @var integer
+ */
+ private $textJustLast;
+
+ /**
+ * The cell's foreground color.
+ * @var integer
+ */
+ private $foregroundColor;
+
+ /**
+ * The cell's background color.
+ * @var integer
+ */
+ private $backgroundColor;
+
+ /**
+ * Color of the bottom border of the cell.
+ * @var integer
+ */
+ private $bottomBorderColor;
+
+ /**
+ * Color of the top border of the cell.
+ * @var integer
+ */
+ private $topBorderColor;
+
+ /**
+ * Color of the left border of the cell.
+ * @var integer
+ */
+ private $leftBorderColor;
+
+ /**
+ * Color of the right border of the cell.
+ * @var integer
+ */
+ private $rightBorderColor;
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @param PHPExcel_Style The XF format
+ */
+ public function __construct(PHPExcel_Style $style = null)
+ {
+ $this->isStyleXf = false;
+ $this->fontIndex = 0;
+
+ $this->numberFormatIndex = 0;
+
+ $this->textJustLast = 0;
+
+ $this->foregroundColor = 0x40;
+ $this->backgroundColor = 0x41;
+
+ $this->_diag = 0;
+
+ $this->bottomBorderColor = 0x40;
+ $this->topBorderColor = 0x40;
+ $this->leftBorderColor = 0x40;
+ $this->rightBorderColor = 0x40;
+ $this->_diag_color = 0x40;
+ $this->_style = $style;
+
+ }
+
+
+ /**
+ * Generate an Excel BIFF XF record (style or cell).
+ *
+ * @return string The XF record
+ */
+ public function writeXf()
+ {
+ // Set the type of the XF record and some of the attributes.
+ if ($this->isStyleXf) {
+ $style = 0xFFF5;
+ } else {
+ $style = self::mapLocked($this->_style->getProtection()->getLocked());
+ $style |= self::mapHidden($this->_style->getProtection()->getHidden()) << 1;
+ }
+
+ // Flags to indicate if attributes have been set.
+ $atr_num = ($this->numberFormatIndex != 0)?1:0;
+ $atr_fnt = ($this->fontIndex != 0)?1:0;
+ $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
+ $atr_bdr = (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
+ self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
+ self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
+ self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()))?1:0;
+ $atr_pat = (($this->foregroundColor != 0x40) ||
+ ($this->backgroundColor != 0x41) ||
+ self::mapFillType($this->_style->getFill()->getFillType()))?1:0;
+ $atr_prot = self::mapLocked($this->_style->getProtection()->getLocked())
+ | self::mapHidden($this->_style->getProtection()->getHidden());
+
+ // Zero the default border colour if the border has not been set.
+ if (self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) == 0) {
+ $this->bottomBorderColor = 0;
+ }
+ if (self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) == 0) {
+ $this->topBorderColor = 0;
+ }
+ if (self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) == 0) {
+ $this->rightBorderColor = 0;
+ }
+ if (self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) == 0) {
+ $this->leftBorderColor = 0;
+ }
+ if (self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) == 0) {
+ $this->_diag_color = 0;
+ }
+
+ $record = 0x00E0; // Record identifier
+ $length = 0x0014; // Number of bytes to follow
+
+ $ifnt = $this->fontIndex; // Index to FONT record
+ $ifmt = $this->numberFormatIndex; // Index to FORMAT record
+
+ $align = $this->mapHAlign($this->_style->getAlignment()->getHorizontal()); // Alignment
+ $align |= (int) $this->_style->getAlignment()->getWrapText() << 3;
+ $align |= self::mapVAlign($this->_style->getAlignment()->getVertical()) << 4;
+ $align |= $this->textJustLast << 7;
+
+ $used_attrib = $atr_num << 2;
+ $used_attrib |= $atr_fnt << 3;
+ $used_attrib |= $atr_alc << 4;
+ $used_attrib |= $atr_bdr << 5;
+ $used_attrib |= $atr_pat << 6;
+ $used_attrib |= $atr_prot << 7;
+
+ $icv = $this->foregroundColor; // fg and bg pattern colors
+ $icv |= $this->backgroundColor << 7;
+
+ $border1 = self::mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()); // Border line style and color
+ $border1 |= self::mapBorderStyle($this->_style->getBorders()->getRight()->getBorderStyle()) << 4;
+ $border1 |= self::mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) << 8;
+ $border1 |= self::mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) << 12;
+ $border1 |= $this->leftBorderColor << 16;
+ $border1 |= $this->rightBorderColor << 23;
+
+ $diagonalDirection = $this->_style->getBorders()->getDiagonalDirection();
+ $diag_tl_to_rb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
+ || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_DOWN;
+ $diag_tr_to_lb = $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_BOTH
+ || $diagonalDirection == PHPExcel_Style_Borders::DIAGONAL_UP;
+ $border1 |= $diag_tl_to_rb << 30;
+ $border1 |= $diag_tr_to_lb << 31;
+
+ $border2 = $this->topBorderColor; // Border color
+ $border2 |= $this->bottomBorderColor << 7;
+ $border2 |= $this->_diag_color << 14;
+ $border2 |= self::mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
+ $border2 |= self::mapFillType($this->_style->getFill()->getFillType()) << 26;
+
+ $header = pack("vv", $record, $length);
+
+ //BIFF8 options: identation, shrinkToFit and text direction
+ $biff8_options = $this->_style->getAlignment()->getIndent();
+ $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
+
+ $data = pack("vvvC", $ifnt, $ifmt, $style, $align);
+ $data .= pack("CCC", self::mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
+ $data .= pack("VVv", $border1, $border2, $icv);
+
+ return($header . $data);
+ }
+
+ /**
+ * Is this a style XF ?
+ *
+ * @param boolean $value
+ */
+ public function setIsStyleXf($value)
+ {
+ $this->isStyleXf = $value;
+ }
+
+ /**
+ * Sets the cell's bottom border color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setBottomColor($colorIndex)
+ {
+ $this->bottomBorderColor = $colorIndex;
+ }
+
+ /**
+ * Sets the cell's top border color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setTopColor($colorIndex)
+ {
+ $this->topBorderColor = $colorIndex;
+ }
+
+ /**
+ * Sets the cell's left border color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setLeftColor($colorIndex)
+ {
+ $this->leftBorderColor = $colorIndex;
+ }
+
+ /**
+ * Sets the cell's right border color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setRightColor($colorIndex)
+ {
+ $this->rightBorderColor = $colorIndex;
+ }
+
+ /**
+ * Sets the cell's diagonal border color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setDiagColor($colorIndex)
+ {
+ $this->_diag_color = $colorIndex;
+ }
+
+
+ /**
+ * Sets the cell's foreground color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setFgColor($colorIndex)
+ {
+ $this->foregroundColor = $colorIndex;
+ }
+
+ /**
+ * Sets the cell's background color
+ *
+ * @access public
+ * @param int $colorIndex Color index
+ */
+ public function setBgColor($colorIndex)
+ {
+ $this->backgroundColor = $colorIndex;
+ }
+
+ /**
+ * Sets the index to the number format record
+ * It can be date, time, currency, etc...
+ *
+ * @access public
+ * @param integer $numberFormatIndex Index to format record
+ */
+ public function setNumberFormatIndex($numberFormatIndex)
+ {
+ $this->numberFormatIndex = $numberFormatIndex;
+ }
+
+ /**
+ * Set the font index.
+ *
+ * @param int $value Font index, note that value 4 does not exist
+ */
+ public function setFontIndex($value)
+ {
+ $this->fontIndex = $value;
+ }
+
+ /**
+ * Map of BIFF2-BIFF8 codes for border styles
+ * @static array of int
+ *
+ */
+ private static $mapBorderStyles = array(
+ PHPExcel_Style_Border::BORDER_NONE => 0x00,
+ PHPExcel_Style_Border::BORDER_THIN => 0x01,
+ PHPExcel_Style_Border::BORDER_MEDIUM => 0x02,
+ PHPExcel_Style_Border::BORDER_DASHED => 0x03,
+ PHPExcel_Style_Border::BORDER_DOTTED => 0x04,
+ PHPExcel_Style_Border::BORDER_THICK => 0x05,
+ PHPExcel_Style_Border::BORDER_DOUBLE => 0x06,
+ PHPExcel_Style_Border::BORDER_HAIR => 0x07,
+ PHPExcel_Style_Border::BORDER_MEDIUMDASHED => 0x08,
+ PHPExcel_Style_Border::BORDER_DASHDOT => 0x09,
+ PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT => 0x0A,
+ PHPExcel_Style_Border::BORDER_DASHDOTDOT => 0x0B,
+ PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT => 0x0C,
+ PHPExcel_Style_Border::BORDER_SLANTDASHDOT => 0x0D,
+ );
+
+ /**
+ * Map border style
+ *
+ * @param string $borderStyle
+ * @return int
+ */
+ private static function mapBorderStyle($borderStyle)
+ {
+ if (isset(self::$mapBorderStyles[$borderStyle])) {
+ return self::$mapBorderStyles[$borderStyle];
+ }
+ return 0x00;
+ }
+
+ /**
+ * Map of BIFF2-BIFF8 codes for fill types
+ * @static array of int
+ *
+ */
+ private static $mapFillTypes = array(
+ PHPExcel_Style_Fill::FILL_NONE => 0x00,
+ PHPExcel_Style_Fill::FILL_SOLID => 0x01,
+ PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY => 0x02,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY => 0x03,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY => 0x04,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL => 0x05,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL => 0x06,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN => 0x07,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKUP => 0x08,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID => 0x09,
+ PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS => 0x0A,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL => 0x0B,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL => 0x0C,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN => 0x0D,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP => 0x0E,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID => 0x0F,
+ PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS => 0x10,
+ PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 => 0x11,
+ PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 => 0x12,
+ PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR => 0x00, // does not exist in BIFF8
+ PHPExcel_Style_Fill::FILL_GRADIENT_PATH => 0x00, // does not exist in BIFF8
+ );
+
+ /**
+ * Map fill type
+ *
+ * @param string $fillType
+ * @return int
+ */
+ private static function mapFillType($fillType)
+ {
+ if (isset(self::$mapFillTypes[$fillType])) {
+ return self::$mapFillTypes[$fillType];
+ }
+ return 0x00;
+ }
+
+ /**
+ * Map of BIFF2-BIFF8 codes for horizontal alignment
+ * @static array of int
+ *
+ */
+ private static $mapHAlignments = array(
+ PHPExcel_Style_Alignment::HORIZONTAL_GENERAL => 0,
+ PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
+ PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
+ PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
+ PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4,
+ PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
+ PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
+ );
+
+ /**
+ * Map to BIFF2-BIFF8 codes for horizontal alignment
+ *
+ * @param string $hAlign
+ * @return int
+ */
+ private function mapHAlign($hAlign)
+ {
+ if (isset(self::$mapHAlignments[$hAlign])) {
+ return self::$mapHAlignments[$hAlign];
+ }
+ return 0;
+ }
+
+ /**
+ * Map of BIFF2-BIFF8 codes for vertical alignment
+ * @static array of int
+ *
+ */
+ private static $mapVAlignments = array(
+ PHPExcel_Style_Alignment::VERTICAL_TOP => 0,
+ PHPExcel_Style_Alignment::VERTICAL_CENTER => 1,
+ PHPExcel_Style_Alignment::VERTICAL_BOTTOM => 2,
+ PHPExcel_Style_Alignment::VERTICAL_JUSTIFY => 3,
+ );
+
+ /**
+ * Map to BIFF2-BIFF8 codes for vertical alignment
+ *
+ * @param string $vAlign
+ * @return int
+ */
+ private static function mapVAlign($vAlign)
+ {
+ if (isset(self::$mapVAlignments[$vAlign])) {
+ return self::$mapVAlignments[$vAlign];
+ }
+ return 2;
+ }
+
+ /**
+ * Map to BIFF8 codes for text rotation angle
+ *
+ * @param int $textRotation
+ * @return int
+ */
+ private static function mapTextRotation($textRotation)
+ {
+ if ($textRotation >= 0) {
+ return $textRotation;
+ } elseif ($textRotation == -165) {
+ return 255;
+ } elseif ($textRotation < 0) {
+ return 90 - $textRotation;
+ }
+ }
+
+ /**
+ * Map locked
+ *
+ * @param string
+ * @return int
+ */
+ private static function mapLocked($locked)
+ {
+ switch ($locked) {
+ case PHPExcel_Style_Protection::PROTECTION_INHERIT:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
+ return 0;
+ default:
+ return 1;
+ }
+ }
+
+ /**
+ * Map hidden
+ *
+ * @param string
+ * @return int
+ */
+ private static function mapHidden($hidden)
+ {
+ switch ($hidden) {
+ case PHPExcel_Style_Protection::PROTECTION_INHERIT:
+ return 0;
+ case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
+ return 0;
+ default:
+ return 0;
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/Exception.php b/Classes/PHPExcel/Writer/Exception.php
new file mode 100644
index 0000000..bfa0056
--- /dev/null
+++ b/Classes/PHPExcel/Writer/Exception.php
@@ -0,0 +1,46 @@
+line = $line;
+ $e->file = $file;
+ throw $e;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php
new file mode 100644
index 0000000..31d7c63
--- /dev/null
+++ b/Classes/PHPExcel/Writer/HTML.php
@@ -0,0 +1,1612 @@
+phpExcel = $phpExcel;
+ $this->defaultFont = $this->phpExcel->getDefaultStyle()->getFont();
+ }
+
+ /**
+ * Save PHPExcel to file
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function save($pFilename = null)
+ {
+ // garbage collect
+ $this->phpExcel->garbageCollect();
+
+ $saveDebugLog = PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->getWriteDebugLog();
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog(false);
+ $saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
+ PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
+
+ // Build CSS
+ $this->buildCSS(!$this->useInlineCss);
+
+ // Open file
+ $fileHandle = fopen($pFilename, 'wb+');
+ if ($fileHandle === false) {
+ throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
+ }
+
+ // Write headers
+ fwrite($fileHandle, $this->generateHTMLHeader(!$this->useInlineCss));
+
+ // Write navigation (tabs)
+ if ((!$this->isPdf) && ($this->generateSheetNavigationBlock)) {
+ fwrite($fileHandle, $this->generateNavigation());
+ }
+
+ // Write data
+ fwrite($fileHandle, $this->generateSheetData());
+
+ // Write footer
+ fwrite($fileHandle, $this->generateHTMLFooter());
+
+ // Close file
+ fclose($fileHandle);
+
+ PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
+ PHPExcel_Calculation::getInstance($this->phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
+ }
+
+ /**
+ * Map VAlign
+ *
+ * @param string $vAlign Vertical alignment
+ * @return string
+ */
+ private function mapVAlign($vAlign)
+ {
+ switch ($vAlign) {
+ case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
+ return 'bottom';
+ case PHPExcel_Style_Alignment::VERTICAL_TOP:
+ return 'top';
+ case PHPExcel_Style_Alignment::VERTICAL_CENTER:
+ case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
+ return 'middle';
+ default:
+ return 'baseline';
+ }
+ }
+
+ /**
+ * Map HAlign
+ *
+ * @param string $hAlign Horizontal alignment
+ * @return string|false
+ */
+ private function mapHAlign($hAlign)
+ {
+ switch ($hAlign) {
+ case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
+ return false;
+ case PHPExcel_Style_Alignment::HORIZONTAL_LEFT:
+ return 'left';
+ case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT:
+ return 'right';
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER:
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
+ return 'center';
+ case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY:
+ return 'justify';
+ default:
+ return false;
+ }
+ }
+
+ /**
+ * Map border style
+ *
+ * @param int $borderStyle Sheet index
+ * @return string
+ */
+ private function mapBorderStyle($borderStyle)
+ {
+ switch ($borderStyle) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ return 'none';
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ return '1px dashed';
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ return '1px dotted';
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ return '1px dashed';
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ return '1px dotted';
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ return '3px double';
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ return '1px solid';
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ return '2px solid';
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ return '2px dashed';
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ return '2px dotted';
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ return '2px dashed';
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ return '2px dashed';
+ case PHPExcel_Style_Border::BORDER_THICK:
+ return '3px solid';
+ case PHPExcel_Style_Border::BORDER_THIN:
+ return '1px solid';
+ default:
+ // map others to thin
+ return '1px solid';
+ }
+ }
+
+ /**
+ * Get sheet index
+ *
+ * @return int
+ */
+ public function getSheetIndex()
+ {
+ return $this->sheetIndex;
+ }
+
+ /**
+ * Set sheet index
+ *
+ * @param int $pValue Sheet index
+ * @return PHPExcel_Writer_HTML
+ */
+ public function setSheetIndex($pValue = 0)
+ {
+ $this->sheetIndex = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get sheet index
+ *
+ * @return boolean
+ */
+ public function getGenerateSheetNavigationBlock()
+ {
+ return $this->generateSheetNavigationBlock;
+ }
+
+ /**
+ * Set sheet index
+ *
+ * @param boolean $pValue Flag indicating whether the sheet navigation block should be generated or not
+ * @return PHPExcel_Writer_HTML
+ */
+ public function setGenerateSheetNavigationBlock($pValue = true)
+ {
+ $this->generateSheetNavigationBlock = (bool) $pValue;
+ return $this;
+ }
+
+ /**
+ * Write all sheets (resets sheetIndex to NULL)
+ */
+ public function writeAllSheets()
+ {
+ $this->sheetIndex = null;
+ return $this;
+ }
+
+ /**
+ * Generate HTML header
+ *
+ * @param boolean $pIncludeStyles Include styles?
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function generateHTMLHeader($pIncludeStyles = false)
+ {
+ // PHPExcel object known?
+ if (is_null($this->phpExcel)) {
+ throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
+ }
+
+ // Construct HTML
+ $properties = $this->phpExcel->getProperties();
+ $html = '' . PHP_EOL;
+ $html .= '' . PHP_EOL;
+ $html .= '' . PHP_EOL;
+ $html .= ' ' . PHP_EOL;
+ $html .= ' ' . PHP_EOL;
+ if ($properties->getTitle() > '') {
+ $html .= ' ' . htmlspecialchars($properties->getTitle()) . '' . PHP_EOL;
+ }
+ if ($properties->getCreator() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getTitle() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getDescription() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getSubject() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getKeywords() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getCategory() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getCompany() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+ if ($properties->getManager() > '') {
+ $html .= ' ' . PHP_EOL;
+ }
+
+ if ($pIncludeStyles) {
+ $html .= $this->generateStyles(true);
+ }
+
+ $html .= ' ' . PHP_EOL;
+ $html .= '' . PHP_EOL;
+ $html .= ' ' . PHP_EOL;
+
+ return $html;
+ }
+
+ /**
+ * Generate sheet data
+ *
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function generateSheetData()
+ {
+ // PHPExcel object known?
+ if (is_null($this->phpExcel)) {
+ throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
+ }
+
+ // Ensure that Spans have been calculated?
+ if ($this->sheetIndex !== null || !$this->spansAreCalculated) {
+ $this->calculateSpans();
+ }
+
+ // Fetch sheets
+ $sheets = array();
+ if (is_null($this->sheetIndex)) {
+ $sheets = $this->phpExcel->getAllSheets();
+ } else {
+ $sheets[] = $this->phpExcel->getSheet($this->sheetIndex);
+ }
+
+ // Construct HTML
+ $html = '';
+
+ // Loop all sheets
+ $sheetId = 0;
+ foreach ($sheets as $sheet) {
+ // Write table header
+ $html .= $this->generateTableHeader($sheet);
+
+ // Get worksheet dimension
+ $dimension = explode(':', $sheet->calculateWorksheetDimension());
+ $dimension[0] = PHPExcel_Cell::coordinateFromString($dimension[0]);
+ $dimension[0][0] = PHPExcel_Cell::columnIndexFromString($dimension[0][0]) - 1;
+ $dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
+ $dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
+
+ // row min,max
+ $rowMin = $dimension[0][1];
+ $rowMax = $dimension[1][1];
+
+ // calculate start of ,
+ $tbodyStart = $rowMin;
+ $theadStart = $theadEnd = 0; // default: no no
+ if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
+ $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop();
+
+ // we can only support repeating rows that start at top row
+ if ($rowsToRepeatAtTop[0] == 1) {
+ $theadStart = $rowsToRepeatAtTop[0];
+ $theadEnd = $rowsToRepeatAtTop[1];
+ $tbodyStart = $rowsToRepeatAtTop[1] + 1;
+ }
+ }
+
+ // Loop through cells
+ $row = $rowMin-1;
+ while ($row++ < $rowMax) {
+ // ?
+ if ($row == $theadStart) {
+ $html .= ' ' . PHP_EOL;
+ $cellType = 'th';
+ }
+
+ // ?
+ if ($row == $tbodyStart) {
+ $html .= ' ' . PHP_EOL;
+ $cellType = 'td';
+ }
+
+ // Write row if there are HTML table cells in it
+ if (!isset($this->isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row])) {
+ // Start a new rowData
+ $rowData = array();
+ // Loop through columns
+ $column = $dimension[0][0] - 1;
+ while ($column++ < $dimension[1][0]) {
+ // Cell exists?
+ if ($sheet->cellExistsByColumnAndRow($column, $row)) {
+ $rowData[$column] = PHPExcel_Cell::stringFromColumnIndex($column) . $row;
+ } else {
+ $rowData[$column] = '';
+ }
+ }
+ $html .= $this->generateRow($sheet, $rowData, $row - 1, $cellType);
+ }
+
+ // ?
+ if ($row == $theadEnd) {
+ $html .= ' ' . PHP_EOL;
+ }
+ }
+ $html .= $this->extendRowsForChartsAndImages($sheet, $row);
+
+ // Close table body.
+ $html .= ' ' . PHP_EOL;
+
+ // Write table footer
+ $html .= $this->generateTableFooter();
+
+ // Writing PDF?
+ if ($this->isPdf) {
+ if (is_null($this->sheetIndex) && $sheetId + 1 < $this->phpExcel->getSheetCount()) {
+ $html .= '';
+ }
+ }
+
+ // Next sheet
+ ++$sheetId;
+ }
+
+ return $html;
+ }
+
+ /**
+ * Generate sheet tabs
+ *
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function generateNavigation()
+ {
+ // PHPExcel object known?
+ if (is_null($this->phpExcel)) {
+ throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
+ }
+
+ // Fetch sheets
+ $sheets = array();
+ if (is_null($this->sheetIndex)) {
+ $sheets = $this->phpExcel->getAllSheets();
+ } else {
+ $sheets[] = $this->phpExcel->getSheet($this->sheetIndex);
+ }
+
+ // Construct HTML
+ $html = '';
+
+ // Only if there are more than 1 sheets
+ if (count($sheets) > 1) {
+ // Loop all sheets
+ $sheetId = 0;
+
+ $html .= '' . PHP_EOL;
+
+ foreach ($sheets as $sheet) {
+ $html .= ' - ' . $sheet->getTitle() . '
' . PHP_EOL;
+ ++$sheetId;
+ }
+
+ $html .= '
' . PHP_EOL;
+ }
+
+ return $html;
+ }
+
+ private function extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
+ {
+ $rowMax = $row;
+ $colMax = 'A';
+ if ($this->includeCharts) {
+ foreach ($pSheet->getChartCollection() as $chart) {
+ if ($chart instanceof PHPExcel_Chart) {
+ $chartCoordinates = $chart->getTopLeftPosition();
+ $chartTL = PHPExcel_Cell::coordinateFromString($chartCoordinates['cell']);
+ $chartCol = PHPExcel_Cell::columnIndexFromString($chartTL[0]);
+ if ($chartTL[1] > $rowMax) {
+ $rowMax = $chartTL[1];
+ if ($chartCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
+ $colMax = $chartTL[0];
+ }
+ }
+ }
+ }
+ }
+
+ foreach ($pSheet->getDrawingCollection() as $drawing) {
+ if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
+ $imageTL = PHPExcel_Cell::coordinateFromString($drawing->getCoordinates());
+ $imageCol = PHPExcel_Cell::columnIndexFromString($imageTL[0]);
+ if ($imageTL[1] > $rowMax) {
+ $rowMax = $imageTL[1];
+ if ($imageCol > PHPExcel_Cell::columnIndexFromString($colMax)) {
+ $colMax = $imageTL[0];
+ }
+ }
+ }
+ }
+
+ $html = '';
+ $colMax++;
+ while ($row <= $rowMax) {
+ $html .= '';
+ for ($col = 'A'; $col != $colMax; ++$col) {
+ $html .= '';
+ $html .= $this->writeImageInCell($pSheet, $col.$row);
+ if ($this->includeCharts) {
+ $html .= $this->writeChartInCell($pSheet, $col.$row);
+ }
+ $html .= ' | ';
+ }
+ ++$row;
+ $html .= '
';
+ }
+ return $html;
+ }
+
+
+ /**
+ * Generate image tag in cell
+ *
+ * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
+ * @param string $coordinates Cell coordinates
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates)
+ {
+ // Construct HTML
+ $html = '';
+
+ // Write images
+ foreach ($pSheet->getDrawingCollection() as $drawing) {
+ if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
+ if ($drawing->getCoordinates() == $coordinates) {
+ $filename = $drawing->getPath();
+
+ // Strip off eventual '.'
+ if (substr($filename, 0, 1) == '.') {
+ $filename = substr($filename, 1);
+ }
+
+ // Prepend images root
+ $filename = $this->getImagesRoot() . $filename;
+
+ // Strip off eventual '.'
+ if (substr($filename, 0, 1) == '.' && substr($filename, 0, 2) != './') {
+ $filename = substr($filename, 1);
+ }
+
+ // Convert UTF8 data to PCDATA
+ $filename = htmlspecialchars($filename);
+
+ $html .= PHP_EOL;
+ if ((!$this->embedImages) || ($this->isPdf)) {
+ $imageData = $filename;
+ } else {
+ $imageDetails = getimagesize($filename);
+ if ($fp = fopen($filename, "rb", 0)) {
+ $picture = fread($fp, filesize($filename));
+ fclose($fp);
+ // base64 encode the binary data, then break it
+ // into chunks according to RFC 2045 semantics
+ $base64 = chunk_split(base64_encode($picture));
+ $imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64;
+ } else {
+ $imageData = $filename;
+ }
+ }
+
+ $html .= '';
+ $html .= '
';
+ $html .= '
';
+ }
+ } elseif ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ if ($drawing->getCoordinates() != $coordinates) {
+ continue;
+ }
+ ob_start(); // Let's start output buffering.
+ imagepng($drawing->getImageResource()); // This will normally output the image, but because of ob_start(), it won't.
+ $contents = ob_get_contents(); // Instead, output above is saved to $contents
+ ob_end_clean(); // End the output buffer.
+
+ $dataUri = "data:image/jpeg;base64," . base64_encode($contents);
+
+ // Because of the nature of tables, width is more important than height.
+ // max-width: 100% ensures that image doesnt overflow containing cell
+ // width: X sets width of supplied image.
+ // As a result, images bigger than cell will be contained and images smaller will not get stretched
+ $html .= '';
+ }
+ }
+
+ return $html;
+ }
+
+ /**
+ * Generate chart tag in cell
+ *
+ * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
+ * @param string $coordinates Cell coordinates
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates)
+ {
+ // Construct HTML
+ $html = '';
+
+ // Write charts
+ foreach ($pSheet->getChartCollection() as $chart) {
+ if ($chart instanceof PHPExcel_Chart) {
+ $chartCoordinates = $chart->getTopLeftPosition();
+ if ($chartCoordinates['cell'] == $coordinates) {
+ $chartFileName = PHPExcel_Shared_File::sys_get_temp_dir().'/'.uniqid().'.png';
+ if (!$chart->render($chartFileName)) {
+ return;
+ }
+
+ $html .= PHP_EOL;
+ $imageDetails = getimagesize($chartFileName);
+ if ($fp = fopen($chartFileName, "rb", 0)) {
+ $picture = fread($fp, filesize($chartFileName));
+ fclose($fp);
+ // base64 encode the binary data, then break it
+ // into chunks according to RFC 2045 semantics
+ $base64 = chunk_split(base64_encode($picture));
+ $imageData = 'data:'.$imageDetails['mime'].';base64,' . $base64;
+
+ $html .= '';
+ $html .= '
' . PHP_EOL;
+ $html .= '
';
+
+ unlink($chartFileName);
+ }
+ }
+ }
+ }
+
+ // Return
+ return $html;
+ }
+
+ /**
+ * Generate CSS styles
+ *
+ * @param boolean $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>)
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function generateStyles($generateSurroundingHTML = true)
+ {
+ // PHPExcel object known?
+ if (is_null($this->phpExcel)) {
+ throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
+ }
+
+ // Build CSS
+ $css = $this->buildCSS($generateSurroundingHTML);
+
+ // Construct HTML
+ $html = '';
+
+ // Start styles
+ if ($generateSurroundingHTML) {
+ $html .= ' ' . PHP_EOL;
+ }
+
+ // Return
+ return $html;
+ }
+
+ /**
+ * Build CSS styles
+ *
+ * @param boolean $generateSurroundingHTML Generate surrounding HTML style? (html { })
+ * @return array
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function buildCSS($generateSurroundingHTML = true)
+ {
+ // PHPExcel object known?
+ if (is_null($this->phpExcel)) {
+ throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
+ }
+
+ // Cached?
+ if (!is_null($this->cssStyles)) {
+ return $this->cssStyles;
+ }
+
+ // Ensure that spans have been calculated
+ if (!$this->spansAreCalculated) {
+ $this->calculateSpans();
+ }
+
+ // Construct CSS
+ $css = array();
+
+ // Start styles
+ if ($generateSurroundingHTML) {
+ // html { }
+ $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif';
+ $css['html']['font-size'] = '11pt';
+ $css['html']['background-color'] = 'white';
+ }
+
+
+ // table { }
+ $css['table']['border-collapse'] = 'collapse';
+ if (!$this->isPdf) {
+ $css['table']['page-break-after'] = 'always';
+ }
+
+ // .gridlines td { }
+ $css['.gridlines td']['border'] = '1px dotted black';
+ $css['.gridlines th']['border'] = '1px dotted black';
+
+ // .b {}
+ $css['.b']['text-align'] = 'center'; // BOOL
+
+ // .e {}
+ $css['.e']['text-align'] = 'center'; // ERROR
+
+ // .f {}
+ $css['.f']['text-align'] = 'right'; // FORMULA
+
+ // .inlineStr {}
+ $css['.inlineStr']['text-align'] = 'left'; // INLINE
+
+ // .n {}
+ $css['.n']['text-align'] = 'right'; // NUMERIC
+
+ // .s {}
+ $css['.s']['text-align'] = 'left'; // STRING
+
+ // Calculate cell style hashes
+ foreach ($this->phpExcel->getCellXfCollection() as $index => $style) {
+ $css['td.style' . $index] = $this->createCSSStyle($style);
+ $css['th.style' . $index] = $this->createCSSStyle($style);
+ }
+
+ // Fetch sheets
+ $sheets = array();
+ if (is_null($this->sheetIndex)) {
+ $sheets = $this->phpExcel->getAllSheets();
+ } else {
+ $sheets[] = $this->phpExcel->getSheet($this->sheetIndex);
+ }
+
+ // Build styles per sheet
+ foreach ($sheets as $sheet) {
+ // Calculate hash code
+ $sheetIndex = $sheet->getParent()->getIndex($sheet);
+
+ // Build styles
+ // Calculate column widths
+ $sheet->calculateColumnWidths();
+
+ // col elements, initialize
+ $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
+ $column = -1;
+ while ($column++ < $highestColumnIndex) {
+ $this->columnWidths[$sheetIndex][$column] = 42; // approximation
+ $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt';
+ }
+
+ // col elements, loop through columnDimensions and set width
+ foreach ($sheet->getColumnDimensions() as $columnDimension) {
+ if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->defaultFont)) >= 0) {
+ $width = PHPExcel_Shared_Drawing::pixelsToPoints($width);
+ $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
+ $this->columnWidths[$sheetIndex][$column] = $width;
+ $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt';
+
+ if ($columnDimension->getVisible() === false) {
+ $css['table.sheet' . $sheetIndex . ' col.col' . $column]['visibility'] = 'collapse';
+ $css['table.sheet' . $sheetIndex . ' col.col' . $column]['*display'] = 'none'; // target IE6+7
+ }
+ }
+ }
+
+ // Default row height
+ $rowDimension = $sheet->getDefaultRowDimension();
+
+ // table.sheetN tr { }
+ $css['table.sheet' . $sheetIndex . ' tr'] = array();
+
+ if ($rowDimension->getRowHeight() == -1) {
+ $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
+ } else {
+ $pt_height = $rowDimension->getRowHeight();
+ }
+ $css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt';
+ if ($rowDimension->getVisible() === false) {
+ $css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none';
+ $css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden';
+ }
+
+ // Calculate row heights
+ foreach ($sheet->getRowDimensions() as $rowDimension) {
+ $row = $rowDimension->getRowIndex() - 1;
+
+ // table.sheetN tr.rowYYYYYY { }
+ $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array();
+
+ if ($rowDimension->getRowHeight() == -1) {
+ $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->phpExcel->getDefaultStyle()->getFont());
+ } else {
+ $pt_height = $rowDimension->getRowHeight();
+ }
+ $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt';
+ if ($rowDimension->getVisible() === false) {
+ $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none';
+ $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden';
+ }
+ }
+ }
+
+ // Cache
+ if (is_null($this->cssStyles)) {
+ $this->cssStyles = $css;
+ }
+
+ // Return
+ return $css;
+ }
+
+ /**
+ * Create CSS style
+ *
+ * @param PHPExcel_Style $pStyle PHPExcel_Style
+ * @return array
+ */
+ private function createCSSStyle(PHPExcel_Style $pStyle)
+ {
+ // Construct CSS
+ $css = '';
+
+ // Create CSS
+ $css = array_merge(
+ $this->createCSSStyleAlignment($pStyle->getAlignment()),
+ $this->createCSSStyleBorders($pStyle->getBorders()),
+ $this->createCSSStyleFont($pStyle->getFont()),
+ $this->createCSSStyleFill($pStyle->getFill())
+ );
+
+ // Return
+ return $css;
+ }
+
+ /**
+ * Create CSS style (PHPExcel_Style_Alignment)
+ *
+ * @param PHPExcel_Style_Alignment $pStyle PHPExcel_Style_Alignment
+ * @return array
+ */
+ private function createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle)
+ {
+ // Construct CSS
+ $css = array();
+
+ // Create CSS
+ $css['vertical-align'] = $this->mapVAlign($pStyle->getVertical());
+ if ($textAlign = $this->mapHAlign($pStyle->getHorizontal())) {
+ $css['text-align'] = $textAlign;
+ if (in_array($textAlign, array('left', 'right'))) {
+ $css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
+ }
+ }
+
+ return $css;
+ }
+
+ /**
+ * Create CSS style (PHPExcel_Style_Font)
+ *
+ * @param PHPExcel_Style_Font $pStyle PHPExcel_Style_Font
+ * @return array
+ */
+ private function createCSSStyleFont(PHPExcel_Style_Font $pStyle)
+ {
+ // Construct CSS
+ $css = array();
+
+ // Create CSS
+ if ($pStyle->getBold()) {
+ $css['font-weight'] = 'bold';
+ }
+ if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) {
+ $css['text-decoration'] = 'underline line-through';
+ } elseif ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
+ $css['text-decoration'] = 'underline';
+ } elseif ($pStyle->getStrikethrough()) {
+ $css['text-decoration'] = 'line-through';
+ }
+ if ($pStyle->getItalic()) {
+ $css['font-style'] = 'italic';
+ }
+
+ $css['color'] = '#' . $pStyle->getColor()->getRGB();
+ $css['font-family'] = '\'' . $pStyle->getName() . '\'';
+ $css['font-size'] = $pStyle->getSize() . 'pt';
+
+ return $css;
+ }
+
+ /**
+ * Create CSS style (PHPExcel_Style_Borders)
+ *
+ * @param PHPExcel_Style_Borders $pStyle PHPExcel_Style_Borders
+ * @return array
+ */
+ private function createCSSStyleBorders(PHPExcel_Style_Borders $pStyle)
+ {
+ // Construct CSS
+ $css = array();
+
+ // Create CSS
+ $css['border-bottom'] = $this->createCSSStyleBorder($pStyle->getBottom());
+ $css['border-top'] = $this->createCSSStyleBorder($pStyle->getTop());
+ $css['border-left'] = $this->createCSSStyleBorder($pStyle->getLeft());
+ $css['border-right'] = $this->createCSSStyleBorder($pStyle->getRight());
+
+ return $css;
+ }
+
+ /**
+ * Create CSS style (PHPExcel_Style_Border)
+ *
+ * @param PHPExcel_Style_Border $pStyle PHPExcel_Style_Border
+ * @return string
+ */
+ private function createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
+ {
+ // Create CSS
+// $css = $this->mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
+ // Create CSS - add !important to non-none border styles for merged cells
+ $borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle());
+ $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
+
+ return $css;
+ }
+
+ /**
+ * Create CSS style (PHPExcel_Style_Fill)
+ *
+ * @param PHPExcel_Style_Fill $pStyle PHPExcel_Style_Fill
+ * @return array
+ */
+ private function createCSSStyleFill(PHPExcel_Style_Fill $pStyle)
+ {
+ // Construct HTML
+ $css = array();
+
+ // Create CSS
+ $value = $pStyle->getFillType() == PHPExcel_Style_Fill::FILL_NONE ?
+ 'white' : '#' . $pStyle->getStartColor()->getRGB();
+ $css['background-color'] = $value;
+
+ return $css;
+ }
+
+ /**
+ * Generate HTML footer
+ */
+ public function generateHTMLFooter()
+ {
+ // Construct HTML
+ $html = '';
+ $html .= ' ' . PHP_EOL;
+ $html .= '' . PHP_EOL;
+
+ return $html;
+ }
+
+ /**
+ * Generate table header
+ *
+ * @param PHPExcel_Worksheet $pSheet The worksheet for the table we are writing
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function generateTableHeader($pSheet)
+ {
+ $sheetIndex = $pSheet->getParent()->getIndex($pSheet);
+
+ // Construct HTML
+ $html = '';
+ $html .= $this->setMargins($pSheet);
+
+ if (!$this->useInlineCss) {
+ $gridlines = $pSheet->getShowGridlines() ? ' gridlines' : '';
+ $html .= ' ' . PHP_EOL;
+ } else {
+ $style = isset($this->cssStyles['table']) ?
+ $this->assembleCSS($this->cssStyles['table']) : '';
+
+ if ($this->isPdf && $pSheet->getShowGridlines()) {
+ $html .= ' ' . PHP_EOL;
+ } else {
+ $html .= ' ' . PHP_EOL;
+ }
+ }
+
+ // Write elements
+ $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) - 1;
+ $i = -1;
+ while ($i++ < $highestColumnIndex) {
+ if (!$this->isPdf) {
+ if (!$this->useInlineCss) {
+ $html .= ' ' . PHP_EOL;
+ } else {
+ $style = isset($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) ?
+ $this->assembleCSS($this->cssStyles['table.sheet' . $sheetIndex . ' col.col' . $i]) : '';
+ $html .= ' ' . PHP_EOL;
+ }
+ }
+ }
+
+ return $html;
+ }
+
+ /**
+ * Generate table footer
+ *
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function generateTableFooter()
+ {
+ $html = '
' . PHP_EOL;
+
+ return $html;
+ }
+
+ /**
+ * Generate row
+ *
+ * @param PHPExcel_Worksheet $pSheet PHPExcel_Worksheet
+ * @param array $pValues Array containing cells in a row
+ * @param int $pRow Row number (0-based)
+ * @return string
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0, $cellType = 'td')
+ {
+ if (is_array($pValues)) {
+ // Construct HTML
+ $html = '';
+
+ // Sheet index
+ $sheetIndex = $pSheet->getParent()->getIndex($pSheet);
+
+ // DomPDF and breaks
+ if ($this->isPdf && count($pSheet->getBreaks()) > 0) {
+ $breaks = $pSheet->getBreaks();
+
+ // check if a break is needed before this row
+ if (isset($breaks['A' . $pRow])) {
+ // close table:
+ $html .= $this->generateTableFooter();
+
+ // insert page break
+ $html .= '';
+
+ // open table again: + etc.
+ $html .= $this->generateTableHeader($pSheet);
+ }
+ }
+
+ // Write row start
+ if (!$this->useInlineCss) {
+ $html .= ' ' . PHP_EOL;
+ } else {
+ $style = isset($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow])
+ ? $this->assembleCSS($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]) : '';
+
+ $html .= '
' . PHP_EOL;
+ }
+
+ // Write cells
+ $colNum = 0;
+ foreach ($pValues as $cellAddress) {
+ $cell = ($cellAddress > '') ? $pSheet->getCell($cellAddress) : '';
+ $coordinate = PHPExcel_Cell::stringFromColumnIndex($colNum) . ($pRow + 1);
+ if (!$this->useInlineCss) {
+ $cssClass = '';
+ $cssClass = 'column' . $colNum;
+ } else {
+ $cssClass = array();
+ if ($cellType == 'th') {
+ if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' th.column' . $colNum])) {
+ $this->cssStyles['table.sheet' . $sheetIndex . ' th.column' . $colNum];
+ }
+ } else {
+ if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum])) {
+ $this->cssStyles['table.sheet' . $sheetIndex . ' td.column' . $colNum];
+ }
+ }
+ }
+ $colSpan = 1;
+ $rowSpan = 1;
+
+ // initialize
+ $cellData = ' ';
+
+ // PHPExcel_Cell
+ if ($cell instanceof PHPExcel_Cell) {
+ $cellData = '';
+ if (is_null($cell->getParent())) {
+ $cell->attach($pSheet);
+ }
+ // Value
+ if ($cell->getValue() instanceof PHPExcel_RichText) {
+ // Loop through rich text elements
+ $elements = $cell->getValue()->getRichTextElements();
+ foreach ($elements as $element) {
+ // Rich text start?
+ if ($element instanceof PHPExcel_RichText_Run) {
+ $cellData .= '';
+
+ if ($element->getFont()->getSuperScript()) {
+ $cellData .= '';
+ } elseif ($element->getFont()->getSubScript()) {
+ $cellData .= '';
+ }
+ }
+
+ // Convert UTF8 data to PCDATA
+ $cellText = $element->getText();
+ $cellData .= htmlspecialchars($cellText);
+
+ if ($element instanceof PHPExcel_RichText_Run) {
+ if ($element->getFont()->getSuperScript()) {
+ $cellData .= '';
+ } elseif ($element->getFont()->getSubScript()) {
+ $cellData .= '';
+ }
+
+ $cellData .= '';
+ }
+ }
+ } else {
+ if ($this->preCalculateFormulas) {
+ $cellData = PHPExcel_Style_NumberFormat::toFormattedString(
+ $cell->getCalculatedValue(),
+ $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(),
+ array($this, 'formatColor')
+ );
+ } else {
+ $cellData = PHPExcel_Style_NumberFormat::toFormattedString(
+ $cell->getValue(),
+ $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode(),
+ array($this, 'formatColor')
+ );
+ }
+ $cellData = htmlspecialchars($cellData);
+ if ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSuperScript()) {
+ $cellData = ''.$cellData.'';
+ } elseif ($pSheet->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSubScript()) {
+ $cellData = ''.$cellData.'';
+ }
+ }
+
+ // Converts the cell content so that spaces occuring at beginning of each new line are replaced by
+ // Example: " Hello\n to the world" is converted to " Hello\n to the world"
+ $cellData = preg_replace("/(?m)(?:^|\\G) /", ' ', $cellData);
+
+ // convert newline "\n" to '
'
+ $cellData = nl2br($cellData);
+
+ // Extend CSS class?
+ if (!$this->useInlineCss) {
+ $cssClass .= ' style' . $cell->getXfIndex();
+ $cssClass .= ' ' . $cell->getDataType();
+ } else {
+ if ($cellType == 'th') {
+ if (isset($this->cssStyles['th.style' . $cell->getXfIndex()])) {
+ $cssClass = array_merge($cssClass, $this->cssStyles['th.style' . $cell->getXfIndex()]);
+ }
+ } else {
+ if (isset($this->cssStyles['td.style' . $cell->getXfIndex()])) {
+ $cssClass = array_merge($cssClass, $this->cssStyles['td.style' . $cell->getXfIndex()]);
+ }
+ }
+
+ // General horizontal alignment: Actual horizontal alignment depends on dataType
+ $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex());
+ if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
+ && isset($this->cssStyles['.' . $cell->getDataType()]['text-align'])) {
+ $cssClass['text-align'] = $this->cssStyles['.' . $cell->getDataType()]['text-align'];
+ }
+ }
+ }
+
+ // Hyperlink?
+ if ($pSheet->hyperlinkExists($coordinate) && !$pSheet->getHyperlink($coordinate)->isInternal()) {
+ $cellData = '' . $cellData . '';
+ }
+
+ // Should the cell be written or is it swallowed by a rowspan or colspan?
+ $writeCell = !(isset($this->isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])
+ && $this->isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum]);
+
+ // Colspan and Rowspan
+ $colspan = 1;
+ $rowspan = 1;
+ if (isset($this->isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum])) {
+ $spans = $this->isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow + 1][$colNum];
+ $rowSpan = $spans['rowspan'];
+ $colSpan = $spans['colspan'];
+
+ // Also apply style from last cell in merge to fix borders -
+ // relies on !important for non-none border declarations in createCSSStyleBorder
+ $endCellCoord = PHPExcel_Cell::stringFromColumnIndex($colNum + $colSpan - 1) . ($pRow + $rowSpan);
+ if (!$this->useInlineCss) {
+ $cssClass .= ' style' . $pSheet->getCell($endCellCoord)->getXfIndex();
+ }
+ }
+
+ // Write
+ if ($writeCell) {
+ // Column start
+ $html .= ' <' . $cellType;
+ if (!$this->useInlineCss) {
+ $html .= ' class="' . $cssClass . '"';
+ } else {
+ //** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
+ // We must explicitly write the width of the element because TCPDF
+ // does not recognize e.g.
+ $width = 0;
+ $i = $colNum - 1;
+ $e = $colNum + $colSpan - 1;
+ while ($i++ < $e) {
+ if (isset($this->columnWidths[$sheetIndex][$i])) {
+ $width += $this->columnWidths[$sheetIndex][$i];
+ }
+ }
+ $cssClass['width'] = $width . 'pt';
+
+ // We must also explicitly write the height of the | element because TCPDF
+ // does not recognize e.g. |
+ if (isset($this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
+ $height = $this->cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
+ $cssClass['height'] = $height;
+ }
+ //** end of redundant code **
+
+ $html .= ' style="' . $this->assembleCSS($cssClass) . '"';
+ }
+ if ($colSpan > 1) {
+ $html .= ' colspan="' . $colSpan . '"';
+ }
+ if ($rowSpan > 1) {
+ $html .= ' rowspan="' . $rowSpan . '"';
+ }
+ $html .= '>';
+
+ // Image?
+ $html .= $this->writeImageInCell($pSheet, $coordinate);
+
+ // Chart?
+ if ($this->includeCharts) {
+ $html .= $this->writeChartInCell($pSheet, $coordinate);
+ }
+
+ // Cell data
+ $html .= $cellData;
+
+ // Column end
+ $html .= ''.$cellType.'>' . PHP_EOL;
+ }
+
+ // Next column
+ ++$colNum;
+ }
+
+ // Write row end
+ $html .= '
' . PHP_EOL;
+
+ // Return
+ return $html;
+ } else {
+ throw new PHPExcel_Writer_Exception("Invalid parameters passed.");
+ }
+ }
+
+ /**
+ * Takes array where of CSS properties / values and converts to CSS string
+ *
+ * @param array
+ * @return string
+ */
+ private function assembleCSS($pValue = array())
+ {
+ $pairs = array();
+ foreach ($pValue as $property => $value) {
+ $pairs[] = $property . ':' . $value;
+ }
+ $string = implode('; ', $pairs);
+
+ return $string;
+ }
+
+ /**
+ * Get images root
+ *
+ * @return string
+ */
+ public function getImagesRoot()
+ {
+ return $this->imagesRoot;
+ }
+
+ /**
+ * Set images root
+ *
+ * @param string $pValue
+ * @return PHPExcel_Writer_HTML
+ */
+ public function setImagesRoot($pValue = '.')
+ {
+ $this->imagesRoot = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get embed images
+ *
+ * @return boolean
+ */
+ public function getEmbedImages()
+ {
+ return $this->embedImages;
+ }
+
+ /**
+ * Set embed images
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Writer_HTML
+ */
+ public function setEmbedImages($pValue = '.')
+ {
+ $this->embedImages = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get use inline CSS?
+ *
+ * @return boolean
+ */
+ public function getUseInlineCss()
+ {
+ return $this->useInlineCss;
+ }
+
+ /**
+ * Set use inline CSS?
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Writer_HTML
+ */
+ public function setUseInlineCss($pValue = false)
+ {
+ $this->useInlineCss = $pValue;
+ return $this;
+ }
+
+ /**
+ * Add color to formatted string as inline style
+ *
+ * @param string $pValue Plain formatted value without color
+ * @param string $pFormat Format code
+ * @return string
+ */
+ public function formatColor($pValue, $pFormat)
+ {
+ // Color information, e.g. [Red] is always at the beginning
+ $color = null; // initialize
+ $matches = array();
+
+ $color_regex = '/^\\[[a-zA-Z]+\\]/';
+ if (preg_match($color_regex, $pFormat, $matches)) {
+ $color = str_replace('[', '', $matches[0]);
+ $color = str_replace(']', '', $color);
+ $color = strtolower($color);
+ }
+
+ // convert to PCDATA
+ $value = htmlspecialchars($pValue);
+
+ // color span tag
+ if ($color !== null) {
+ $value = '' . $value . '';
+ }
+
+ return $value;
+ }
+
+ /**
+ * Calculate information about HTML colspan and rowspan which is not always the same as Excel's
+ */
+ private function calculateSpans()
+ {
+ // Identify all cells that should be omitted in HTML due to cell merge.
+ // In HTML only the upper-left cell should be written and it should have
+ // appropriate rowspan / colspan attribute
+ $sheetIndexes = $this->sheetIndex !== null ?
+ array($this->sheetIndex) : range(0, $this->phpExcel->getSheetCount() - 1);
+
+ foreach ($sheetIndexes as $sheetIndex) {
+ $sheet = $this->phpExcel->getSheet($sheetIndex);
+
+ $candidateSpannedRow = array();
+
+ // loop through all Excel merged cells
+ foreach ($sheet->getMergeCells() as $cells) {
+ list($cells,) = PHPExcel_Cell::splitRange($cells);
+ $first = $cells[0];
+ $last = $cells[1];
+
+ list($fc, $fr) = PHPExcel_Cell::coordinateFromString($first);
+ $fc = PHPExcel_Cell::columnIndexFromString($fc) - 1;
+
+ list($lc, $lr) = PHPExcel_Cell::coordinateFromString($last);
+ $lc = PHPExcel_Cell::columnIndexFromString($lc) - 1;
+
+ // loop through the individual cells in the individual merge
+ $r = $fr - 1;
+ while ($r++ < $lr) {
+ // also, flag this row as a HTML row that is candidate to be omitted
+ $candidateSpannedRow[$r] = $r;
+
+ $c = $fc - 1;
+ while ($c++ < $lc) {
+ if (!($c == $fc && $r == $fr)) {
+ // not the upper-left cell (should not be written in HTML)
+ $this->isSpannedCell[$sheetIndex][$r][$c] = array(
+ 'baseCell' => array($fr, $fc),
+ );
+ } else {
+ // upper-left is the base cell that should hold the colspan/rowspan attribute
+ $this->isBaseCell[$sheetIndex][$r][$c] = array(
+ 'xlrowspan' => $lr - $fr + 1, // Excel rowspan
+ 'rowspan' => $lr - $fr + 1, // HTML rowspan, value may change
+ 'xlcolspan' => $lc - $fc + 1, // Excel colspan
+ 'colspan' => $lc - $fc + 1, // HTML colspan, value may change
+ );
+ }
+ }
+ }
+ }
+
+ // Identify which rows should be omitted in HTML. These are the rows where all the cells
+ // participate in a merge and the where base cells are somewhere above.
+ $countColumns = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn());
+ foreach ($candidateSpannedRow as $rowIndex) {
+ if (isset($this->isSpannedCell[$sheetIndex][$rowIndex])) {
+ if (count($this->isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) {
+ $this->isSpannedRow[$sheetIndex][$rowIndex] = $rowIndex;
+ };
+ }
+ }
+
+ // For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
+ if (isset($this->isSpannedRow[$sheetIndex])) {
+ foreach ($this->isSpannedRow[$sheetIndex] as $rowIndex) {
+ $adjustedBaseCells = array();
+ $c = -1;
+ $e = $countColumns - 1;
+ while ($c++ < $e) {
+ $baseCell = $this->isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
+
+ if (!in_array($baseCell, $adjustedBaseCells)) {
+ // subtract rowspan by 1
+ --$this->isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
+ $adjustedBaseCells[] = $baseCell;
+ }
+ }
+ }
+ }
+
+ // TODO: Same for columns
+ }
+
+ // We have calculated the spans
+ $this->spansAreCalculated = true;
+ }
+
+ private function setMargins(PHPExcel_Worksheet $pSheet)
+ {
+ $htmlPage = '@page { ';
+ $htmlBody = 'body { ';
+
+ $left = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()) . 'in; ';
+ $htmlPage .= 'margin-left: ' . $left;
+ $htmlBody .= 'margin-left: ' . $left;
+ $right = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()) . 'in; ';
+ $htmlPage .= 'margin-right: ' . $right;
+ $htmlBody .= 'margin-right: ' . $right;
+ $top = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()) . 'in; ';
+ $htmlPage .= 'margin-top: ' . $top;
+ $htmlBody .= 'margin-top: ' . $top;
+ $bottom = PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()) . 'in; ';
+ $htmlPage .= 'margin-bottom: ' . $bottom;
+ $htmlBody .= 'margin-bottom: ' . $bottom;
+
+ $htmlPage .= "}\n";
+ $htmlBody .= "}\n";
+
+ return "\n";
+ }
+}
diff --git a/Classes/PHPExcel/Writer/IWriter.php b/Classes/PHPExcel/Writer/IWriter.php
new file mode 100644
index 0000000..c7cfe74
--- /dev/null
+++ b/Classes/PHPExcel/Writer/IWriter.php
@@ -0,0 +1,37 @@
+setPHPExcel($pPHPExcel);
+
+ $writerPartsArray = array(
+ 'content' => 'PHPExcel_Writer_OpenDocument_Content',
+ 'meta' => 'PHPExcel_Writer_OpenDocument_Meta',
+ 'meta_inf' => 'PHPExcel_Writer_OpenDocument_MetaInf',
+ 'mimetype' => 'PHPExcel_Writer_OpenDocument_Mimetype',
+ 'settings' => 'PHPExcel_Writer_OpenDocument_Settings',
+ 'styles' => 'PHPExcel_Writer_OpenDocument_Styles',
+ 'thumbnails' => 'PHPExcel_Writer_OpenDocument_Thumbnails'
+ );
+
+ foreach ($writerPartsArray as $writer => $class) {
+ $this->writerParts[$writer] = new $class($this);
+ }
+ }
+
+ /**
+ * Get writer part
+ *
+ * @param string $pPartName Writer part name
+ * @return PHPExcel_Writer_Excel2007_WriterPart
+ */
+ public function getWriterPart($pPartName = '')
+ {
+ if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) {
+ return $this->writerParts[strtolower($pPartName)];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Save PHPExcel to file
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function save($pFilename = null)
+ {
+ if (!$this->spreadSheet) {
+ throw new PHPExcel_Writer_Exception('PHPExcel object unassigned.');
+ }
+
+ // garbage collect
+ $this->spreadSheet->garbageCollect();
+
+ // If $pFilename is php://output or php://stdout, make it a temporary file...
+ $originalFilename = $pFilename;
+ if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
+ $pFilename = @tempnam(PHPExcel_Shared_File::sys_get_temp_dir(), 'phpxltmp');
+ if ($pFilename == '') {
+ $pFilename = $originalFilename;
+ }
+ }
+
+ $objZip = $this->createZip($pFilename);
+
+ $objZip->addFromString('META-INF/manifest.xml', $this->getWriterPart('meta_inf')->writeManifest());
+ $objZip->addFromString('Thumbnails/thumbnail.png', $this->getWriterPart('thumbnails')->writeThumbnail());
+ $objZip->addFromString('content.xml', $this->getWriterPart('content')->write());
+ $objZip->addFromString('meta.xml', $this->getWriterPart('meta')->write());
+ $objZip->addFromString('mimetype', $this->getWriterPart('mimetype')->write());
+ $objZip->addFromString('settings.xml', $this->getWriterPart('settings')->write());
+ $objZip->addFromString('styles.xml', $this->getWriterPart('styles')->write());
+
+ // Close file
+ if ($objZip->close() === false) {
+ throw new PHPExcel_Writer_Exception("Could not close zip file $pFilename.");
+ }
+
+ // If a temporary file was used, copy it to the correct file stream
+ if ($originalFilename != $pFilename) {
+ if (copy($pFilename, $originalFilename) === false) {
+ throw new PHPExcel_Writer_Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
+ }
+ @unlink($pFilename);
+ }
+ }
+
+ /**
+ * Create zip object
+ *
+ * @param string $pFilename
+ * @throws PHPExcel_Writer_Exception
+ * @return ZipArchive
+ */
+ private function createZip($pFilename)
+ {
+ // Create new ZIP file and open it for writing
+ $zipClass = PHPExcel_Settings::getZipClass();
+ $objZip = new $zipClass();
+
+ // Retrieve OVERWRITE and CREATE constants from the instantiated zip class
+ // This method of accessing constant values from a dynamic class should work with all appropriate versions of PHP
+ $ro = new ReflectionObject($objZip);
+ $zipOverWrite = $ro->getConstant('OVERWRITE');
+ $zipCreate = $ro->getConstant('CREATE');
+
+ if (file_exists($pFilename)) {
+ unlink($pFilename);
+ }
+ // Try opening the ZIP file
+ if ($objZip->open($pFilename, $zipOverWrite) !== true) {
+ if ($objZip->open($pFilename, $zipCreate) !== true) {
+ throw new PHPExcel_Writer_Exception("Could not open $pFilename for writing.");
+ }
+ }
+
+ return $objZip;
+ }
+
+ /**
+ * Get PHPExcel object
+ *
+ * @return PHPExcel
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function getPHPExcel()
+ {
+ if ($this->spreadSheet !== null) {
+ return $this->spreadSheet;
+ } else {
+ throw new PHPExcel_Writer_Exception('No PHPExcel assigned.');
+ }
+ }
+
+ /**
+ * Set PHPExcel object
+ *
+ * @param PHPExcel $pPHPExcel PHPExcel object
+ * @throws PHPExcel_Writer_Exception
+ * @return PHPExcel_Writer_Excel2007
+ */
+ public function setPHPExcel(PHPExcel $pPHPExcel = null)
+ {
+ $this->spreadSheet = $pPHPExcel;
+ return $this;
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php b/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php
new file mode 100644
index 0000000..f1e98a1
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php
@@ -0,0 +1,63 @@
+
+ */
+class PHPExcel_Writer_OpenDocument_Cell_Comment
+{
+ public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell)
+ {
+ $comments = $cell->getWorksheet()->getComments();
+ if (!isset($comments[$cell->getCoordinate()])) {
+ return;
+ }
+ $comment = $comments[$cell->getCoordinate()];
+
+ $objWriter->startElement('office:annotation');
+ //$objWriter->writeAttribute('draw:style-name', 'gr1');
+ //$objWriter->writeAttribute('draw:text-style-name', 'P1');
+ $objWriter->writeAttribute('svg:width', $comment->getWidth());
+ $objWriter->writeAttribute('svg:height', $comment->getHeight());
+ $objWriter->writeAttribute('svg:x', $comment->getMarginLeft());
+ $objWriter->writeAttribute('svg:y', $comment->getMarginTop());
+ //$objWriter->writeAttribute('draw:caption-point-x', $comment->getMarginLeft());
+ //$objWriter->writeAttribute('draw:caption-point-y', $comment->getMarginTop());
+ $objWriter->writeElement('dc:creator', $comment->getAuthor());
+ // TODO: Not realized in PHPExcel_Comment yet.
+ //$objWriter->writeElement('dc:date', $comment->getDate());
+ $objWriter->writeElement('text:p', $comment->getText()->getPlainText());
+ //$objWriter->writeAttribute('draw:text-style-name', 'P1');
+ $objWriter->endElement();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Content.php b/Classes/PHPExcel/Writer/OpenDocument/Content.php
new file mode 100644
index 0000000..a34b167
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Content.php
@@ -0,0 +1,272 @@
+
+ */
+class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_WriterPart
+{
+ const NUMBER_COLS_REPEATED_MAX = 1024;
+ const NUMBER_ROWS_REPEATED_MAX = 1048576;
+
+ /**
+ * Write content.xml to XML format
+ *
+ * @param PHPExcel $pPHPExcel
+ * @return string XML Output
+ * @throws PHPExcel_Writer_Exception
+ */
+ public function write(PHPExcel $pPHPExcel = null)
+ {
+ if (!$pPHPExcel) {
+ $pPHPExcel = $this->getParentWriter()->getPHPExcel(); /* @var $pPHPExcel PHPExcel */
+ }
+
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8');
+
+ // Content
+ $objWriter->startElement('office:document-content');
+ $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
+ $objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
+ $objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
+ $objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
+ $objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
+ $objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
+ $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
+ $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
+ $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
+ $objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
+ $objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0');
+ $objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
+ $objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
+ $objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
+ $objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML');
+ $objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
+ $objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
+ $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
+ $objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer');
+ $objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc');
+ $objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events');
+ $objWriter->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms');
+ $objWriter->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
+ $objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
+ $objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report');
+ $objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
+ $objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
+ $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
+ $objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table');
+ $objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0');
+ $objWriter->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0');
+ $objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/');
+ $objWriter->writeAttribute('office:version', '1.2');
+
+ $objWriter->writeElement('office:scripts');
+ $objWriter->writeElement('office:font-face-decls');
+ $objWriter->writeElement('office:automatic-styles');
+
+ $objWriter->startElement('office:body');
+ $objWriter->startElement('office:spreadsheet');
+ $objWriter->writeElement('table:calculation-settings');
+ $this->writeSheets($objWriter);
+ $objWriter->writeElement('table:named-expressions');
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+
+ /**
+ * Write sheets
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ */
+ private function writeSheets(PHPExcel_Shared_XMLWriter $objWriter)
+ {
+ $pPHPExcel = $this->getParentWriter()->getPHPExcel(); /* @var $pPHPExcel PHPExcel */
+
+ $sheet_count = $pPHPExcel->getSheetCount();
+ for ($i = 0; $i < $sheet_count; $i++) {
+ //$this->getWriterPart('Worksheet')->writeWorksheet());
+ $objWriter->startElement('table:table');
+ $objWriter->writeAttribute('table:name', $pPHPExcel->getSheet($i)->getTitle());
+ $objWriter->writeElement('office:forms');
+ $objWriter->startElement('table:table-column');
+ $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX);
+ $objWriter->endElement();
+ $this->writeRows($objWriter, $pPHPExcel->getSheet($i));
+ $objWriter->endElement();
+ }
+ }
+
+ /**
+ * Write rows of the specified sheet
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ * @param PHPExcel_Worksheet $sheet
+ */
+ private function writeRows(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet $sheet)
+ {
+ $number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX;
+ $span_row = 0;
+ $rows = $sheet->getRowIterator();
+ while ($rows->valid()) {
+ $number_rows_repeated--;
+ $row = $rows->current();
+ if ($row->getCellIterator()->valid()) {
+ if ($span_row) {
+ $objWriter->startElement('table:table-row');
+ if ($span_row > 1) {
+ $objWriter->writeAttribute('table:number-rows-repeated', $span_row);
+ }
+ $objWriter->startElement('table:table-cell');
+ $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX);
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $span_row = 0;
+ }
+ $objWriter->startElement('table:table-row');
+ $this->writeCells($objWriter, $row);
+ $objWriter->endElement();
+ } else {
+ $span_row++;
+ }
+ $rows->next();
+ }
+ }
+
+ /**
+ * Write cells of the specified row
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ * @param PHPExcel_Worksheet_Row $row
+ * @throws PHPExcel_Writer_Exception
+ */
+ private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row)
+ {
+ $number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX;
+ $prev_column = -1;
+ $cells = $row->getCellIterator();
+ while ($cells->valid()) {
+ $cell = $cells->current();
+ $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;
+
+ $this->writeCellSpan($objWriter, $column, $prev_column);
+ $objWriter->startElement('table:table-cell');
+
+ switch ($cell->getDataType()) {
+ case PHPExcel_Cell_DataType::TYPE_BOOL:
+ $objWriter->writeAttribute('office:value-type', 'boolean');
+ $objWriter->writeAttribute('office:value', $cell->getValue());
+ $objWriter->writeElement('text:p', $cell->getValue());
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_ERROR:
+ throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.');
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_FORMULA:
+ try {
+ $formula_value = $cell->getCalculatedValue();
+ } catch (Exception $e) {
+ $formula_value = $cell->getValue();
+ }
+ $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
+ if (is_numeric($formula_value)) {
+ $objWriter->writeAttribute('office:value-type', 'float');
+ } else {
+ $objWriter->writeAttribute('office:value-type', 'string');
+ }
+ $objWriter->writeAttribute('office:value', $formula_value);
+ $objWriter->writeElement('text:p', $formula_value);
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_INLINE:
+ throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.');
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_NUMERIC:
+ $objWriter->writeAttribute('office:value-type', 'float');
+ $objWriter->writeAttribute('office:value', $cell->getValue());
+ $objWriter->writeElement('text:p', $cell->getValue());
+ break;
+
+ case PHPExcel_Cell_DataType::TYPE_STRING:
+ $objWriter->writeAttribute('office:value-type', 'string');
+ $objWriter->writeElement('text:p', $cell->getValue());
+ break;
+ }
+ PHPExcel_Writer_OpenDocument_Cell_Comment::write($objWriter, $cell);
+ $objWriter->endElement();
+ $prev_column = $column;
+ $cells->next();
+ }
+ $number_cols_repeated = $number_cols_repeated - $prev_column - 1;
+ if ($number_cols_repeated > 0) {
+ if ($number_cols_repeated > 1) {
+ $objWriter->startElement('table:table-cell');
+ $objWriter->writeAttribute('table:number-columns-repeated', $number_cols_repeated);
+ $objWriter->endElement();
+ } else {
+ $objWriter->writeElement('table:table-cell');
+ }
+ }
+ }
+
+ /**
+ * Write span
+ *
+ * @param PHPExcel_Shared_XMLWriter $objWriter
+ * @param integer $curColumn
+ * @param integer $prevColumn
+ */
+ private function writeCellSpan(PHPExcel_Shared_XMLWriter $objWriter, $curColumn, $prevColumn)
+ {
+ $diff = $curColumn - $prevColumn - 1;
+ if (1 === $diff) {
+ $objWriter->writeElement('table:table-cell');
+ } elseif ($diff > 1) {
+ $objWriter->startElement('table:table-cell');
+ $objWriter->writeAttribute('table:number-columns-repeated', $diff);
+ $objWriter->endElement();
+ }
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Meta.php b/Classes/PHPExcel/Writer/OpenDocument/Meta.php
new file mode 100644
index 0000000..1a5c5fd
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Meta.php
@@ -0,0 +1,95 @@
+getParentWriter()->getPHPExcel();
+ }
+
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8');
+
+ // Meta
+ $objWriter->startElement('office:document-meta');
+
+ $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
+ $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
+ $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
+ $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
+ $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
+ $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
+ $objWriter->writeAttribute('office:version', '1.2');
+
+ $objWriter->startElement('office:meta');
+
+ $objWriter->writeElement('meta:initial-creator', $pPHPExcel->getProperties()->getCreator());
+ $objWriter->writeElement('dc:creator', $pPHPExcel->getProperties()->getCreator());
+ $objWriter->writeElement('meta:creation-date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
+ $objWriter->writeElement('dc:date', date(DATE_W3C, $pPHPExcel->getProperties()->getCreated()));
+ $objWriter->writeElement('dc:title', $pPHPExcel->getProperties()->getTitle());
+ $objWriter->writeElement('dc:description', $pPHPExcel->getProperties()->getDescription());
+ $objWriter->writeElement('dc:subject', $pPHPExcel->getProperties()->getSubject());
+ $keywords = explode(' ', $pPHPExcel->getProperties()->getKeywords());
+ foreach ($keywords as $keyword) {
+ $objWriter->writeElement('meta:keyword', $keyword);
+ }
+
+ //
+ $objWriter->startElement('meta:user-defined');
+ $objWriter->writeAttribute('meta:name', 'Company');
+ $objWriter->writeRaw($pPHPExcel->getProperties()->getCompany());
+ $objWriter->endElement();
+
+ $objWriter->startElement('meta:user-defined');
+ $objWriter->writeAttribute('meta:name', 'category');
+ $objWriter->writeRaw($pPHPExcel->getProperties()->getCategory());
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/MetaInf.php b/Classes/PHPExcel/Writer/OpenDocument/MetaInf.php
new file mode 100644
index 0000000..c43b723
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/MetaInf.php
@@ -0,0 +1,87 @@
+getParentWriter()->getPHPExcel();
+ }
+
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8');
+
+ // Manifest
+ $objWriter->startElement('manifest:manifest');
+ $objWriter->writeAttribute('xmlns:manifest', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0');
+ $objWriter->writeAttribute('manifest:version', '1.2');
+
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', '/');
+ $objWriter->writeAttribute('manifest:version', '1.2');
+ $objWriter->writeAttribute('manifest:media-type', 'application/vnd.oasis.opendocument.spreadsheet');
+ $objWriter->endElement();
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', 'meta.xml');
+ $objWriter->writeAttribute('manifest:media-type', 'text/xml');
+ $objWriter->endElement();
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', 'settings.xml');
+ $objWriter->writeAttribute('manifest:media-type', 'text/xml');
+ $objWriter->endElement();
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', 'content.xml');
+ $objWriter->writeAttribute('manifest:media-type', 'text/xml');
+ $objWriter->endElement();
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', 'Thumbnails/thumbnail.png');
+ $objWriter->writeAttribute('manifest:media-type', 'image/png');
+ $objWriter->endElement();
+ $objWriter->startElement('manifest:file-entry');
+ $objWriter->writeAttribute('manifest:full-path', 'styles.xml');
+ $objWriter->writeAttribute('manifest:media-type', 'text/xml');
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Mimetype.php b/Classes/PHPExcel/Writer/OpenDocument/Mimetype.php
new file mode 100644
index 0000000..d51a8b9
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Mimetype.php
@@ -0,0 +1,41 @@
+getParentWriter()->getPHPExcel();
+ }
+
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8');
+
+ // Settings
+ $objWriter->startElement('office:document-settings');
+ $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
+ $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
+ $objWriter->writeAttribute('xmlns:config', 'urn:oasis:names:tc:opendocument:xmlns:config:1.0');
+ $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
+ $objWriter->writeAttribute('office:version', '1.2');
+
+ $objWriter->startElement('office:settings');
+ $objWriter->startElement('config:config-item-set');
+ $objWriter->writeAttribute('config:name', 'ooo:view-settings');
+ $objWriter->startElement('config:config-item-map-indexed');
+ $objWriter->writeAttribute('config:name', 'Views');
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->startElement('config:config-item-set');
+ $objWriter->writeAttribute('config:name', 'ooo:configuration-settings');
+ $objWriter->endElement();
+ $objWriter->endElement();
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Styles.php b/Classes/PHPExcel/Writer/OpenDocument/Styles.php
new file mode 100644
index 0000000..cc6e25b
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Styles.php
@@ -0,0 +1,92 @@
+getParentWriter()->getPHPExcel();
+ }
+
+ $objWriter = null;
+ if ($this->getParentWriter()->getUseDiskCaching()) {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
+ } else {
+ $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
+ }
+
+ // XML header
+ $objWriter->startDocument('1.0', 'UTF-8');
+
+ // Content
+ $objWriter->startElement('office:document-styles');
+ $objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
+ $objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
+ $objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
+ $objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
+ $objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
+ $objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
+ $objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
+ $objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
+ $objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
+ $objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
+ $objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0');
+ $objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
+ $objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
+ $objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
+ $objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML');
+ $objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
+ $objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
+ $objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
+ $objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer');
+ $objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc');
+ $objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events');
+ $objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report');
+ $objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
+ $objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
+ $objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
+ $objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table');
+ $objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/');
+ $objWriter->writeAttribute('office:version', '1.2');
+
+ $objWriter->writeElement('office:font-face-decls');
+ $objWriter->writeElement('office:styles');
+ $objWriter->writeElement('office:automatic-styles');
+ $objWriter->writeElement('office:master-styles');
+ $objWriter->endElement();
+
+ return $objWriter->getData();
+ }
+}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Thumbnails.php b/Classes/PHPExcel/Writer/OpenDocument/Thumbnails.php
new file mode 100644
index 0000000..54247ae
--- /dev/null
+++ b/Classes/PHPExcel/Writer/OpenDocument/Thumbnails.php
@@ -0,0 +1,41 @@
+renderer = new $rendererName($phpExcel);
+ }
+
+
+ /**
+ * Magic method to handle direct calls to the configured PDF renderer wrapper class.
+ *
+ * @param string $name Renderer library method name
+ * @param mixed[] $arguments Array of arguments to pass to the renderer method
+ * @return mixed Returned data from the PDF renderer wrapper method
+ */
+ public function __call($name, $arguments)
+ {
+ if ($this->renderer === null) {
+ throw new PHPExcel_Writer_Exception("PDF Rendering library has not been defined.");
+ }
+
+ return call_user_func_array(array($this->renderer, $name), $arguments);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function save($pFilename = null)
+ {
+ $this->renderer->save($pFilename);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/PDF/Core.php b/Classes/PHPExcel/Writer/PDF/Core.php
new file mode 100644
index 0000000..4fed84a
--- /dev/null
+++ b/Classes/PHPExcel/Writer/PDF/Core.php
@@ -0,0 +1,355 @@
+ 'LETTER', // (8.5 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL
+ => 'LETTER', // (8.5 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID
+ => array(792.00, 1224.00), // (11 in. by 17 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER
+ => array(1224.00, 792.00), // (17 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL
+ => 'LEGAL', // (8.5 in. by 14 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT
+ => array(396.00, 612.00), // (5.5 in. by 8.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE
+ => 'EXECUTIVE', // (7.25 in. by 10.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3
+ => 'A3', // (297 mm by 420 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4
+ => 'A4', // (210 mm by 297 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL
+ => 'A4', // (210 mm by 297 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5
+ => 'A5', // (148 mm by 210 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4
+ => 'B4', // (250 mm by 353 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5
+ => 'B5', // (176 mm by 250 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO
+ => 'FOLIO', // (8.5 in. by 13 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO
+ => array(609.45, 779.53), // (215 mm by 275 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1
+ => array(720.00, 1008.00), // (10 in. by 14 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2
+ => array(792.00, 1224.00), // (11 in. by 17 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE
+ => 'LETTER', // (8.5 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE
+ => array(279.00, 639.00), // (3.875 in. by 8.875 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE
+ => array(297.00, 684.00), // (4.125 in. by 9.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE
+ => array(324.00, 747.00), // (4.5 in. by 10.375 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE
+ => array(342.00, 792.00), // (4.75 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE
+ => array(360.00, 828.00), // (5 in. by 11.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C
+ => array(1224.00, 1584.00), // (17 in. by 22 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_D
+ => array(1584.00, 2448.00), // (22 in. by 34 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_E
+ => array(2448.00, 3168.00), // (34 in. by 44 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE
+ => array(311.81, 623.62), // (110 mm by 220 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE
+ => 'C5', // (162 mm by 229 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE
+ => 'C3', // (324 mm by 458 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE
+ => 'C4', // (229 mm by 324 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE
+ => 'C6', // (114 mm by 162 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE
+ => array(323.15, 649.13), // (114 mm by 229 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE
+ => 'B4', // (250 mm by 353 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE
+ => 'B5', // (176 mm by 250 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE
+ => array(498.90, 354.33), // (176 mm by 125 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE
+ => array(311.81, 651.97), // (110 mm by 230 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE
+ => array(279.00, 540.00), // (3.875 in. by 7.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE
+ => array(261.00, 468.00), // (3.625 in. by 6.5 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD
+ => array(1071.00, 792.00), // (14.875 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD
+ => array(612.00, 864.00), // (8.5 in. by 12 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD
+ => 'FOLIO', // (8.5 in. by 13 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4
+ => 'B4', // (250 mm by 353 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD
+ => array(566.93, 419.53), // (200 mm by 148 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1
+ => array(648.00, 792.00), // (9 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2
+ => array(720.00, 792.00), // (10 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3
+ => array(1080.00, 792.00), // (15 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE
+ => array(623.62, 623.62), // (220 mm by 220 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER
+ => array(667.80, 864.00), // (9.275 in. by 12 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER
+ => array(667.80, 1080.00), // (9.275 in. by 15 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER
+ => array(841.68, 1296.00), // (11.69 in. by 18 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER
+ => array(668.98, 912.76), // (236 mm by 322 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER
+ => array(595.80, 792.00), // (8.275 in. by 11 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER
+ => 'A4', // (210 mm by 297 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER
+ => array(667.80, 864.00), // (9.275 in. by 12 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER
+ => array(643.46, 1009.13), // (227 mm by 356 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER
+ => array(864.57, 1380.47), // (305 mm by 487 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER
+ => array(612.00, 913.68), // (8.5 in. by 12.69 in.)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER
+ => array(595.28, 935.43), // (210 mm by 330 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER
+ => 'A5', // (148 mm by 210 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER
+ => array(515.91, 728.50), // (182 mm by 257 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER
+ => array(912.76, 1261.42), // (322 mm by 445 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER
+ => array(493.23, 666.14), // (174 mm by 235 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER
+ => array(569.76, 782.36), // (201 mm by 276 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER
+ => 'A2', // (420 mm by 594 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER
+ => 'A3', // (297 mm by 420 mm)
+ PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER
+ => array(912.76, 1261.42) // (322 mm by 445 mm)
+ );
+
+ /**
+ * Create a new PHPExcel_Writer_PDF
+ *
+ * @param PHPExcel $phpExcel PHPExcel object
+ */
+ public function __construct(PHPExcel $phpExcel)
+ {
+ parent::__construct($phpExcel);
+ $this->setUseInlineCss(true);
+ $this->tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
+ }
+
+ /**
+ * Get Font
+ *
+ * @return string
+ */
+ public function getFont()
+ {
+ return $this->font;
+ }
+
+ /**
+ * Set font. Examples:
+ * 'arialunicid0-chinese-simplified'
+ * 'arialunicid0-chinese-traditional'
+ * 'arialunicid0-korean'
+ * 'arialunicid0-japanese'
+ *
+ * @param string $fontName
+ */
+ public function setFont($fontName)
+ {
+ $this->font = $fontName;
+ return $this;
+ }
+
+ /**
+ * Get Paper Size
+ *
+ * @return int
+ */
+ public function getPaperSize()
+ {
+ return $this->paperSize;
+ }
+
+ /**
+ * Set Paper Size
+ *
+ * @param string $pValue Paper size
+ * @return PHPExcel_Writer_PDF
+ */
+ public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
+ {
+ $this->paperSize = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get Orientation
+ *
+ * @return string
+ */
+ public function getOrientation()
+ {
+ return $this->orientation;
+ }
+
+ /**
+ * Set Orientation
+ *
+ * @param string $pValue Page orientation
+ * @return PHPExcel_Writer_PDF
+ */
+ public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
+ {
+ $this->orientation = $pValue;
+ return $this;
+ }
+
+ /**
+ * Get temporary storage directory
+ *
+ * @return string
+ */
+ public function getTempDir()
+ {
+ return $this->tempDir;
+ }
+
+ /**
+ * Set temporary storage directory
+ *
+ * @param string $pValue Temporary storage directory
+ * @throws PHPExcel_Writer_Exception when directory does not exist
+ * @return PHPExcel_Writer_PDF
+ */
+ public function setTempDir($pValue = '')
+ {
+ if (is_dir($pValue)) {
+ $this->tempDir = $pValue;
+ } else {
+ throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue");
+ }
+ return $this;
+ }
+
+ /**
+ * Save PHPExcel to PDF file, pre-save
+ *
+ * @param string $pFilename Name of the file to save as
+ * @throws PHPExcel_Writer_Exception
+ */
+ protected function prepareForSave($pFilename = null)
+ {
+ // garbage collect
+ $this->phpExcel->garbageCollect();
+
+ $this->saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
+ PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
+
+ // Open file
+ $fileHandle = fopen($pFilename, 'w');
+ if ($fileHandle === false) {
+ throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing.");
+ }
+
+ // Set PDF
+ $this->isPdf = true;
+ // Build CSS
+ $this->buildCSS(true);
+
+ return $fileHandle;
+ }
+
+ /**
+ * Save PHPExcel to PDF file, post-save
+ *
+ * @param resource $fileHandle
+ * @throws PHPExcel_Writer_Exception
+ */
+ protected function restoreStateAfterSave($fileHandle)
+ {
+ // Close file
+ fclose($fileHandle);
+
+ PHPExcel_Calculation::setArrayReturnType($this->saveArrayReturnType);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/PDF/DomPDF.php b/Classes/PHPExcel/Writer/PDF/DomPDF.php
new file mode 100644
index 0000000..83761ac
--- /dev/null
+++ b/Classes/PHPExcel/Writer/PDF/DomPDF.php
@@ -0,0 +1,108 @@
+getSheetIndex())) {
+ $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet(0)->getPageMargins();
+ } else {
+ $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
+ }
+
+ $orientation = ($orientation == 'L') ? 'landscape' : 'portrait';
+
+ // Override Page Orientation
+ if (!is_null($this->getOrientation())) {
+ $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
+ ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT
+ : $this->getOrientation();
+ }
+ // Override Paper Size
+ if (!is_null($this->getPaperSize())) {
+ $printPaperSize = $this->getPaperSize();
+ }
+
+ if (isset(self::$paperSizes[$printPaperSize])) {
+ $paperSize = self::$paperSizes[$printPaperSize];
+ }
+
+
+ // Create PDF
+ $pdf = new DOMPDF();
+ $pdf->set_paper(strtolower($paperSize), $orientation);
+
+ $pdf->load_html(
+ $this->generateHTMLHeader(false) .
+ $this->generateSheetData() .
+ $this->generateHTMLFooter()
+ );
+ $pdf->render();
+
+ // Write to file
+ fwrite($fileHandle, $pdf->output());
+
+ parent::restoreStateAfterSave($fileHandle);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/PDF/mPDF.php b/Classes/PHPExcel/Writer/PDF/mPDF.php
new file mode 100644
index 0000000..e4e6057
--- /dev/null
+++ b/Classes/PHPExcel/Writer/PDF/mPDF.php
@@ -0,0 +1,118 @@
+getSheetIndex())) {
+ $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet(0)->getPageMargins();
+ } else {
+ $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
+ }
+ $this->setOrientation($orientation);
+
+ // Override Page Orientation
+ if (!is_null($this->getOrientation())) {
+ $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
+ ? PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT
+ : $this->getOrientation();
+ }
+ $orientation = strtoupper($orientation);
+
+ // Override Paper Size
+ if (!is_null($this->getPaperSize())) {
+ $printPaperSize = $this->getPaperSize();
+ }
+
+ if (isset(self::$paperSizes[$printPaperSize])) {
+ $paperSize = self::$paperSizes[$printPaperSize];
+ }
+
+
+ // Create PDF
+ $pdf = new mpdf();
+ $ortmp = $orientation;
+ $pdf->_setPageSize(strtoupper($paperSize), $ortmp);
+ $pdf->DefOrientation = $orientation;
+ $pdf->AddPage($orientation);
+
+ // Document info
+ $pdf->SetTitle($this->phpExcel->getProperties()->getTitle());
+ $pdf->SetAuthor($this->phpExcel->getProperties()->getCreator());
+ $pdf->SetSubject($this->phpExcel->getProperties()->getSubject());
+ $pdf->SetKeywords($this->phpExcel->getProperties()->getKeywords());
+ $pdf->SetCreator($this->phpExcel->getProperties()->getCreator());
+
+ $pdf->WriteHTML(
+ $this->generateHTMLHeader(false) .
+ $this->generateSheetData() .
+ $this->generateHTMLFooter()
+ );
+
+ // Write to file
+ fwrite($fileHandle, $pdf->Output('', 'S'));
+
+ parent::restoreStateAfterSave($fileHandle);
+ }
+}
diff --git a/Classes/PHPExcel/Writer/PDF/tcPDF.php b/Classes/PHPExcel/Writer/PDF/tcPDF.php
new file mode 100644
index 0000000..dea33a3
--- /dev/null
+++ b/Classes/PHPExcel/Writer/PDF/tcPDF.php
@@ -0,0 +1,123 @@
+getSheetIndex())) {
+ $orientation = ($this->phpExcel->getSheet(0)->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet(0)->getPageMargins();
+ } else {
+ $orientation = ($this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation()
+ == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE) ? 'L' : 'P';
+ $printPaperSize = $this->phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
+ $printMargins = $this->phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
+ }
+
+ // Override Page Orientation
+ if (!is_null($this->getOrientation())) {
+ $orientation = ($this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE)
+ ? 'L'
+ : 'P';
+ }
+ // Override Paper Size
+ if (!is_null($this->getPaperSize())) {
+ $printPaperSize = $this->getPaperSize();
+ }
+
+ if (isset(self::$paperSizes[$printPaperSize])) {
+ $paperSize = self::$paperSizes[$printPaperSize];
+ }
+
+
+ // Create PDF
+ $pdf = new TCPDF($orientation, 'pt', $paperSize);
+ $pdf->setFontSubsetting(false);
+ // Set margins, converting inches to points (using 72 dpi)
+ $pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
+ $pdf->SetAutoPageBreak(true, $printMargins->getBottom() * 72);
+
+ $pdf->setPrintHeader(false);
+ $pdf->setPrintFooter(false);
+
+ $pdf->AddPage();
+
+ // Set the appropriate font
+ $pdf->SetFont($this->getFont());
+ $pdf->writeHTML(
+ $this->generateHTMLHeader(false) .
+ $this->generateSheetData() .
+ $this->generateHTMLFooter()
+ );
+
+ // Document info
+ $pdf->SetTitle($this->phpExcel->getProperties()->getTitle());
+ $pdf->SetAuthor($this->phpExcel->getProperties()->getCreator());
+ $pdf->SetSubject($this->phpExcel->getProperties()->getSubject());
+ $pdf->SetKeywords($this->phpExcel->getProperties()->getKeywords());
+ $pdf->SetCreator($this->phpExcel->getProperties()->getCreator());
+
+ // Write to file
+ fwrite($fileHandle, $pdf->output($pFilename, 'S'));
+
+ parent::restoreStateAfterSave($fileHandle);
+ }
+}
diff --git a/Classes/PHPExcel/locale/bg/config b/Classes/PHPExcel/locale/bg/config
new file mode 100644
index 0000000..4cecddb
--- /dev/null
+++ b/Classes/PHPExcel/locale/bg/config
@@ -0,0 +1,49 @@
+##
+## PHPExcel
+##
+
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = лв
+
+
+##
+## Excel Error Codes (For future use)
+
+##
+NULL = #ПРÐЗÐО!
+DIV0 = #ДЕЛ/0!
+VALUE = #СТОЙÐОСТ!
+REF = #РЕФ!
+NAME = #ИМЕ?
+NUM = #ЧИСЛО!
+NA = #Ð/Д
diff --git a/Classes/PHPExcel/locale/cs/config b/Classes/PHPExcel/locale/cs/config
new file mode 100644
index 0000000..42cdf32
--- /dev/null
+++ b/Classes/PHPExcel/locale/cs/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = KÄ
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULL!
+DIV0 = #DIV/0!
+VALUE = #HODNOTA!
+REF = #REF!
+NAME = #NÃZEV?
+NUM = #NUM!
+NA = #N/A
diff --git a/Classes/PHPExcel/locale/cs/functions b/Classes/PHPExcel/locale/cs/functions
new file mode 100644
index 0000000..c0a3cbb
--- /dev/null
+++ b/Classes/PHPExcel/locale/cs/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Funkce doplňků a automatizace
+##
+GETPIVOTDATA = ZÃSKATKONTDATA ## Vrátà data uložená v kontingenÄnà tabulce. Pomocà funkce ZÃSKATKONTDATA můžete naÄÃst souhrnná data z kontingenÄnà tabulky, pokud jsou tato data v kontingenÄnà sestavÄ› zobrazena.
+
+
+##
+## Cube functions Funkce pro práci s krychlemi
+##
+CUBEKPIMEMBER = CUBEKPIMEMBER ## Vrátà název, vlastnost a velikost klÃÄového ukazatele výkonu (KUV) a zobrazà v buňce název a vlastnost. KlÃÄový ukazatel výkonu je kvantifikovatelná veliÄina, napÅ™Ãklad hrubý mÄ›sÃÄnà zisk nebo Ätvrtletnà obrat na zamÄ›stnance, která se použÃvá pro sledovánà výkonnosti organizace.
+CUBEMEMBER = CUBEMEMBER ## Vrátà Älen nebo n-tici v hierarchii krychle. Sloužà k ověřenÃ, zda v krychli existuje Älen nebo n-tice.
+CUBEMEMBERPROPERTY = CUBEMEMBERPROPERTY ## Vrátà hodnotu vlastnosti Älena v krychli. Sloužà k ověřenÃ, zda v krychli existuje Älen s daným názvem, a k vrácenà konkrétnà vlastnosti tohoto Älena.
+CUBERANKEDMEMBER = CUBERANKEDMEMBER ## Vrátà n-tý nebo poÅ™adový Älen sady. Použijte ji pro vrácenà jednoho nebo vÃce prvků sady, napÅ™Ãklad obchodnÃka s nejvyÅ¡Å¡Ãm obratem nebo deseti nejlepÅ¡Ãch studentů.
+CUBESET = CUBESET ## Definuje vypoÄtenou sadu Älenů nebo n-tic odeslánÃm výrazu sady do krychle na serveru, který vytvořà sadu a potom ji vrátà do aplikace Microsoft Office Excel.
+CUBESETCOUNT = CUBESETCOUNT ## Vrátà poÄet položek v množinÄ›
+CUBEVALUE = CUBEVALUE ## Vrátà úhrnnou hodnotu z krychle.
+
+
+##
+## Database functions Funkce databáze
+##
+DAVERAGE = DPRŮMĚR ## Vrátà průměr vybraných položek databáze.
+DCOUNT = DPOÄŒET ## SpoÄÃtá buňky databáze obsahujÃcà ÄÃsla.
+DCOUNTA = DPOÄŒET2 ## SpoÄÃtá buňky databáze, které nejsou prázdné.
+DGET = DZÃSKAT ## Extrahuje z databáze jeden záznam splňujÃcà zadaná kritéria.
+DMAX = DMAX ## Vrátà maximálnà hodnotu z vybraných položek databáze.
+DMIN = DMIN ## Vrátà minimálnà hodnotu z vybraných položek databáze.
+DPRODUCT = DSOUÄŒIN ## Vynásobà hodnoty urÄitého pole záznamů v databázi, které splňujà daná kritéria.
+DSTDEV = DSMODCH.VÃBÄšR ## Odhadne smÄ›rodatnou odchylku výbÄ›ru vybraných položek databáze.
+DSTDEVP = DSMODCH ## VypoÄte smÄ›rodatnou odchylku základnÃho souboru vybraných položek databáze.
+DSUM = DSUMA ## SeÄte ÄÃsla ve sloupcovém poli záznamů databáze, která splňujà daná kritéria.
+DVAR = DVAR.VÃBÄšR ## Odhadne rozptyl výbÄ›ru vybraných položek databáze.
+DVARP = DVAR ## VypoÄte rozptyl základnÃho souboru vybraných položek databáze.
+
+
+##
+## Date and time functions Funkce data a Äasu
+##
+DATE = DATUM ## Vrátà poÅ™adové ÄÃslo urÄitého data.
+DATEVALUE = DATUMHODN ## PÅ™evede datum ve formÄ› textu na poÅ™adové ÄÃslo.
+DAY = DEN ## PÅ™evede poÅ™adové ÄÃslo na den v mÄ›sÃci.
+DAYS360 = ROK360 ## Vrátà poÄet dnà mezi dvÄ›ma daty na základÄ› roku s 360 dny.
+EDATE = EDATE ## Vrátà poÅ™adové ÄÃslo data, které oznaÄuje urÄený poÄet mÄ›sÃců pÅ™ed nebo po poÄáteÄnÃm datu.
+EOMONTH = EOMONTH ## Vrátà poÅ™adové ÄÃslo poslednÃho dne mÄ›sÃce pÅ™ed nebo po zadaném poÄtu mÄ›sÃců.
+HOUR = HODINA ## PÅ™evede poÅ™adové ÄÃslo na hodinu.
+MINUTE = MINUTA ## PÅ™evede poÅ™adové ÄÃslo na minutu.
+MONTH = MÄšSÃC ## PÅ™evede poÅ™adové ÄÃslo na mÄ›sÃc.
+NETWORKDAYS = NETWORKDAYS ## Vrátà poÄet celých pracovnÃch dnà mezi dvÄ›ma daty.
+NOW = NYNà ## Vrátà poÅ™adové ÄÃslo aktuálnÃho data a Äasu.
+SECOND = SEKUNDA ## PÅ™evede poÅ™adové ÄÃslo na sekundu.
+TIME = ÄŒAS ## Vrátà poÅ™adové ÄÃslo urÄitého Äasu.
+TIMEVALUE = ÄŒASHODN ## PÅ™evede Äas ve formÄ› textu na poÅ™adové ÄÃslo.
+TODAY = DNES ## Vrátà poÅ™adové ÄÃslo dneÅ¡nÃho data.
+WEEKDAY = DENTÃDNE ## PÅ™evede poÅ™adové ÄÃslo na den v týdnu.
+WEEKNUM = WEEKNUM ## PÅ™evede poÅ™adové ÄÃslo na ÄÃslo pÅ™edstavujÃcà ÄÃselnou pozici týdne v roce.
+WORKDAY = WORKDAY ## Vrátà poÅ™adové ÄÃslo data pÅ™ed nebo po zadaném poÄtu pracovnÃch dnÃ.
+YEAR = ROK ## PÅ™evede poÅ™adové ÄÃslo na rok.
+YEARFRAC = YEARFRAC ## Vrátà Äást roku vyjádÅ™enou zlomkem a pÅ™edstavujÃcà poÄet celých dnà mezi poÄáteÄnÃm a koncovým datem.
+
+
+##
+## Engineering functions Inženýrské funkce (Technické funkce)
+##
+BESSELI = BESSELI ## Vrátà modifikovanou Besselovu funkci In(x).
+BESSELJ = BESSELJ ## Vrátà modifikovanou Besselovu funkci Jn(x).
+BESSELK = BESSELK ## Vrátà modifikovanou Besselovu funkci Kn(x).
+BESSELY = BESSELY ## Vrátà Besselovu funkci Yn(x).
+BIN2DEC = BIN2DEC ## PÅ™evede binárnà ÄÃslo na desÃtkové.
+BIN2HEX = BIN2HEX ## PÅ™evede binárnà ÄÃslo na Å¡estnáctkové.
+BIN2OCT = BIN2OCT ## PÅ™evede binárnà ÄÃslo na osmiÄkové.
+COMPLEX = COMPLEX ## PÅ™evede reálnou a imaginárnà Äást na komplexnà ÄÃslo.
+CONVERT = CONVERT ## PÅ™evede ÄÃslo do jiného jednotkového mÄ›rného systému.
+DEC2BIN = DEC2BIN ## PÅ™evede desÃtkového ÄÃsla na dvojkové
+DEC2HEX = DEC2HEX ## PÅ™evede desÃtkové ÄÃslo na Å¡estnáctkové.
+DEC2OCT = DEC2OCT ## PÅ™evede desÃtkové ÄÃslo na osmiÄkové.
+DELTA = DELTA ## Testuje rovnost dvou hodnot.
+ERF = ERF ## Vrátà chybovou funkci.
+ERFC = ERFC ## Vrátà doplňkovou chybovou funkci.
+GESTEP = GESTEP ## Testuje, zda je ÄÃslo vÄ›tÅ¡Ã než meznà hodnota.
+HEX2BIN = HEX2BIN ## PÅ™evede Å¡estnáctkové ÄÃslo na binárnÃ.
+HEX2DEC = HEX2DEC ## PÅ™evede Å¡estnáctkové ÄÃslo na desÃtkové.
+HEX2OCT = HEX2OCT ## PÅ™evede Å¡estnáctkové ÄÃslo na osmiÄkové.
+IMABS = IMABS ## Vrátà absolutnà hodnotu (modul) komplexnÃho ÄÃsla.
+IMAGINARY = IMAGINARY ## Vrátà imaginárnà Äást komplexnÃho ÄÃsla.
+IMARGUMENT = IMARGUMENT ## Vrátà argument théta, úhel vyjádřený v radiánech.
+IMCONJUGATE = IMCONJUGATE ## Vrátà komplexnÄ› sdružené ÄÃslo ke komplexnÃmu ÄÃslu.
+IMCOS = IMCOS ## Vrátà kosinus komplexnÃho ÄÃsla.
+IMDIV = IMDIV ## Vrátà podÃl dvou komplexnÃch ÄÃsel.
+IMEXP = IMEXP ## Vrátà exponenciálnà tvar komplexnÃho ÄÃsla.
+IMLN = IMLN ## Vrátà pÅ™irozený logaritmus komplexnÃho ÄÃsla.
+IMLOG10 = IMLOG10 ## Vrátà dekadický logaritmus komplexnÃho ÄÃsla.
+IMLOG2 = IMLOG2 ## Vrátà logaritmus komplexnÃho ÄÃsla pÅ™i základu 2.
+IMPOWER = IMPOWER ## Vrátà komplexnà ÄÃslo umocnÄ›né na celé ÄÃslo.
+IMPRODUCT = IMPRODUCT ## Vrátà souÄin komplexnÃch ÄÃsel.
+IMREAL = IMREAL ## Vrátà reálnou Äást komplexnÃho ÄÃsla.
+IMSIN = IMSIN ## Vrátà sinus komplexnÃho ÄÃsla.
+IMSQRT = IMSQRT ## Vrátà druhou odmocninu komplexnÃho ÄÃsla.
+IMSUB = IMSUB ## Vrátà rozdÃl mezi dvÄ›ma komplexnÃmi ÄÃsly.
+IMSUM = IMSUM ## Vrátà souÄet dvou komplexnÃch ÄÃsel.
+OCT2BIN = OCT2BIN ## PÅ™evede osmiÄkové ÄÃslo na binárnÃ.
+OCT2DEC = OCT2DEC ## PÅ™evede osmiÄkové ÄÃslo na desÃtkové.
+OCT2HEX = OCT2HEX ## PÅ™evede osmiÄkové ÄÃslo na Å¡estnáctkové.
+
+
+##
+## Financial functions FinanÄnà funkce
+##
+ACCRINT = ACCRINT ## Vrátà nahromadÄ›ný úrok z cenného papÃru, ze kterého je úrok placen v pravidelných termÃnech.
+ACCRINTM = ACCRINTM ## Vrátà nahromadÄ›ný úrok z cenného papÃru, ze kterého je úrok placen k datu splatnosti.
+AMORDEGRC = AMORDEGRC ## Vrátà lineárnà amortizaci v každém úÄetnÃm obdobà pomocà koeficientu amortizace.
+AMORLINC = AMORLINC ## Vrátà lineárnà amortizaci v každém úÄetnÃm obdobÃ.
+COUPDAYBS = COUPDAYBS ## Vrátà poÄet dnů od zaÄátku obdobà placenà kupónů do data splatnosti.
+COUPDAYS = COUPDAYS ## Vrátà poÄet dnů v obdobà placenà kupónů, které obsahuje den zúÄtovánÃ.
+COUPDAYSNC = COUPDAYSNC ## Vrátà poÄet dnů od data zúÄtovánà do následujÃcÃho data placenà kupónu.
+COUPNCD = COUPNCD ## Vrátà následujÃcà datum placenà kupónu po datu zúÄtovánÃ.
+COUPNUM = COUPNUM ## Vrátà poÄet kupónů splatných mezi datem zúÄtovánà a datem splatnosti.
+COUPPCD = COUPPCD ## Vrátà pÅ™edchozà datum placenà kupónu pÅ™ed datem zúÄtovánÃ.
+CUMIPMT = CUMIPMT ## Vrátà kumulativnà úrok splacený mezi dvÄ›ma obdobÃmi.
+CUMPRINC = CUMPRINC ## Vrátà kumulativnà jistinu splacenou mezi dvÄ›ma obdobÃmi půjÄky.
+DB = ODPIS.ZRYCH ## Vrátà odpis aktiva za urÄité obdobà pomocà degresivnà metody odpisu s pevným zůstatkem.
+DDB = ODPIS.ZRYCH2 ## Vrátà odpis aktiva za urÄité obdobà pomocà dvojité degresivnà metody odpisu nebo jiné metody, kterou zadáte.
+DISC = DISC ## Vrátà diskontnà sazbu cenného papÃru.
+DOLLARDE = DOLLARDE ## PÅ™evede Äástku v korunách vyjádÅ™enou zlomkem na Äástku v korunách vyjádÅ™enou desetinným ÄÃslem.
+DOLLARFR = DOLLARFR ## PÅ™evede Äástku v korunách vyjádÅ™enou desetinným ÄÃslem na Äástku v korunách vyjádÅ™enou zlomkem.
+DURATION = DURATION ## Vrátà roÄnà dobu cenného papÃru s pravidelnými úrokovými sazbami.
+EFFECT = EFFECT ## Vrátà efektivnà roÄnà úrokovou sazbu.
+FV = BUDHODNOTA ## Vrátà budoucà hodnotu investice.
+FVSCHEDULE = FVSCHEDULE ## Vrátà budoucà hodnotu poÄáteÄnà jistiny po použità série sazeb složitého úroku.
+INTRATE = INTRATE ## Vrátà úrokovou sazbu plnÄ› investovaného cenného papÃru.
+IPMT = PLATBA.ÚROK ## Vrátà výšku úroku investice za dané obdobÃ.
+IRR = MÃRA.VÃNOSNOSTI ## Vrátà vnitÅ™nà výnosové procento série peněžnÃch toků.
+ISPMT = ISPMT ## VypoÄte výši úroku z investice zaplaceného bÄ›hem urÄitého obdobÃ.
+MDURATION = MDURATION ## Vrátà Macauleyho modifikovanou dobu cenného papÃru o nominálnà hodnotÄ› 100 KÄ.
+MIRR = MOD.MÃRA.VÃNOSNOSTI ## Vrátà vnitÅ™nà sazbu výnosu, pÅ™iÄemž kladné a záporné hodnoty peněžnÃch prostÅ™edků jsou financovány podle různých sazeb.
+NOMINAL = NOMINAL ## Vrátà nominálnà roÄnà úrokovou sazbu.
+NPER = POÄŒET.OBDOBà ## Vrátà poÄet obdobà pro investici.
+NPV = ÄŒISTÃ.SOUÄŒHODNOTA ## Vrátà Äistou souÄasnou hodnotu investice vypoÄÃtanou na základÄ› série pravidelných peněžnÃch toků a diskontnà sazby.
+ODDFPRICE = ODDFPRICE ## Vrátà cenu cenného papÃru o nominálnà hodnotÄ› 100 KÄ s odliÅ¡ným prvnÃm obdobÃm.
+ODDFYIELD = ODDFYIELD ## Vrátà výnos cenného papÃru s odliÅ¡ným prvnÃm obdobÃm.
+ODDLPRICE = ODDLPRICE ## Vrátà cenu cenného papÃru o nominálnà hodnotÄ› 100 KÄ s odliÅ¡ným poslednÃm obdobÃm.
+ODDLYIELD = ODDLYIELD ## Vrátà výnos cenného papÃru s odliÅ¡ným poslednÃm obdobÃm.
+PMT = PLATBA ## Vrátà hodnotu pravidelné splátky anuity.
+PPMT = PLATBA.ZÃKLAD ## Vrátà hodnotu splátky jistiny pro zadanou investici za dané obdobÃ.
+PRICE = PRICE ## Vrátà cenu cenného papÃru o nominálnà hodnotÄ› 100 KÄ, ze kterého je úrok placen v pravidelných termÃnech.
+PRICEDISC = PRICEDISC ## Vrátà cenu diskontnÃho cenného papÃru o nominálnà hodnotÄ› 100 KÄ.
+PRICEMAT = PRICEMAT ## Vrátà cenu cenného papÃru o nominálnà hodnotÄ› 100 KÄ, ze kterého je úrok placen k datu splatnosti.
+PV = SOUÄŒHODNOTA ## Vrátà souÄasnou hodnotu investice.
+RATE = ÚROKOVÃ.MÃRA ## Vrátà úrokovou sazbu vztaženou na obdobà anuity.
+RECEIVED = RECEIVED ## Vrátà Äástku obdrženou k datu splatnosti plnÄ› investovaného cenného papÃru.
+SLN = ODPIS.LIN ## Vrátà pÅ™Ãmé odpisy aktiva pro jedno obdobÃ.
+SYD = ODPIS.NELIN ## Vrátà smÄ›rné ÄÃslo roÄnÃch odpisů aktiva pro zadané obdobÃ.
+TBILLEQ = TBILLEQ ## Vrátà výnos směnky státnà pokladny ekvivalentnà výnosu obligace.
+TBILLPRICE = TBILLPRICE ## Vrátà cenu smÄ›nky státnà pokladny o nominálnà hodnotÄ› 100 KÄ.
+TBILLYIELD = TBILLYIELD ## Vrátà výnos směnky státnà pokladny.
+VDB = ODPIS.ZA.INT ## Vrátà odpis aktiva pro urÄité obdobà nebo Äást obdobà pomocà degresivnà metody odpisu.
+XIRR = XIRR ## Vrátà vnitÅ™nà výnosnost pro harmonogram peněžnÃch toků, který nemusà být nutnÄ› periodický.
+XNPV = XNPV ## Vrátà Äistou souÄasnou hodnotu pro harmonogram peněžnÃch toků, který nemusà být nutnÄ› periodický.
+YIELD = YIELD ## Vrátà výnos cenného papÃru, ze kterého je úrok placen v pravidelných termÃnech.
+YIELDDISC = YIELDDISC ## Vrátà roÄnà výnos diskontnÃho cenného papÃru, napÅ™Ãklad smÄ›nky státnà pokladny.
+YIELDMAT = YIELDMAT ## Vrátà roÄnà výnos cenného papÃru, ze kterého je úrok placen k datu splatnosti.
+
+
+##
+## Information functions InformaÄnà funkce
+##
+CELL = POLÃÄŒKO ## Vrátà informace o formátovánÃ, umÃstÄ›nà nebo obsahu buňky.
+ERROR.TYPE = CHYBA.TYP ## Vrátà ÄÃslo odpovÃdajÃcà typu chyby.
+INFO = O.PROSTŘEDà ## Vrátà informace o aktuálnÃm pracovnÃm prostÅ™edÃ.
+ISBLANK = JE.PRÃZDNÉ ## Vrátà hodnotu PRAVDA, pokud se argument hodnota odkazuje na prázdnou buňku.
+ISERR = JE.CHYBA ## Vrátà hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota (kromě #N/A).
+ISERROR = JE.CHYBHODN ## Vrátà hodnotu PRAVDA, pokud je argument hodnota libovolná chybová hodnota.
+ISEVEN = ISEVEN ## Vrátà hodnotu PRAVDA, pokud je ÄÃslo sudé.
+ISLOGICAL = JE.LOGHODN ## Vrátà hodnotu PRAVDA, pokud je argument hodnota logická hodnota.
+ISNA = JE.NEDEF ## Vrátà hodnotu PRAVDA, pokud je argument hodnota chybová hodnota #N/A.
+ISNONTEXT = JE.NETEXT ## Vrátà hodnotu PRAVDA, pokud argument hodnota nenà text.
+ISNUMBER = JE.ÄŒÃSLO ## Vrátà hodnotu PRAVDA, pokud je argument hodnota ÄÃslo.
+ISODD = ISODD ## Vrátà hodnotu PRAVDA, pokud je ÄÃslo liché.
+ISREF = JE.ODKAZ ## Vrátà hodnotu PRAVDA, pokud je argument hodnota odkaz.
+ISTEXT = JE.TEXT ## Vrátà hodnotu PRAVDA, pokud je argument hodnota text.
+N = N ## Vrátà hodnotu pÅ™evedenou na ÄÃslo.
+NA = NEDEF ## Vrátà chybovou hodnotu #N/A.
+TYPE = TYP ## Vrátà ÄÃslo oznaÄujÃcà datový typ hodnoty.
+
+
+##
+## Logical functions Logické funkce
+##
+AND = A ## Vrátà hodnotu PRAVDA, majÃ-li vÅ¡echny argumenty hodnotu PRAVDA.
+FALSE = NEPRAVDA ## Vrátà logickou hodnotu NEPRAVDA.
+IF = KDYŽ ## UrÄÃ, který logický test má probÄ›hnout.
+IFERROR = IFERROR ## Pokud je vzorec vyhodnocen jako chyba, vrátà zadanou hodnotu. V opaÄném pÅ™ÃpadÄ› vrátà výsledek vzorce.
+NOT = NE ## Provede logickou negaci argumentu funkce.
+OR = NEBO ## Vrátà hodnotu PRAVDA, je-li alespoň jeden argument roven hodnotě PRAVDA.
+TRUE = PRAVDA ## Vrátà logickou hodnotu PRAVDA.
+
+
+##
+## Lookup and reference functions Vyhledávacà funkce
+##
+ADDRESS = ODKAZ ## Vrátà textový odkaz na jednu buňku listu.
+AREAS = POÄŒET.BLOKÅ® ## Vrátà poÄet oblastà v odkazu.
+CHOOSE = ZVOLIT ## Zvolà hodnotu ze seznamu hodnot.
+COLUMN = SLOUPEC ## Vrátà ÄÃslo sloupce odkazu.
+COLUMNS = SLOUPCE ## Vrátà poÄet sloupců v odkazu.
+HLOOKUP = VVYHLEDAT ## Prohledá hornà řádek matice a vrátà hodnotu urÄené buňky.
+HYPERLINK = HYPERTEXTOVÃ.ODKAZ ## Vytvořà zástupce nebo odkaz, který otevÅ™e dokument uložený na sÃÅ¥ovém serveru, v sÃti intranet nebo Internet.
+INDEX = INDEX ## Pomocà rejstÅ™Ãku zvolà hodnotu z odkazu nebo matice.
+INDIRECT = NEPŘÃMÃ.ODKAZ ## Vrátà odkaz urÄený textovou hodnotou.
+LOOKUP = VYHLEDAT ## Vyhledá hodnoty ve vektoru nebo matici.
+MATCH = POZVYHLEDAT ## Vyhledá hodnoty v odkazu nebo matici.
+OFFSET = POSUN ## Vrátà posun odkazu od zadaného odkazu.
+ROW = ŘÃDEK ## Vrátà ÄÃslo řádku odkazu.
+ROWS = ŘÃDKY ## Vrátà poÄet řádků v odkazu.
+RTD = RTD ## NaÄte data reálného Äasu z programu, který podporuje automatizaci modelu COM (Automatizace: Způsob práce s objekty urÄité aplikace z jiné aplikace nebo nástroje pro vývoj. Automatizace (dÅ™Ãve nazývaná automatizace OLE) je poÄÃtaÄovým standardem a je funkcà modelu COM (Component Object Model).).
+TRANSPOSE = TRANSPOZICE ## Vrátà transponovanou matici.
+VLOOKUP = SVYHLEDAT ## Prohledá prvnà sloupec matice, přesune kurzor v řádku a vrátà hodnotu buňky.
+
+
+##
+## Math and trigonometry functions Matematické a trigonometrické funkce
+##
+ABS = ABS ## Vrátà absolutnà hodnotu ÄÃsla.
+ACOS = ARCCOS ## Vrátà arkuskosinus ÄÃsla.
+ACOSH = ARCCOSH ## Vrátà hyperbolický arkuskosinus ÄÃsla.
+ASIN = ARCSIN ## Vrátà arkussinus ÄÃsla.
+ASINH = ARCSINH ## Vrátà hyperbolický arkussinus ÄÃsla.
+ATAN = ARCTG ## Vrátà arkustangens ÄÃsla.
+ATAN2 = ARCTG2 ## Vrátà arkustangens x-ové a y-ové souřadnice.
+ATANH = ARCTGH ## Vrátà hyperbolický arkustangens ÄÃsla.
+CEILING = ZAOKR.NAHORU ## Zaokrouhlà ÄÃslo na nejbližšà celé ÄÃslo nebo na nejbližšà násobek zadané hodnoty.
+COMBIN = KOMBINACE ## Vrátà poÄet kombinacà pro daný poÄet položek.
+COS = COS ## Vrátà kosinus ÄÃsla.
+COSH = COSH ## Vrátà hyperbolický kosinus ÄÃsla.
+DEGREES = DEGREES ## Převede radiány na stupně.
+EVEN = ZAOKROUHLIT.NA.SUDÉ ## Zaokrouhlà ÄÃslo nahoru na nejbližšà celé sudé ÄÃslo.
+EXP = EXP ## Vrátà základ pÅ™irozeného logaritmu e umocnÄ›ný na zadané ÄÃslo.
+FACT = FAKTORIÃL ## Vrátà faktoriál ÄÃsla.
+FACTDOUBLE = FACTDOUBLE ## Vrátà dvojitý faktoriál ÄÃsla.
+FLOOR = ZAOKR.DOLÅ® ## Zaokrouhlà ÄÃslo dolů, smÄ›rem k nule.
+GCD = GCD ## Vrátà nejvÄ›tÅ¡Ã spoleÄný dÄ›litel.
+INT = CELÃ.ÄŒÃST ## Zaokrouhlà ÄÃslo dolů na nejbližšà celé ÄÃslo.
+LCM = LCM ## Vrátà nejmenÅ¡Ã spoleÄný násobek.
+LN = LN ## Vrátà pÅ™irozený logaritmus ÄÃsla.
+LOG = LOGZ ## Vrátà logaritmus ÄÃsla pÅ™i zadaném základu.
+LOG10 = LOG ## Vrátà dekadický logaritmus ÄÃsla.
+MDETERM = DETERMINANT ## Vrátà determinant matice.
+MINVERSE = INVERZE ## Vrátà inverznà matici.
+MMULT = SOUÄŒIN.MATIC ## Vrátà souÄin dvou matic.
+MOD = MOD ## Vrátà zbytek po dÄ›lenÃ.
+MROUND = MROUND ## Vrátà ÄÃslo zaokrouhlené na požadovaný násobek.
+MULTINOMIAL = MULTINOMIAL ## Vrátà mnohoÄlen z množiny ÄÃsel.
+ODD = ZAOKROUHLIT.NA.LICHÉ ## Zaokrouhlà ÄÃslo nahoru na nejbližšà celé liché ÄÃslo.
+PI = PI ## Vrátà hodnotu ÄÃsla pÃ.
+POWER = POWER ## Umocnà ÄÃslo na zadanou mocninu.
+PRODUCT = SOUČIN ## Vynásobà argumenty funkce.
+QUOTIENT = QUOTIENT ## Vrátà celou Äást dÄ›lenÃ.
+RADIANS = RADIANS ## Převede stupně na radiány.
+RAND = NÃHÄŒÃSLO ## Vrátà náhodné ÄÃslo mezi 0 a 1.
+RANDBETWEEN = RANDBETWEEN ## Vrátà náhodné ÄÃslo mezi zadanými ÄÃsly.
+ROMAN = ROMAN ## PÅ™evede arabskou ÄÃslici na Å™Ãmskou ve formátu textu.
+ROUND = ZAOKROUHLIT ## Zaokrouhlà ÄÃslo na zadaný poÄet ÄÃslic.
+ROUNDDOWN = ROUNDDOWN ## Zaokrouhlà ÄÃslo dolů, smÄ›rem k nule.
+ROUNDUP = ROUNDUP ## Zaokrouhlà ÄÃslo nahoru, smÄ›rem od nuly.
+SERIESSUM = SERIESSUM ## Vrátà souÄet mocninné Å™ady urÄené podle vzorce.
+SIGN = SIGN ## Vrátà znaménko ÄÃsla.
+SIN = SIN ## Vrátà sinus daného úhlu.
+SINH = SINH ## Vrátà hyperbolický sinus ÄÃsla.
+SQRT = ODMOCNINA ## Vrátà kladnou druhou odmocninu.
+SQRTPI = SQRTPI ## Vrátà druhou odmocninu výrazu (ÄÃslo * pÃ).
+SUBTOTAL = SUBTOTAL ## Vrátà souhrn v seznamu nebo databázi.
+SUM = SUMA ## SeÄte argumenty funkce.
+SUMIF = SUMIF ## SeÄte buňky vybrané podle zadaných kritériÃ.
+SUMIFS = SUMIFS ## SeÄte buňky urÄené vÃce zadanými podmÃnkami.
+SUMPRODUCT = SOUÄŒIN.SKALÃRNà ## Vrátà souÄet souÄinů odpovÃdajÃcÃch prvků matic.
+SUMSQ = SUMA.ÄŒTVERCÅ® ## Vrátà souÄet Ätverců argumentů.
+SUMX2MY2 = SUMX2MY2 ## Vrátà souÄet rozdÃlu Ätverců odpovÃdajÃcÃch hodnot ve dvou maticÃch.
+SUMX2PY2 = SUMX2PY2 ## Vrátà souÄet souÄtu Ätverců odpovÃdajÃcÃch hodnot ve dvou maticÃch.
+SUMXMY2 = SUMXMY2 ## Vrátà souÄet Ätverců rozdÃlů odpovÃdajÃcÃch hodnot ve dvou maticÃch.
+TAN = TGTG ## Vrátà tangens ÄÃsla.
+TANH = TGH ## Vrátà hyperbolický tangens ÄÃsla.
+TRUNC = USEKNOUT ## Zkrátà ÄÃslo na celé ÄÃslo.
+
+
+##
+## Statistical functions Statistické funkce
+##
+AVEDEV = PRÅ®MODCHYLKA ## Vrátà průmÄ›rnou hodnotu absolutnÃch odchylek datových bodů od jejich stÅ™ednà hodnoty.
+AVERAGE = PRŮMĚR ## Vrátà průměrnou hodnotu argumentů.
+AVERAGEA = AVERAGEA ## Vrátà průmÄ›rnou hodnotu argumentů vÄetnÄ› ÄÃsel, textu a logických hodnot.
+AVERAGEIF = AVERAGEIF ## Vrátà průmÄ›rnou hodnotu (aritmetický průmÄ›r) vÅ¡ech bunÄ›k v oblasti, které vyhovujà pÅ™ÃsluÅ¡né podmÃnce.
+AVERAGEIFS = AVERAGEIFS ## Vrátà průmÄ›rnou hodnotu (aritmetický průmÄ›r) vÅ¡ech bunÄ›k vyhovujÃcÃch nÄ›kolika podmÃnkám.
+BETADIST = BETADIST ## Vrátà hodnotu souÄtového rozdÄ›lenà beta.
+BETAINV = BETAINV ## Vrátà inverznà hodnotu souÄtového rozdÄ›lenà pro zadané rozdÄ›lenà beta.
+BINOMDIST = BINOMDIST ## Vrátà hodnotu binomického rozdÄ›lenà pravdÄ›podobnosti jednotlivých veliÄin.
+CHIDIST = CHIDIST ## Vrátà jednostrannou pravdÄ›podobnost rozdÄ›lenà chÃ-kvadrát.
+CHIINV = CHIINV ## Vrátà hodnotu funkce inverznà k distribuÄnà funkci jednostranné pravdÄ›podobnosti rozdÄ›lenà chÃ-kvadrát.
+CHITEST = CHITEST ## Vrátà test nezávislosti.
+CONFIDENCE = CONFIDENCE ## Vrátà interval spolehlivosti pro stÅ™ednà hodnotu základnÃho souboru.
+CORREL = CORREL ## Vrátà korelaÄnà koeficient mezi dvÄ›ma množinami dat.
+COUNT = POÄŒET ## Vrátà poÄet ÄÃsel v seznamu argumentů.
+COUNTA = POÄŒET2 ## Vrátà poÄet hodnot v seznamu argumentů.
+COUNTBLANK = COUNTBLANK ## SpoÄÃtá poÄet prázdných bunÄ›k v oblasti.
+COUNTIF = COUNTIF ## SpoÄÃtá buňky v oblasti, které odpovÃdajà zadaným kritériÃm.
+COUNTIFS = COUNTIFS ## SpoÄÃtá buňky v oblasti, které odpovÃdajà vÃce kritériÃm.
+COVAR = COVAR ## Vrátà hodnotu kovariance, průmÄ›rnou hodnotu souÄinů párových odchylek
+CRITBINOM = CRITBINOM ## Vrátà nejmenÅ¡Ã hodnotu, pro kterou má souÄtové binomické rozdÄ›lenà hodnotu vÄ›tÅ¡Ã nebo rovnu hodnotÄ› kritéria.
+DEVSQ = DEVSQ ## Vrátà souÄet Ätverců odchylek.
+EXPONDIST = EXPONDIST ## Vrátà hodnotu exponenciálnÃho rozdÄ›lenÃ.
+FDIST = FDIST ## Vrátà hodnotu rozdělenà pravděpodobnosti F.
+FINV = FINV ## Vrátà hodnotu inverznà funkce k distribuÄnà funkci rozdÄ›lenà F.
+FISHER = FISHER ## Vrátà hodnotu Fisherovy transformace.
+FISHERINV = FISHERINV ## Vrátà hodnotu inverznà funkce k Fisherově transformaci.
+FORECAST = FORECAST ## Vrátà hodnotu lineárnÃho trendu.
+FREQUENCY = ÄŒETNOSTI ## Vrátà Äetnost rozdÄ›lenà jako svislou matici.
+FTEST = FTEST ## Vrátà výsledek F-testu.
+GAMMADIST = GAMMADIST ## Vrátà hodnotu rozdělenà gama.
+GAMMAINV = GAMMAINV ## Vrátà hodnotu inverznà funkce k distribuÄnà funkci souÄtového rozdÄ›lenà gama.
+GAMMALN = GAMMALN ## Vrátà přirozený logaritmus funkce gama, Γ(x).
+GEOMEAN = GEOMEAN ## Vrátà geometrický průměr.
+GROWTH = LOGLINTREND ## Vrátà hodnoty exponenciálnÃho trendu.
+HARMEAN = HARMEAN ## Vrátà harmonický průměr.
+HYPGEOMDIST = HYPGEOMDIST ## Vrátà hodnotu hypergeometrického rozdÄ›lenÃ.
+INTERCEPT = INTERCEPT ## Vrátà úsek lineárnà regresnà Äáry.
+KURT = KURT ## Vrátà hodnotu excesu množiny dat.
+LARGE = LARGE ## Vrátà k-tou největšà hodnotu množiny dat.
+LINEST = LINREGRESE ## Vrátà parametry lineárnÃho trendu.
+LOGEST = LOGLINREGRESE ## Vrátà parametry exponenciálnÃho trendu.
+LOGINV = LOGINV ## Vrátà inverznà funkci k distribuÄnà funkci logaritmicko-normálnÃho rozdÄ›lenÃ.
+LOGNORMDIST = LOGNORMDIST ## Vrátà hodnotu souÄtového logaritmicko-normálnÃho rozdÄ›lenÃ.
+MAX = MAX ## Vrátà maximálnà hodnotu seznamu argumentů.
+MAXA = MAXA ## Vrátà maximálnà hodnotu seznamu argumentů vÄetnÄ› ÄÃsel, textu a logických hodnot.
+MEDIAN = MEDIAN ## Vrátà stÅ™ednà hodnotu zadaných ÄÃsel.
+MIN = MIN ## Vrátà minimálnà hodnotu seznamu argumentů.
+MINA = MINA ## Vrátà nejmenÅ¡Ã hodnotu v seznamu argumentů vÄetnÄ› ÄÃsel, textu a logických hodnot.
+MODE = MODE ## Vrátà hodnotu, která se v množinÄ› dat vyskytuje nejÄastÄ›ji.
+NEGBINOMDIST = NEGBINOMDIST ## Vrátà hodnotu negativnÃho binomického rozdÄ›lenÃ.
+NORMDIST = NORMDIST ## Vrátà hodnotu normálnÃho souÄtového rozdÄ›lenÃ.
+NORMINV = NORMINV ## Vrátà inverznà funkci k funkci normálnÃho souÄtového rozdÄ›lenÃ.
+NORMSDIST = NORMSDIST ## Vrátà hodnotu standardnÃho normálnÃho souÄtového rozdÄ›lenÃ.
+NORMSINV = NORMSINV ## Vrátà inverznà funkci k funkci standardnÃho normálnÃho souÄtového rozdÄ›lenÃ.
+PEARSON = PEARSON ## Vrátà Pearsonův výsledný momentový korelaÄnà koeficient.
+PERCENTILE = PERCENTIL ## Vrátà hodnotu k-tého percentilu hodnot v oblasti.
+PERCENTRANK = PERCENTRANK ## Vrátà poÅ™adà hodnoty v množinÄ› dat vyjádÅ™ené procentuálnà Äástà množiny dat.
+PERMUT = PERMUTACE ## Vrátà poÄet permutacà pro zadaný poÄet objektů.
+POISSON = POISSON ## Vrátà hodnotu distribuÄnà funkce Poissonova rozdÄ›lenÃ.
+PROB = PROB ## Vrátà pravdÄ›podobnost výskytu hodnot v oblasti mezi dvÄ›ma meznÃmi hodnotami.
+QUARTILE = QUARTIL ## Vrátà hodnotu kvartilu množiny dat.
+RANK = RANK ## Vrátà poÅ™adà ÄÃsla v seznamu ÄÃsel.
+RSQ = RKQ ## Vrátà druhou mocninu Pearsonova výsledného momentového korelaÄnÃho koeficientu.
+SKEW = SKEW ## Vrátà zeÅ¡ikmenà rozdÄ›lenÃ.
+SLOPE = SLOPE ## Vrátà smÄ›rnici lineárnà regresnà Äáry.
+SMALL = SMALL ## Vrátà k-tou nejmenšà hodnotu množiny dat.
+STANDARDIZE = STANDARDIZE ## Vrátà normalizovanou hodnotu.
+STDEV = SMODCH.VÃBÄšR ## VypoÄte smÄ›rodatnou odchylku výbÄ›ru.
+STDEVA = STDEVA ## VypoÄte smÄ›rodatnou odchylku výbÄ›ru vÄetnÄ› ÄÃsel, textu a logických hodnot.
+STDEVP = SMODCH ## VypoÄte smÄ›rodatnou odchylku základnÃho souboru.
+STDEVPA = STDEVPA ## VypoÄte smÄ›rodatnou odchylku základnÃho souboru vÄetnÄ› ÄÃsel, textu a logických hodnot.
+STEYX = STEYX ## Vrátà standardnà chybu předpovězené hodnoty y pro každou hodnotu x v regresi.
+TDIST = TDIST ## Vrátà hodnotu Studentova t-rozdÄ›lenÃ.
+TINV = TINV ## Vrátà inverznà funkci k distribuÄnà funkci Studentova t-rozdÄ›lenÃ.
+TREND = LINTREND ## Vrátà hodnoty lineárnÃho trendu.
+TRIMMEAN = TRIMMEAN ## Vrátà stÅ™ednà hodnotu vnitÅ™nà Äásti množiny dat.
+TTEST = TTEST ## Vrátà pravděpodobnost spojenou se Studentovým t-testem.
+VAR = VAR.VÃBÄšR ## VypoÄte rozptyl výbÄ›ru.
+VARA = VARA ## VypoÄte rozptyl výbÄ›ru vÄetnÄ› ÄÃsel, textu a logických hodnot.
+VARP = VAR ## VypoÄte rozptyl základnÃho souboru.
+VARPA = VARPA ## VypoÄte rozptyl základnÃho souboru vÄetnÄ› ÄÃsel, textu a logických hodnot.
+WEIBULL = WEIBULL ## Vrátà hodnotu Weibullova rozdÄ›lenÃ.
+ZTEST = ZTEST ## Vrátà jednostrannou P-hodnotu z-testu.
+
+
+##
+## Text functions Textové funkce
+##
+ASC = ASC ## ZmÄ›nà znaky s plnou Å¡ÃÅ™kou (dvoubajtové)v Å™etÄ›zci znaků na znaky s poloviÄnà šÃÅ™kou (jednobajtové).
+BAHTTEXT = BAHTTEXT ## PÅ™evede ÄÃslo na text ve formátu, mÄ›ny ß (baht).
+CHAR = ZNAK ## Vrátà znak urÄený ÄÃslem kódu.
+CLEAN = VYČISTIT ## Odebere z textu všechny netisknutelné znaky.
+CODE = KÓD ## Vrátà ÄÃselný kód prvnÃho znaku zadaného textového Å™etÄ›zce.
+CONCATENATE = CONCATENATE ## Spojà několik textových položek do jedné.
+DOLLAR = KÄŒ ## PÅ™evede ÄÃslo na text ve formátu mÄ›ny KÄ (Äeská koruna).
+EXACT = STEJNÉ ## Zkontroluje, zda jsou dvě textové hodnoty shodné.
+FIND = NAJÃT ## Nalezne textovou hodnotu uvnitÅ™ jiné (rozliÅ¡uje malá a velká pÃsmena).
+FINDB = FINDB ## Nalezne textovou hodnotu uvnitÅ™ jiné (rozliÅ¡uje malá a velká pÃsmena).
+FIXED = ZAOKROUHLIT.NA.TEXT ## Zformátuje ÄÃslo jako text s pevným poÄtem desetinných mÃst.
+JIS = JIS ## ZmÄ›nà znaky s poloviÄnà šÃÅ™kou (jednobajtové) v Å™etÄ›zci znaků na znaky s plnou Å¡ÃÅ™kou (dvoubajtové).
+LEFT = ZLEVA ## Vrátà prvnà znaky textové hodnoty umÃstÄ›né nejvÃce vlevo.
+LEFTB = LEFTB ## Vrátà prvnà znaky textové hodnoty umÃstÄ›né nejvÃce vlevo.
+LEN = DÉLKA ## Vrátà poÄet znaků textového Å™etÄ›zce.
+LENB = LENB ## Vrátà poÄet znaků textového Å™etÄ›zce.
+LOWER = MALà ## PÅ™evede text na malá pÃsmena.
+MID = ÄŒÃST ## Vrátà urÄitý poÄet znaků textového Å™etÄ›zce poÄÃnaje zadaným mÃstem.
+MIDB = MIDB ## Vrátà urÄitý poÄet znaků textového Å™etÄ›zce poÄÃnaje zadaným mÃstem.
+PHONETIC = ZVUKOVÉ ## Extrahuje fonetické znaky (furigana) z textového řetězce.
+PROPER = VELKÃ2 ## PÅ™evede prvnà pÃsmeno každého slova textové hodnoty na velké.
+REPLACE = NAHRADIT ## Nahradà znaky uvnitř textu.
+REPLACEB = NAHRADITB ## Nahradà znaky uvnitř textu.
+REPT = OPAKOVAT ## Zopakuje text podle zadaného poÄtu opakovánÃ.
+RIGHT = ZPRAVA ## Vrátà prvnà znaky textové hodnoty umÃstÄ›né nejvÃce vpravo.
+RIGHTB = RIGHTB ## Vrátà prvnà znaky textové hodnoty umÃstÄ›né nejvÃce vpravo.
+SEARCH = HLEDAT ## Nalezne textovou hodnotu uvnitÅ™ jiné (malá a velká pÃsmena nejsou rozliÅ¡ována).
+SEARCHB = SEARCHB ## Nalezne textovou hodnotu uvnitÅ™ jiné (malá a velká pÃsmena nejsou rozliÅ¡ována).
+SUBSTITUTE = DOSADIT ## V textovém řetězci nahradà starý text novým.
+T = T ## Převede argumenty na text.
+TEXT = HODNOTA.NA.TEXT ## Zformátuje ÄÃslo a pÅ™evede ho na text.
+TRIM = PROČISTIT ## Odstranà z textu mezery.
+UPPER = VELKà ## PÅ™evede text na velká pÃsmena.
+VALUE = HODNOTA ## PÅ™evede textový argument na ÄÃslo.
diff --git a/Classes/PHPExcel/locale/da/config b/Classes/PHPExcel/locale/da/config
new file mode 100644
index 0000000..ae59003
--- /dev/null
+++ b/Classes/PHPExcel/locale/da/config
@@ -0,0 +1,48 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = kr
+
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NUL!
+DIV0 = #DIVISION/0!
+VALUE = #VÆRDI!
+REF = #REFERENCE!
+NAME = #NAVN?
+NUM = #NUM!
+NA = #I/T
diff --git a/Classes/PHPExcel/locale/da/functions b/Classes/PHPExcel/locale/da/functions
new file mode 100644
index 0000000..26e0310
--- /dev/null
+++ b/Classes/PHPExcel/locale/da/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Tilføjelsesprogram- og automatiseringsfunktioner
+##
+GETPIVOTDATA = HENTPIVOTDATA ## Returnerer data, der er lagret i en pivottabelrapport
+
+
+##
+## Cube functions Kubefunktioner
+##
+CUBEKPIMEMBER = KUBE.KPI.MEDLEM ## Returnerer navn, egenskab og mål for en KPI-indikator og viser navnet og egenskaben i cellen. En KPI-indikator er en målbar størrelse, f.eks. bruttooverskud pr. måned eller personaleudskiftning pr. kvartal, der bruges til at overvåge en organisations præstationer.
+CUBEMEMBER = KUBE.MEDLEM ## Returnerer et medlem eller en tupel fra kubehierarkiet. Bruges til at validere, om et medlem eller en tupel findes i kuben.
+CUBEMEMBERPROPERTY = KUBEMEDLEM.EGENSKAB ## Returnerer værdien af en egenskab for et medlem i kuben. Bruges til at validere, om et medlemsnavn findes i kuben, og returnere den angivne egenskab for medlemmet.
+CUBERANKEDMEMBER = KUBEMEDLEM.RANG ## Returnerer det n'te eller rangordnede medlem i et sæt. Bruges til at returnere et eller flere elementer i et sæt, f.eks. topsælgere eller de 10 bedste elever.
+CUBESET = KUBESÆT ## Definerer et beregnet sæt medlemmer eller tupler ved at sende et sætudtryk til kuben på serveren, som opretter sættet og returnerer det til Microsoft Office Excel.
+CUBESETCOUNT = KUBESÆT.TÆL ## Returnerer antallet af elementer i et sæt.
+CUBEVALUE = KUBEVÆRDI ## Returnerer en sammenlagt (aggregeret) værdi fra en kube.
+
+
+##
+## Database functions Databasefunktioner
+##
+DAVERAGE = DMIDDEL ## Returnerer gennemsnittet af markerede databaseposter
+DCOUNT = DTÆL ## Tæller de celler, der indeholder tal, i en database
+DCOUNTA = DTÆLV ## Tæller udfyldte celler i en database
+DGET = DHENT ## Uddrager en enkelt post, der opfylder de angivne kriterier, fra en database
+DMAX = DMAKS ## Returnerer den største værdi blandt markerede databaseposter
+DMIN = DMIN ## Returnerer den mindste værdi blandt markerede databaseposter
+DPRODUCT = DPRODUKT ## Ganger værdierne i et bestemt felt med poster, der opfylder kriterierne i en database
+DSTDEV = DSTDAFV ## Beregner et skøn over standardafvigelsen baseret på en stikprøve af markerede databaseposter
+DSTDEVP = DSTDAFVP ## Beregner standardafvigelsen baseret på hele populationen af markerede databaseposter
+DSUM = DSUM ## Sammenlægger de tal i feltkolonnen i databasen, der opfylder kriterierne
+DVAR = DVARIANS ## Beregner varians baseret på en stikprøve af markerede databaseposter
+DVARP = DVARIANSP ## Beregner varians baseret på hele populationen af markerede databaseposter
+
+
+##
+## Date and time functions Dato- og klokkeslætsfunktioner
+##
+DATE = DATO ## Returnerer serienummeret for en bestemt dato
+DATEVALUE = DATOVÆRDI ## Konverterer en dato i form af tekst til et serienummer
+DAY = DAG ## Konverterer et serienummer til en dag i måneden
+DAYS360 = DAGE360 ## Beregner antallet af dage mellem to datoer på grundlag af et år med 360 dage
+EDATE = EDATO ## Returnerer serienummeret for den dato, der ligger det angivne antal måneder før eller efter startdatoen
+EOMONTH = SLUT.PÅ.MÅNED ## Returnerer serienummeret på den sidste dag i måneden før eller efter et angivet antal måneder
+HOUR = TIME ## Konverterer et serienummer til en time
+MINUTE = MINUT ## Konverterer et serienummer til et minut
+MONTH = MÅNED ## Konverterer et serienummer til en måned
+NETWORKDAYS = ANTAL.ARBEJDSDAGE ## Returnerer antallet af hele arbejdsdage mellem to datoer
+NOW = NU ## Returnerer serienummeret for den aktuelle dato eller det aktuelle klokkeslæt
+SECOND = SEKUND ## Konverterer et serienummer til et sekund
+TIME = KLOKKESLÆT ## Returnerer serienummeret for et bestemt klokkeslæt
+TIMEVALUE = TIDSVÆRDI ## Konverterer et klokkeslæt i form af tekst til et serienummer
+TODAY = IDAG ## Returnerer serienummeret for dags dato
+WEEKDAY = UGEDAG ## Konverterer et serienummer til en ugedag
+WEEKNUM = UGE.NR ## Konverterer et serienummer til et tal, der angiver ugenummeret i året
+WORKDAY = ARBEJDSDAG ## Returnerer serienummeret for dagen før eller efter det angivne antal arbejdsdage
+YEAR = ÅR ## Konverterer et serienummer til et år
+YEARFRAC = ÅR.BRØK ## Returnerer årsbrøken, der repræsenterer antallet af hele dage mellem startdato og slutdato
+
+
+##
+## Engineering functions Tekniske funktioner
+##
+BESSELI = BESSELI ## Returnerer den modificerede Bessel-funktion In(x)
+BESSELJ = BESSELJ ## Returnerer Bessel-funktionen Jn(x)
+BESSELK = BESSELK ## Returnerer den modificerede Bessel-funktion Kn(x)
+BESSELY = BESSELY ## Returnerer Bessel-funktionen Yn(x)
+BIN2DEC = BIN.TIL.DEC ## Konverterer et binært tal til et decimaltal
+BIN2HEX = BIN.TIL.HEX ## Konverterer et binært tal til et heksadecimalt tal
+BIN2OCT = BIN.TIL.OKT ## Konverterer et binært tal til et oktaltal.
+COMPLEX = KOMPLEKS ## Konverterer reelle og imaginære koefficienter til et komplekst tal
+CONVERT = KONVERTER ## Konverterer et tal fra én måleenhed til en anden
+DEC2BIN = DEC.TIL.BIN ## Konverterer et decimaltal til et binært tal
+DEC2HEX = DEC.TIL.HEX ## Konverterer et decimaltal til et heksadecimalt tal
+DEC2OCT = DEC.TIL.OKT ## Konverterer et decimaltal til et oktaltal
+DELTA = DELTA ## Tester, om to værdier er ens
+ERF = FEJLFUNK ## Returner fejlfunktionen
+ERFC = FEJLFUNK.KOMP ## Returnerer den komplementære fejlfunktion
+GESTEP = GETRIN ## Tester, om et tal er større end en grænseværdi
+HEX2BIN = HEX.TIL.BIN ## Konverterer et heksadecimalt tal til et binært tal
+HEX2DEC = HEX.TIL.DEC ## Konverterer et decimaltal til et heksadecimalt tal
+HEX2OCT = HEX.TIL.OKT ## Konverterer et heksadecimalt tal til et oktaltal
+IMABS = IMAGABS ## Returnerer den absolutte værdi (modulus) for et komplekst tal
+IMAGINARY = IMAGINÆR ## Returnerer den imaginære koefficient for et komplekst tal
+IMARGUMENT = IMAGARGUMENT ## Returnerer argumentet theta, en vinkel udtrykt i radianer
+IMCONJUGATE = IMAGKONJUGERE ## Returnerer den komplekse konjugation af et komplekst tal
+IMCOS = IMAGCOS ## Returnerer et komplekst tals cosinus
+IMDIV = IMAGDIV ## Returnerer kvotienten for to komplekse tal
+IMEXP = IMAGEKSP ## Returnerer et komplekst tals eksponentialfunktion
+IMLN = IMAGLN ## Returnerer et komplekst tals naturlige logaritme
+IMLOG10 = IMAGLOG10 ## Returnerer et komplekst tals sædvanlige logaritme (titalslogaritme)
+IMLOG2 = IMAGLOG2 ## Returnerer et komplekst tals sædvanlige logaritme (totalslogaritme)
+IMPOWER = IMAGPOTENS ## Returnerer et komplekst tal opløftet i en heltalspotens
+IMPRODUCT = IMAGPRODUKT ## Returnerer produktet af komplekse tal
+IMREAL = IMAGREELT ## Returnerer den reelle koefficient for et komplekst tal
+IMSIN = IMAGSIN ## Returnerer et komplekst tals sinus
+IMSQRT = IMAGKVROD ## Returnerer et komplekst tals kvadratrod
+IMSUB = IMAGSUB ## Returnerer forskellen mellem to komplekse tal
+IMSUM = IMAGSUM ## Returnerer summen af komplekse tal
+OCT2BIN = OKT.TIL.BIN ## Konverterer et oktaltal til et binært tal
+OCT2DEC = OKT.TIL.DEC ## Konverterer et oktaltal til et decimaltal
+OCT2HEX = OKT.TIL.HEX ## Konverterer et oktaltal til et heksadecimalt tal
+
+
+##
+## Financial functions Finansielle funktioner
+##
+ACCRINT = PÅLØBRENTE ## Returnerer den påløbne rente for et værdipapir med periodiske renteudbetalinger
+ACCRINTM = PÅLØBRENTE.UDLØB ## Returnerer den påløbne rente for et værdipapir, hvor renteudbetalingen finder sted ved papirets udløb
+AMORDEGRC = AMORDEGRC ## Returnerer afskrivningsbeløbet for hver regnskabsperiode ved hjælp af en afskrivningskoefficient
+AMORLINC = AMORLINC ## Returnerer afskrivningsbeløbet for hver regnskabsperiode
+COUPDAYBS = KUPONDAGE.SA ## Returnerer antallet af dage fra starten af kuponperioden til afregningsdatoen
+COUPDAYS = KUPONDAGE.A ## Returnerer antallet af dage fra begyndelsen af kuponperioden til afregningsdatoen
+COUPDAYSNC = KUPONDAGE.ANK ## Returnerer antallet af dage i den kuponperiode, der indeholder afregningsdatoen
+COUPNCD = KUPONDAG.NÆSTE ## Returnerer den næste kupondato efter afregningsdatoen
+COUPNUM = KUPONBETALINGER ## Returnerer antallet af kuponudbetalinger mellem afregnings- og udløbsdatoen
+COUPPCD = KUPONDAG.FORRIGE ## Returnerer den forrige kupondato før afregningsdatoen
+CUMIPMT = AKKUM.RENTE ## Returnerer den akkumulerede rente, der betales på et lån mellem to perioder
+CUMPRINC = AKKUM.HOVEDSTOL ## Returnerer den akkumulerede nedbringelse af hovedstol mellem to perioder
+DB = DB ## Returnerer afskrivningen på et aktiv i en angivet periode ved anvendelse af saldometoden
+DDB = DSA ## Returnerer afskrivningsbeløbet for et aktiv over en bestemt periode ved anvendelse af dobbeltsaldometoden eller en anden afskrivningsmetode, som du angiver
+DISC = DISKONTO ## Returnerer et værdipapirs diskonto
+DOLLARDE = KR.DECIMAL ## Konverterer en kronepris udtrykt som brøk til en kronepris udtrykt som decimaltal
+DOLLARFR = KR.BRØK ## Konverterer en kronepris udtrykt som decimaltal til en kronepris udtrykt som brøk
+DURATION = VARIGHED ## Returnerer den årlige løbetid for et værdipapir med periodiske renteudbetalinger
+EFFECT = EFFEKTIV.RENTE ## Returnerer den årlige effektive rente
+FV = FV ## Returnerer fremtidsværdien af en investering
+FVSCHEDULE = FVTABEL ## Returnerer den fremtidige værdi af en hovedstol, når der er tilskrevet rente og rentes rente efter forskellige rentesatser
+INTRATE = RENTEFOD ## Returnerer renten på et fuldt ud investeret værdipapir
+IPMT = R.YDELSE ## Returnerer renten fra en investering for en given periode
+IRR = IA ## Returnerer den interne rente for en række pengestrømme
+ISPMT = ISPMT ## Beregner den betalte rente i løbet af en bestemt investeringsperiode
+MDURATION = MVARIGHED ## Returnerer Macauleys modificerede løbetid for et værdipapir med en formodet pari på kr. 100
+MIRR = MIA ## Returnerer den interne forrentning, hvor positive og negative pengestrømme finansieres til forskellig rente
+NOMINAL = NOMINEL ## Returnerer den årlige nominelle rente
+NPER = NPER ## Returnerer antallet af perioder for en investering
+NPV = NUTIDSVÆRDI ## Returnerer nettonutidsværdien for en investering baseret på en række periodiske pengestrømme og en diskonteringssats
+ODDFPRICE = ULIGE.KURS.PÅLYDENDE ## Returnerer kursen pr. kr. 100 nominel værdi for et værdipapir med en ulige (kort eller lang) første periode
+ODDFYIELD = ULIGE.FØRSTE.AFKAST ## Returnerer afkastet for et værdipapir med ulige første periode
+ODDLPRICE = ULIGE.SIDSTE.KURS ## Returnerer kursen pr. kr. 100 nominel værdi for et værdipapir med ulige sidste periode
+ODDLYIELD = ULIGE.SIDSTE.AFKAST ## Returnerer afkastet for et værdipapir med ulige sidste periode
+PMT = YDELSE ## Returnerer renten fra en investering for en given periode
+PPMT = H.YDELSE ## Returnerer ydelsen på hovedstolen for en investering i en given periode
+PRICE = KURS ## Returnerer kursen pr. kr 100 nominel værdi for et værdipapir med periodiske renteudbetalinger
+PRICEDISC = KURS.DISKONTO ## Returnerer kursen pr. kr 100 nominel værdi for et diskonteret værdipapir
+PRICEMAT = KURS.UDLØB ## Returnerer kursen pr. kr 100 nominel værdi for et værdipapir, hvor renten udbetales ved papirets udløb
+PV = NV ## Returnerer den nuværende værdi af en investering
+RATE = RENTE ## Returnerer renten i hver periode for en annuitet
+RECEIVED = MODTAGET.VED.UDLØB ## Returnerer det beløb, der modtages ved udløbet af et fuldt ud investeret værdipapir
+SLN = LA ## Returnerer den lineære afskrivning for et aktiv i en enkelt periode
+SYD = ÅRSAFSKRIVNING ## Returnerer den årlige afskrivning på et aktiv i en bestemt periode
+TBILLEQ = STATSOBLIGATION ## Returnerer det obligationsækvivalente afkast for en statsobligation
+TBILLPRICE = STATSOBLIGATION.KURS ## Returnerer kursen pr. kr 100 nominel værdi for en statsobligation
+TBILLYIELD = STATSOBLIGATION.AFKAST ## Returnerer en afkastet på en statsobligation
+VDB = VSA ## Returnerer afskrivningen på et aktiv i en angivet periode, herunder delperioder, ved brug af dobbeltsaldometoden
+XIRR = INTERN.RENTE ## Returnerer den interne rente for en plan over pengestrømme, der ikke behøver at være periodiske
+XNPV = NETTO.NUTIDSVÆRDI ## Returnerer nutidsværdien for en plan over pengestrømme, der ikke behøver at være periodiske
+YIELD = AFKAST ## Returnerer afkastet for et værdipapir med periodiske renteudbetalinger
+YIELDDISC = AFKAST.DISKONTO ## Returnerer det årlige afkast for et diskonteret værdipapir, f.eks. en statsobligation
+YIELDMAT = AFKAST.UDLØBSDATO ## Returnerer det årlige afkast for et værdipapir, hvor renten udbetales ved papirets udløb
+
+
+##
+## Information functions Informationsfunktioner
+##
+CELL = CELLE ## Returnerer oplysninger om formatering, placering eller indhold af en celle
+ERROR.TYPE = FEJLTYPE ## Returnerer et tal, der svarer til en fejltype
+INFO = INFO ## Returnerer oplysninger om det aktuelle operativmiljø
+ISBLANK = ER.TOM ## Returnerer SAND, hvis værdien er tom
+ISERR = ER.FJL ## Returnerer SAND, hvis værdien er en fejlværdi undtagen #I/T
+ISERROR = ER.FEJL ## Returnerer SAND, hvis værdien er en fejlværdi
+ISEVEN = ER.LIGE ## Returnerer SAND, hvis tallet er lige
+ISLOGICAL = ER.LOGISK ## Returnerer SAND, hvis værdien er en logisk værdi
+ISNA = ER.IKKE.TILGÆNGELIG ## Returnerer SAND, hvis værdien er fejlværdien #I/T
+ISNONTEXT = ER.IKKE.TEKST ## Returnerer SAND, hvis værdien ikke er tekst
+ISNUMBER = ER.TAL ## Returnerer SAND, hvis værdien er et tal
+ISODD = ER.ULIGE ## Returnerer SAND, hvis tallet er ulige
+ISREF = ER.REFERENCE ## Returnerer SAND, hvis værdien er en reference
+ISTEXT = ER.TEKST ## Returnerer SAND, hvis værdien er tekst
+N = TAL ## Returnerer en værdi konverteret til et tal
+NA = IKKE.TILGÆNGELIG ## Returnerer fejlværdien #I/T
+TYPE = VÆRDITYPE ## Returnerer et tal, der angiver datatypen for en værdi
+
+
+##
+## Logical functions Logiske funktioner
+##
+AND = OG ## Returnerer SAND, hvis alle argumenterne er sande
+FALSE = FALSK ## Returnerer den logiske værdi FALSK
+IF = HVIS ## Angiver en logisk test, der skal udføres
+IFERROR = HVIS.FEJL ## Returnerer en værdi, du angiver, hvis en formel evauleres som en fejl. Returnerer i modsat fald resultatet af formlen
+NOT = IKKE ## Vender argumentets logik om
+OR = ELLER ## Returneret værdien SAND, hvis mindst ét argument er sandt
+TRUE = SAND ## Returnerer den logiske værdi SAND
+
+
+##
+## Lookup and reference functions Opslags- og referencefunktioner
+##
+ADDRESS = ADRESSE ## Returnerer en reference som tekst til en enkelt celle i et regneark
+AREAS = OMRÅDER ## Returnerer antallet af områder i en reference
+CHOOSE = VÆLG ## Vælger en værdi på en liste med værdier
+COLUMN = KOLONNE ## Returnerer kolonnenummeret i en reference
+COLUMNS = KOLONNER ## Returnerer antallet af kolonner i en reference
+HLOOKUP = VOPSLAG ## Søger i den øverste række af en matrix og returnerer værdien af den angivne celle
+HYPERLINK = HYPERLINK ## Opretter en genvej kaldet et hyperlink, der åbner et dokument, som er lagret på en netværksserver, på et intranet eller på internettet
+INDEX = INDEKS ## Anvender et indeks til at vælge en værdi fra en reference eller en matrix
+INDIRECT = INDIREKTE ## Returnerer en reference, der er angivet af en tekstværdi
+LOOKUP = SLÅ.OP ## Søger værdier i en vektor eller en matrix
+MATCH = SAMMENLIGN ## Søger værdier i en reference eller en matrix
+OFFSET = FORSKYDNING ## Returnerer en reference forskudt i forhold til en given reference
+ROW = RÆKKE ## Returnerer rækkenummeret for en reference
+ROWS = RÆKKER ## Returnerer antallet af rækker i en reference
+RTD = RTD ## Henter realtidsdata fra et program, der understøtter COM-automatisering (Automation: En metode til at arbejde med objekter fra et andet program eller udviklingsværktøj. Automation, som tidligere blev kaldt OLE Automation, er en industristandard og en funktion i COM (Component Object Model).)
+TRANSPOSE = TRANSPONER ## Returnerer en transponeret matrix
+VLOOKUP = LOPSLAG ## Søger i øverste række af en matrix og flytter på tværs af rækken for at returnere en celleværdi
+
+
+##
+## Math and trigonometry functions Matematiske og trigonometriske funktioner
+##
+ABS = ABS ## Returnerer den absolutte værdi af et tal
+ACOS = ARCCOS ## Returnerer et tals arcus cosinus
+ACOSH = ARCCOSH ## Returnerer den inverse hyperbolske cosinus af tal
+ASIN = ARCSIN ## Returnerer et tals arcus sinus
+ASINH = ARCSINH ## Returnerer den inverse hyperbolske sinus for tal
+ATAN = ARCTAN ## Returnerer et tals arcus tangens
+ATAN2 = ARCTAN2 ## Returnerer de angivne x- og y-koordinaters arcus tangens
+ATANH = ARCTANH ## Returnerer et tals inverse hyperbolske tangens
+CEILING = AFRUND.LOFT ## Afrunder et tal til nærmeste heltal eller til nærmeste multiplum af betydning
+COMBIN = KOMBIN ## Returnerer antallet af kombinationer for et givet antal objekter
+COS = COS ## Returnerer et tals cosinus
+COSH = COSH ## Returnerer den inverse hyperbolske cosinus af et tal
+DEGREES = GRADER ## Konverterer radianer til grader
+EVEN = LIGE ## Runder et tal op til nærmeste lige heltal
+EXP = EKSP ## Returnerer e opløftet til en potens af et angivet tal
+FACT = FAKULTET ## Returnerer et tals fakultet
+FACTDOUBLE = DOBBELT.FAKULTET ## Returnerer et tals dobbelte fakultet
+FLOOR = AFRUND.GULV ## Runder et tal ned mod nul
+GCD = STØRSTE.FÆLLES.DIVISOR ## Returnerer den største fælles divisor
+INT = HELTAL ## Nedrunder et tal til det nærmeste heltal
+LCM = MINDSTE.FÆLLES.MULTIPLUM ## Returnerer det mindste fælles multiplum
+LN = LN ## Returnerer et tals naturlige logaritme
+LOG = LOG ## Returnerer logaritmen for et tal på grundlag af et angivet grundtal
+LOG10 = LOG10 ## Returnerer titalslogaritmen af et tal
+MDETERM = MDETERM ## Returnerer determinanten for en matrix
+MINVERSE = MINVERT ## Returnerer den inverse matrix for en matrix
+MMULT = MPRODUKT ## Returnerer matrixproduktet af to matrixer
+MOD = REST ## Returnerer restværdien fra division
+MROUND = MAFRUND ## Returnerer et tal afrundet til det ønskede multiplum
+MULTINOMIAL = MULTINOMIAL ## Returnerer et multinomialt talsæt
+ODD = ULIGE ## Runder et tal op til nærmeste ulige heltal
+PI = PI ## Returnerer værdien af pi
+POWER = POTENS ## Returnerer resultatet af et tal opløftet til en potens
+PRODUCT = PRODUKT ## Multiplicerer argumenterne
+QUOTIENT = KVOTIENT ## Returnerer heltalsdelen ved division
+RADIANS = RADIANER ## Konverterer grader til radianer
+RAND = SLUMP ## Returnerer et tilfældigt tal mellem 0 og 1
+RANDBETWEEN = SLUMP.MELLEM ## Returnerer et tilfældigt tal mellem de tal, der angives
+ROMAN = ROMERTAL ## Konverterer et arabertal til romertal som tekst
+ROUND = AFRUND ## Afrunder et tal til et angivet antal decimaler
+ROUNDDOWN = RUND.NED ## Runder et tal ned mod nul
+ROUNDUP = RUND.OP ## Runder et tal op, væk fra 0 (nul)
+SERIESSUM = SERIESUM ## Returnerer summen af en potensserie baseret på en formel
+SIGN = FORTEGN ## Returnerer et tals fortegn
+SIN = SIN ## Returnerer en given vinkels sinusværdi
+SINH = SINH ## Returnerer den hyperbolske sinus af et tal
+SQRT = KVROD ## Returnerer en positiv kvadratrod
+SQRTPI = KVRODPI ## Returnerer kvadratroden af (tal * pi;)
+SUBTOTAL = SUBTOTAL ## Returnerer en subtotal på en liste eller i en database
+SUM = SUM ## Lægger argumenterne sammen
+SUMIF = SUM.HVIS ## Lægger de celler sammen, der er specificeret af et givet kriterium.
+SUMIFS = SUM.HVISER ## Lægger de celler i et område sammen, der opfylder flere kriterier.
+SUMPRODUCT = SUMPRODUKT ## Returnerer summen af produkter af ens matrixkomponenter
+SUMSQ = SUMKV ## Returnerer summen af argumenternes kvadrater
+SUMX2MY2 = SUMX2MY2 ## Returnerer summen af differensen mellem kvadrater af ens værdier i to matrixer
+SUMX2PY2 = SUMX2PY2 ## Returnerer summen af summen af kvadrater af tilsvarende værdier i to matrixer
+SUMXMY2 = SUMXMY2 ## Returnerer summen af kvadrater af differenser mellem ens værdier i to matrixer
+TAN = TAN ## Returnerer et tals tangens
+TANH = TANH ## Returnerer et tals hyperbolske tangens
+TRUNC = AFKORT ## Afkorter et tal til et heltal
+
+
+##
+## Statistical functions Statistiske funktioner
+##
+AVEDEV = MAD ## Returnerer den gennemsnitlige numeriske afvigelse fra stikprøvens middelværdi
+AVERAGE = MIDDEL ## Returnerer middelværdien af argumenterne
+AVERAGEA = MIDDELV ## Returnerer middelværdien af argumenterne og medtager tal, tekst og logiske værdier
+AVERAGEIF = MIDDEL.HVIS ## Returnerer gennemsnittet (den aritmetiske middelværdi) af alle de celler, der opfylder et givet kriterium, i et område
+AVERAGEIFS = MIDDEL.HVISER ## Returnerer gennemsnittet (den aritmetiske middelværdi) af alle de celler, der opfylder flere kriterier.
+BETADIST = BETAFORDELING ## Returnerer den kumulative betafordelingsfunktion
+BETAINV = BETAINV ## Returnerer den inverse kumulative fordelingsfunktion for en angivet betafordeling
+BINOMDIST = BINOMIALFORDELING ## Returnerer punktsandsynligheden for binomialfordelingen
+CHIDIST = CHIFORDELING ## Returnerer fraktilsandsynligheden for en chi2-fordeling
+CHIINV = CHIINV ## Returnerer den inverse fraktilsandsynlighed for en chi2-fordeling
+CHITEST = CHITEST ## Foretager en test for uafhængighed
+CONFIDENCE = KONFIDENSINTERVAL ## Returnerer et konfidensinterval for en population
+CORREL = KORRELATION ## Returnerer korrelationskoefficienten mellem to datasæt
+COUNT = TÆL ## Tæller antallet af tal på en liste med argumenter
+COUNTA = TÆLV ## Tæller antallet af værdier på en liste med argumenter
+COUNTBLANK = ANTAL.BLANKE ## Tæller antallet af tomme celler i et område
+COUNTIF = TÆLHVIS ## Tæller antallet af celler, som opfylder de givne kriterier, i et område
+COUNTIFS = TÆL.HVISER ## Tæller antallet af de celler, som opfylder flere kriterier, i et område
+COVAR = KOVARIANS ## Beregner kovariansen mellem to stokastiske variabler
+CRITBINOM = KRITBINOM ## Returnerer den mindste værdi for x, for hvilken det gælder, at fordelingsfunktionen er mindre end eller lig med kriterieværdien.
+DEVSQ = SAK ## Returnerer summen af de kvadrerede afvigelser fra middelværdien
+EXPONDIST = EKSPFORDELING ## Returnerer eksponentialfordelingen
+FDIST = FFORDELING ## Returnerer fraktilsandsynligheden for F-fordelingen
+FINV = FINV ## Returnerer den inverse fraktilsandsynlighed for F-fordelingen
+FISHER = FISHER ## Returnerer Fisher-transformationen
+FISHERINV = FISHERINV ## Returnerer den inverse Fisher-transformation
+FORECAST = PROGNOSE ## Returnerer en prognoseværdi baseret på lineær tendens
+FREQUENCY = FREKVENS ## Returnerer en frekvensfordeling i en søjlevektor
+FTEST = FTEST ## Returnerer resultatet af en F-test til sammenligning af varians
+GAMMADIST = GAMMAFORDELING ## Returnerer fordelingsfunktionen for gammafordelingen
+GAMMAINV = GAMMAINV ## Returnerer den inverse fordelingsfunktion for gammafordelingen
+GAMMALN = GAMMALN ## Returnerer den naturlige logaritme til gammafordelingen, G(x)
+GEOMEAN = GEOMIDDELVÆRDI ## Returnerer det geometriske gennemsnit
+GROWTH = FORØGELSE ## Returnerer værdier langs en eksponentiel tendens
+HARMEAN = HARMIDDELVÆRDI ## Returnerer det harmoniske gennemsnit
+HYPGEOMDIST = HYPGEOFORDELING ## Returnerer punktsandsynligheden i en hypergeometrisk fordeling
+INTERCEPT = SKÆRING ## Returnerer afskæringsværdien på y-aksen i en lineær regression
+KURT = TOPSTEJL ## Returnerer kurtosisværdien for en stokastisk variabel
+LARGE = STOR ## Returnerer den k'te største værdi i et datasæt
+LINEST = LINREGR ## Returnerer parameterestimaterne for en lineær tendens
+LOGEST = LOGREGR ## Returnerer parameterestimaterne for en eksponentiel tendens
+LOGINV = LOGINV ## Returnerer den inverse fordelingsfunktion for lognormalfordelingen
+LOGNORMDIST = LOGNORMFORDELING ## Returnerer fordelingsfunktionen for lognormalfordelingen
+MAX = MAKS ## Returnerer den maksimale værdi på en liste med argumenter.
+MAXA = MAKSV ## Returnerer den maksimale værdi på en liste med argumenter og medtager tal, tekst og logiske værdier
+MEDIAN = MEDIAN ## Returnerer medianen for de angivne tal
+MIN = MIN ## Returnerer den mindste værdi på en liste med argumenter.
+MINA = MINV ## Returnerer den mindste værdi på en liste med argumenter og medtager tal, tekst og logiske værdier
+MODE = HYPPIGST ## Returnerer den hyppigste værdi i et datasæt
+NEGBINOMDIST = NEGBINOMFORDELING ## Returnerer den negative binomialfordeling
+NORMDIST = NORMFORDELING ## Returnerer fordelingsfunktionen for normalfordelingen
+NORMINV = NORMINV ## Returnerer den inverse fordelingsfunktion for normalfordelingen
+NORMSDIST = STANDARDNORMFORDELING ## Returnerer fordelingsfunktionen for standardnormalfordelingen
+NORMSINV = STANDARDNORMINV ## Returnerer den inverse fordelingsfunktion for standardnormalfordelingen
+PEARSON = PEARSON ## Returnerer Pearsons korrelationskoefficient
+PERCENTILE = FRAKTIL ## Returnerer den k'te fraktil for datasættet
+PERCENTRANK = PROCENTPLADS ## Returnerer den procentuelle rang for en given værdi i et datasæt
+PERMUT = PERMUT ## Returnerer antallet af permutationer for et givet sæt objekter
+POISSON = POISSON ## Returnerer fordelingsfunktionen for en Poisson-fordeling
+PROB = SANDSYNLIGHED ## Returnerer intervalsandsynligheden
+QUARTILE = KVARTIL ## Returnerer kvartilen i et givet datasæt
+RANK = PLADS ## Returnerer rangen for et tal på en liste med tal
+RSQ = FORKLARINGSGRAD ## Returnerer R2-værdien fra en simpel lineær regression
+SKEW = SKÆVHED ## Returnerer skævheden for en stokastisk variabel
+SLOPE = HÆLDNING ## Returnerer estimatet på hældningen fra en simpel lineær regression
+SMALL = MINDSTE ## Returnerer den k'te mindste værdi i datasættet
+STANDARDIZE = STANDARDISER ## Returnerer en standardiseret værdi
+STDEV = STDAFV ## Estimerer standardafvigelsen på basis af en stikprøve
+STDEVA = STDAFVV ## Beregner standardafvigelsen på basis af en prøve og medtager tal, tekst og logiske værdier
+STDEVP = STDAFVP ## Beregner standardafvigelsen på basis af en hel population
+STDEVPA = STDAFVPV ## Beregner standardafvigelsen på basis af en hel population og medtager tal, tekst og logiske værdier
+STEYX = STFYX ## Returnerer standardafvigelsen for de estimerede y-værdier i den simple lineære regression
+TDIST = TFORDELING ## Returnerer fordelingsfunktionen for Student's t-fordeling
+TINV = TINV ## Returnerer den inverse fordelingsfunktion for Student's t-fordeling
+TREND = TENDENS ## Returnerer værdi under antagelse af en lineær tendens
+TRIMMEAN = TRIMMIDDELVÆRDI ## Returnerer den trimmede middelværdi for datasættet
+TTEST = TTEST ## Returnerer den sandsynlighed, der er forbundet med Student's t-test
+VAR = VARIANS ## Beregner variansen på basis af en prøve
+VARA = VARIANSV ## Beregner variansen på basis af en prøve og medtager tal, tekst og logiske værdier
+VARP = VARIANSP ## Beregner variansen på basis af hele populationen
+VARPA = VARIANSPV ## Beregner variansen på basis af hele populationen og medtager tal, tekst og logiske værdier
+WEIBULL = WEIBULL ## Returnerer fordelingsfunktionen for Weibull-fordelingen
+ZTEST = ZTEST ## Returnerer sandsynlighedsværdien ved en en-sidet z-test
+
+
+##
+## Text functions Tekstfunktioner
+##
+ASC = ASC ## Ændrer engelske tegn i fuld bredde (dobbelt-byte) eller katakana i en tegnstreng til tegn i halv bredde (enkelt-byte)
+BAHTTEXT = BAHTTEKST ## Konverterer et tal til tekst ved hjælp af valutaformatet ß (baht)
+CHAR = TEGN ## Returnerer det tegn, der svarer til kodenummeret
+CLEAN = RENS ## Fjerner alle tegn, der ikke kan udskrives, fra tekst
+CODE = KODE ## Returnerer en numerisk kode for det første tegn i en tekststreng
+CONCATENATE = SAMMENKÆDNING ## Sammenkæder adskillige tekstelementer til ét tekstelement
+DOLLAR = KR ## Konverterer et tal til tekst ved hjælp af valutaformatet kr. (kroner)
+EXACT = EKSAKT ## Kontrollerer, om to tekstværdier er identiske
+FIND = FIND ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes mellem store og små bogstaver)
+FINDB = FINDB ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes mellem store og små bogstaver)
+FIXED = FAST ## Formaterer et tal som tekst med et fast antal decimaler
+JIS = JIS ## Ændrer engelske tegn i halv bredde (enkelt-byte) eller katakana i en tegnstreng til tegn i fuld bredde (dobbelt-byte)
+LEFT = VENSTRE ## Returnerer tegnet længst til venstre i en tekstværdi
+LEFTB = VENSTREB ## Returnerer tegnet længst til venstre i en tekstværdi
+LEN = LÆNGDE ## Returnerer antallet af tegn i en tekststreng
+LENB = LÆNGDEB ## Returnerer antallet af tegn i en tekststreng
+LOWER = SMÅ.BOGSTAVER ## Konverterer tekst til små bogstaver
+MID = MIDT ## Returnerer et bestemt antal tegn fra en tekststreng fra og med den angivne startposition
+MIDB = MIDTB ## Returnerer et bestemt antal tegn fra en tekststreng fra og med den angivne startposition
+PHONETIC = FONETISK ## Uddrager de fonetiske (furigana) tegn fra en tekststreng
+PROPER = STORT.FORBOGSTAV ## Konverterer første bogstav i hvert ord i teksten til stort bogstav
+REPLACE = ERSTAT ## Erstatter tegn i tekst
+REPLACEB = ERSTATB ## Erstatter tegn i tekst
+REPT = GENTAG ## Gentager tekst et givet antal gange
+RIGHT = HØJRE ## Returnerer tegnet længste til højre i en tekstværdi
+RIGHTB = HØJREB ## Returnerer tegnet længste til højre i en tekstværdi
+SEARCH = SØG ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes ikke mellem store og små bogstaver)
+SEARCHB = SØGB ## Søger efter en tekstværdi i en anden tekstværdi (der skelnes ikke mellem store og små bogstaver)
+SUBSTITUTE = UDSKIFT ## Udskifter gammel tekst med ny tekst i en tekststreng
+T = T ## Konverterer argumenterne til tekst
+TEXT = TEKST ## Formaterer et tal og konverterer det til tekst
+TRIM = FJERN.OVERFLØDIGE.BLANKE ## Fjerner mellemrum fra tekst
+UPPER = STORE.BOGSTAVER ## Konverterer tekst til store bogstaver
+VALUE = VÆRDI ## Konverterer et tekstargument til et tal
diff --git a/Classes/PHPExcel/locale/de/config b/Classes/PHPExcel/locale/de/config
new file mode 100644
index 0000000..aa0228e
--- /dev/null
+++ b/Classes/PHPExcel/locale/de/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULL!
+DIV0 = #DIV/0!
+VALUE = #WERT!
+REF = #BEZUG!
+NAME = #NAME?
+NUM = #ZAHL!
+NA = #NV
diff --git a/Classes/PHPExcel/locale/de/functions b/Classes/PHPExcel/locale/de/functions
new file mode 100644
index 0000000..3147f9c
--- /dev/null
+++ b/Classes/PHPExcel/locale/de/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Add-In- und Automatisierungsfunktionen
+##
+GETPIVOTDATA = PIVOTDATENZUORDNEN ## In einem PivotTable-Bericht gespeicherte Daten werden zurückgegeben.
+
+
+##
+## Cube functions Cubefunktionen
+##
+CUBEKPIMEMBER = CUBEKPIELEMENT ## Gibt Name, Eigenschaft und Measure eines Key Performance Indicators (KPI) zurück und zeigt den Namen und die Eigenschaft in der Zelle an. Ein KPI ist ein quantifizierbares Maß, wie z. B. der monatliche Bruttogewinn oder die vierteljährliche Mitarbeiterfluktuation, mit dessen Hilfe das Leistungsverhalten eines Unternehmens überwacht werden kann.
+CUBEMEMBER = CUBEELEMENT ## Gibt ein Element oder ein Tuple in einer Cubehierarchie zurück. Wird verwendet, um zu überprüfen, ob das Element oder Tuple im Cube vorhanden ist.
+CUBEMEMBERPROPERTY = CUBEELEMENTEIGENSCHAFT ## Gibt den Wert einer Elementeigenschaft im Cube zurück. Wird verwendet, um zu überprüfen, ob ein Elementname im Cube vorhanden ist, und um die für dieses Element angegebene Eigenschaft zurückzugeben.
+CUBERANKEDMEMBER = CUBERANGELEMENT ## Gibt das n-te oder n-rangige Element in einer Menge zurück. Wird verwendet, um mindestens ein Element in einer Menge zurückzugeben, wie z. B. bester Vertriebsmitarbeiter oder 10 beste Kursteilnehmer.
+CUBESET = CUBEMENGE ## Definiert eine berechnete Menge Elemente oder Tuples durch Senden eines Mengenausdrucks an den Cube auf dem Server, der die Menge erstellt und an Microsoft Office Excel zurückgibt.
+CUBESETCOUNT = CUBEMENGENANZAHL ## Gibt die Anzahl der Elemente in einer Menge zurück.
+CUBEVALUE = CUBEWERT ## Gibt einen Aggregatwert aus einem Cube zurück.
+
+
+##
+## Database functions Datenbankfunktionen
+##
+DAVERAGE = DBMITTELWERT ## Gibt den Mittelwert der ausgewählten Datenbankeinträge zurück
+DCOUNT = DBANZAHL ## Zählt die Zellen mit Zahlen in einer Datenbank
+DCOUNTA = DBANZAHL2 ## Zählt nicht leere Zellen in einer Datenbank
+DGET = DBAUSZUG ## Extrahiert aus einer Datenbank einen einzelnen Datensatz, der den angegebenen Kriterien entspricht
+DMAX = DBMAX ## Gibt den größten Wert aus ausgewählten Datenbankeinträgen zurück
+DMIN = DBMIN ## Gibt den kleinsten Wert aus ausgewählten Datenbankeinträgen zurück
+DPRODUCT = DBPRODUKT ## Multipliziert die Werte in einem bestimmten Feld mit Datensätzen, die den Kriterien in einer Datenbank entsprechen
+DSTDEV = DBSTDABW ## Schätzt die Standardabweichung auf der Grundlage einer Stichprobe aus ausgewählten Datenbankeinträgen
+DSTDEVP = DBSTDABWN ## Berechnet die Standardabweichung auf der Grundlage der Grundgesamtheit ausgewählter Datenbankeinträge
+DSUM = DBSUMME ## Addiert die Zahlen in der Feldspalte mit Datensätzen in der Datenbank, die den Kriterien entsprechen
+DVAR = DBVARIANZ ## Schätzt die Varianz auf der Grundlage ausgewählter Datenbankeinträge
+DVARP = DBVARIANZEN ## Berechnet die Varianz auf der Grundlage der Grundgesamtheit ausgewählter Datenbankeinträge
+
+
+##
+## Date and time functions Datums- und Zeitfunktionen
+##
+DATE = DATUM ## Gibt die fortlaufende Zahl eines bestimmten Datums zurück
+DATEVALUE = DATWERT ## Wandelt ein Datum in Form von Text in eine fortlaufende Zahl um
+DAY = TAG ## Wandelt eine fortlaufende Zahl in den Tag des Monats um
+DAYS360 = TAGE360 ## Berechnet die Anzahl der Tage zwischen zwei Datumsangaben ausgehend von einem Jahr, das 360 Tage hat
+EDATE = EDATUM ## Gibt die fortlaufende Zahl des Datums zurück, bei dem es sich um die angegebene Anzahl von Monaten vor oder nach dem Anfangstermin handelt
+EOMONTH = MONATSENDE ## Gibt die fortlaufende Zahl des letzten Tags des Monats vor oder nach einer festgelegten Anzahl von Monaten zurück
+HOUR = STUNDE ## Wandelt eine fortlaufende Zahl in eine Stunde um
+MINUTE = MINUTE ## Wandelt eine fortlaufende Zahl in eine Minute um
+MONTH = MONAT ## Wandelt eine fortlaufende Zahl in einen Monat um
+NETWORKDAYS = NETTOARBEITSTAGE ## Gibt die Anzahl von ganzen Arbeitstagen zwischen zwei Datumswerten zurück
+NOW = JETZT ## Gibt die fortlaufende Zahl des aktuellen Datums und der aktuellen Uhrzeit zurück
+SECOND = SEKUNDE ## Wandelt eine fortlaufende Zahl in eine Sekunde um
+TIME = ZEIT ## Gibt die fortlaufende Zahl einer bestimmten Uhrzeit zurück
+TIMEVALUE = ZEITWERT ## Wandelt eine Uhrzeit in Form von Text in eine fortlaufende Zahl um
+TODAY = HEUTE ## Gibt die fortlaufende Zahl des heutigen Datums zurück
+WEEKDAY = WOCHENTAG ## Wandelt eine fortlaufende Zahl in den Wochentag um
+WEEKNUM = KALENDERWOCHE ## Wandelt eine fortlaufende Zahl in eine Zahl um, die angibt, in welche Woche eines Jahres das angegebene Datum fällt
+WORKDAY = ARBEITSTAG ## Gibt die fortlaufende Zahl des Datums vor oder nach einer bestimmten Anzahl von Arbeitstagen zurück
+YEAR = JAHR ## Wandelt eine fortlaufende Zahl in ein Jahr um
+YEARFRAC = BRTEILJAHRE ## Gibt die Anzahl der ganzen Tage zwischen Ausgangsdatum und Enddatum in Bruchteilen von Jahren zurück
+
+
+##
+## Engineering functions Konstruktionsfunktionen
+##
+BESSELI = BESSELI ## Gibt die geänderte Besselfunktion In(x) zurück
+BESSELJ = BESSELJ ## Gibt die Besselfunktion Jn(x) zurück
+BESSELK = BESSELK ## Gibt die geänderte Besselfunktion Kn(x) zurück
+BESSELY = BESSELY ## Gibt die Besselfunktion Yn(x) zurück
+BIN2DEC = BININDEZ ## Wandelt eine binäre Zahl (Dualzahl) in eine dezimale Zahl um
+BIN2HEX = BININHEX ## Wandelt eine binäre Zahl (Dualzahl) in eine hexadezimale Zahl um
+BIN2OCT = BININOKT ## Wandelt eine binäre Zahl (Dualzahl) in eine oktale Zahl um
+COMPLEX = KOMPLEXE ## Wandelt den Real- und Imaginärteil in eine komplexe Zahl um
+CONVERT = UMWANDELN ## Wandelt eine Zahl von einem Maßsystem in ein anderes um
+DEC2BIN = DEZINBIN ## Wandelt eine dezimale Zahl in eine binäre Zahl (Dualzahl) um
+DEC2HEX = DEZINHEX ## Wandelt eine dezimale Zahl in eine hexadezimale Zahl um
+DEC2OCT = DEZINOKT ## Wandelt eine dezimale Zahl in eine oktale Zahl um
+DELTA = DELTA ## Überprüft, ob zwei Werte gleich sind
+ERF = GAUSSFEHLER ## Gibt die Gauss'sche Fehlerfunktion zurück
+ERFC = GAUSSFKOMPL ## Gibt das Komplement zur Gauss'schen Fehlerfunktion zurück
+GESTEP = GGANZZAHL ## Überprüft, ob eine Zahl größer als ein gegebener Schwellenwert ist
+HEX2BIN = HEXINBIN ## Wandelt eine hexadezimale Zahl in eine Binärzahl um
+HEX2DEC = HEXINDEZ ## Wandelt eine hexadezimale Zahl in eine dezimale Zahl um
+HEX2OCT = HEXINOKT ## Wandelt eine hexadezimale Zahl in eine Oktalzahl um
+IMABS = IMABS ## Gibt den Absolutbetrag (Modulo) einer komplexen Zahl zurück
+IMAGINARY = IMAGINÄRTEIL ## Gibt den Imaginärteil einer komplexen Zahl zurück
+IMARGUMENT = IMARGUMENT ## Gibt das Argument Theta zurück, einen Winkel, der als Bogenmaß ausgedrückt wird
+IMCONJUGATE = IMKONJUGIERTE ## Gibt die konjugierte komplexe Zahl zu einer komplexen Zahl zurück
+IMCOS = IMCOS ## Gibt den Kosinus einer komplexen Zahl zurück
+IMDIV = IMDIV ## Gibt den Quotienten zweier komplexer Zahlen zurück
+IMEXP = IMEXP ## Gibt die algebraische Form einer in exponentieller Schreibweise vorliegenden komplexen Zahl zurück
+IMLN = IMLN ## Gibt den natürlichen Logarithmus einer komplexen Zahl zurück
+IMLOG10 = IMLOG10 ## Gibt den Logarithmus einer komplexen Zahl zur Basis 10 zurück
+IMLOG2 = IMLOG2 ## Gibt den Logarithmus einer komplexen Zahl zur Basis 2 zurück
+IMPOWER = IMAPOTENZ ## Potenziert eine komplexe Zahl mit einer ganzen Zahl
+IMPRODUCT = IMPRODUKT ## Gibt das Produkt von komplexen Zahlen zurück
+IMREAL = IMREALTEIL ## Gibt den Realteil einer komplexen Zahl zurück
+IMSIN = IMSIN ## Gibt den Sinus einer komplexen Zahl zurück
+IMSQRT = IMWURZEL ## Gibt die Quadratwurzel einer komplexen Zahl zurück
+IMSUB = IMSUB ## Gibt die Differenz zwischen zwei komplexen Zahlen zurück
+IMSUM = IMSUMME ## Gibt die Summe von komplexen Zahlen zurück
+OCT2BIN = OKTINBIN ## Wandelt eine oktale Zahl in eine binäre Zahl (Dualzahl) um
+OCT2DEC = OKTINDEZ ## Wandelt eine oktale Zahl in eine dezimale Zahl um
+OCT2HEX = OKTINHEX ## Wandelt eine oktale Zahl in eine hexadezimale Zahl um
+
+
+##
+## Financial functions Finanzmathematische Funktionen
+##
+ACCRINT = AUFGELZINS ## Gibt die aufgelaufenen Zinsen (Stückzinsen) eines Wertpapiers mit periodischen Zinszahlungen zurück
+ACCRINTM = AUFGELZINSF ## Gibt die aufgelaufenen Zinsen (Stückzinsen) eines Wertpapiers zurück, die bei Fälligkeit ausgezahlt werden
+AMORDEGRC = AMORDEGRK ## Gibt die Abschreibung für die einzelnen Abschreibungszeiträume mithilfe eines Abschreibungskoeffizienten zurück
+AMORLINC = AMORLINEARK ## Gibt die Abschreibung für die einzelnen Abschreibungszeiträume zurück
+COUPDAYBS = ZINSTERMTAGVA ## Gibt die Anzahl der Tage vom Anfang des Zinstermins bis zum Abrechnungstermin zurück
+COUPDAYS = ZINSTERMTAGE ## Gibt die Anzahl der Tage der Zinsperiode zurück, die den Abrechnungstermin einschließt
+COUPDAYSNC = ZINSTERMTAGNZ ## Gibt die Anzahl der Tage vom Abrechnungstermin bis zum nächsten Zinstermin zurück
+COUPNCD = ZINSTERMNZ ## Gibt das Datum des ersten Zinstermins nach dem Abrechnungstermin zurück
+COUPNUM = ZINSTERMZAHL ## Gibt die Anzahl der Zinstermine zwischen Abrechnungs- und Fälligkeitsdatum zurück
+COUPPCD = ZINSTERMVZ ## Gibt das Datum des letzten Zinstermins vor dem Abrechnungstermin zurück
+CUMIPMT = KUMZINSZ ## Berechnet die kumulierten Zinsen, die zwischen zwei Perioden zu zahlen sind
+CUMPRINC = KUMKAPITAL ## Berechnet die aufgelaufene Tilgung eines Darlehens, die zwischen zwei Perioden zu zahlen ist
+DB = GDA2 ## Gibt die geometrisch-degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode zurück
+DDB = GDA ## Gibt die Abschreibung eines Anlageguts für einen angegebenen Zeitraum unter Verwendung der degressiven Doppelraten-Abschreibung oder eines anderen von Ihnen angegebenen Abschreibungsverfahrens zurück
+DISC = DISAGIO ## Gibt den in Prozent ausgedrückten Abzinsungssatz eines Wertpapiers zurück
+DOLLARDE = NOTIERUNGDEZ ## Wandelt eine Notierung, die als Dezimalbruch ausgedrückt wurde, in eine Dezimalzahl um
+DOLLARFR = NOTIERUNGBRU ## Wandelt eine Notierung, die als Dezimalzahl ausgedrückt wurde, in einen Dezimalbruch um
+DURATION = DURATION ## Gibt die jährliche Duration eines Wertpapiers mit periodischen Zinszahlungen zurück
+EFFECT = EFFEKTIV ## Gibt die jährliche Effektivverzinsung zurück
+FV = ZW ## Gibt den zukünftigen Wert (Endwert) einer Investition zurück
+FVSCHEDULE = ZW2 ## Gibt den aufgezinsten Wert des Anfangskapitals für eine Reihe periodisch unterschiedlicher Zinssätze zurück
+INTRATE = ZINSSATZ ## Gibt den Zinssatz eines voll investierten Wertpapiers zurück
+IPMT = ZINSZ ## Gibt die Zinszahlung einer Investition für die angegebene Periode zurück
+IRR = IKV ## Gibt den internen Zinsfuß einer Investition ohne Finanzierungskosten oder Reinvestitionsgewinne zurück
+ISPMT = ISPMT ## Berechnet die während eines bestimmten Zeitraums für eine Investition gezahlten Zinsen
+MDURATION = MDURATION ## Gibt die geänderte Dauer für ein Wertpapier mit einem angenommenen Nennwert von 100 € zurück
+MIRR = QIKV ## Gibt den internen Zinsfuß zurück, wobei positive und negative Zahlungen zu unterschiedlichen Sätzen finanziert werden
+NOMINAL = NOMINAL ## Gibt die jährliche Nominalverzinsung zurück
+NPER = ZZR ## Gibt die Anzahl der Zahlungsperioden einer Investition zurück
+NPV = NBW ## Gibt den Nettobarwert einer Investition auf Basis periodisch anfallender Zahlungen und eines Abzinsungsfaktors zurück
+ODDFPRICE = UNREGER.KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers mit einem unregelmäßigen ersten Zinstermin zurück
+ODDFYIELD = UNREGER.REND ## Gibt die Rendite eines Wertpapiers mit einem unregelmäßigen ersten Zinstermin zurück
+ODDLPRICE = UNREGLE.KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers mit einem unregelmäßigen letzten Zinstermin zurück
+ODDLYIELD = UNREGLE.REND ## Gibt die Rendite eines Wertpapiers mit einem unregelmäßigen letzten Zinstermin zurück
+PMT = RMZ ## Gibt die periodische Zahlung für eine Annuität zurück
+PPMT = KAPZ ## Gibt die Kapitalrückzahlung einer Investition für eine angegebene Periode zurück
+PRICE = KURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück, das periodisch Zinsen auszahlt
+PRICEDISC = KURSDISAGIO ## Gibt den Kurs pro 100 € Nennwert eines unverzinslichen Wertpapiers zurück
+PRICEMAT = KURSFÄLLIG ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück, das Zinsen am Fälligkeitsdatum auszahlt
+PV = BW ## Gibt den Barwert einer Investition zurück
+RATE = ZINS ## Gibt den Zinssatz pro Zeitraum einer Annuität zurück
+RECEIVED = AUSZAHLUNG ## Gibt den Auszahlungsbetrag eines voll investierten Wertpapiers am Fälligkeitstermin zurück
+SLN = LIA ## Gibt die lineare Abschreibung eines Wirtschaftsguts pro Periode zurück
+SYD = DIA ## Gibt die arithmetisch-degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode zurück
+TBILLEQ = TBILLÄQUIV ## Gibt die Rendite für ein Wertpapier zurück
+TBILLPRICE = TBILLKURS ## Gibt den Kurs pro 100 € Nennwert eines Wertpapiers zurück
+TBILLYIELD = TBILLRENDITE ## Gibt die Rendite für ein Wertpapier zurück
+VDB = VDB ## Gibt die degressive Abschreibung eines Wirtschaftsguts für eine bestimmte Periode oder Teilperiode zurück
+XIRR = XINTZINSFUSS ## Gibt den internen Zinsfuß einer Reihe nicht periodisch anfallender Zahlungen zurück
+XNPV = XKAPITALWERT ## Gibt den Nettobarwert (Kapitalwert) einer Reihe nicht periodisch anfallender Zahlungen zurück
+YIELD = RENDITE ## Gibt die Rendite eines Wertpapiers zurück, das periodisch Zinsen auszahlt
+YIELDDISC = RENDITEDIS ## Gibt die jährliche Rendite eines unverzinslichen Wertpapiers zurück
+YIELDMAT = RENDITEFÄLL ## Gibt die jährliche Rendite eines Wertpapiers zurück, das Zinsen am Fälligkeitsdatum auszahlt
+
+
+##
+## Information functions Informationsfunktionen
+##
+CELL = ZELLE ## Gibt Informationen zu Formatierung, Position oder Inhalt einer Zelle zurück
+ERROR.TYPE = FEHLER.TYP ## Gibt eine Zahl zurück, die einem Fehlertyp entspricht
+INFO = INFO ## Gibt Informationen zur aktuellen Betriebssystemumgebung zurück
+ISBLANK = ISTLEER ## Gibt WAHR zurück, wenn der Wert leer ist
+ISERR = ISTFEHL ## Gibt WAHR zurück, wenn der Wert ein beliebiger Fehlerwert außer #N/V ist
+ISERROR = ISTFEHLER ## Gibt WAHR zurück, wenn der Wert ein beliebiger Fehlerwert ist
+ISEVEN = ISTGERADE ## Gibt WAHR zurück, wenn es sich um eine gerade Zahl handelt
+ISLOGICAL = ISTLOG ## Gibt WAHR zurück, wenn der Wert ein Wahrheitswert ist
+ISNA = ISTNV ## Gibt WAHR zurück, wenn der Wert der Fehlerwert #N/V ist
+ISNONTEXT = ISTKTEXT ## Gibt WAHR zurück, wenn der Wert ein Element ist, das keinen Text enthält
+ISNUMBER = ISTZAHL ## Gibt WAHR zurück, wenn der Wert eine Zahl ist
+ISODD = ISTUNGERADE ## Gibt WAHR zurück, wenn es sich um eine ungerade Zahl handelt
+ISREF = ISTBEZUG ## Gibt WAHR zurück, wenn der Wert ein Bezug ist
+ISTEXT = ISTTEXT ## Gibt WAHR zurück, wenn der Wert ein Element ist, das Text enthält
+N = N ## Gibt den in eine Zahl umgewandelten Wert zurück
+NA = NV ## Gibt den Fehlerwert #NV zurück
+TYPE = TYP ## Gibt eine Zahl zurück, die den Datentyp des angegebenen Werts anzeigt
+
+
+##
+## Logical functions Logische Funktionen
+##
+AND = UND ## Gibt WAHR zurück, wenn alle zugehörigen Argumente WAHR sind
+FALSE = FALSCH ## Gibt den Wahrheitswert FALSCH zurück
+IF = WENN ## Gibt einen logischen Test zum Ausführen an
+IFERROR = WENNFEHLER ## Gibt einen von Ihnen festgelegten Wert zurück, wenn die Auswertung der Formel zu einem Fehler führt; andernfalls wird das Ergebnis der Formel zurückgegeben
+NOT = NICHT ## Kehrt den Wahrheitswert der zugehörigen Argumente um
+OR = ODER ## Gibt WAHR zurück, wenn ein Argument WAHR ist
+TRUE = WAHR ## Gibt den Wahrheitswert WAHR zurück
+
+
+##
+## Lookup and reference functions Nachschlage- und Verweisfunktionen
+##
+ADDRESS = ADRESSE ## Gibt einen Bezug auf eine einzelne Zelle in einem Tabellenblatt als Text zurück
+AREAS = BEREICHE ## Gibt die Anzahl der innerhalb eines Bezugs aufgeführten Bereiche zurück
+CHOOSE = WAHL ## Wählt einen Wert aus eine Liste mit Werten aus
+COLUMN = SPALTE ## Gibt die Spaltennummer eines Bezugs zurück
+COLUMNS = SPALTEN ## Gibt die Anzahl der Spalten in einem Bezug zurück
+HLOOKUP = HVERWEIS ## Sucht in der obersten Zeile einer Matrix und gibt den Wert der angegebenen Zelle zurück
+HYPERLINK = HYPERLINK ## Erstellt eine Verknüpfung, über die ein auf einem Netzwerkserver, in einem Intranet oder im Internet gespeichertes Dokument geöffnet wird
+INDEX = INDEX ## Verwendet einen Index, um einen Wert aus einem Bezug oder einer Matrix auszuwählen
+INDIRECT = INDIREKT ## Gibt einen Bezug zurück, der von einem Textwert angegeben wird
+LOOKUP = LOOKUP ## Sucht Werte in einem Vektor oder einer Matrix
+MATCH = VERGLEICH ## Sucht Werte in einem Bezug oder einer Matrix
+OFFSET = BEREICH.VERSCHIEBEN ## Gibt einen Bezugoffset aus einem gegebenen Bezug zurück
+ROW = ZEILE ## Gibt die Zeilennummer eines Bezugs zurück
+ROWS = ZEILEN ## Gibt die Anzahl der Zeilen in einem Bezug zurück
+RTD = RTD ## Ruft Echtzeitdaten von einem Programm ab, das die COM-Automatisierung (Automatisierung: Ein Verfahren, bei dem aus einer Anwendung oder einem Entwicklungstool heraus mit den Objekten einer anderen Anwendung gearbeitet wird. Die früher als OLE-Automatisierung bezeichnete Automatisierung ist ein Industriestandard und eine Funktion von COM (Component Object Model).) unterstützt
+TRANSPOSE = MTRANS ## Gibt die transponierte Matrix einer Matrix zurück
+VLOOKUP = SVERWEIS ## Sucht in der ersten Spalte einer Matrix und arbeitet sich durch die Zeile, um den Wert einer Zelle zurückzugeben
+
+
+##
+## Math and trigonometry functions Mathematische und trigonometrische Funktionen
+##
+ABS = ABS ## Gibt den Absolutwert einer Zahl zurück
+ACOS = ARCCOS ## Gibt den Arkuskosinus einer Zahl zurück
+ACOSH = ARCCOSHYP ## Gibt den umgekehrten hyperbolischen Kosinus einer Zahl zurück
+ASIN = ARCSIN ## Gibt den Arkussinus einer Zahl zurück
+ASINH = ARCSINHYP ## Gibt den umgekehrten hyperbolischen Sinus einer Zahl zurück
+ATAN = ARCTAN ## Gibt den Arkustangens einer Zahl zurück
+ATAN2 = ARCTAN2 ## Gibt den Arkustangens einer x- und einer y-Koordinate zurück
+ATANH = ARCTANHYP ## Gibt den umgekehrten hyperbolischen Tangens einer Zahl zurück
+CEILING = OBERGRENZE ## Rundet eine Zahl auf die nächste ganze Zahl oder das nächste Vielfache von Schritt
+COMBIN = KOMBINATIONEN ## Gibt die Anzahl der Kombinationen für eine bestimmte Anzahl von Objekten zurück
+COS = COS ## Gibt den Kosinus einer Zahl zurück
+COSH = COSHYP ## Gibt den hyperbolischen Kosinus einer Zahl zurück
+DEGREES = GRAD ## Wandelt Bogenmaß (Radiant) in Grad um
+EVEN = GERADE ## Rundet eine Zahl auf die nächste gerade ganze Zahl auf
+EXP = EXP ## Potenziert die Basis e mit der als Argument angegebenen Zahl
+FACT = FAKULTÄT ## Gibt die Fakultät einer Zahl zurück
+FACTDOUBLE = ZWEIFAKULTÄT ## Gibt die Fakultät zu Zahl mit Schrittlänge 2 zurück
+FLOOR = UNTERGRENZE ## Rundet die Zahl auf Anzahl_Stellen ab
+GCD = GGT ## Gibt den größten gemeinsamen Teiler zurück
+INT = GANZZAHL ## Rundet eine Zahl auf die nächstkleinere ganze Zahl ab
+LCM = KGV ## Gibt das kleinste gemeinsame Vielfache zurück
+LN = LN ## Gibt den natürlichen Logarithmus einer Zahl zurück
+LOG = LOG ## Gibt den Logarithmus einer Zahl zu der angegebenen Basis zurück
+LOG10 = LOG10 ## Gibt den Logarithmus einer Zahl zur Basis 10 zurück
+MDETERM = MDET ## Gibt die Determinante einer Matrix zurück
+MINVERSE = MINV ## Gibt die inverse Matrix einer Matrix zurück
+MMULT = MMULT ## Gibt das Produkt zweier Matrizen zurück
+MOD = REST ## Gibt den Rest einer Division zurück
+MROUND = VRUNDEN ## Gibt eine auf das gewünschte Vielfache gerundete Zahl zurück
+MULTINOMIAL = POLYNOMIAL ## Gibt den Polynomialkoeffizienten einer Gruppe von Zahlen zurück
+ODD = UNGERADE ## Rundet eine Zahl auf die nächste ungerade ganze Zahl auf
+PI = PI ## Gibt den Wert Pi zurück
+POWER = POTENZ ## Gibt als Ergebnis eine potenzierte Zahl zurück
+PRODUCT = PRODUKT ## Multipliziert die zugehörigen Argumente
+QUOTIENT = QUOTIENT ## Gibt den ganzzahligen Anteil einer Division zurück
+RADIANS = BOGENMASS ## Wandelt Grad in Bogenmaß (Radiant) um
+RAND = ZUFALLSZAHL ## Gibt eine Zufallszahl zwischen 0 und 1 zurück
+RANDBETWEEN = ZUFALLSBEREICH ## Gibt eine Zufallszahl aus dem festgelegten Bereich zurück
+ROMAN = RÖMISCH ## Wandelt eine arabische Zahl in eine römische Zahl als Text um
+ROUND = RUNDEN ## Rundet eine Zahl auf eine bestimmte Anzahl von Dezimalstellen
+ROUNDDOWN = ABRUNDEN ## Rundet die Zahl auf Anzahl_Stellen ab
+ROUNDUP = AUFRUNDEN ## Rundet die Zahl auf Anzahl_Stellen auf
+SERIESSUM = POTENZREIHE ## Gibt die Summe von Potenzen (zur Berechnung von Potenzreihen und dichotomen Wahrscheinlichkeiten) zurück
+SIGN = VORZEICHEN ## Gibt das Vorzeichen einer Zahl zurück
+SIN = SIN ## Gibt den Sinus einer Zahl zurück
+SINH = SINHYP ## Gibt den hyperbolischen Sinus einer Zahl zurück
+SQRT = WURZEL ## Gibt die Quadratwurzel einer Zahl zurück
+SQRTPI = WURZELPI ## Gibt die Wurzel aus der mit Pi (pi) multiplizierten Zahl zurück
+SUBTOTAL = TEILERGEBNIS ## Gibt ein Teilergebnis in einer Liste oder Datenbank zurück
+SUM = SUMME ## Addiert die zugehörigen Argumente
+SUMIF = SUMMEWENN ## Addiert Zahlen, die mit den Suchkriterien übereinstimmen
+SUMIFS = SUMMEWENNS ## Die Zellen, die mehrere Kriterien erfüllen, werden in einem Bereich hinzugefügt
+SUMPRODUCT = SUMMENPRODUKT ## Gibt die Summe der Produkte zusammengehöriger Matrixkomponenten zurück
+SUMSQ = QUADRATESUMME ## Gibt die Summe der quadrierten Argumente zurück
+SUMX2MY2 = SUMMEX2MY2 ## Gibt die Summe der Differenzen der Quadrate für zusammengehörige Komponenten zweier Matrizen zurück
+SUMX2PY2 = SUMMEX2PY2 ## Gibt die Summe der Quadrate für zusammengehörige Komponenten zweier Matrizen zurück
+SUMXMY2 = SUMMEXMY2 ## Gibt die Summe der quadrierten Differenzen für zusammengehörige Komponenten zweier Matrizen zurück
+TAN = TAN ## Gibt den Tangens einer Zahl zurück
+TANH = TANHYP ## Gibt den hyperbolischen Tangens einer Zahl zurück
+TRUNC = KÜRZEN ## Schneidet die Kommastellen einer Zahl ab und gibt als Ergebnis eine ganze Zahl zurück
+
+
+##
+## Statistical functions Statistische Funktionen
+##
+AVEDEV = MITTELABW ## Gibt die durchschnittliche absolute Abweichung einer Reihe von Merkmalsausprägungen und ihrem Mittelwert zurück
+AVERAGE = MITTELWERT ## Gibt den Mittelwert der zugehörigen Argumente zurück
+AVERAGEA = MITTELWERTA ## Gibt den Mittelwert der zugehörigen Argumente, die Zahlen, Text und Wahrheitswerte enthalten, zurück
+AVERAGEIF = MITTELWERTWENN ## Der Durchschnittswert (arithmetisches Mittel) für alle Zellen in einem Bereich, die einem angegebenen Kriterium entsprechen, wird zurückgegeben
+AVERAGEIFS = MITTELWERTWENNS ## Gibt den Durchschnittswert (arithmetisches Mittel) aller Zellen zurück, die mehreren Kriterien entsprechen
+BETADIST = BETAVERT ## Gibt die Werte der kumulierten Betaverteilungsfunktion zurück
+BETAINV = BETAINV ## Gibt das Quantil der angegebenen Betaverteilung zurück
+BINOMDIST = BINOMVERT ## Gibt Wahrscheinlichkeiten einer binomialverteilten Zufallsvariablen zurück
+CHIDIST = CHIVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer Chi-Quadrat-verteilten Zufallsgröße zurück
+CHIINV = CHIINV ## Gibt Quantile der Verteilungsfunktion (1-Alpha) der Chi-Quadrat-Verteilung zurück
+CHITEST = CHITEST ## Gibt die Teststatistik eines Unabhängigkeitstests zurück
+CONFIDENCE = KONFIDENZ ## Ermöglicht die Berechnung des 1-Alpha Konfidenzintervalls für den Erwartungswert einer Zufallsvariablen
+CORREL = KORREL ## Gibt den Korrelationskoeffizienten zweier Reihen von Merkmalsausprägungen zurück
+COUNT = ANZAHL ## Gibt die Anzahl der Zahlen in der Liste mit Argumenten an
+COUNTA = ANZAHL2 ## Gibt die Anzahl der Werte in der Liste mit Argumenten an
+COUNTBLANK = ANZAHLLEEREZELLEN ## Gibt die Anzahl der leeren Zellen in einem Bereich an
+COUNTIF = ZÄHLENWENN ## Gibt die Anzahl der Zellen in einem Bereich an, deren Inhalte mit den Suchkriterien übereinstimmen
+COUNTIFS = ZÄHLENWENNS ## Gibt die Anzahl der Zellen in einem Bereich an, deren Inhalte mit mehreren Suchkriterien übereinstimmen
+COVAR = KOVAR ## Gibt die Kovarianz zurück, den Mittelwert der für alle Datenpunktpaare gebildeten Produkte der Abweichungen
+CRITBINOM = KRITBINOM ## Gibt den kleinsten Wert zurück, für den die kumulierten Wahrscheinlichkeiten der Binomialverteilung kleiner oder gleich einer Grenzwahrscheinlichkeit sind
+DEVSQ = SUMQUADABW ## Gibt die Summe der quadrierten Abweichungen der Datenpunkte von ihrem Stichprobenmittelwert zurück
+EXPONDIST = EXPONVERT ## Gibt Wahrscheinlichkeiten einer exponential verteilten Zufallsvariablen zurück
+FDIST = FVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer F-verteilten Zufallsvariablen zurück
+FINV = FINV ## Gibt Quantile der F-Verteilung zurück
+FISHER = FISHER ## Gibt die Fisher-Transformation zurück
+FISHERINV = FISHERINV ## Gibt die Umkehrung der Fisher-Transformation zurück
+FORECAST = PROGNOSE ## Gibt einen Wert zurück, der sich aus einem linearen Trend ergibt
+FREQUENCY = HÄUFIGKEIT ## Gibt eine Häufigkeitsverteilung als vertikale Matrix zurück
+FTEST = FTEST ## Gibt die Teststatistik eines F-Tests zurück
+GAMMADIST = GAMMAVERT ## Gibt Wahrscheinlichkeiten einer gammaverteilten Zufallsvariablen zurück
+GAMMAINV = GAMMAINV ## Gibt Quantile der Gammaverteilung zurück
+GAMMALN = GAMMALN ## Gibt den natürlichen Logarithmus der Gammafunktion zurück, Γ(x)
+GEOMEAN = GEOMITTEL ## Gibt das geometrische Mittel zurück
+GROWTH = VARIATION ## Gibt Werte zurück, die sich aus einem exponentiellen Trend ergeben
+HARMEAN = HARMITTEL ## Gibt das harmonische Mittel zurück
+HYPGEOMDIST = HYPGEOMVERT ## Gibt Wahrscheinlichkeiten einer hypergeometrisch-verteilten Zufallsvariablen zurück
+INTERCEPT = ACHSENABSCHNITT ## Gibt den Schnittpunkt der Regressionsgeraden zurück
+KURT = KURT ## Gibt die Kurtosis (Exzess) einer Datengruppe zurück
+LARGE = KGRÖSSTE ## Gibt den k-größten Wert einer Datengruppe zurück
+LINEST = RGP ## Gibt die Parameter eines linearen Trends zurück
+LOGEST = RKP ## Gibt die Parameter eines exponentiellen Trends zurück
+LOGINV = LOGINV ## Gibt Quantile der Lognormalverteilung zurück
+LOGNORMDIST = LOGNORMVERT ## Gibt Werte der Verteilungsfunktion einer lognormalverteilten Zufallsvariablen zurück
+MAX = MAX ## Gibt den Maximalwert einer Liste mit Argumenten zurück
+MAXA = MAXA ## Gibt den Maximalwert einer Liste mit Argumenten zurück, die Zahlen, Text und Wahrheitswerte enthalten
+MEDIAN = MEDIAN ## Gibt den Median der angegebenen Zahlen zurück
+MIN = MIN ## Gibt den Minimalwert einer Liste mit Argumenten zurück
+MINA = MINA ## Gibt den kleinsten Wert einer Liste mit Argumenten zurück, die Zahlen, Text und Wahrheitswerte enthalten
+MODE = MODALWERT ## Gibt den am häufigsten vorkommenden Wert in einer Datengruppe zurück
+NEGBINOMDIST = NEGBINOMVERT ## Gibt Wahrscheinlichkeiten einer negativen, binominal verteilten Zufallsvariablen zurück
+NORMDIST = NORMVERT ## Gibt Wahrscheinlichkeiten einer normal verteilten Zufallsvariablen zurück
+NORMINV = NORMINV ## Gibt Quantile der Normalverteilung zurück
+NORMSDIST = STANDNORMVERT ## Gibt Werte der Verteilungsfunktion einer standardnormalverteilten Zufallsvariablen zurück
+NORMSINV = STANDNORMINV ## Gibt Quantile der Standardnormalverteilung zurück
+PEARSON = PEARSON ## Gibt den Pearsonschen Korrelationskoeffizienten zurück
+PERCENTILE = QUANTIL ## Gibt das Alpha-Quantil einer Gruppe von Daten zurück
+PERCENTRANK = QUANTILSRANG ## Gibt den prozentualen Rang (Alpha) eines Werts in einer Datengruppe zurück
+PERMUT = VARIATIONEN ## Gibt die Anzahl der Möglichkeiten zurück, um k Elemente aus einer Menge von n Elementen ohne Zurücklegen zu ziehen
+POISSON = POISSON ## Gibt Wahrscheinlichkeiten einer poissonverteilten Zufallsvariablen zurück
+PROB = WAHRSCHBEREICH ## Gibt die Wahrscheinlichkeit für ein von zwei Werten eingeschlossenes Intervall zurück
+QUARTILE = QUARTILE ## Gibt die Quartile der Datengruppe zurück
+RANK = RANG ## Gibt den Rang zurück, den eine Zahl innerhalb einer Liste von Zahlen einnimmt
+RSQ = BESTIMMTHEITSMASS ## Gibt das Quadrat des Pearsonschen Korrelationskoeffizienten zurück
+SKEW = SCHIEFE ## Gibt die Schiefe einer Verteilung zurück
+SLOPE = STEIGUNG ## Gibt die Steigung der Regressionsgeraden zurück
+SMALL = KKLEINSTE ## Gibt den k-kleinsten Wert einer Datengruppe zurück
+STANDARDIZE = STANDARDISIERUNG ## Gibt den standardisierten Wert zurück
+STDEV = STABW ## Schätzt die Standardabweichung ausgehend von einer Stichprobe
+STDEVA = STABWA ## Schätzt die Standardabweichung ausgehend von einer Stichprobe, die Zahlen, Text und Wahrheitswerte enthält
+STDEVP = STABWN ## Berechnet die Standardabweichung ausgehend von der Grundgesamtheit
+STDEVPA = STABWNA ## Berechnet die Standardabweichung ausgehend von der Grundgesamtheit, die Zahlen, Text und Wahrheitswerte enthält
+STEYX = STFEHLERYX ## Gibt den Standardfehler der geschätzten y-Werte für alle x-Werte der Regression zurück
+TDIST = TVERT ## Gibt Werte der Verteilungsfunktion (1-Alpha) einer (Student) t-verteilten Zufallsvariablen zurück
+TINV = TINV ## Gibt Quantile der t-Verteilung zurück
+TREND = TREND ## Gibt Werte zurück, die sich aus einem linearen Trend ergeben
+TRIMMEAN = GESTUTZTMITTEL ## Gibt den Mittelwert einer Datengruppe zurück, ohne die Randwerte zu berücksichtigen
+TTEST = TTEST ## Gibt die Teststatistik eines Student'schen t-Tests zurück
+VAR = VARIANZ ## Schätzt die Varianz ausgehend von einer Stichprobe
+VARA = VARIANZA ## Schätzt die Varianz ausgehend von einer Stichprobe, die Zahlen, Text und Wahrheitswerte enthält
+VARP = VARIANZEN ## Berechnet die Varianz ausgehend von der Grundgesamtheit
+VARPA = VARIANZENA ## Berechnet die Varianz ausgehend von der Grundgesamtheit, die Zahlen, Text und Wahrheitswerte enthält
+WEIBULL = WEIBULL ## Gibt Wahrscheinlichkeiten einer weibullverteilten Zufallsvariablen zurück
+ZTEST = GTEST ## Gibt den einseitigen Wahrscheinlichkeitswert für einen Gausstest (Normalverteilung) zurück
+
+
+##
+## Text functions Textfunktionen
+##
+ASC = ASC ## Konvertiert DB-Text in einer Zeichenfolge (lateinische Buchstaben oder Katakana) in SB-Text
+BAHTTEXT = BAHTTEXT ## Wandelt eine Zahl in Text im Währungsformat ß (Baht) um
+CHAR = ZEICHEN ## Gibt das der Codezahl entsprechende Zeichen zurück
+CLEAN = SÄUBERN ## Löscht alle nicht druckbaren Zeichen aus einem Text
+CODE = CODE ## Gibt die Codezahl des ersten Zeichens in einem Text zurück
+CONCATENATE = VERKETTEN ## Verknüpft mehrere Textelemente zu einem Textelement
+DOLLAR = DM ## Wandelt eine Zahl in Text im Währungsformat € (Euro) um
+EXACT = IDENTISCH ## Prüft, ob zwei Textwerte identisch sind
+FIND = FINDEN ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird unterschieden)
+FINDB = FINDENB ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird unterschieden)
+FIXED = FEST ## Formatiert eine Zahl als Text mit einer festen Anzahl von Dezimalstellen
+JIS = JIS ## Konvertiert SB-Text in einer Zeichenfolge (lateinische Buchstaben oder Katakana) in DB-Text
+LEFT = LINKS ## Gibt die Zeichen ganz links in einem Textwert zurück
+LEFTB = LINKSB ## Gibt die Zeichen ganz links in einem Textwert zurück
+LEN = LÄNGE ## Gibt die Anzahl der Zeichen in einer Zeichenfolge zurück
+LENB = LÄNGEB ## Gibt die Anzahl der Zeichen in einer Zeichenfolge zurück
+LOWER = KLEIN ## Wandelt Text in Kleinbuchstaben um
+MID = TEIL ## Gibt eine bestimmte Anzahl Zeichen aus einer Zeichenfolge ab der von Ihnen angegebenen Stelle zurück
+MIDB = TEILB ## Gibt eine bestimmte Anzahl Zeichen aus einer Zeichenfolge ab der von Ihnen angegebenen Stelle zurück
+PHONETIC = PHONETIC ## Extrahiert die phonetischen (Furigana-)Zeichen aus einer Textzeichenfolge
+PROPER = GROSS2 ## Wandelt den ersten Buchstaben aller Wörter eines Textwerts in Großbuchstaben um
+REPLACE = ERSETZEN ## Ersetzt Zeichen in Text
+REPLACEB = ERSETZENB ## Ersetzt Zeichen in Text
+REPT = WIEDERHOLEN ## Wiederholt einen Text so oft wie angegeben
+RIGHT = RECHTS ## Gibt die Zeichen ganz rechts in einem Textwert zurück
+RIGHTB = RECHTSB ## Gibt die Zeichen ganz rechts in einem Textwert zurück
+SEARCH = SUCHEN ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird nicht unterschieden)
+SEARCHB = SUCHENB ## Sucht nach einem Textwert, der in einem anderen Textwert enthalten ist (Groß-/Kleinschreibung wird nicht unterschieden)
+SUBSTITUTE = WECHSELN ## Ersetzt in einer Zeichenfolge neuen Text gegen alten
+T = T ## Wandelt die zugehörigen Argumente in Text um
+TEXT = TEXT ## Formatiert eine Zahl und wandelt sie in Text um
+TRIM = GLÄTTEN ## Entfernt Leerzeichen aus Text
+UPPER = GROSS ## Wandelt Text in Großbuchstaben um
+VALUE = WERT ## Wandelt ein Textargument in eine Zahl um
diff --git a/Classes/PHPExcel/locale/en/uk/config b/Classes/PHPExcel/locale/en/uk/config
new file mode 100644
index 0000000..532080b
--- /dev/null
+++ b/Classes/PHPExcel/locale/en/uk/config
@@ -0,0 +1,32 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+##
+## (For future use)
+##
+currencySymbol = £
diff --git a/Classes/PHPExcel/locale/es/config b/Classes/PHPExcel/locale/es/config
new file mode 100644
index 0000000..96cfa69
--- /dev/null
+++ b/Classes/PHPExcel/locale/es/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rather than €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #¡NULO!
+DIV0 = #¡DIV/0!
+VALUE = #¡VALOR!
+REF = #¡REF!
+NAME = #¿NOMBRE?
+NUM = #¡NÚM!
+NA = #N/A
diff --git a/Classes/PHPExcel/locale/es/functions b/Classes/PHPExcel/locale/es/functions
new file mode 100644
index 0000000..4876269
--- /dev/null
+++ b/Classes/PHPExcel/locale/es/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Funciones de complementos y automatización
+##
+GETPIVOTDATA = IMPORTARDATOSDINAMICOS ## Devuelve los datos almacenados en un informe de tabla dinámica.
+
+
+##
+## Cube functions Funciones de cubo
+##
+CUBEKPIMEMBER = MIEMBROKPICUBO ## Devuelve un nombre, propiedad y medida de indicador de rendimiento clave (KPI) y muestra el nombre y la propiedad en la celda. Un KPI es una medida cuantificable, como los beneficios brutos mensuales o la facturación trimestral por empleado, que se usa para supervisar el rendimiento de una organización.
+CUBEMEMBER = MIEMBROCUBO ## Devuelve un miembro o tupla en una jerarquÃa de cubo. Se usa para validar la existencia del miembro o la tupla en el cubo.
+CUBEMEMBERPROPERTY = PROPIEDADMIEMBROCUBO ## Devuelve el valor de una propiedad de miembro del cubo Se usa para validar la existencia de un nombre de miembro en el cubo y para devolver la propiedad especificada para este miembro.
+CUBERANKEDMEMBER = MIEMBRORANGOCUBO ## Devuelve el miembro n, o clasificado, de un conjunto. Se usa para devolver uno o más elementos de un conjunto, por ejemplo, el representante con mejores ventas o los diez mejores alumnos.
+CUBESET = CONJUNTOCUBO ## Define un conjunto calculado de miembros o tuplas mediante el envÃo de una expresión de conjunto al cubo en el servidor, lo que crea el conjunto y, después, devuelve dicho conjunto a Microsoft Office Excel.
+CUBESETCOUNT = RECUENTOCONJUNTOCUBO ## Devuelve el número de elementos de un conjunto.
+CUBEVALUE = VALORCUBO ## Devuelve un valor agregado de un cubo.
+
+
+##
+## Database functions Funciones de base de datos
+##
+DAVERAGE = BDPROMEDIO ## Devuelve el promedio de las entradas seleccionadas en la base de datos.
+DCOUNT = BDCONTAR ## Cuenta el número de celdas que contienen números en una base de datos.
+DCOUNTA = BDCONTARA ## Cuenta el número de celdas no vacÃas en una base de datos.
+DGET = BDEXTRAER ## Extrae de una base de datos un único registro que cumple los criterios especificados.
+DMAX = BDMAX ## Devuelve el valor máximo de las entradas seleccionadas de la base de datos.
+DMIN = BDMIN ## Devuelve el valor mÃnimo de las entradas seleccionadas de la base de datos.
+DPRODUCT = BDPRODUCTO ## Multiplica los valores de un campo concreto de registros de una base de datos que cumplen los criterios especificados.
+DSTDEV = BDDESVEST ## Calcula la desviación estándar a partir de una muestra de entradas seleccionadas en la base de datos.
+DSTDEVP = BDDESVESTP ## Calcula la desviación estándar en función de la población total de las entradas seleccionadas de la base de datos.
+DSUM = BDSUMA ## Suma los números de la columna de campo de los registros de la base de datos que cumplen los criterios.
+DVAR = BDVAR ## Calcula la varianza a partir de una muestra de entradas seleccionadas de la base de datos.
+DVARP = BDVARP ## Calcula la varianza a partir de la población total de entradas seleccionadas de la base de datos.
+
+
+##
+## Date and time functions Funciones de fecha y hora
+##
+DATE = FECHA ## Devuelve el número de serie correspondiente a una fecha determinada.
+DATEVALUE = FECHANUMERO ## Convierte una fecha con formato de texto en un valor de número de serie.
+DAY = DIA ## Convierte un número de serie en un valor de dÃa del mes.
+DAYS360 = DIAS360 ## Calcula el número de dÃas entre dos fechas a partir de un año de 360 dÃas.
+EDATE = FECHA.MES ## Devuelve el número de serie de la fecha equivalente al número indicado de meses anteriores o posteriores a la fecha inicial.
+EOMONTH = FIN.MES ## Devuelve el número de serie correspondiente al último dÃa del mes anterior o posterior a un número de meses especificado.
+HOUR = HORA ## Convierte un número de serie en un valor de hora.
+MINUTE = MINUTO ## Convierte un número de serie en un valor de minuto.
+MONTH = MES ## Convierte un número de serie en un valor de mes.
+NETWORKDAYS = DIAS.LAB ## Devuelve el número de todos los dÃas laborables existentes entre dos fechas.
+NOW = AHORA ## Devuelve el número de serie correspondiente a la fecha y hora actuales.
+SECOND = SEGUNDO ## Convierte un número de serie en un valor de segundo.
+TIME = HORA ## Devuelve el número de serie correspondiente a una hora determinada.
+TIMEVALUE = HORANUMERO ## Convierte una hora con formato de texto en un valor de número de serie.
+TODAY = HOY ## Devuelve el número de serie correspondiente al dÃa actual.
+WEEKDAY = DIASEM ## Convierte un número de serie en un valor de dÃa de la semana.
+WEEKNUM = NUM.DE.SEMANA ## Convierte un número de serie en un número que representa el lugar numérico correspondiente a una semana de un año.
+WORKDAY = DIA.LAB ## Devuelve el número de serie de la fecha que tiene lugar antes o después de un número determinado de dÃas laborables.
+YEAR = AÑO ## Convierte un número de serie en un valor de año.
+YEARFRAC = FRAC.AÑO ## Devuelve la fracción de año que representa el número total de dÃas existentes entre el valor de fecha_inicial y el de fecha_final.
+
+
+##
+## Engineering functions Funciones de ingenierÃa
+##
+BESSELI = BESSELI ## Devuelve la función Bessel In(x) modificada.
+BESSELJ = BESSELJ ## Devuelve la función Bessel Jn(x).
+BESSELK = BESSELK ## Devuelve la función Bessel Kn(x) modificada.
+BESSELY = BESSELY ## Devuelve la función Bessel Yn(x).
+BIN2DEC = BIN.A.DEC ## Convierte un número binario en decimal.
+BIN2HEX = BIN.A.HEX ## Convierte un número binario en hexadecimal.
+BIN2OCT = BIN.A.OCT ## Convierte un número binario en octal.
+COMPLEX = COMPLEJO ## Convierte coeficientes reales e imaginarios en un número complejo.
+CONVERT = CONVERTIR ## Convierte un número de un sistema de medida a otro.
+DEC2BIN = DEC.A.BIN ## Convierte un número decimal en binario.
+DEC2HEX = DEC.A.HEX ## Convierte un número decimal en hexadecimal.
+DEC2OCT = DEC.A.OCT ## Convierte un número decimal en octal.
+DELTA = DELTA ## Comprueba si dos valores son iguales.
+ERF = FUN.ERROR ## Devuelve la función de error.
+ERFC = FUN.ERROR.COMPL ## Devuelve la función de error complementario.
+GESTEP = MAYOR.O.IGUAL ## Comprueba si un número es mayor que un valor de umbral.
+HEX2BIN = HEX.A.BIN ## Convierte un número hexadecimal en binario.
+HEX2DEC = HEX.A.DEC ## Convierte un número hexadecimal en decimal.
+HEX2OCT = HEX.A.OCT ## Convierte un número hexadecimal en octal.
+IMABS = IM.ABS ## Devuelve el valor absoluto (módulo) de un número complejo.
+IMAGINARY = IMAGINARIO ## Devuelve el coeficiente imaginario de un número complejo.
+IMARGUMENT = IM.ANGULO ## Devuelve el argumento theta, un ángulo expresado en radianes.
+IMCONJUGATE = IM.CONJUGADA ## Devuelve la conjugada compleja de un número complejo.
+IMCOS = IM.COS ## Devuelve el coseno de un número complejo.
+IMDIV = IM.DIV ## Devuelve el cociente de dos números complejos.
+IMEXP = IM.EXP ## Devuelve el valor exponencial de un número complejo.
+IMLN = IM.LN ## Devuelve el logaritmo natural (neperiano) de un número complejo.
+IMLOG10 = IM.LOG10 ## Devuelve el logaritmo en base 10 de un número complejo.
+IMLOG2 = IM.LOG2 ## Devuelve el logaritmo en base 2 de un número complejo.
+IMPOWER = IM.POT ## Devuelve un número complejo elevado a una potencia entera.
+IMPRODUCT = IM.PRODUCT ## Devuelve el producto de números complejos.
+IMREAL = IM.REAL ## Devuelve el coeficiente real de un número complejo.
+IMSIN = IM.SENO ## Devuelve el seno de un número complejo.
+IMSQRT = IM.RAIZ2 ## Devuelve la raÃz cuadrada de un número complejo.
+IMSUB = IM.SUSTR ## Devuelve la diferencia entre dos números complejos.
+IMSUM = IM.SUM ## Devuelve la suma de números complejos.
+OCT2BIN = OCT.A.BIN ## Convierte un número octal en binario.
+OCT2DEC = OCT.A.DEC ## Convierte un número octal en decimal.
+OCT2HEX = OCT.A.HEX ## Convierte un número octal en hexadecimal.
+
+
+##
+## Financial functions Funciones financieras
+##
+ACCRINT = INT.ACUM ## Devuelve el interés acumulado de un valor bursátil con pagos de interés periódicos.
+ACCRINTM = INT.ACUM.V ## Devuelve el interés acumulado de un valor bursátil con pagos de interés al vencimiento.
+AMORDEGRC = AMORTIZ.PROGRE ## Devuelve la amortización de cada perÃodo contable mediante el uso de un coeficiente de amortización.
+AMORLINC = AMORTIZ.LIN ## Devuelve la amortización de cada uno de los perÃodos contables.
+COUPDAYBS = CUPON.DIAS.L1 ## Devuelve el número de dÃas desde el principio del perÃodo de un cupón hasta la fecha de liquidación.
+COUPDAYS = CUPON.DIAS ## Devuelve el número de dÃas del perÃodo (entre dos cupones) donde se encuentra la fecha de liquidación.
+COUPDAYSNC = CUPON.DIAS.L2 ## Devuelve el número de dÃas desde la fecha de liquidación hasta la fecha del próximo cupón.
+COUPNCD = CUPON.FECHA.L2 ## Devuelve la fecha del próximo cupón después de la fecha de liquidación.
+COUPNUM = CUPON.NUM ## Devuelve el número de pagos de cupón entre la fecha de liquidación y la fecha de vencimiento.
+COUPPCD = CUPON.FECHA.L1 ## Devuelve la fecha de cupón anterior a la fecha de liquidación.
+CUMIPMT = PAGO.INT.ENTRE ## Devuelve el interés acumulado pagado entre dos perÃodos.
+CUMPRINC = PAGO.PRINC.ENTRE ## Devuelve el capital acumulado pagado de un préstamo entre dos perÃodos.
+DB = DB ## Devuelve la amortización de un bien durante un perÃodo especÃfico a través del método de amortización de saldo fijo.
+DDB = DDB ## Devuelve la amortización de un bien durante un perÃodo especÃfico a través del método de amortización por doble disminución de saldo u otro método que se especifique.
+DISC = TASA.DESC ## Devuelve la tasa de descuento de un valor bursátil.
+DOLLARDE = MONEDA.DEC ## Convierte una cotización de un valor bursátil expresada en forma fraccionaria en una cotización de un valor bursátil expresada en forma decimal.
+DOLLARFR = MONEDA.FRAC ## Convierte una cotización de un valor bursátil expresada en forma decimal en una cotización de un valor bursátil expresada en forma fraccionaria.
+DURATION = DURACION ## Devuelve la duración anual de un valor bursátil con pagos de interés periódico.
+EFFECT = INT.EFECTIVO ## Devuelve la tasa de interés anual efectiva.
+FV = VF ## Devuelve el valor futuro de una inversión.
+FVSCHEDULE = VF.PLAN ## Devuelve el valor futuro de un capital inicial después de aplicar una serie de tasas de interés compuesto.
+INTRATE = TASA.INT ## Devuelve la tasa de interés para la inversión total de un valor bursátil.
+IPMT = PAGOINT ## Devuelve el pago de intereses de una inversión durante un perÃodo determinado.
+IRR = TIR ## Devuelve la tasa interna de retorno para una serie de flujos de efectivo periódicos.
+ISPMT = INT.PAGO.DIR ## Calcula el interés pagado durante un perÃodo especÃfico de una inversión.
+MDURATION = DURACION.MODIF ## Devuelve la duración de Macauley modificada de un valor bursátil con un valor nominal supuesto de 100 $.
+MIRR = TIRM ## Devuelve la tasa interna de retorno donde se financian flujos de efectivo positivos y negativos a tasas diferentes.
+NOMINAL = TASA.NOMINAL ## Devuelve la tasa nominal de interés anual.
+NPER = NPER ## Devuelve el número de perÃodos de una inversión.
+NPV = VNA ## Devuelve el valor neto actual de una inversión en función de una serie de flujos periódicos de efectivo y una tasa de descuento.
+ODDFPRICE = PRECIO.PER.IRREGULAR.1 ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con un primer perÃodo impar.
+ODDFYIELD = RENDTO.PER.IRREGULAR.1 ## Devuelve el rendimiento de un valor bursátil con un primer perÃodo impar.
+ODDLPRICE = PRECIO.PER.IRREGULAR.2 ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con un último perÃodo impar.
+ODDLYIELD = RENDTO.PER.IRREGULAR.2 ## Devuelve el rendimiento de un valor bursátil con un último perÃodo impar.
+PMT = PAGO ## Devuelve el pago periódico de una anualidad.
+PPMT = PAGOPRIN ## Devuelve el pago de capital de una inversión durante un perÃodo determinado.
+PRICE = PRECIO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil que paga una tasa de interés periódico.
+PRICEDISC = PRECIO.DESCUENTO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil con descuento.
+PRICEMAT = PRECIO.VENCIMIENTO ## Devuelve el precio por un valor nominal de 100 $ de un valor bursátil que paga interés a su vencimiento.
+PV = VALACT ## Devuelve el valor actual de una inversión.
+RATE = TASA ## Devuelve la tasa de interés por perÃodo de una anualidad.
+RECEIVED = CANTIDAD.RECIBIDA ## Devuelve la cantidad recibida al vencimiento de un valor bursátil completamente invertido.
+SLN = SLN ## Devuelve la amortización por método directo de un bien en un perÃodo dado.
+SYD = SYD ## Devuelve la amortización por suma de dÃgitos de los años de un bien durante un perÃodo especificado.
+TBILLEQ = LETRA.DE.TES.EQV.A.BONO ## Devuelve el rendimiento de un bono equivalente a una letra del Tesoro (de EE.UU.)
+TBILLPRICE = LETRA.DE.TES.PRECIO ## Devuelve el precio por un valor nominal de 100 $ de una letra del Tesoro (de EE.UU.)
+TBILLYIELD = LETRA.DE.TES.RENDTO ## Devuelve el rendimiento de una letra del Tesoro (de EE.UU.)
+VDB = DVS ## Devuelve la amortización de un bien durante un perÃodo especÃfico o parcial a través del método de cálculo del saldo en disminución.
+XIRR = TIR.NO.PER ## Devuelve la tasa interna de retorno para un flujo de efectivo que no es necesariamente periódico.
+XNPV = VNA.NO.PER ## Devuelve el valor neto actual para un flujo de efectivo que no es necesariamente periódico.
+YIELD = RENDTO ## Devuelve el rendimiento de un valor bursátil que paga intereses periódicos.
+YIELDDISC = RENDTO.DESC ## Devuelve el rendimiento anual de un valor bursátil con descuento; por ejemplo, una letra del Tesoro (de EE.UU.)
+YIELDMAT = RENDTO.VENCTO ## Devuelve el rendimiento anual de un valor bursátil que paga intereses al vencimiento.
+
+
+##
+## Information functions Funciones de información
+##
+CELL = CELDA ## Devuelve información acerca del formato, la ubicación o el contenido de una celda.
+ERROR.TYPE = TIPO.DE.ERROR ## Devuelve un número que corresponde a un tipo de error.
+INFO = INFO ## Devuelve información acerca del entorno operativo en uso.
+ISBLANK = ESBLANCO ## Devuelve VERDADERO si el valor está en blanco.
+ISERR = ESERR ## Devuelve VERDADERO si el valor es cualquier valor de error excepto #N/A.
+ISERROR = ESERROR ## Devuelve VERDADERO si el valor es cualquier valor de error.
+ISEVEN = ES.PAR ## Devuelve VERDADERO si el número es par.
+ISLOGICAL = ESLOGICO ## Devuelve VERDADERO si el valor es un valor lógico.
+ISNA = ESNOD ## Devuelve VERDADERO si el valor es el valor de error #N/A.
+ISNONTEXT = ESNOTEXTO ## Devuelve VERDADERO si el valor no es texto.
+ISNUMBER = ESNUMERO ## Devuelve VERDADERO si el valor es un número.
+ISODD = ES.IMPAR ## Devuelve VERDADERO si el número es impar.
+ISREF = ESREF ## Devuelve VERDADERO si el valor es una referencia.
+ISTEXT = ESTEXTO ## Devuelve VERDADERO si el valor es texto.
+N = N ## Devuelve un valor convertido en un número.
+NA = ND ## Devuelve el valor de error #N/A.
+TYPE = TIPO ## Devuelve un número que indica el tipo de datos de un valor.
+
+
+##
+## Logical functions Funciones lógicas
+##
+AND = Y ## Devuelve VERDADERO si todos sus argumentos son VERDADERO.
+FALSE = FALSO ## Devuelve el valor lógico FALSO.
+IF = SI ## Especifica una prueba lógica que realizar.
+IFERROR = SI.ERROR ## Devuelve un valor que se especifica si una fórmula lo evalúa como un error; de lo contrario, devuelve el resultado de la fórmula.
+NOT = NO ## Invierte el valor lógico del argumento.
+OR = O ## Devuelve VERDADERO si cualquier argumento es VERDADERO.
+TRUE = VERDADERO ## Devuelve el valor lógico VERDADERO.
+
+
+##
+## Lookup and reference functions Funciones de búsqueda y referencia
+##
+ADDRESS = DIRECCION ## Devuelve una referencia como texto a una sola celda de una hoja de cálculo.
+AREAS = AREAS ## Devuelve el número de áreas de una referencia.
+CHOOSE = ELEGIR ## Elige un valor de una lista de valores.
+COLUMN = COLUMNA ## Devuelve el número de columna de una referencia.
+COLUMNS = COLUMNAS ## Devuelve el número de columnas de una referencia.
+HLOOKUP = BUSCARH ## Busca en la fila superior de una matriz y devuelve el valor de la celda indicada.
+HYPERLINK = HIPERVINCULO ## Crea un acceso directo o un salto que abre un documento almacenado en un servidor de red, en una intranet o en Internet.
+INDEX = INDICE ## Usa un Ãndice para elegir un valor de una referencia o matriz.
+INDIRECT = INDIRECTO ## Devuelve una referencia indicada por un valor de texto.
+LOOKUP = BUSCAR ## Busca valores de un vector o una matriz.
+MATCH = COINCIDIR ## Busca valores de una referencia o matriz.
+OFFSET = DESREF ## Devuelve un desplazamiento de referencia respecto a una referencia dada.
+ROW = FILA ## Devuelve el número de fila de una referencia.
+ROWS = FILAS ## Devuelve el número de filas de una referencia.
+RTD = RDTR ## Recupera datos en tiempo real desde un programa compatible con la automatización COM (automatización: modo de trabajar con los objetos de una aplicación desde otra aplicación o herramienta de entorno. La automatización, antes denominada automatización OLE, es un estándar de la industria y una función del Modelo de objetos componentes (COM).).
+TRANSPOSE = TRANSPONER ## Devuelve la transposición de una matriz.
+VLOOKUP = BUSCARV ## Busca en la primera columna de una matriz y se mueve en horizontal por la fila para devolver el valor de una celda.
+
+
+##
+## Math and trigonometry functions Funciones matemáticas y trigonométricas
+##
+ABS = ABS ## Devuelve el valor absoluto de un número.
+ACOS = ACOS ## Devuelve el arcocoseno de un número.
+ACOSH = ACOSH ## Devuelve el coseno hiperbólico inverso de un número.
+ASIN = ASENO ## Devuelve el arcoseno de un número.
+ASINH = ASENOH ## Devuelve el seno hiperbólico inverso de un número.
+ATAN = ATAN ## Devuelve la arcotangente de un número.
+ATAN2 = ATAN2 ## Devuelve la arcotangente de las coordenadas "x" e "y".
+ATANH = ATANH ## Devuelve la tangente hiperbólica inversa de un número.
+CEILING = MULTIPLO.SUPERIOR ## Redondea un número al entero más próximo o al múltiplo significativo más cercano.
+COMBIN = COMBINAT ## Devuelve el número de combinaciones para un número determinado de objetos.
+COS = COS ## Devuelve el coseno de un número.
+COSH = COSH ## Devuelve el coseno hiperbólico de un número.
+DEGREES = GRADOS ## Convierte radianes en grados.
+EVEN = REDONDEA.PAR ## Redondea un número hasta el entero par más próximo.
+EXP = EXP ## Devuelve e elevado a la potencia de un número dado.
+FACT = FACT ## Devuelve el factorial de un número.
+FACTDOUBLE = FACT.DOBLE ## Devuelve el factorial doble de un número.
+FLOOR = MULTIPLO.INFERIOR ## Redondea un número hacia abajo, en dirección hacia cero.
+GCD = M.C.D ## Devuelve el máximo común divisor.
+INT = ENTERO ## Redondea un número hacia abajo hasta el entero más próximo.
+LCM = M.C.M ## Devuelve el mÃnimo común múltiplo.
+LN = LN ## Devuelve el logaritmo natural (neperiano) de un número.
+LOG = LOG ## Devuelve el logaritmo de un número en una base especificada.
+LOG10 = LOG10 ## Devuelve el logaritmo en base 10 de un número.
+MDETERM = MDETERM ## Devuelve la determinante matricial de una matriz.
+MINVERSE = MINVERSA ## Devuelve la matriz inversa de una matriz.
+MMULT = MMULT ## Devuelve el producto de matriz de dos matrices.
+MOD = RESIDUO ## Devuelve el resto de la división.
+MROUND = REDOND.MULT ## Devuelve un número redondeado al múltiplo deseado.
+MULTINOMIAL = MULTINOMIAL ## Devuelve el polinomio de un conjunto de números.
+ODD = REDONDEA.IMPAR ## Redondea un número hacia arriba hasta el entero impar más próximo.
+PI = PI ## Devuelve el valor de pi.
+POWER = POTENCIA ## Devuelve el resultado de elevar un número a una potencia.
+PRODUCT = PRODUCTO ## Multiplica sus argumentos.
+QUOTIENT = COCIENTE ## Devuelve la parte entera de una división.
+RADIANS = RADIANES ## Convierte grados en radianes.
+RAND = ALEATORIO ## Devuelve un número aleatorio entre 0 y 1.
+RANDBETWEEN = ALEATORIO.ENTRE ## Devuelve un número aleatorio entre los números que especifique.
+ROMAN = NUMERO.ROMANO ## Convierte un número arábigo en número romano, con formato de texto.
+ROUND = REDONDEAR ## Redondea un número al número de decimales especificado.
+ROUNDDOWN = REDONDEAR.MENOS ## Redondea un número hacia abajo, en dirección hacia cero.
+ROUNDUP = REDONDEAR.MAS ## Redondea un número hacia arriba, en dirección contraria a cero.
+SERIESSUM = SUMA.SERIES ## Devuelve la suma de una serie de potencias en función de la fórmula.
+SIGN = SIGNO ## Devuelve el signo de un número.
+SIN = SENO ## Devuelve el seno de un ángulo determinado.
+SINH = SENOH ## Devuelve el seno hiperbólico de un número.
+SQRT = RAIZ ## Devuelve la raÃz cuadrada positiva de un número.
+SQRTPI = RAIZ2PI ## Devuelve la raÃz cuadrada de un número multiplicado por PI (número * pi).
+SUBTOTAL = SUBTOTALES ## Devuelve un subtotal en una lista o base de datos.
+SUM = SUMA ## Suma sus argumentos.
+SUMIF = SUMAR.SI ## Suma las celdas especificadas que cumplen unos criterios determinados.
+SUMIFS = SUMAR.SI.CONJUNTO ## Suma las celdas de un rango que cumplen varios criterios.
+SUMPRODUCT = SUMAPRODUCTO ## Devuelve la suma de los productos de los correspondientes componentes de matriz.
+SUMSQ = SUMA.CUADRADOS ## Devuelve la suma de los cuadrados de los argumentos.
+SUMX2MY2 = SUMAX2MENOSY2 ## Devuelve la suma de la diferencia de los cuadrados de los valores correspondientes de dos matrices.
+SUMX2PY2 = SUMAX2MASY2 ## Devuelve la suma de la suma de los cuadrados de los valores correspondientes de dos matrices.
+SUMXMY2 = SUMAXMENOSY2 ## Devuelve la suma de los cuadrados de las diferencias de los valores correspondientes de dos matrices.
+TAN = TAN ## Devuelve la tangente de un número.
+TANH = TANH ## Devuelve la tangente hiperbólica de un número.
+TRUNC = TRUNCAR ## Trunca un número a un entero.
+
+
+##
+## Statistical functions Funciones estadÃsticas
+##
+AVEDEV = DESVPROM ## Devuelve el promedio de las desviaciones absolutas de la media de los puntos de datos.
+AVERAGE = PROMEDIO ## Devuelve el promedio de sus argumentos.
+AVERAGEA = PROMEDIOA ## Devuelve el promedio de sus argumentos, incluidos números, texto y valores lógicos.
+AVERAGEIF = PROMEDIO.SI ## Devuelve el promedio (media aritmética) de todas las celdas de un rango que cumplen unos criterios determinados.
+AVERAGEIFS = PROMEDIO.SI.CONJUNTO ## Devuelve el promedio (media aritmética) de todas las celdas que cumplen múltiples criterios.
+BETADIST = DISTR.BETA ## Devuelve la función de distribución beta acumulativa.
+BETAINV = DISTR.BETA.INV ## Devuelve la función inversa de la función de distribución acumulativa de una distribución beta especificada.
+BINOMDIST = DISTR.BINOM ## Devuelve la probabilidad de una variable aleatoria discreta siguiendo una distribución binomial.
+CHIDIST = DISTR.CHI ## Devuelve la probabilidad de una variable aleatoria continua siguiendo una distribución chi cuadrado de una sola cola.
+CHIINV = PRUEBA.CHI.INV ## Devuelve la función inversa de la probabilidad de una variable aleatoria continua siguiendo una distribución chi cuadrado de una sola cola.
+CHITEST = PRUEBA.CHI ## Devuelve la prueba de independencia.
+CONFIDENCE = INTERVALO.CONFIANZA ## Devuelve el intervalo de confianza de la media de una población.
+CORREL = COEF.DE.CORREL ## Devuelve el coeficiente de correlación entre dos conjuntos de datos.
+COUNT = CONTAR ## Cuenta cuántos números hay en la lista de argumentos.
+COUNTA = CONTARA ## Cuenta cuántos valores hay en la lista de argumentos.
+COUNTBLANK = CONTAR.BLANCO ## Cuenta el número de celdas en blanco de un rango.
+COUNTIF = CONTAR.SI ## Cuenta el número de celdas, dentro del rango, que cumplen el criterio especificado.
+COUNTIFS = CONTAR.SI.CONJUNTO ## Cuenta el número de celdas, dentro del rango, que cumplen varios criterios.
+COVAR = COVAR ## Devuelve la covarianza, que es el promedio de los productos de las desviaciones para cada pareja de puntos de datos.
+CRITBINOM = BINOM.CRIT ## Devuelve el menor valor cuya distribución binomial acumulativa es menor o igual a un valor de criterio.
+DEVSQ = DESVIA2 ## Devuelve la suma de los cuadrados de las desviaciones.
+EXPONDIST = DISTR.EXP ## Devuelve la distribución exponencial.
+FDIST = DISTR.F ## Devuelve la distribución de probabilidad F.
+FINV = DISTR.F.INV ## Devuelve la función inversa de la distribución de probabilidad F.
+FISHER = FISHER ## Devuelve la transformación Fisher.
+FISHERINV = PRUEBA.FISHER.INV ## Devuelve la función inversa de la transformación Fisher.
+FORECAST = PRONOSTICO ## Devuelve un valor en una tendencia lineal.
+FREQUENCY = FRECUENCIA ## Devuelve una distribución de frecuencia como una matriz vertical.
+FTEST = PRUEBA.F ## Devuelve el resultado de una prueba F.
+GAMMADIST = DISTR.GAMMA ## Devuelve la distribución gamma.
+GAMMAINV = DISTR.GAMMA.INV ## Devuelve la función inversa de la distribución gamma acumulativa.
+GAMMALN = GAMMA.LN ## Devuelve el logaritmo natural de la función gamma, G(x).
+GEOMEAN = MEDIA.GEOM ## Devuelve la media geométrica.
+GROWTH = CRECIMIENTO ## Devuelve valores en una tendencia exponencial.
+HARMEAN = MEDIA.ARMO ## Devuelve la media armónica.
+HYPGEOMDIST = DISTR.HIPERGEOM ## Devuelve la distribución hipergeométrica.
+INTERCEPT = INTERSECCION.EJE ## Devuelve la intersección de la lÃnea de regresión lineal.
+KURT = CURTOSIS ## Devuelve la curtosis de un conjunto de datos.
+LARGE = K.ESIMO.MAYOR ## Devuelve el k-ésimo mayor valor de un conjunto de datos.
+LINEST = ESTIMACION.LINEAL ## Devuelve los parámetros de una tendencia lineal.
+LOGEST = ESTIMACION.LOGARITMICA ## Devuelve los parámetros de una tendencia exponencial.
+LOGINV = DISTR.LOG.INV ## Devuelve la función inversa de la distribución logarÃtmico-normal.
+LOGNORMDIST = DISTR.LOG.NORM ## Devuelve la distribución logarÃtmico-normal acumulativa.
+MAX = MAX ## Devuelve el valor máximo de una lista de argumentos.
+MAXA = MAXA ## Devuelve el valor máximo de una lista de argumentos, incluidos números, texto y valores lógicos.
+MEDIAN = MEDIANA ## Devuelve la mediana de los números dados.
+MIN = MIN ## Devuelve el valor mÃnimo de una lista de argumentos.
+MINA = MINA ## Devuelve el valor mÃnimo de una lista de argumentos, incluidos números, texto y valores lógicos.
+MODE = MODA ## Devuelve el valor más común de un conjunto de datos.
+NEGBINOMDIST = NEGBINOMDIST ## Devuelve la distribución binomial negativa.
+NORMDIST = DISTR.NORM ## Devuelve la distribución normal acumulativa.
+NORMINV = DISTR.NORM.INV ## Devuelve la función inversa de la distribución normal acumulativa.
+NORMSDIST = DISTR.NORM.ESTAND ## Devuelve la distribución normal estándar acumulativa.
+NORMSINV = DISTR.NORM.ESTAND.INV ## Devuelve la función inversa de la distribución normal estándar acumulativa.
+PEARSON = PEARSON ## Devuelve el coeficiente de momento de correlación de producto Pearson.
+PERCENTILE = PERCENTIL ## Devuelve el k-ésimo percentil de los valores de un rango.
+PERCENTRANK = RANGO.PERCENTIL ## Devuelve el rango porcentual de un valor de un conjunto de datos.
+PERMUT = PERMUTACIONES ## Devuelve el número de permutaciones de un número determinado de objetos.
+POISSON = POISSON ## Devuelve la distribución de Poisson.
+PROB = PROBABILIDAD ## Devuelve la probabilidad de que los valores de un rango se encuentren entre dos lÃmites.
+QUARTILE = CUARTIL ## Devuelve el cuartil de un conjunto de datos.
+RANK = JERARQUIA ## Devuelve la jerarquÃa de un número en una lista de números.
+RSQ = COEFICIENTE.R2 ## Devuelve el cuadrado del coeficiente de momento de correlación de producto Pearson.
+SKEW = COEFICIENTE.ASIMETRIA ## Devuelve la asimetrÃa de una distribución.
+SLOPE = PENDIENTE ## Devuelve la pendiente de la lÃnea de regresión lineal.
+SMALL = K.ESIMO.MENOR ## Devuelve el k-ésimo menor valor de un conjunto de datos.
+STANDARDIZE = NORMALIZACION ## Devuelve un valor normalizado.
+STDEV = DESVEST ## Calcula la desviación estándar a partir de una muestra.
+STDEVA = DESVESTA ## Calcula la desviación estándar a partir de una muestra, incluidos números, texto y valores lógicos.
+STDEVP = DESVESTP ## Calcula la desviación estándar en función de toda la población.
+STDEVPA = DESVESTPA ## Calcula la desviación estándar en función de toda la población, incluidos números, texto y valores lógicos.
+STEYX = ERROR.TIPICO.XY ## Devuelve el error estándar del valor de "y" previsto para cada "x" de la regresión.
+TDIST = DISTR.T ## Devuelve la distribución de t de Student.
+TINV = DISTR.T.INV ## Devuelve la función inversa de la distribución de t de Student.
+TREND = TENDENCIA ## Devuelve valores en una tendencia lineal.
+TRIMMEAN = MEDIA.ACOTADA ## Devuelve la media del interior de un conjunto de datos.
+TTEST = PRUEBA.T ## Devuelve la probabilidad asociada a una prueba t de Student.
+VAR = VAR ## Calcula la varianza en función de una muestra.
+VARA = VARA ## Calcula la varianza en función de una muestra, incluidos números, texto y valores lógicos.
+VARP = VARP ## Calcula la varianza en función de toda la población.
+VARPA = VARPA ## Calcula la varianza en función de toda la población, incluidos números, texto y valores lógicos.
+WEIBULL = DIST.WEIBULL ## Devuelve la distribución de Weibull.
+ZTEST = PRUEBA.Z ## Devuelve el valor de una probabilidad de una cola de una prueba z.
+
+
+##
+## Text functions Funciones de texto
+##
+ASC = ASC ## Convierte las letras inglesas o katakana de ancho completo (de dos bytes) dentro de una cadena de caracteres en caracteres de ancho medio (de un byte).
+BAHTTEXT = TEXTOBAHT ## Convierte un número en texto, con el formato de moneda ß (Baht).
+CHAR = CARACTER ## Devuelve el carácter especificado por el número de código.
+CLEAN = LIMPIAR ## Quita del texto todos los caracteres no imprimibles.
+CODE = CODIGO ## Devuelve un código numérico del primer carácter de una cadena de texto.
+CONCATENATE = CONCATENAR ## Concatena varios elementos de texto en uno solo.
+DOLLAR = MONEDA ## Convierte un número en texto, con el formato de moneda $ (dólar).
+EXACT = IGUAL ## Comprueba si dos valores de texto son idénticos.
+FIND = ENCONTRAR ## Busca un valor de texto dentro de otro (distingue mayúsculas de minúsculas).
+FINDB = ENCONTRARB ## Busca un valor de texto dentro de otro (distingue mayúsculas de minúsculas).
+FIXED = DECIMAL ## Da formato a un número como texto con un número fijo de decimales.
+JIS = JIS ## Convierte las letras inglesas o katakana de ancho medio (de un byte) dentro de una cadena de caracteres en caracteres de ancho completo (de dos bytes).
+LEFT = IZQUIERDA ## Devuelve los caracteres del lado izquierdo de un valor de texto.
+LEFTB = IZQUIERDAB ## Devuelve los caracteres del lado izquierdo de un valor de texto.
+LEN = LARGO ## Devuelve el número de caracteres de una cadena de texto.
+LENB = LARGOB ## Devuelve el número de caracteres de una cadena de texto.
+LOWER = MINUSC ## Pone el texto en minúsculas.
+MID = EXTRAE ## Devuelve un número especÃfico de caracteres de una cadena de texto que comienza en la posición que se especifique.
+MIDB = EXTRAEB ## Devuelve un número especÃfico de caracteres de una cadena de texto que comienza en la posición que se especifique.
+PHONETIC = FONETICO ## Extrae los caracteres fonéticos (furigana) de una cadena de texto.
+PROPER = NOMPROPIO ## Pone en mayúscula la primera letra de cada palabra de un valor de texto.
+REPLACE = REEMPLAZAR ## Reemplaza caracteres de texto.
+REPLACEB = REEMPLAZARB ## Reemplaza caracteres de texto.
+REPT = REPETIR ## Repite el texto un número determinado de veces.
+RIGHT = DERECHA ## Devuelve los caracteres del lado derecho de un valor de texto.
+RIGHTB = DERECHAB ## Devuelve los caracteres del lado derecho de un valor de texto.
+SEARCH = HALLAR ## Busca un valor de texto dentro de otro (no distingue mayúsculas de minúsculas).
+SEARCHB = HALLARB ## Busca un valor de texto dentro de otro (no distingue mayúsculas de minúsculas).
+SUBSTITUTE = SUSTITUIR ## Sustituye texto nuevo por texto antiguo en una cadena de texto.
+T = T ## Convierte sus argumentos a texto.
+TEXT = TEXTO ## Da formato a un número y lo convierte en texto.
+TRIM = ESPACIOS ## Quita los espacios del texto.
+UPPER = MAYUSC ## Pone el texto en mayúsculas.
+VALUE = VALOR ## Convierte un argumento de texto en un número.
diff --git a/Classes/PHPExcel/locale/fi/config b/Classes/PHPExcel/locale/fi/config
new file mode 100644
index 0000000..498cf4c
--- /dev/null
+++ b/Classes/PHPExcel/locale/fi/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = $ # Symbol not known, should it be a € (Euro)?
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #TYHJÄ!
+DIV0 = #JAKO/0!
+VALUE = #ARVO!
+REF = #VIITTAUS!
+NAME = #NIMI?
+NUM = #LUKU!
+NA = #PUUTTUU
diff --git a/Classes/PHPExcel/locale/fi/functions b/Classes/PHPExcel/locale/fi/functions
new file mode 100644
index 0000000..6a7c2b3
--- /dev/null
+++ b/Classes/PHPExcel/locale/fi/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Apuohjelma- ja automaatiofunktiot
+##
+GETPIVOTDATA = NOUDA.PIVOT.TIEDOT ## Palauttaa pivot-taulukkoraporttiin tallennettuja tietoja.
+
+
+##
+## Cube functions Kuutiofunktiot
+##
+CUBEKPIMEMBER = KUUTIOKPIJÄSEN ## Palauttaa suorituskykyilmaisimen (KPI) nimen, ominaisuuden sekä mitan ja näyttää nimen sekä ominaisuuden solussa. KPI on mitattavissa oleva suure, kuten kuukauden bruttotuotto tai vuosineljänneksen työntekijäkohtainen liikevaihto, joiden avulla tarkkaillaan organisaation suorituskykyä.
+CUBEMEMBER = KUUTIONJÄSEN ## Palauttaa kuutiohierarkian jäsenen tai monikon. Tällä funktiolla voit tarkistaa, että jäsen tai monikko on olemassa kuutiossa.
+CUBEMEMBERPROPERTY = KUUTIONJÄSENENOMINAISUUS ## Palauttaa kuution jäsenominaisuuden arvon. Tällä funktiolla voit tarkistaa, että nimi on olemassa kuutiossa, ja palauttaa tämän jäsenen määritetyn ominaisuuden.
+CUBERANKEDMEMBER = KUUTIONLUOKITELTUJÄSEN ## Palauttaa joukon n:nnen jäsenen. Tällä funktiolla voit palauttaa joukosta elementtejä, kuten parhaan myyjän tai 10 parasta opiskelijaa.
+CUBESET = KUUTIOJOUKKO ## Määrittää lasketun jäsen- tai monikkojoukon lähettämällä joukon lausekkeita palvelimessa olevalle kuutiolle. Palvelin luo joukon ja palauttaa sen Microsoft Office Excelille.
+CUBESETCOUNT = KUUTIOJOUKKOJENMÄÄRÄ ## Palauttaa joukon kohteiden määrän.
+CUBEVALUE = KUUTIONARVO ## Palauttaa koostetun arvon kuutiosta.
+
+
+##
+## Database functions Tietokantafunktiot
+##
+DAVERAGE = TKESKIARVO ## Palauttaa valittujen tietokantamerkintöjen keskiarvon.
+DCOUNT = TLASKE ## Laskee tietokannan lukuja sisältävien solujen määrän.
+DCOUNTA = TLASKEA ## Laskee tietokannan tietoja sisältävien solujen määrän.
+DGET = TNOUDA ## Hakee määritettyjä ehtoja vastaavan tietueen tietokannasta.
+DMAX = TMAKS ## Palauttaa suurimman arvon tietokannasta valittujen arvojen joukosta.
+DMIN = TMIN ## Palauttaa pienimmän arvon tietokannasta valittujen arvojen joukosta.
+DPRODUCT = TTULO ## Kertoo määritetyn ehdon täyttävien tietokannan tietueiden tietyssä kentässä olevat arvot.
+DSTDEV = TKESKIHAJONTA ## Laskee keskihajonnan tietokannasta valituista arvoista muodostuvan otoksen perusteella.
+DSTDEVP = TKESKIHAJONTAP ## Laskee keskihajonnan tietokannasta valittujen arvojen koko populaation perusteella.
+DSUM = TSUMMA ## Lisää luvut määritetyn ehdon täyttävien tietokannan tietueiden kenttäsarakkeeseen.
+DVAR = TVARIANSSI ## Laskee varianssin tietokannasta valittujen arvojen otoksen perusteella.
+DVARP = TVARIANSSIP ## Laskee varianssin tietokannasta valittujen arvojen koko populaation perusteella.
+
+
+##
+## Date and time functions Päivämäärä- ja aikafunktiot
+##
+DATE = PÄIVÄYS ## Palauttaa annetun päivämäärän järjestysluvun.
+DATEVALUE = PÄIVÄYSARVO ## Muuntaa tekstimuodossa olevan päivämäärän järjestysluvuksi.
+DAY = PÄIVÄ ## Muuntaa järjestysluvun kuukauden päiväksi.
+DAYS360 = PÄIVÄT360 ## Laskee kahden päivämäärän välisten päivien määrän käyttäen perustana 360-päiväistä vuotta.
+EDATE = PÄIVÄ.KUUKAUSI ## Palauttaa järjestyslukuna päivämäärän, joka poikkeaa aloituspäivän päivämäärästä annetun kuukausimäärän verran joko eteen- tai taaksepäin.
+EOMONTH = KUUKAUSI.LOPPU ## Palauttaa järjestyslukuna sen kuukauden viimeisen päivämäärän, joka poikkeaa annetun kuukausimäärän verran eteen- tai taaksepäin.
+HOUR = TUNNIT ## Muuntaa järjestysluvun tunneiksi.
+MINUTE = MINUUTIT ## Muuntaa järjestysluvun minuuteiksi.
+MONTH = KUUKAUSI ## Muuntaa järjestysluvun kuukausiksi.
+NETWORKDAYS = TYÖPÄIVÄT ## Palauttaa kahden päivämäärän välissä olevien täysien työpäivien määrän.
+NOW = NYT ## Palauttaa kuluvan päivämäärän ja ajan järjestysnumeron.
+SECOND = SEKUNNIT ## Muuntaa järjestysluvun sekunneiksi.
+TIME = AIKA ## Palauttaa annetun kellonajan järjestysluvun.
+TIMEVALUE = AIKA_ARVO ## Muuntaa tekstimuodossa olevan kellonajan järjestysluvuksi.
+TODAY = TÄMÄ.PÄIVÄ ## Palauttaa kuluvan päivän päivämäärän järjestysluvun.
+WEEKDAY = VIIKONPÄIVÄ ## Muuntaa järjestysluvun viikonpäiväksi.
+WEEKNUM = VIIKKO.NRO ## Muuntaa järjestysluvun luvuksi, joka ilmaisee viikon järjestysluvun vuoden alusta laskettuna.
+WORKDAY = TYÖPÄIVÄ ## Palauttaa järjestysluvun päivämäärälle, joka sijaitsee annettujen työpäivien verran eteen tai taaksepäin.
+YEAR = VUOSI ## Muuntaa järjestysluvun vuosiksi.
+YEARFRAC = VUOSI.OSA ## Palauttaa määritettyjen päivämäärien (aloituspäivä ja lopetuspäivä) välisen osan vuodesta.
+
+
+##
+## Engineering functions Tekniset funktiot
+##
+BESSELI = BESSELI ## Palauttaa muunnetun Bessel-funktion In(x).
+BESSELJ = BESSELJ ## Palauttaa Bessel-funktion Jn(x).
+BESSELK = BESSELK ## Palauttaa muunnetun Bessel-funktion Kn(x).
+BESSELY = BESSELY ## Palauttaa Bessel-funktion Yn(x).
+BIN2DEC = BINDES ## Muuntaa binaariluvun desimaaliluvuksi.
+BIN2HEX = BINHEKSA ## Muuntaa binaariluvun heksadesimaaliluvuksi.
+BIN2OCT = BINOKT ## Muuntaa binaariluvun oktaaliluvuksi.
+COMPLEX = KOMPLEKSI ## Muuntaa reaali- ja imaginaariosien kertoimet kompleksiluvuksi.
+CONVERT = MUUNNA ## Muuntaa luvun toisen mittajärjestelmän mukaiseksi.
+DEC2BIN = DESBIN ## Muuntaa desimaaliluvun binaariluvuksi.
+DEC2HEX = DESHEKSA ## Muuntaa kymmenjärjestelmän luvun heksadesimaaliluvuksi.
+DEC2OCT = DESOKT ## Muuntaa kymmenjärjestelmän luvun oktaaliluvuksi.
+DELTA = SAMA.ARVO ## Tarkistaa, ovatko kaksi arvoa yhtä suuria.
+ERF = VIRHEFUNKTIO ## Palauttaa virhefunktion.
+ERFC = VIRHEFUNKTIO.KOMPLEMENTTI ## Palauttaa komplementtivirhefunktion.
+GESTEP = RAJA ## Testaa, onko luku suurempi kuin kynnysarvo.
+HEX2BIN = HEKSABIN ## Muuntaa heksadesimaaliluvun binaariluvuksi.
+HEX2DEC = HEKSADES ## Muuntaa heksadesimaaliluvun desimaaliluvuksi.
+HEX2OCT = HEKSAOKT ## Muuntaa heksadesimaaliluvun oktaaliluvuksi.
+IMABS = KOMPLEKSI.ITSEISARVO ## Palauttaa kompleksiluvun itseisarvon (moduluksen).
+IMAGINARY = KOMPLEKSI.IMAG ## Palauttaa kompleksiluvun imaginaariosan kertoimen.
+IMARGUMENT = KOMPLEKSI.ARG ## Palauttaa theeta-argumentin, joka on radiaaneina annettu kulma.
+IMCONJUGATE = KOMPLEKSI.KONJ ## Palauttaa kompleksiluvun konjugaattiluvun.
+IMCOS = KOMPLEKSI.COS ## Palauttaa kompleksiluvun kosinin.
+IMDIV = KOMPLEKSI.OSAM ## Palauttaa kahden kompleksiluvun osamäärän.
+IMEXP = KOMPLEKSI.EKSP ## Palauttaa kompleksiluvun eksponentin.
+IMLN = KOMPLEKSI.LN ## Palauttaa kompleksiluvun luonnollisen logaritmin.
+IMLOG10 = KOMPLEKSI.LOG10 ## Palauttaa kompleksiluvun kymmenkantaisen logaritmin.
+IMLOG2 = KOMPLEKSI.LOG2 ## Palauttaa kompleksiluvun kaksikantaisen logaritmin.
+IMPOWER = KOMPLEKSI.POT ## Palauttaa kokonaislukupotenssiin korotetun kompleksiluvun.
+IMPRODUCT = KOMPLEKSI.TULO ## Palauttaa kompleksilukujen tulon.
+IMREAL = KOMPLEKSI.REAALI ## Palauttaa kompleksiluvun reaaliosan kertoimen.
+IMSIN = KOMPLEKSI.SIN ## Palauttaa kompleksiluvun sinin.
+IMSQRT = KOMPLEKSI.NELIÖJ ## Palauttaa kompleksiluvun neliöjuuren.
+IMSUB = KOMPLEKSI.EROTUS ## Palauttaa kahden kompleksiluvun erotuksen.
+IMSUM = KOMPLEKSI.SUM ## Palauttaa kompleksilukujen summan.
+OCT2BIN = OKTBIN ## Muuntaa oktaaliluvun binaariluvuksi.
+OCT2DEC = OKTDES ## Muuntaa oktaaliluvun desimaaliluvuksi.
+OCT2HEX = OKTHEKSA ## Muuntaa oktaaliluvun heksadesimaaliluvuksi.
+
+
+##
+## Financial functions Rahoitusfunktiot
+##
+ACCRINT = KERTYNYT.KORKO ## Laskee arvopaperille kertyneen koron, kun korko kertyy säännöllisin väliajoin.
+ACCRINTM = KERTYNYT.KORKO.LOPUSSA ## Laskee arvopaperille kertyneen koron, kun korko maksetaan eräpäivänä.
+AMORDEGRC = AMORDEGRC ## Laskee kunkin laskentakauden poiston poistokerrointa käyttämällä.
+AMORLINC = AMORLINC ## Palauttaa kunkin laskentakauden poiston.
+COUPDAYBS = KORKOPÄIVÄT.ALUSTA ## Palauttaa koronmaksukauden aloituspäivän ja tilityspäivän välisen ajanjakson päivien määrän.
+COUPDAYS = KORKOPÄIVÄT ## Palauttaa päivien määrän koronmaksukaudelta, johon tilityspäivä kuuluu.
+COUPDAYSNC = KORKOPÄIVÄT.SEURAAVA ## Palauttaa tilityspäivän ja seuraavan koronmaksupäivän välisen ajanjakson päivien määrän.
+COUPNCD = KORKOMAKSU.SEURAAVA ## Palauttaa tilityspäivän jälkeisen seuraavan koronmaksupäivän.
+COUPNUM = KORKOPÄIVÄJAKSOT ## Palauttaa arvopaperin ostopäivän ja erääntymispäivän välisten koronmaksupäivien määrän.
+COUPPCD = KORKOPÄIVÄ.EDELLINEN ## Palauttaa tilityspäivää edeltävän koronmaksupäivän.
+CUMIPMT = MAKSETTU.KORKO ## Palauttaa kahden jakson välisenä aikana kertyneen koron.
+CUMPRINC = MAKSETTU.LYHENNYS ## Palauttaa lainalle kahden jakson välisenä aikana kertyneen lyhennyksen.
+DB = DB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan.
+DDB = DDB ## Palauttaa kauden kirjanpidollisen poiston amerikkalaisen DDB-menetelmän (Double-Declining Balance) tai jonkin muun määrittämäsi menetelmän mukaan.
+DISC = DISKONTTOKORKO ## Palauttaa arvopaperin diskonttokoron.
+DOLLARDE = VALUUTTA.DES ## Muuntaa murtolukuna ilmoitetun valuuttamäärän desimaaliluvuksi.
+DOLLARFR = VALUUTTA.MURTO ## Muuntaa desimaalilukuna ilmaistun valuuttamäärän murtoluvuksi.
+DURATION = KESTO ## Palauttaa keston arvopaperille, jonka koronmaksu tapahtuu säännöllisesti.
+EFFECT = KORKO.EFEKT ## Palauttaa todellisen vuosikoron.
+FV = TULEVA.ARVO ## Palauttaa sijoituksen tulevan arvon.
+FVSCHEDULE = TULEVA.ARVO.ERIKORKO ## Palauttaa pääoman tulevan arvon, kun pääomalle on kertynyt korkoa vaihtelevasti.
+INTRATE = KORKO.ARVOPAPERI ## Palauttaa arvopaperin korkokannan täysin sijoitetulle arvopaperille.
+IPMT = IPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona kertyvän koron.
+IRR = SISÄINEN.KORKO ## Laskee sisäisen korkokannan kassavirrasta muodostuvalle sarjalle.
+ISPMT = ONMAKSU ## Laskee sijoituksen maksetun koron tietyllä jaksolla.
+MDURATION = KESTO.MUUNN ## Palauttaa muunnetun Macauley-keston arvopaperille, jonka oletettu nimellisarvo on 100 euroa.
+MIRR = MSISÄINEN ## Palauttaa sisäisen korkokannan, kun positiivisten ja negatiivisten kassavirtojen rahoituskorko on erilainen.
+NOMINAL = KORKO.VUOSI ## Palauttaa vuosittaisen nimelliskoron.
+NPER = NJAKSO ## Palauttaa sijoituksen jaksojen määrän.
+NPV = NNA ## Palauttaa sijoituksen nykyarvon toistuvista kassavirroista muodostuvan sarjan ja diskonttokoron perusteella.
+ODDFPRICE = PARITON.ENS.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa ensimmäinen jakso on pariton.
+ODDFYIELD = PARITON.ENS.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa ensimmäinen jakso on pariton.
+ODDLPRICE = PARITON.VIIM.NIMELLISARVO ## Palauttaa arvopaperin hinnan tilanteessa, jossa viimeinen jakso on pariton.
+ODDLYIELD = PARITON.VIIM.TUOTTO ## Palauttaa arvopaperin tuoton tilanteessa, jossa viimeinen jakso on pariton.
+PMT = MAKSU ## Palauttaa annuiteetin kausittaisen maksuerän.
+PPMT = PPMT ## Laskee sijoitukselle tai lainalle tiettynä ajanjaksona maksettavan lyhennyksen.
+PRICE = HINTA ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan säännöllisin väliajoin.
+PRICEDISC = HINTA.DISK ## Palauttaa diskontatun arvopaperin hinnan 100 euron nimellisarvoa kohden.
+PRICEMAT = HINTA.LUNASTUS ## Palauttaa hinnan 100 euron nimellisarvoa kohden arvopaperille, jonka korko maksetaan erääntymispäivänä.
+PV = NA ## Palauttaa sijoituksen nykyarvon.
+RATE = KORKO ## Palauttaa annuiteetin kausittaisen korkokannan.
+RECEIVED = SAATU.HINTA ## Palauttaa arvopaperin tuoton erääntymispäivänä kokonaan maksetulle sijoitukselle.
+SLN = STP ## Palauttaa sijoituksen tasapoiston yhdeltä jaksolta.
+SYD = VUOSIPOISTO ## Palauttaa sijoituksen vuosipoiston annettuna kautena amerikkalaisen SYD-menetelmän (Sum-of-Year's Digits) avulla.
+TBILLEQ = OBLIG.TUOTTOPROS ## Palauttaa valtion obligaation tuoton vastaavana joukkovelkakirjan tuottona.
+TBILLPRICE = OBLIG.HINTA ## Palauttaa obligaation hinnan 100 euron nimellisarvoa kohden.
+TBILLYIELD = OBLIG.TUOTTO ## Palauttaa obligaation tuoton.
+VDB = VDB ## Palauttaa annetun kauden tai kauden osan kirjanpidollisen poiston amerikkalaisen DB-menetelmän (Fixed-declining balance) mukaan.
+XIRR = SISÄINEN.KORKO.JAKSOTON ## Palauttaa sisäisen korkokannan kassavirtojen sarjoille, jotka eivät välttämättä ole säännöllisiä.
+XNPV = NNA.JAKSOTON ## Palauttaa nettonykyarvon kassavirtasarjalle, joka ei välttämättä ole kausittainen.
+YIELD = TUOTTO ## Palauttaa tuoton arvopaperille, jonka korko maksetaan säännöllisin väliajoin.
+YIELDDISC = TUOTTO.DISK ## Palauttaa diskontatun arvopaperin, kuten obligaation, vuosittaisen tuoton.
+YIELDMAT = TUOTTO.ERÄP ## Palauttaa erääntymispäivänään korkoa tuottavan arvopaperin vuosittaisen tuoton.
+
+
+##
+## Information functions Erikoisfunktiot
+##
+CELL = SOLU ## Palauttaa tietoja solun muotoilusta, sijainnista ja sisällöstä.
+ERROR.TYPE = VIRHEEN.LAJI ## Palauttaa virhetyyppiä vastaavan luvun.
+INFO = KUVAUS ## Palauttaa tietoja nykyisestä käyttöympäristöstä.
+ISBLANK = ONTYHJÄ ## Palauttaa arvon TOSI, jos arvo on tyhjä.
+ISERR = ONVIRH ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo paitsi arvo #PUUTTUU!.
+ISERROR = ONVIRHE ## Palauttaa arvon TOSI, jos arvo on mikä tahansa virhearvo.
+ISEVEN = ONPARILLINEN ## Palauttaa arvon TOSI, jos arvo on parillinen.
+ISLOGICAL = ONTOTUUS ## Palauttaa arvon TOSI, jos arvo on mikä tahansa looginen arvo.
+ISNA = ONPUUTTUU ## Palauttaa arvon TOSI, jos virhearvo on #PUUTTUU!.
+ISNONTEXT = ONEI_TEKSTI ## Palauttaa arvon TOSI, jos arvo ei ole teksti.
+ISNUMBER = ONLUKU ## Palauttaa arvon TOSI, jos arvo on luku.
+ISODD = ONPARITON ## Palauttaa arvon TOSI, jos arvo on pariton.
+ISREF = ONVIITT ## Palauttaa arvon TOSI, jos arvo on viittaus.
+ISTEXT = ONTEKSTI ## Palauttaa arvon TOSI, jos arvo on teksti.
+N = N ## Palauttaa arvon luvuksi muunnettuna.
+NA = PUUTTUU ## Palauttaa virhearvon #PUUTTUU!.
+TYPE = TYYPPI ## Palauttaa luvun, joka ilmaisee arvon tietotyypin.
+
+
+##
+## Logical functions Loogiset funktiot
+##
+AND = JA ## Palauttaa arvon TOSI, jos kaikkien argumenttien arvo on TOSI.
+FALSE = EPÄTOSI ## Palauttaa totuusarvon EPÄTOSI.
+IF = JOS ## Määrittää suoritettavan loogisen testin.
+IFERROR = JOSVIRHE ## Palauttaa määrittämäsi arvon, jos kaavan tulos on virhe; muussa tapauksessa palauttaa kaavan tuloksen.
+NOT = EI ## Kääntää argumentin loogisen arvon.
+OR = TAI ## Palauttaa arvon TOSI, jos minkä tahansa argumentin arvo on TOSI.
+TRUE = TOSI ## Palauttaa totuusarvon TOSI.
+
+
+##
+## Lookup and reference functions Haku- ja viitefunktiot
+##
+ADDRESS = OSOITE ## Palauttaa laskentataulukon soluun osoittavan viittauksen tekstinä.
+AREAS = ALUEET ## Palauttaa viittauksessa olevien alueiden määrän.
+CHOOSE = VALITSE.INDEKSI ## Valitsee arvon arvoluettelosta.
+COLUMN = SARAKE ## Palauttaa viittauksen sarakenumeron.
+COLUMNS = SARAKKEET ## Palauttaa viittauksessa olevien sarakkeiden määrän.
+HLOOKUP = VHAKU ## Suorittaa haun matriisin ylimmältä riviltä ja palauttaa määritetyn solun arvon.
+HYPERLINK = HYPERLINKKI ## Luo pikakuvakkeen tai tekstin, joka avaa verkkopalvelimeen, intranetiin tai Internetiin tallennetun tiedoston.
+INDEX = INDEKSI ## Valitsee arvon viittauksesta tai matriisista indeksin mukaan.
+INDIRECT = EPÄSUORA ## Palauttaa tekstiarvona ilmaistun viittauksen.
+LOOKUP = HAKU ## Etsii arvoja vektorista tai matriisista.
+MATCH = VASTINE ## Etsii arvoja viittauksesta tai matriisista.
+OFFSET = SIIRTYMÄ ## Palauttaa annetun viittauksen siirtymän.
+ROW = RIVI ## Palauttaa viittauksen rivinumeron.
+ROWS = RIVIT ## Palauttaa viittauksessa olevien rivien määrän.
+RTD = RTD ## Noutaa COM-automaatiota (automaatio: Tapa käsitellä sovelluksen objekteja toisesta sovelluksesta tai kehitystyökalusta. Automaatio, jota aiemmin kutsuttiin OLE-automaatioksi, on teollisuusstandardi ja COM-mallin (Component Object Model) ominaisuus.) tukevasta ohjelmasta reaaliaikaisia tietoja.
+TRANSPOSE = TRANSPONOI ## Palauttaa matriisin käänteismatriisin.
+VLOOKUP = PHAKU ## Suorittaa haun matriisin ensimmäisestä sarakkeesta ja palauttaa rivillä olevan solun arvon.
+
+
+##
+## Math and trigonometry functions Matemaattiset ja trigonometriset funktiot
+##
+ABS = ITSEISARVO ## Palauttaa luvun itseisarvon.
+ACOS = ACOS ## Palauttaa luvun arkuskosinin.
+ACOSH = ACOSH ## Palauttaa luvun käänteisen hyperbolisen kosinin.
+ASIN = ASIN ## Palauttaa luvun arkussinin.
+ASINH = ASINH ## Palauttaa luvun käänteisen hyperbolisen sinin.
+ATAN = ATAN ## Palauttaa luvun arkustangentin.
+ATAN2 = ATAN2 ## Palauttaa arkustangentin x- ja y-koordinaatin perusteella.
+ATANH = ATANH ## Palauttaa luvun käänteisen hyperbolisen tangentin.
+CEILING = PYÖRISTÄ.KERR.YLÖS ## Pyöristää luvun lähimpään kokonaislukuun tai tarkkuusargumentin lähimpään kerrannaiseen.
+COMBIN = KOMBINAATIO ## Palauttaa mahdollisten kombinaatioiden määrän annetulle objektien määrälle.
+COS = COS ## Palauttaa luvun kosinin.
+COSH = COSH ## Palauttaa luvun hyperbolisen kosinin.
+DEGREES = ASTEET ## Muuntaa radiaanit asteiksi.
+EVEN = PARILLINEN ## Pyöristää luvun ylöspäin lähimpään parilliseen kokonaislukuun.
+EXP = EKSPONENTTI ## Palauttaa e:n korotettuna annetun luvun osoittamaan potenssiin.
+FACT = KERTOMA ## Palauttaa luvun kertoman.
+FACTDOUBLE = KERTOMA.OSA ## Palauttaa luvun osakertoman.
+FLOOR = PYÖRISTÄ.KERR.ALAS ## Pyöristää luvun alaspäin (nollaa kohti).
+GCD = SUURIN.YHT.TEKIJÄ ## Palauttaa suurimman yhteisen tekijän.
+INT = KOKONAISLUKU ## Pyöristää luvun alaspäin lähimpään kokonaislukuun.
+LCM = PIENIN.YHT.JAETTAVA ## Palauttaa pienimmän yhteisen tekijän.
+LN = LUONNLOG ## Palauttaa luvun luonnollisen logaritmin.
+LOG = LOG ## Laskee luvun logaritmin käyttämällä annettua kantalukua.
+LOG10 = LOG10 ## Palauttaa luvun kymmenkantaisen logaritmin.
+MDETERM = MDETERM ## Palauttaa matriisin matriisideterminantin.
+MINVERSE = MKÄÄNTEINEN ## Palauttaa matriisin käänteismatriisin.
+MMULT = MKERRO ## Palauttaa kahden matriisin tulon.
+MOD = JAKOJ ## Palauttaa jakolaskun jäännöksen.
+MROUND = PYÖRISTÄ.KERR ## Palauttaa luvun pyöristettynä annetun luvun kerrannaiseen.
+MULTINOMIAL = MULTINOMI ## Palauttaa lukujoukon multinomin.
+ODD = PARITON ## Pyöristää luvun ylöspäin lähimpään parittomaan kokonaislukuun.
+PI = PII ## Palauttaa piin arvon.
+POWER = POTENSSI ## Palauttaa luvun korotettuna haluttuun potenssiin.
+PRODUCT = TULO ## Kertoo annetut argumentit.
+QUOTIENT = OSAMÄÄRÄ ## Palauttaa osamäärän kokonaislukuosan.
+RADIANS = RADIAANIT ## Muuntaa asteet radiaaneiksi.
+RAND = SATUNNAISLUKU ## Palauttaa satunnaisluvun väliltä 0–1.
+RANDBETWEEN = SATUNNAISLUKU.VÄLILTÄ ## Palauttaa satunnaisluvun määritettyjen lukujen väliltä.
+ROMAN = ROMAN ## Muuntaa arabialaisen numeron tekstimuotoiseksi roomalaiseksi numeroksi.
+ROUND = PYÖRISTÄ ## Pyöristää luvun annettuun määrään desimaaleja.
+ROUNDDOWN = PYÖRISTÄ.DES.ALAS ## Pyöristää luvun alaspäin (nollaa kohti).
+ROUNDUP = PYÖRISTÄ.DES.YLÖS ## Pyöristää luvun ylöspäin (poispäin nollasta).
+SERIESSUM = SARJA.SUMMA ## Palauttaa kaavaan perustuvan potenssisarjan arvon.
+SIGN = ETUMERKKI ## Palauttaa luvun etumerkin.
+SIN = SIN ## Palauttaa annetun kulman sinin.
+SINH = SINH ## Palauttaa luvun hyperbolisen sinin.
+SQRT = NELIÖJUURI ## Palauttaa positiivisen neliöjuuren.
+SQRTPI = NELIÖJUURI.PII ## Palauttaa tulon (luku * pii) neliöjuuren.
+SUBTOTAL = VÄLISUMMA ## Palauttaa luettelon tai tietokannan välisumman.
+SUM = SUMMA ## Laskee yhteen annetut argumentit.
+SUMIF = SUMMA.JOS ## Laskee ehdot täyttävien solujen summan.
+SUMIFS = SUMMA.JOS.JOUKKO ## Laskee yhteen solualueen useita ehtoja vastaavat solut.
+SUMPRODUCT = TULOJEN.SUMMA ## Palauttaa matriisin toisiaan vastaavien osien tulojen summan.
+SUMSQ = NELIÖSUMMA ## Palauttaa argumenttien neliöiden summan.
+SUMX2MY2 = NELIÖSUMMIEN.EROTUS ## Palauttaa kahden matriisin toisiaan vastaavien arvojen laskettujen neliösummien erotuksen.
+SUMX2PY2 = NELIÖSUMMIEN.SUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen neliösummien summan.
+SUMXMY2 = EROTUSTEN.NELIÖSUMMA ## Palauttaa kahden matriisin toisiaan vastaavien arvojen erotusten neliösumman.
+TAN = TAN ## Palauttaa luvun tangentin.
+TANH = TANH ## Palauttaa luvun hyperbolisen tangentin.
+TRUNC = KATKAISE ## Katkaisee luvun kokonaisluvuksi.
+
+
+##
+## Statistical functions Tilastolliset funktiot
+##
+AVEDEV = KESKIPOIKKEAMA ## Palauttaa hajontojen itseisarvojen keskiarvon.
+AVERAGE = KESKIARVO ## Palauttaa argumenttien keskiarvon.
+AVERAGEA = KESKIARVOA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, keskiarvon.
+AVERAGEIF = KESKIARVO.JOS ## Palauttaa alueen niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka täyttävät annetut ehdot.
+AVERAGEIFS = KESKIARVO.JOS.JOUKKO ## Palauttaa niiden solujen keskiarvon (aritmeettisen keskiarvon), jotka vastaavat useita ehtoja.
+BETADIST = BEETAJAKAUMA ## Palauttaa kumulatiivisen beetajakaumafunktion arvon.
+BETAINV = BEETAJAKAUMA.KÄÄNT ## Palauttaa määritetyn beetajakauman käänteisen kumulatiivisen jakaumafunktion arvon.
+BINOMDIST = BINOMIJAKAUMA ## Palauttaa yksittäisen termin binomijakaumatodennäköisyyden.
+CHIDIST = CHIJAKAUMA ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden.
+CHIINV = CHIJAKAUMA.KÄÄNT ## Palauttaa yksisuuntaisen chi-neliön jakauman todennäköisyyden käänteisarvon.
+CHITEST = CHITESTI ## Palauttaa riippumattomuustestin tuloksen.
+CONFIDENCE = LUOTTAMUSVÄLI ## Palauttaa luottamusvälin populaation keskiarvolle.
+CORREL = KORRELAATIO ## Palauttaa kahden arvojoukon korrelaatiokertoimen.
+COUNT = LASKE ## Laskee argumenttiluettelossa olevien lukujen määrän.
+COUNTA = LASKE.A ## Laskee argumenttiluettelossa olevien arvojen määrän.
+COUNTBLANK = LASKE.TYHJÄT ## Laskee alueella olevien tyhjien solujen määrän.
+COUNTIF = LASKE.JOS ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa annettuja ehtoja.
+COUNTIFS = LASKE.JOS.JOUKKO ## Laskee alueella olevien sellaisten solujen määrän, joiden sisältö vastaa useita ehtoja.
+COVAR = KOVARIANSSI ## Palauttaa kovarianssin, joka on keskiarvo havaintoaineiston kunkin pisteparin poikkeamien tuloista.
+CRITBINOM = BINOMIJAKAUMA.KRIT ## Palauttaa pienimmän arvon, jossa binomijakauman kertymäfunktion arvo on pienempi tai yhtä suuri kuin vertailuarvo.
+DEVSQ = OIKAISTU.NELIÖSUMMA ## Palauttaa keskipoikkeamien neliösumman.
+EXPONDIST = EKSPONENTIAALIJAKAUMA ## Palauttaa eksponentiaalijakauman.
+FDIST = FJAKAUMA ## Palauttaa F-todennäköisyysjakauman.
+FINV = FJAKAUMA.KÄÄNT ## Palauttaa F-todennäköisyysjakauman käänteisfunktion.
+FISHER = FISHER ## Palauttaa Fisher-muunnoksen.
+FISHERINV = FISHER.KÄÄNT ## Palauttaa käänteisen Fisher-muunnoksen.
+FORECAST = ENNUSTE ## Palauttaa lineaarisen trendin arvon.
+FREQUENCY = TAAJUUS ## Palauttaa frekvenssijakautuman pystysuuntaisena matriisina.
+FTEST = FTESTI ## Palauttaa F-testin tuloksen.
+GAMMADIST = GAMMAJAKAUMA ## Palauttaa gammajakauman.
+GAMMAINV = GAMMAJAKAUMA.KÄÄNT ## Palauttaa käänteisen gammajakauman kertymäfunktion.
+GAMMALN = GAMMALN ## Palauttaa gammafunktion luonnollisen logaritmin G(x).
+GEOMEAN = KESKIARVO.GEOM ## Palauttaa geometrisen keskiarvon.
+GROWTH = KASVU ## Palauttaa eksponentiaalisen trendin arvon.
+HARMEAN = KESKIARVO.HARM ## Palauttaa harmonisen keskiarvon.
+HYPGEOMDIST = HYPERGEOM.JAKAUMA ## Palauttaa hypergeometrisen jakauman.
+INTERCEPT = LEIKKAUSPISTE ## Palauttaa lineaarisen regressiosuoran leikkauspisteen.
+KURT = KURT ## Palauttaa tietoalueen vinous-arvon eli huipukkuuden.
+LARGE = SUURI ## Palauttaa tietojoukon k:nneksi suurimman arvon.
+LINEST = LINREGR ## Palauttaa lineaarisen trendin parametrit.
+LOGEST = LOGREGR ## Palauttaa eksponentiaalisen trendin parametrit.
+LOGINV = LOGNORM.JAKAUMA.KÄÄNT ## Palauttaa lognormeeratun jakauman käänteisfunktion.
+LOGNORMDIST = LOGNORM.JAKAUMA ## Palauttaa lognormaalisen jakauman kertymäfunktion.
+MAX = MAKS ## Palauttaa suurimman arvon argumenttiluettelosta.
+MAXA = MAKSA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, suurimman arvon.
+MEDIAN = MEDIAANI ## Palauttaa annettujen lukujen mediaanin.
+MIN = MIN ## Palauttaa pienimmän arvon argumenttiluettelosta.
+MINA = MINA ## Palauttaa argumenttien, mukaan lukien lukujen, tekstin ja loogisten arvojen, pienimmän arvon.
+MODE = MOODI ## Palauttaa tietojoukossa useimmin esiintyvän arvon.
+NEGBINOMDIST = BINOMIJAKAUMA.NEG ## Palauttaa negatiivisen binomijakauman.
+NORMDIST = NORM.JAKAUMA ## Palauttaa normaalijakauman kertymäfunktion.
+NORMINV = NORM.JAKAUMA.KÄÄNT ## Palauttaa käänteisen normaalijakauman kertymäfunktion.
+NORMSDIST = NORM.JAKAUMA.NORMIT ## Palauttaa normitetun normaalijakauman kertymäfunktion.
+NORMSINV = NORM.JAKAUMA.NORMIT.KÄÄNT ## Palauttaa normitetun normaalijakauman kertymäfunktion käänteisarvon.
+PEARSON = PEARSON ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen.
+PERCENTILE = PROSENTTIPISTE ## Palauttaa alueen arvojen k:nnen prosenttipisteen.
+PERCENTRANK = PROSENTTIJÄRJESTYS ## Palauttaa tietojoukon arvon prosentuaalisen järjestysluvun.
+PERMUT = PERMUTAATIO ## Palauttaa mahdollisten permutaatioiden määrän annetulle objektien määrälle.
+POISSON = POISSON ## Palauttaa Poissonin todennäköisyysjakauman.
+PROB = TODENNÄKÖISYYS ## Palauttaa todennäköisyyden sille, että arvot ovat tietyltä väliltä.
+QUARTILE = NELJÄNNES ## Palauttaa tietoalueen neljänneksen.
+RANK = ARVON.MUKAAN ## Palauttaa luvun paikan lukuarvoluettelossa.
+RSQ = PEARSON.NELIÖ ## Palauttaa Pearsonin tulomomenttikorrelaatiokertoimen neliön.
+SKEW = JAKAUMAN.VINOUS ## Palauttaa jakauman vinouden.
+SLOPE = KULMAKERROIN ## Palauttaa lineaarisen regressiosuoran kulmakertoimen.
+SMALL = PIENI ## Palauttaa tietojoukon k:nneksi pienimmän arvon.
+STANDARDIZE = NORMITA ## Palauttaa normitetun arvon.
+STDEV = KESKIHAJONTA ## Laskee populaation keskihajonnan otoksen perusteella.
+STDEVA = KESKIHAJONTAA ## Laskee populaation keskihajonnan otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot.
+STDEVP = KESKIHAJONTAP ## Laskee normaalijakautuman koko populaation perusteella.
+STDEVPA = KESKIHAJONTAPA ## Laskee populaation keskihajonnan koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot.
+STEYX = KESKIVIRHE ## Palauttaa regression kutakin x-arvoa vastaavan ennustetun y-arvon keskivirheen.
+TDIST = TJAKAUMA ## Palauttaa t-jakautuman.
+TINV = TJAKAUMA.KÄÄNT ## Palauttaa käänteisen t-jakauman.
+TREND = SUUNTAUS ## Palauttaa lineaarisen trendin arvoja.
+TRIMMEAN = KESKIARVO.TASATTU ## Palauttaa tietojoukon tasatun keskiarvon.
+TTEST = TTESTI ## Palauttaa t-testiin liittyvän todennäköisyyden.
+VAR = VAR ## Arvioi populaation varianssia otoksen perusteella.
+VARA = VARA ## Laskee populaation varianssin otoksen perusteella, mukaan lukien luvut, tekstin ja loogiset arvot.
+VARP = VARP ## Laskee varianssin koko populaation perusteella.
+VARPA = VARPA ## Laskee populaation varianssin koko populaation perusteella, mukaan lukien luvut, tekstin ja totuusarvot.
+WEIBULL = WEIBULL ## Palauttaa Weibullin jakauman.
+ZTEST = ZTESTI ## Palauttaa z-testin yksisuuntaisen todennäköisyysarvon.
+
+
+##
+## Text functions Tekstifunktiot
+##
+ASC = ASC ## Muuntaa merkkijonossa olevat englanninkieliset DBCS- tai katakana-merkit SBCS-merkeiksi.
+BAHTTEXT = BAHTTEKSTI ## Muuntaa luvun tekstiksi ß (baht) -valuuttamuotoa käyttämällä.
+CHAR = MERKKI ## Palauttaa koodin lukua vastaavan merkin.
+CLEAN = SIIVOA ## Poistaa tekstistä kaikki tulostumattomat merkit.
+CODE = KOODI ## Palauttaa tekstimerkkijonon ensimmäisen merkin numerokoodin.
+CONCATENATE = KETJUTA ## Yhdistää useat merkkijonot yhdeksi merkkijonoksi.
+DOLLAR = VALUUTTA ## Muuntaa luvun tekstiksi $ (dollari) -valuuttamuotoa käyttämällä.
+EXACT = VERTAA ## Tarkistaa, ovatko kaksi tekstiarvoa samanlaiset.
+FIND = ETSI ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet).
+FINDB = ETSIB ## Etsii tekstiarvon toisen tekstin sisältä (tunnistaa isot ja pienet kirjaimet).
+FIXED = KIINTEÄ ## Muotoilee luvun tekstiksi, jossa on kiinteä määrä desimaaleja.
+JIS = JIS ## Muuntaa merkkijonossa olevat englanninkieliset SBCS- tai katakana-merkit DBCS-merkeiksi.
+LEFT = VASEN ## Palauttaa tekstiarvon vasemmanpuoliset merkit.
+LEFTB = VASENB ## Palauttaa tekstiarvon vasemmanpuoliset merkit.
+LEN = PITUUS ## Palauttaa tekstimerkkijonon merkkien määrän.
+LENB = PITUUSB ## Palauttaa tekstimerkkijonon merkkien määrän.
+LOWER = PIENET ## Muuntaa tekstin pieniksi kirjaimiksi.
+MID = POIMI.TEKSTI ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta.
+MIDB = POIMI.TEKSTIB ## Palauttaa määritetyn määrän merkkejä merkkijonosta alkaen annetusta kohdasta.
+PHONETIC = FONEETTINEN ## Hakee foneettiset (furigana) merkit merkkijonosta.
+PROPER = ERISNIMI ## Muuttaa merkkijonon kunkin sanan ensimmäisen kirjaimen isoksi.
+REPLACE = KORVAA ## Korvaa tekstissä olevat merkit.
+REPLACEB = KORVAAB ## Korvaa tekstissä olevat merkit.
+REPT = TOISTA ## Toistaa tekstin annetun määrän kertoja.
+RIGHT = OIKEA ## Palauttaa tekstiarvon oikeanpuoliset merkit.
+RIGHTB = OIKEAB ## Palauttaa tekstiarvon oikeanpuoliset merkit.
+SEARCH = KÄY.LÄPI ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi).
+SEARCHB = KÄY.LÄPIB ## Etsii tekstiarvon toisen tekstin sisältä (isot ja pienet kirjaimet tulkitaan samoiksi merkeiksi).
+SUBSTITUTE = VAIHDA ## Korvaa merkkijonossa olevan tekstin toisella.
+T = T ## Muuntaa argumentit tekstiksi.
+TEXT = TEKSTI ## Muotoilee luvun ja muuntaa sen tekstiksi.
+TRIM = POISTA.VÄLIT ## Poistaa välilyönnit tekstistä.
+UPPER = ISOT ## Muuntaa tekstin isoiksi kirjaimiksi.
+VALUE = ARVO ## Muuntaa tekstiargumentin luvuksi.
diff --git a/Classes/PHPExcel/locale/fr/config b/Classes/PHPExcel/locale/fr/config
new file mode 100644
index 0000000..1f5db88
--- /dev/null
+++ b/Classes/PHPExcel/locale/fr/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NUL!
+DIV0 = #DIV/0!
+VALUE = #VALEUR!
+REF = #REF!
+NAME = #NOM?
+NUM = #NOMBRE!
+NA = #N/A
diff --git a/Classes/PHPExcel/locale/fr/functions b/Classes/PHPExcel/locale/fr/functions
new file mode 100644
index 0000000..03b80e5
--- /dev/null
+++ b/Classes/PHPExcel/locale/fr/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Fonctions de complément et d’automatisation
+##
+GETPIVOTDATA = LIREDONNEESTABCROISDYNAMIQUE ## Renvoie les données stockées dans un rapport de tableau croisé dynamique.
+
+
+##
+## Cube functions Fonctions Cube
+##
+CUBEKPIMEMBER = MEMBREKPICUBE ## Renvoie un nom, une propriété et une mesure d’indicateur de performance clé et affiche le nom et la propriété dans la cellule. Un indicateur de performance clé est une mesure quantifiable, telle que la marge bénéficiaire brute mensuelle ou la rotation trimestrielle du personnel, utilisée pour évaluer les performances d’une entreprise.
+CUBEMEMBER = MEMBRECUBE ## Renvoie un membre ou un uplet dans une hiérarchie de cubes. Utilisez cette fonction pour valider l’existence du membre ou de l’uplet dans le cube.
+CUBEMEMBERPROPERTY = PROPRIETEMEMBRECUBE ## Renvoie la valeur d’une propriété de membre du cube. Utilisez cette fonction pour valider l’existence d’un nom de membre dans le cube et pour renvoyer la propriété spécifiée pour ce membre.
+CUBERANKEDMEMBER = RANGMEMBRECUBE ## Renvoie le nième membre ou le membre placé à un certain rang dans un ensemble. Utilisez cette fonction pour renvoyer un ou plusieurs éléments d’un ensemble, tels que les meilleurs vendeurs ou les 10 meilleurs étudiants.
+CUBESET = JEUCUBE ## Définit un ensemble calculé de membres ou d’uplets en envoyant une expression définie au cube sur le serveur qui crée l’ensemble et le renvoie à Microsoft Office Excel.
+CUBESETCOUNT = NBJEUCUBE ## Renvoie le nombre d’éléments dans un jeu.
+CUBEVALUE = VALEURCUBE ## Renvoie une valeur d’agrégation issue d’un cube.
+
+
+##
+## Database functions Fonctions de base de données
+##
+DAVERAGE = BDMOYENNE ## Renvoie la moyenne des entrées de base de données sélectionnées.
+DCOUNT = BCOMPTE ## Compte le nombre de cellules d’une base de données qui contiennent des nombres.
+DCOUNTA = BDNBVAL ## Compte les cellules non vides d’une base de données.
+DGET = BDLIRE ## Extrait d’une base de données un enregistrement unique répondant aux critères spécifiés.
+DMAX = BDMAX ## Renvoie la valeur maximale des entrées de base de données sélectionnées.
+DMIN = BDMIN ## Renvoie la valeur minimale des entrées de base de données sélectionnées.
+DPRODUCT = BDPRODUIT ## Multiplie les valeurs d’un champ particulier des enregistrements d’une base de données, qui répondent aux critères spécifiés.
+DSTDEV = BDECARTYPE ## Calcule l’écart type pour un échantillon d’entrées de base de données sélectionnées.
+DSTDEVP = BDECARTYPEP ## Calcule l’écart type pour l’ensemble d’une population d’entrées de base de données sélectionnées.
+DSUM = BDSOMME ## Ajoute les nombres dans la colonne de champ des enregistrements de la base de données, qui répondent aux critères.
+DVAR = BDVAR ## Calcule la variance pour un échantillon d’entrées de base de données sélectionnées.
+DVARP = BDVARP ## Calcule la variance pour l’ensemble d’une population d’entrées de base de données sélectionnées.
+
+
+##
+## Date and time functions Fonctions de date et d’heure
+##
+DATE = DATE ## Renvoie le numéro de série d’une date précise.
+DATEVALUE = DATEVAL ## Convertit une date représentée sous forme de texte en numéro de série.
+DAY = JOUR ## Convertit un numéro de série en jour du mois.
+DAYS360 = JOURS360 ## Calcule le nombre de jours qui séparent deux dates sur la base d’une année de 360 jours.
+EDATE = MOIS.DECALER ## Renvoie le numéro séquentiel de la date qui représente une date spécifiée (l’argument date_départ), corrigée en plus ou en moins du nombre de mois indiqué.
+EOMONTH = FIN.MOIS ## Renvoie le numéro séquentiel de la date du dernier jour du mois précédant ou suivant la date_départ du nombre de mois indiqué.
+HOUR = HEURE ## Convertit un numéro de série en heure.
+MINUTE = MINUTE ## Convertit un numéro de série en minute.
+MONTH = MOIS ## Convertit un numéro de série en mois.
+NETWORKDAYS = NB.JOURS.OUVRES ## Renvoie le nombre de jours ouvrés entiers compris entre deux dates.
+NOW = MAINTENANT ## Renvoie le numéro de série de la date et de l’heure du jour.
+SECOND = SECONDE ## Convertit un numéro de série en seconde.
+TIME = TEMPS ## Renvoie le numéro de série d’une heure précise.
+TIMEVALUE = TEMPSVAL ## Convertit une date représentée sous forme de texte en numéro de série.
+TODAY = AUJOURDHUI ## Renvoie le numéro de série de la date du jour.
+WEEKDAY = JOURSEM ## Convertit un numéro de série en jour de la semaine.
+WEEKNUM = NO.SEMAINE ## Convertit un numéro de série en un numéro représentant l’ordre de la semaine dans l’année.
+WORKDAY = SERIE.JOUR.OUVRE ## Renvoie le numéro de série de la date avant ou après le nombre de jours ouvrés spécifiés.
+YEAR = ANNEE ## Convertit un numéro de série en année.
+YEARFRAC = FRACTION.ANNEE ## Renvoie la fraction de l’année représentant le nombre de jours entre la date de début et la date de fin.
+
+
+##
+## Engineering functions Fonctions d’ingénierie
+##
+BESSELI = BESSELI ## Renvoie la fonction Bessel modifiée In(x).
+BESSELJ = BESSELJ ## Renvoie la fonction Bessel Jn(x).
+BESSELK = BESSELK ## Renvoie la fonction Bessel modifiée Kn(x).
+BESSELY = BESSELY ## Renvoie la fonction Bessel Yn(x).
+BIN2DEC = BINDEC ## Convertit un nombre binaire en nombre décimal.
+BIN2HEX = BINHEX ## Convertit un nombre binaire en nombre hexadécimal.
+BIN2OCT = BINOCT ## Convertit un nombre binaire en nombre octal.
+COMPLEX = COMPLEXE ## Convertit des coefficients réel et imaginaire en un nombre complexe.
+CONVERT = CONVERT ## Convertit un nombre d’une unité de mesure à une autre.
+DEC2BIN = DECBIN ## Convertit un nombre décimal en nombre binaire.
+DEC2HEX = DECHEX ## Convertit un nombre décimal en nombre hexadécimal.
+DEC2OCT = DECOCT ## Convertit un nombre décimal en nombre octal.
+DELTA = DELTA ## Teste l’égalité de deux nombres.
+ERF = ERF ## Renvoie la valeur de la fonction d’erreur.
+ERFC = ERFC ## Renvoie la valeur de la fonction d’erreur complémentaire.
+GESTEP = SUP.SEUIL ## Teste si un nombre est supérieur à une valeur de seuil.
+HEX2BIN = HEXBIN ## Convertit un nombre hexadécimal en nombre binaire.
+HEX2DEC = HEXDEC ## Convertit un nombre hexadécimal en nombre décimal.
+HEX2OCT = HEXOCT ## Convertit un nombre hexadécimal en nombre octal.
+IMABS = COMPLEXE.MODULE ## Renvoie la valeur absolue (module) d’un nombre complexe.
+IMAGINARY = COMPLEXE.IMAGINAIRE ## Renvoie le coefficient imaginaire d’un nombre complexe.
+IMARGUMENT = COMPLEXE.ARGUMENT ## Renvoie l’argument thêta, un angle exprimé en radians.
+IMCONJUGATE = COMPLEXE.CONJUGUE ## Renvoie le nombre complexe conjugué d’un nombre complexe.
+IMCOS = IMCOS ## Renvoie le cosinus d’un nombre complexe.
+IMDIV = COMPLEXE.DIV ## Renvoie le quotient de deux nombres complexes.
+IMEXP = COMPLEXE.EXP ## Renvoie la fonction exponentielle d’un nombre complexe.
+IMLN = COMPLEXE.LN ## Renvoie le logarithme népérien d’un nombre complexe.
+IMLOG10 = COMPLEXE.LOG10 ## Calcule le logarithme en base 10 d’un nombre complexe.
+IMLOG2 = COMPLEXE.LOG2 ## Calcule le logarithme en base 2 d’un nombre complexe.
+IMPOWER = COMPLEXE.PUISSANCE ## Renvoie un nombre complexe élevé à une puissance entière.
+IMPRODUCT = COMPLEXE.PRODUIT ## Renvoie le produit de plusieurs nombres complexes.
+IMREAL = COMPLEXE.REEL ## Renvoie le coefficient réel d’un nombre complexe.
+IMSIN = COMPLEXE.SIN ## Renvoie le sinus d’un nombre complexe.
+IMSQRT = COMPLEXE.RACINE ## Renvoie la racine carrée d’un nombre complexe.
+IMSUB = COMPLEXE.DIFFERENCE ## Renvoie la différence entre deux nombres complexes.
+IMSUM = COMPLEXE.SOMME ## Renvoie la somme de plusieurs nombres complexes.
+OCT2BIN = OCTBIN ## Convertit un nombre octal en nombre binaire.
+OCT2DEC = OCTDEC ## Convertit un nombre octal en nombre décimal.
+OCT2HEX = OCTHEX ## Convertit un nombre octal en nombre hexadécimal.
+
+
+##
+## Financial functions Fonctions financières
+##
+ACCRINT = INTERET.ACC ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu périodiquement.
+ACCRINTM = INTERET.ACC.MAT ## Renvoie l’intérêt couru non échu d’un titre dont l’intérêt est perçu à l’échéance.
+AMORDEGRC = AMORDEGRC ## Renvoie l’amortissement correspondant à chaque période comptable en utilisant un coefficient d’amortissement.
+AMORLINC = AMORLINC ## Renvoie l’amortissement d’un bien à la fin d’une période fiscale donnée.
+COUPDAYBS = NB.JOURS.COUPON.PREC ## Renvoie le nombre de jours entre le début de la période de coupon et la date de liquidation.
+COUPDAYS = NB.JOURS.COUPONS ## Renvoie le nombre de jours pour la période du coupon contenant la date de liquidation.
+COUPDAYSNC = NB.JOURS.COUPON.SUIV ## Renvoie le nombre de jours entre la date de liquidation et la date du coupon suivant la date de liquidation.
+COUPNCD = DATE.COUPON.SUIV ## Renvoie la première date de coupon ultérieure à la date de règlement.
+COUPNUM = NB.COUPONS ## Renvoie le nombre de coupons dus entre la date de règlement et la date d’échéance.
+COUPPCD = DATE.COUPON.PREC ## Renvoie la date de coupon précédant la date de règlement.
+CUMIPMT = CUMUL.INTER ## Renvoie l’intérêt cumulé payé sur un emprunt entre deux périodes.
+CUMPRINC = CUMUL.PRINCPER ## Renvoie le montant cumulé des remboursements du capital d’un emprunt effectués entre deux périodes.
+DB = DB ## Renvoie l’amortissement d’un bien pour une période spécifiée en utilisant la méthode de l’amortissement dégressif à taux fixe.
+DDB = DDB ## Renvoie l’amortissement d’un bien pour toute période spécifiée, en utilisant la méthode de l’amortissement dégressif à taux double ou selon un coefficient à spécifier.
+DISC = TAUX.ESCOMPTE ## Calcule le taux d’escompte d’une transaction.
+DOLLARDE = PRIX.DEC ## Convertit un prix en euros, exprimé sous forme de fraction, en un prix en euros exprimé sous forme de nombre décimal.
+DOLLARFR = PRIX.FRAC ## Convertit un prix en euros, exprimé sous forme de nombre décimal, en un prix en euros exprimé sous forme de fraction.
+DURATION = DUREE ## Renvoie la durée, en années, d’un titre dont l’intérêt est perçu périodiquement.
+EFFECT = TAUX.EFFECTIF ## Renvoie le taux d’intérêt annuel effectif.
+FV = VC ## Renvoie la valeur future d’un investissement.
+FVSCHEDULE = VC.PAIEMENTS ## Calcule la valeur future d’un investissement en appliquant une série de taux d’intérêt composites.
+INTRATE = TAUX.INTERET ## Affiche le taux d’intérêt d’un titre totalement investi.
+IPMT = INTPER ## Calcule le montant des intérêts d’un investissement pour une période donnée.
+IRR = TRI ## Calcule le taux de rentabilité interne d’un investissement pour une succession de trésoreries.
+ISPMT = ISPMT ## Calcule le montant des intérêts d’un investissement pour une période donnée.
+MDURATION = DUREE.MODIFIEE ## Renvoie la durée de Macauley modifiée pour un titre ayant une valeur nominale hypothétique de 100_euros.
+MIRR = TRIM ## Calcule le taux de rentabilité interne lorsque les paiements positifs et négatifs sont financés à des taux différents.
+NOMINAL = TAUX.NOMINAL ## Calcule le taux d’intérêt nominal annuel.
+NPER = NPM ## Renvoie le nombre de versements nécessaires pour rembourser un emprunt.
+NPV = VAN ## Calcule la valeur actuelle nette d’un investissement basé sur une série de décaissements et un taux d’escompte.
+ODDFPRICE = PRIX.PCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière.
+ODDFYIELD = REND.PCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la première période de coupon est irrégulière.
+ODDLPRICE = PRIX.DCOUPON.IRREG ## Renvoie le prix par tranche de valeur nominale de 100 euros d’un titre dont la première période de coupon est irrégulière.
+ODDLYIELD = REND.DCOUPON.IRREG ## Renvoie le taux de rendement d’un titre dont la dernière période de coupon est irrégulière.
+PMT = VPM ## Calcule le paiement périodique d’un investissement donné.
+PPMT = PRINCPER ## Calcule, pour une période donnée, la part de remboursement du principal d’un investissement.
+PRICE = PRIX.TITRE ## Renvoie le prix d’un titre rapportant des intérêts périodiques, pour une valeur nominale de 100 euros.
+PRICEDISC = VALEUR.ENCAISSEMENT ## Renvoie la valeur d’encaissement d’un escompte commercial, pour une valeur nominale de 100 euros.
+PRICEMAT = PRIX.TITRE.ECHEANCE ## Renvoie le prix d’un titre dont la valeur nominale est 100 euros et qui rapporte des intérêts à l’échéance.
+PV = PV ## Calcule la valeur actuelle d’un investissement.
+RATE = TAUX ## Calcule le taux d’intérêt par période pour une annuité.
+RECEIVED = VALEUR.NOMINALE ## Renvoie la valeur nominale à échéance d’un effet de commerce.
+SLN = AMORLIN ## Calcule l’amortissement linéaire d’un bien pour une période donnée.
+SYD = SYD ## Calcule l’amortissement d’un bien pour une période donnée sur la base de la méthode américaine Sum-of-Years Digits (amortissement dégressif à taux décroissant appliqué à une valeur constante).
+TBILLEQ = TAUX.ESCOMPTE.R ## Renvoie le taux d’escompte rationnel d’un bon du Trésor.
+TBILLPRICE = PRIX.BON.TRESOR ## Renvoie le prix d’un bon du Trésor d’une valeur nominale de 100 euros.
+TBILLYIELD = RENDEMENT.BON.TRESOR ## Calcule le taux de rendement d’un bon du Trésor.
+VDB = VDB ## Renvoie l’amortissement d’un bien pour une période spécifiée ou partielle en utilisant une méthode de l’amortissement dégressif à taux fixe.
+XIRR = TRI.PAIEMENTS ## Calcule le taux de rentabilité interne d’un ensemble de paiements non périodiques.
+XNPV = VAN.PAIEMENTS ## Renvoie la valeur actuelle nette d’un ensemble de paiements non périodiques.
+YIELD = RENDEMENT.TITRE ## Calcule le rendement d’un titre rapportant des intérêts périodiquement.
+YIELDDISC = RENDEMENT.SIMPLE ## Calcule le taux de rendement d’un emprunt à intérêt simple (par exemple, un bon du Trésor).
+YIELDMAT = RENDEMENT.TITRE.ECHEANCE ## Renvoie le rendement annuel d’un titre qui rapporte des intérêts à l’échéance.
+
+
+##
+## Information functions Fonctions d’information
+##
+CELL = CELLULE ## Renvoie des informations sur la mise en forme, l’emplacement et le contenu d’une cellule.
+ERROR.TYPE = TYPE.ERREUR ## Renvoie un nombre correspondant à un type d’erreur.
+INFO = INFORMATIONS ## Renvoie des informations sur l’environnement d’exploitation actuel.
+ISBLANK = ESTVIDE ## Renvoie VRAI si l’argument valeur est vide.
+ISERR = ESTERR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur, sauf #N/A.
+ISERROR = ESTERREUR ## Renvoie VRAI si l’argument valeur fait référence à une valeur d’erreur.
+ISEVEN = EST.PAIR ## Renvoie VRAI si le chiffre est pair.
+ISLOGICAL = ESTLOGIQUE ## Renvoie VRAI si l’argument valeur fait référence à une valeur logique.
+ISNA = ESTNA ## Renvoie VRAI si l’argument valeur fait référence à la valeur d’erreur #N/A.
+ISNONTEXT = ESTNONTEXTE ## Renvoie VRAI si l’argument valeur ne se présente pas sous forme de texte.
+ISNUMBER = ESTNUM ## Renvoie VRAI si l’argument valeur représente un nombre.
+ISODD = EST.IMPAIR ## Renvoie VRAI si le chiffre est impair.
+ISREF = ESTREF ## Renvoie VRAI si l’argument valeur est une référence.
+ISTEXT = ESTTEXTE ## Renvoie VRAI si l’argument valeur se présente sous forme de texte.
+N = N ## Renvoie une valeur convertie en nombre.
+NA = NA ## Renvoie la valeur d’erreur #N/A.
+TYPE = TYPE ## Renvoie un nombre indiquant le type de données d’une valeur.
+
+
+##
+## Logical functions Fonctions logiques
+##
+AND = ET ## Renvoie VRAI si tous ses arguments sont VRAI.
+FALSE = FAUX ## Renvoie la valeur logique FAUX.
+IF = SI ## Spécifie un test logique à effectuer.
+IFERROR = SIERREUR ## Renvoie une valeur que vous spécifiez si une formule génère une erreur ; sinon, elle renvoie le résultat de la formule.
+NOT = NON ## Inverse la logique de cet argument.
+OR = OU ## Renvoie VRAI si un des arguments est VRAI.
+TRUE = VRAI ## Renvoie la valeur logique VRAI.
+
+
+##
+## Lookup and reference functions Fonctions de recherche et de référence
+##
+ADDRESS = ADRESSE ## Renvoie une référence sous forme de texte à une seule cellule d’une feuille de calcul.
+AREAS = ZONES ## Renvoie le nombre de zones dans une référence.
+CHOOSE = CHOISIR ## Choisit une valeur dans une liste.
+COLUMN = COLONNE ## Renvoie le numéro de colonne d’une référence.
+COLUMNS = COLONNES ## Renvoie le nombre de colonnes dans une référence.
+HLOOKUP = RECHERCHEH ## Effectue une recherche dans la première ligne d’une matrice et renvoie la valeur de la cellule indiquée.
+HYPERLINK = LIEN_HYPERTEXTE ## Crée un raccourci ou un renvoi qui ouvre un document stocké sur un serveur réseau, sur un réseau Intranet ou sur Internet.
+INDEX = INDEX ## Utilise un index pour choisir une valeur provenant d’une référence ou d’une matrice.
+INDIRECT = INDIRECT ## Renvoie une référence indiquée par une valeur de texte.
+LOOKUP = RECHERCHE ## Recherche des valeurs dans un vecteur ou une matrice.
+MATCH = EQUIV ## Recherche des valeurs dans une référence ou une matrice.
+OFFSET = DECALER ## Renvoie une référence décalée par rapport à une référence donnée.
+ROW = LIGNE ## Renvoie le numéro de ligne d’une référence.
+ROWS = LIGNES ## Renvoie le nombre de lignes dans une référence.
+RTD = RTD ## Extrait les données en temps réel à partir d’un programme prenant en charge l’automation COM (Automation : utilisation des objets d'une application à partir d'une autre application ou d'un autre outil de développement. Autrefois appelée OLE Automation, Automation est une norme industrielle et une fonctionnalité du modèle d'objet COM (Component Object Model).).
+TRANSPOSE = TRANSPOSE ## Renvoie la transposition d’une matrice.
+VLOOKUP = RECHERCHEV ## Effectue une recherche dans la première colonne d’une matrice et se déplace sur la ligne pour renvoyer la valeur d’une cellule.
+
+
+##
+## Math and trigonometry functions Fonctions mathématiques et trigonométriques
+##
+ABS = ABS ## Renvoie la valeur absolue d’un nombre.
+ACOS = ACOS ## Renvoie l’arccosinus d’un nombre.
+ACOSH = ACOSH ## Renvoie le cosinus hyperbolique inverse d’un nombre.
+ASIN = ASIN ## Renvoie l’arcsinus d’un nombre.
+ASINH = ASINH ## Renvoie le sinus hyperbolique inverse d’un nombre.
+ATAN = ATAN ## Renvoie l’arctangente d’un nombre.
+ATAN2 = ATAN2 ## Renvoie l’arctangente des coordonnées x et y.
+ATANH = ATANH ## Renvoie la tangente hyperbolique inverse d’un nombre.
+CEILING = PLAFOND ## Arrondit un nombre au nombre entier le plus proche ou au multiple le plus proche de l’argument précision en s’éloignant de zéro.
+COMBIN = COMBIN ## Renvoie le nombre de combinaisons que l’on peut former avec un nombre donné d’objets.
+COS = COS ## Renvoie le cosinus d’un nombre.
+COSH = COSH ## Renvoie le cosinus hyperbolique d’un nombre.
+DEGREES = DEGRES ## Convertit des radians en degrés.
+EVEN = PAIR ## Arrondit un nombre au nombre entier pair le plus proche en s’éloignant de zéro.
+EXP = EXP ## Renvoie e élevé à la puissance d’un nombre donné.
+FACT = FACT ## Renvoie la factorielle d’un nombre.
+FACTDOUBLE = FACTDOUBLE ## Renvoie la factorielle double d’un nombre.
+FLOOR = PLANCHER ## Arrondit un nombre en tendant vers 0 (zéro).
+GCD = PGCD ## Renvoie le plus grand commun diviseur.
+INT = ENT ## Arrondit un nombre à l’entier immédiatement inférieur.
+LCM = PPCM ## Renvoie le plus petit commun multiple.
+LN = LN ## Renvoie le logarithme népérien d’un nombre.
+LOG = LOG ## Renvoie le logarithme d’un nombre dans la base spécifiée.
+LOG10 = LOG10 ## Calcule le logarithme en base 10 d’un nombre.
+MDETERM = DETERMAT ## Renvoie le déterminant d’une matrice.
+MINVERSE = INVERSEMAT ## Renvoie la matrice inverse d’une matrice.
+MMULT = PRODUITMAT ## Renvoie le produit de deux matrices.
+MOD = MOD ## Renvoie le reste d’une division.
+MROUND = ARRONDI.AU.MULTIPLE ## Donne l’arrondi d’un nombre au multiple spécifié.
+MULTINOMIAL = MULTINOMIALE ## Calcule la multinomiale d’un ensemble de nombres.
+ODD = IMPAIR ## Renvoie le nombre, arrondi à la valeur du nombre entier impair le plus proche en s’éloignant de zéro.
+PI = PI ## Renvoie la valeur de pi.
+POWER = PUISSANCE ## Renvoie la valeur du nombre élevé à une puissance.
+PRODUCT = PRODUIT ## Multiplie ses arguments.
+QUOTIENT = QUOTIENT ## Renvoie la partie entière du résultat d’une division.
+RADIANS = RADIANS ## Convertit des degrés en radians.
+RAND = ALEA ## Renvoie un nombre aléatoire compris entre 0 et 1.
+RANDBETWEEN = ALEA.ENTRE.BORNES ## Renvoie un nombre aléatoire entre les nombres que vous spécifiez.
+ROMAN = ROMAIN ## Convertit des chiffres arabes en chiffres romains, sous forme de texte.
+ROUND = ARRONDI ## Arrondit un nombre au nombre de chiffres indiqué.
+ROUNDDOWN = ARRONDI.INF ## Arrondit un nombre en tendant vers 0 (zéro).
+ROUNDUP = ARRONDI.SUP ## Arrondit un nombre à l’entier supérieur, en s’éloignant de zéro.
+SERIESSUM = SOMME.SERIES ## Renvoie la somme d’une série géométrique en s’appuyant sur la formule suivante :
+SIGN = SIGNE ## Renvoie le signe d’un nombre.
+SIN = SIN ## Renvoie le sinus d’un angle donné.
+SINH = SINH ## Renvoie le sinus hyperbolique d’un nombre.
+SQRT = RACINE ## Renvoie la racine carrée d’un nombre.
+SQRTPI = RACINE.PI ## Renvoie la racine carrée de (nombre * pi).
+SUBTOTAL = SOUS.TOTAL ## Renvoie un sous-total dans une liste ou une base de données.
+SUM = SOMME ## Calcule la somme de ses arguments.
+SUMIF = SOMME.SI ## Additionne les cellules spécifiées si elles répondent à un critère donné.
+SUMIFS = SOMME.SI.ENS ## Ajoute les cellules d’une plage qui répondent à plusieurs critères.
+SUMPRODUCT = SOMMEPROD ## Multiplie les valeurs correspondantes des matrices spécifiées et calcule la somme de ces produits.
+SUMSQ = SOMME.CARRES ## Renvoie la somme des carrés des arguments.
+SUMX2MY2 = SOMME.X2MY2 ## Renvoie la somme de la différence des carrés des valeurs correspondantes de deux matrices.
+SUMX2PY2 = SOMME.X2PY2 ## Renvoie la somme de la somme des carrés des valeurs correspondantes de deux matrices.
+SUMXMY2 = SOMME.XMY2 ## Renvoie la somme des carrés des différences entre les valeurs correspondantes de deux matrices.
+TAN = TAN ## Renvoie la tangente d’un nombre.
+TANH = TANH ## Renvoie la tangente hyperbolique d’un nombre.
+TRUNC = TRONQUE ## Renvoie la partie entière d’un nombre.
+
+
+##
+## Statistical functions Fonctions statistiques
+##
+AVEDEV = ECART.MOYEN ## Renvoie la moyenne des écarts absolus observés dans la moyenne des points de données.
+AVERAGE = MOYENNE ## Renvoie la moyenne de ses arguments.
+AVERAGEA = AVERAGEA ## Renvoie la moyenne de ses arguments, nombres, texte et valeurs logiques inclus.
+AVERAGEIF = MOYENNE.SI ## Renvoie la moyenne (arithmétique) de toutes les cellules d’une plage qui répondent à des critères donnés.
+AVERAGEIFS = MOYENNE.SI.ENS ## Renvoie la moyenne (arithmétique) de toutes les cellules qui répondent à plusieurs critères.
+BETADIST = LOI.BETA ## Renvoie la fonction de distribution cumulée.
+BETAINV = BETA.INVERSE ## Renvoie l’inverse de la fonction de distribution cumulée pour une distribution bêta spécifiée.
+BINOMDIST = LOI.BINOMIALE ## Renvoie la probabilité d’une variable aléatoire discrète suivant la loi binomiale.
+CHIDIST = LOI.KHIDEUX ## Renvoie la probabilité unilatérale de la distribution khi-deux.
+CHIINV = KHIDEUX.INVERSE ## Renvoie l’inverse de la probabilité unilatérale de la distribution khi-deux.
+CHITEST = TEST.KHIDEUX ## Renvoie le test d’indépendance.
+CONFIDENCE = INTERVALLE.CONFIANCE ## Renvoie l’intervalle de confiance pour une moyenne de population.
+CORREL = COEFFICIENT.CORRELATION ## Renvoie le coefficient de corrélation entre deux séries de données.
+COUNT = NB ## Détermine les nombres compris dans la liste des arguments.
+COUNTA = NBVAL ## Détermine le nombre de valeurs comprises dans la liste des arguments.
+COUNTBLANK = NB.VIDE ## Compte le nombre de cellules vides dans une plage.
+COUNTIF = NB.SI ## Compte le nombre de cellules qui répondent à un critère donné dans une plage.
+COUNTIFS = NB.SI.ENS ## Compte le nombre de cellules à l’intérieur d’une plage qui répondent à plusieurs critères.
+COVAR = COVARIANCE ## Renvoie la covariance, moyenne des produits des écarts pour chaque série d’observations.
+CRITBINOM = CRITERE.LOI.BINOMIALE ## Renvoie la plus petite valeur pour laquelle la distribution binomiale cumulée est inférieure ou égale à une valeur de critère.
+DEVSQ = SOMME.CARRES.ECARTS ## Renvoie la somme des carrés des écarts.
+EXPONDIST = LOI.EXPONENTIELLE ## Renvoie la distribution exponentielle.
+FDIST = LOI.F ## Renvoie la distribution de probabilité F.
+FINV = INVERSE.LOI.F ## Renvoie l’inverse de la distribution de probabilité F.
+FISHER = FISHER ## Renvoie la transformation de Fisher.
+FISHERINV = FISHER.INVERSE ## Renvoie l’inverse de la transformation de Fisher.
+FORECAST = PREVISION ## Calcule une valeur par rapport à une tendance linéaire.
+FREQUENCY = FREQUENCE ## Calcule la fréquence d’apparition des valeurs dans une plage de valeurs, puis renvoie des nombres sous forme de matrice verticale.
+FTEST = TEST.F ## Renvoie le résultat d’un test F.
+GAMMADIST = LOI.GAMMA ## Renvoie la probabilité d’une variable aléatoire suivant une loi Gamma.
+GAMMAINV = LOI.GAMMA.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi Gamma.
+GAMMALN = LNGAMMA ## Renvoie le logarithme népérien de la fonction Gamma, G(x)
+GEOMEAN = MOYENNE.GEOMETRIQUE ## Renvoie la moyenne géométrique.
+GROWTH = CROISSANCE ## Calcule des valeurs par rapport à une tendance exponentielle.
+HARMEAN = MOYENNE.HARMONIQUE ## Renvoie la moyenne harmonique.
+HYPGEOMDIST = LOI.HYPERGEOMETRIQUE ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi hypergéométrique.
+INTERCEPT = ORDONNEE.ORIGINE ## Renvoie l’ordonnée à l’origine d’une droite de régression linéaire.
+KURT = KURTOSIS ## Renvoie le kurtosis d’une série de données.
+LARGE = GRANDE.VALEUR ## Renvoie la k-ième plus grande valeur d’une série de données.
+LINEST = DROITEREG ## Renvoie les paramètres d’une tendance linéaire.
+LOGEST = LOGREG ## Renvoie les paramètres d’une tendance exponentielle.
+LOGINV = LOI.LOGNORMALE.INVERSE ## Renvoie l’inverse de la probabilité pour une variable aléatoire suivant la loi lognormale.
+LOGNORMDIST = LOI.LOGNORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi lognormale.
+MAX = MAX ## Renvoie la valeur maximale contenue dans une liste d’arguments.
+MAXA = MAXA ## Renvoie la valeur maximale d’une liste d’arguments, nombres, texte et valeurs logiques inclus.
+MEDIAN = MEDIANE ## Renvoie la valeur médiane des nombres donnés.
+MIN = MIN ## Renvoie la valeur minimale contenue dans une liste d’arguments.
+MINA = MINA ## Renvoie la plus petite valeur d’une liste d’arguments, nombres, texte et valeurs logiques inclus.
+MODE = MODE ## Renvoie la valeur la plus courante d’une série de données.
+NEGBINOMDIST = LOI.BINOMIALE.NEG ## Renvoie la probabilité d’une variable aléatoire discrète suivant une loi binomiale négative.
+NORMDIST = LOI.NORMALE ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale.
+NORMINV = LOI.NORMALE.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi normale standard.
+NORMSDIST = LOI.NORMALE.STANDARD ## Renvoie la probabilité d’une variable aléatoire continue suivant une loi normale standard.
+NORMSINV = LOI.NORMALE.STANDARD.INVERSE ## Renvoie l’inverse de la distribution cumulée normale standard.
+PEARSON = PEARSON ## Renvoie le coefficient de corrélation d’échantillonnage de Pearson.
+PERCENTILE = CENTILE ## Renvoie le k-ième centile des valeurs d’une plage.
+PERCENTRANK = RANG.POURCENTAGE ## Renvoie le rang en pourcentage d’une valeur d’une série de données.
+PERMUT = PERMUTATION ## Renvoie le nombre de permutations pour un nombre donné d’objets.
+POISSON = LOI.POISSON ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Poisson.
+PROB = PROBABILITE ## Renvoie la probabilité que des valeurs d’une plage soient comprises entre deux limites.
+QUARTILE = QUARTILE ## Renvoie le quartile d’une série de données.
+RANK = RANG ## Renvoie le rang d’un nombre contenu dans une liste.
+RSQ = COEFFICIENT.DETERMINATION ## Renvoie la valeur du coefficient de détermination R^2 d’une régression linéaire.
+SKEW = COEFFICIENT.ASYMETRIE ## Renvoie l’asymétrie d’une distribution.
+SLOPE = PENTE ## Renvoie la pente d’une droite de régression linéaire.
+SMALL = PETITE.VALEUR ## Renvoie la k-ième plus petite valeur d’une série de données.
+STANDARDIZE = CENTREE.REDUITE ## Renvoie une valeur centrée réduite.
+STDEV = ECARTYPE ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population.
+STDEVA = STDEVA ## Évalue l’écart type d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques inclus.
+STDEVP = ECARTYPEP ## Calcule l’écart type d’une population à partir de la population entière.
+STDEVPA = STDEVPA ## Calcule l’écart type d’une population à partir de l’ensemble de la population, nombres, texte et valeurs logiques inclus.
+STEYX = ERREUR.TYPE.XY ## Renvoie l’erreur type de la valeur y prévue pour chaque x de la régression.
+TDIST = LOI.STUDENT ## Renvoie la probabilité d’une variable aléatoire suivant une loi T de Student.
+TINV = LOI.STUDENT.INVERSE ## Renvoie, pour une probabilité donnée, la valeur d’une variable aléatoire suivant une loi T de Student.
+TREND = TENDANCE ## Renvoie des valeurs par rapport à une tendance linéaire.
+TRIMMEAN = MOYENNE.REDUITE ## Renvoie la moyenne de l’intérieur d’une série de données.
+TTEST = TEST.STUDENT ## Renvoie la probabilité associée à un test T de Student.
+VAR = VAR ## Calcule la variance sur la base d’un échantillon.
+VARA = VARA ## Estime la variance d’une population en se basant sur un échantillon de cette population, nombres, texte et valeurs logiques incluses.
+VARP = VAR.P ## Calcule la variance sur la base de l’ensemble de la population.
+VARPA = VARPA ## Calcule la variance d’une population en se basant sur la population entière, nombres, texte et valeurs logiques inclus.
+WEIBULL = LOI.WEIBULL ## Renvoie la probabilité d’une variable aléatoire suivant une loi de Weibull.
+ZTEST = TEST.Z ## Renvoie la valeur de probabilité unilatérale d’un test z.
+
+
+##
+## Text functions Fonctions de texte
+##
+ASC = ASC ## Change les caractères anglais ou katakana à pleine chasse (codés sur deux octets) à l’intérieur d’une chaîne de caractères en caractères à demi-chasse (codés sur un octet).
+BAHTTEXT = BAHTTEXT ## Convertit un nombre en texte en utilisant le format monétaire ß (baht).
+CHAR = CAR ## Renvoie le caractère spécifié par le code numérique.
+CLEAN = EPURAGE ## Supprime tous les caractères de contrôle du texte.
+CODE = CODE ## Renvoie le numéro de code du premier caractère du texte.
+CONCATENATE = CONCATENER ## Assemble plusieurs éléments textuels de façon à n’en former qu’un seul.
+DOLLAR = EURO ## Convertit un nombre en texte en utilisant le format monétaire € (euro).
+EXACT = EXACT ## Vérifie si deux valeurs de texte sont identiques.
+FIND = TROUVE ## Trouve un valeur textuelle dans une autre, en respectant la casse.
+FINDB = TROUVERB ## Trouve un valeur textuelle dans une autre, en respectant la casse.
+FIXED = CTXT ## Convertit un nombre au format texte avec un nombre de décimales spécifié.
+JIS = JIS ## Change les caractères anglais ou katakana à demi-chasse (codés sur un octet) à l’intérieur d’une chaîne de caractères en caractères à à pleine chasse (codés sur deux octets).
+LEFT = GAUCHE ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères.
+LEFTB = GAUCHEB ## Renvoie des caractères situés à l’extrême gauche d’une chaîne de caractères.
+LEN = NBCAR ## Renvoie le nombre de caractères contenus dans une chaîne de texte.
+LENB = LENB ## Renvoie le nombre de caractères contenus dans une chaîne de texte.
+LOWER = MINUSCULE ## Convertit le texte en minuscules.
+MID = STXT ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez.
+MIDB = STXTB ## Renvoie un nombre déterminé de caractères d’une chaîne de texte à partir de la position que vous indiquez.
+PHONETIC = PHONETIQUE ## Extrait les caractères phonétiques (furigana) d’une chaîne de texte.
+PROPER = NOMPROPRE ## Met en majuscules la première lettre de chaque mot dans une chaîne textuelle.
+REPLACE = REMPLACER ## Remplace des caractères dans un texte.
+REPLACEB = REMPLACERB ## Remplace des caractères dans un texte.
+REPT = REPT ## Répète un texte un certain nombre de fois.
+RIGHT = DROITE ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères.
+RIGHTB = DROITEB ## Renvoie des caractères situés à l’extrême droite d’une chaîne de caractères.
+SEARCH = CHERCHE ## Trouve un texte dans un autre texte (sans respecter la casse).
+SEARCHB = CHERCHERB ## Trouve un texte dans un autre texte (sans respecter la casse).
+SUBSTITUTE = SUBSTITUE ## Remplace l’ancien texte d’une chaîne de caractères par un nouveau.
+T = T ## Convertit ses arguments en texte.
+TEXT = TEXTE ## Convertit un nombre au format texte.
+TRIM = SUPPRESPACE ## Supprime les espaces du texte.
+UPPER = MAJUSCULE ## Convertit le texte en majuscules.
+VALUE = CNUM ## Convertit un argument textuel en nombre
diff --git a/Classes/PHPExcel/locale/hu/config b/Classes/PHPExcel/locale/hu/config
new file mode 100644
index 0000000..080b201
--- /dev/null
+++ b/Classes/PHPExcel/locale/hu/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = Ft
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULLA!
+DIV0 = #ZÉRÓOSZTÓ!
+VALUE = #ÉRTÉK!
+REF = #HIV!
+NAME = #NÉV?
+NUM = #SZÃM!
+NA = #HIÃNYZIK
diff --git a/Classes/PHPExcel/locale/hu/functions b/Classes/PHPExcel/locale/hu/functions
new file mode 100644
index 0000000..200d3f7
--- /dev/null
+++ b/Classes/PHPExcel/locale/hu/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions BÅ‘vÃtmények és automatizálási függvények
+##
+GETPIVOTDATA = KIMUTATÃSADATOT.VESZ ## A kimutatásokban tárolt adatok visszaadására használható.
+
+
+##
+## Cube functions Kockafüggvények
+##
+CUBEKPIMEMBER = KOCKA.FÅTELJMUT ## Egy fÅ‘ teljesÃtménymutató (KPI) nevét, tulajdonságát és mértékegységét adja eredményül, a nevet és a tulajdonságot megjelenÃti a cellában. A KPI-k számszerűsÃthetÅ‘ mérési lehetÅ‘séget jelentenek – ilyen mutató például a havi bruttó nyereség vagy az egy alkalmazottra jutó negyedéves forgalom –, egy szervezet teljesÃtményének nyomonkövetésére használhatók.
+CUBEMEMBER = KOCKA.TAG ## Kockahierachia tagját vagy rekordját adja eredményül. Ellenőrizhető vele, hogy szerepel-e a kockában az adott tag vagy rekord.
+CUBEMEMBERPROPERTY = KOCKA.TAG.TUL ## A kocka egyik tagtulajdonságának értékét adja eredményül. Használatával ellenőrizhető, hogy szerepel-e egy tagnév a kockában, eredménye pedig az erre a tagra vonatkozó, megadott tulajdonság.
+CUBERANKEDMEMBER = KOCKA.HALM.ELEM ## Egy halmaz rangsor szerinti n-edik tagját adja eredményül. Használatával egy halmaz egy vagy több elemét kaphatja meg, például a legnagyobb teljesÃtményű üzletkötÅ‘t vagy a 10 legjobb tanulót.
+CUBESET = KOCKA.HALM ## SzámÃtott tagok vagy rekordok halmazát adja eredményül, ehhez egy beállÃtott kifejezést elküld a kiszolgálón található kockának, majd ezt a halmazt adja vissza a Microsoft Office Excel alkalmazásnak.
+CUBESETCOUNT = KOCKA.HALM.DB ## Egy halmaz elemszámát adja eredményül.
+CUBEVALUE = KOCKA.ÉRTÉK ## Kockából összesÃtett értéket ad eredményül.
+
+
+##
+## Database functions Adatbázis-kezelő függvények
+##
+DAVERAGE = AB.ÃTLAG ## A kijelölt adatbáziselemek átlagát számÃtja ki.
+DCOUNT = AB.DARAB ## Megszámolja, hogy az adatbázisban hány cella tartalmaz számokat.
+DCOUNTA = AB.DARAB2 ## Megszámolja az adatbázisban lévő nem üres cellákat.
+DGET = AB.MEZŠ## Egy adatbázisból egyetlen olyan rekordot ad vissza, amely megfelel a megadott feltételeknek.
+DMAX = AB.MAX ## A kiválasztott adatbáziselemek közül a legnagyobb értéket adja eredményül.
+DMIN = AB.MIN ## A kijelölt adatbáziselemek közül a legkisebb értéket adja eredményül.
+DPRODUCT = AB.SZORZAT ## Az adatbázis megadott feltételeknek eleget tevő rekordjaira összeszorozza a megadott mezőben található számértékeket, és eredményül ezt a szorzatot adja.
+DSTDEV = AB.SZÓRÃS ## A kijelölt adatbáziselemek egy mintája alapján megbecsüli a szórást.
+DSTDEVP = AB.SZÓRÃS2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámÃtja a szórást.
+DSUM = AB.SZUM ## Összeadja a feltételnek megfelelő adatbázisrekordok mezőoszlopában a számokat.
+DVAR = AB.VAR ## A kijelölt adatbáziselemek mintája alapján becslést ad a szórásnégyzetre.
+DVARP = AB.VAR2 ## A kijelölt adatbáziselemek teljes sokasága alapján kiszámÃtja a szórásnégyzetet.
+
+
+##
+## Date and time functions Dátumfüggvények
+##
+DATE = DÃTUM ## Adott dátum dátumértékét adja eredményül.
+DATEVALUE = DÃTUMÉRTÉK ## Szövegként megadott dátumot dátumértékké alakÃt át.
+DAY = NAP ## Dátumértéket a hónap egy napjává (0-31) alakÃt.
+DAYS360 = NAP360 ## Két dátum közé esÅ‘ napok számát számÃtja ki a 360 napos év alapján.
+EDATE = EDATE ## Adott dátumnál adott számú hónappal korábbi vagy későbbi dátum dátumértékét adja eredményül.
+EOMONTH = EOMONTH ## Adott dátumnál adott számú hónappal korábbi vagy későbbi hónap utolsó napjának dátumértékét adja eredményül.
+HOUR = ÓRA ## Időértéket órákká alakÃt.
+MINUTE = PERC ## Időértéket percekké alakÃt.
+MONTH = HÓNAP ## Időértéket hónapokká alakÃt.
+NETWORKDAYS = NETWORKDAYS ## Két dátum között a teljes munkanapok számát adja meg.
+NOW = MOST ## A napi dátum dátumértékét és a pontos idő időértékét adja eredményül.
+SECOND = MPERC ## Időértéket másodpercekké alakÃt át.
+TIME = IDŠ## Adott időpont időértékét adja meg.
+TIMEVALUE = IDÅÉRTÉK ## Szövegként megadott idÅ‘pontot időértékké alakÃt át.
+TODAY = MA ## A napi dátum dátumértékét adja eredményül.
+WEEKDAY = HÉT.NAPJA ## Dátumértéket a hét napjává alakÃtja át.
+WEEKNUM = WEEKNUM ## Visszatérési értéke egy szám, amely azt mutatja meg, hogy a megadott dátum az év hányadik hetére esik.
+WORKDAY = WORKDAY ## Adott dátumnál adott munkanappal korábbi vagy későbbi dátum dátumértékét adja eredményül.
+YEAR = ÉV ## Sorszámot évvé alakÃt át.
+YEARFRAC = YEARFRAC ## Az adott dátumok közötti teljes napok számát törtévként adja meg.
+
+
+##
+## Engineering functions Mérnöki függvények
+##
+BESSELI = BESSELI ## Az In(x) módosÃtott Bessel-függvény értékét adja eredményül.
+BESSELJ = BESSELJ ## A Jn(x) Bessel-függvény értékét adja eredményül.
+BESSELK = BESSELK ## A Kn(x) módosÃtott Bessel-függvény értékét adja eredményül.
+BESSELY = BESSELY ## Az Yn(x) módosÃtott Bessel-függvény értékét adja eredményül.
+BIN2DEC = BIN2DEC ## Bináris számot decimálissá alakÃt át.
+BIN2HEX = BIN2HEX ## Bináris számot hexadecimálissá alakÃt át.
+BIN2OCT = BIN2OCT ## Bináris számot oktálissá alakÃt át.
+COMPLEX = COMPLEX ## Valós és képzetes részből komplex számot képez.
+CONVERT = CONVERT ## Mértékegységeket vált át.
+DEC2BIN = DEC2BIN ## Decimális számot binárissá alakÃt át.
+DEC2HEX = DEC2HEX ## Decimális számot hexadecimálissá alakÃt át.
+DEC2OCT = DEC2OCT ## Decimális számot oktálissá alakÃt át.
+DELTA = DELTA ## Azt vizsgálja, hogy két érték egyenlő-e.
+ERF = ERF ## A hibafüggvény értékét adja eredményül.
+ERFC = ERFC ## A kiegészÃtett hibafüggvény értékét adja eredményül.
+GESTEP = GESTEP ## Azt vizsgálja, hogy egy szám nagyobb-e adott küszöbértéknél.
+HEX2BIN = HEX2BIN ## Hexadecimális számot binárissá alakÃt át.
+HEX2DEC = HEX2DEC ## Hexadecimális számot decimálissá alakÃt át.
+HEX2OCT = HEX2OCT ## Hexadecimális számot oktálissá alakÃt át.
+IMABS = IMABS ## Komplex szám abszolút értékét (modulusát) adja eredményül.
+IMAGINARY = IMAGINARY ## Komplex szám képzetes részét adja eredményül.
+IMARGUMENT = IMARGUMENT ## A komplex szám radiánban kifejezett théta argumentumát adja eredményül.
+IMCONJUGATE = IMCONJUGATE ## Komplex szám komplex konjugáltját adja eredményül.
+IMCOS = IMCOS ## Komplex szám koszinuszát adja eredményül.
+IMDIV = IMDIV ## Két komplex szám hányadosát adja eredményül.
+IMEXP = IMEXP ## Az e szám komplex kitevőjű hatványát adja eredményül.
+IMLN = IMLN ## Komplex szám természetes logaritmusát adja eredményül.
+IMLOG10 = IMLOG10 ## Komplex szám tÃzes alapú logaritmusát adja eredményül.
+IMLOG2 = IMLOG2 ## Komplex szám kettes alapú logaritmusát adja eredményül.
+IMPOWER = IMPOWER ## Komplex szám hatványát adja eredményül.
+IMPRODUCT = IMPRODUCT ## Komplex számok szorzatát adja eredményül.
+IMREAL = IMREAL ## Komplex szám valós részét adja eredményül.
+IMSIN = IMSIN ## Komplex szám szinuszát adja eredményül.
+IMSQRT = IMSQRT ## Komplex szám négyzetgyökét adja eredményül.
+IMSUB = IMSUB ## Két komplex szám különbségét adja eredményül.
+IMSUM = IMSUM ## Komplex számok összegét adja eredményül.
+OCT2BIN = OCT2BIN ## Oktális számot binárissá alakÃt át.
+OCT2DEC = OCT2DEC ## Oktális számot decimálissá alakÃt át.
+OCT2HEX = OCT2HEX ## Oktális számot hexadecimálissá alakÃt át.
+
+
+##
+## Financial functions Pénzügyi függvények
+##
+ACCRINT = ACCRINT ## Periodikusan kamatozó értékpapÃr felszaporodott kamatát adja eredményül.
+ACCRINTM = ACCRINTM ## Lejáratkor kamatozó értékpapÃr felszaporodott kamatát adja eredményül.
+AMORDEGRC = AMORDEGRC ## Ãllóeszköz lineáris értékcsökkenését adja meg az egyes könyvelési idÅ‘szakokra vonatkozóan.
+AMORLINC = AMORLINC ## Az egyes könyvelési időszakokban az értékcsökkenést adja meg.
+COUPDAYBS = COUPDAYBS ## A szelvényidőszak kezdetétől a kifizetés időpontjáig eltelt napokat adja vissza.
+COUPDAYS = COUPDAYS ## A kifizetés időpontját magában foglaló szelvényperiódus hosszát adja meg napokban.
+COUPDAYSNC = COUPDAYSNC ## A kifizetés időpontja és a legközelebbi szelvénydátum közötti napok számát adja meg.
+COUPNCD = COUPNCD ## A kifizetést követő legelső szelvénydátumot adja eredményül.
+COUPNUM = COUPNUM ## A kifizetés és a lejárat időpontja között kifizetendő szelvények számát adja eredményül.
+COUPPCD = COUPPCD ## A kifizetés előtti utolsó szelvénydátumot adja eredményül.
+CUMIPMT = CUMIPMT ## Két fizetési időszak között kifizetett kamat halmozott értékét adja eredményül.
+CUMPRINC = CUMPRINC ## Két fizetési időszak között kifizetett részletek halmozott (kamatot nem tartalmazó) értékét adja eredményül.
+DB = KCS2 ## Eszköz adott idÅ‘szak alatti értékcsökkenését számÃtja ki a lineáris leÃrási modell alkalmazásával.
+DDB = KCSA ## Eszköz értékcsökkenését számÃtja ki adott idÅ‘szakra vonatkozóan a progresszÃv vagy egyéb megadott leÃrási modell alkalmazásával.
+DISC = DISC ## ÉrtékpapÃr leszámÃtolási kamatlábát adja eredményül.
+DOLLARDE = DOLLARDE ## Egy közönséges törtként megadott számot tizedes törtté alakÃt át.
+DOLLARFR = DOLLARFR ## Tizedes törtként megadott számot közönséges törtté alakÃt át.
+DURATION = DURATION ## Periodikus kamatfizetésű értékpapÃr éves kamatérzékenységét adja eredményül.
+EFFECT = EFFECT ## Az éves tényleges kamatláb értékét adja eredményül.
+FV = JBÉ ## Befektetés jövÅ‘beli értékét számÃtja ki.
+FVSCHEDULE = FVSCHEDULE ## A kezdőtőke adott kamatlábak szerint megnövelt jövőbeli értékét adja eredményül.
+INTRATE = INTRATE ## A lejáratig teljesen lekötött értékpapÃr kamatrátáját adja eredményül.
+IPMT = RRÉSZLET ## Hiteltörlesztésen belül a tÅ‘ketörlesztés nagyságát számÃtja ki adott idÅ‘szakra.
+IRR = BMR ## A befektetés belsÅ‘ megtérülési rátáját számÃtja ki pénzáramláshoz.
+ISPMT = LRÉSZLETKAMAT ## A befektetés adott idÅ‘szakára fizetett kamatot számÃtja ki.
+MDURATION = MDURATION ## Egy 100 Ft névértékű értékpapÃr Macauley-féle módosÃtott kamatérzékenységét adja eredményül.
+MIRR = MEGTÉRÃœLÉS ## A befektetés belsÅ‘ megtérülési rátáját számÃtja ki a költségek és a bevételek különbözÅ‘ kamatlába mellett.
+NOMINAL = NOMINAL ## Az éves névleges kamatláb értékét adja eredményül.
+NPER = PER.SZÃM ## A törlesztési idÅ‘szakok számát adja meg.
+NPV = NMÉ ## Befektetéshez kapcsolódó pénzáramlás nettó jelenértékét számÃtja ki ismert pénzáramlás és kamatláb mellett.
+ODDFPRICE = ODDFPRICE ## Egy 100 Ft névértékű, a futamidÅ‘ elején töredék-idÅ‘szakos értékpapÃr árát adja eredményül.
+ODDFYIELD = ODDFYIELD ## A futamidÅ‘ elején töredék-idÅ‘szakos értékpapÃr hozamát adja eredményül.
+ODDLPRICE = ODDLPRICE ## Egy 100 Ft névértékű, a futamidÅ‘ végén töredék-idÅ‘szakos értékpapÃr árát adja eredményül.
+ODDLYIELD = ODDLYIELD ## A futamidÅ‘ végén töredék-idÅ‘szakos értékpapÃr hozamát adja eredményül.
+PMT = RÉSZLET ## A törlesztési idÅ‘szakra vonatkozó törlesztési összeget számÃtja ki.
+PPMT = PRÉSZLET ## Hiteltörlesztésen belül a tÅ‘ketörlesztés nagyságát számÃtja ki adott idÅ‘szakra.
+PRICE = PRICE ## Egy 100 Ft névértékű, periodikusan kamatozó értékpapÃr árát adja eredményül.
+PRICEDISC = PRICEDISC ## Egy 100 Ft névértékű leszámÃtolt értékpapÃr árát adja eredményül.
+PRICEMAT = PRICEMAT ## Egy 100 Ft névértékű, a lejáratkor kamatozó értékpapÃr árát adja eredményül.
+PV = MÉ ## Befektetés jelenlegi értékét számÃtja ki.
+RATE = RÃTA ## Egy törlesztési idÅ‘szakban az egy idÅ‘szakra esÅ‘ kamatláb nagyságát számÃtja ki.
+RECEIVED = RECEIVED ## A lejáratig teljesen lekötött értékpapÃr lejáratakor kapott összegét adja eredményül.
+SLN = LCSA ## Tárgyi eszköz egy idÅ‘szakra esÅ‘ amortizációját adja meg bruttó érték szerinti lineáris leÃrási kulcsot alkalmazva.
+SYD = SYD ## Tárgyi eszköz értékcsökkenését számÃtja ki adott idÅ‘szakra az évek számjegyösszegével dolgozó módszer alapján.
+TBILLEQ = TBILLEQ ## Kincstárjegy kötvény-egyenértékű hozamát adja eredményül.
+TBILLPRICE = TBILLPRICE ## Egy 100 Ft névértékű kincstárjegy árát adja eredményül.
+TBILLYIELD = TBILLYIELD ## Kincstárjegy hozamát adja eredményül.
+VDB = ÉCSRI ## Tárgyi eszköz amortizációját számÃtja ki megadott vagy részidÅ‘szakra a csökkenÅ‘ egyenleg módszerének alkalmazásával.
+XIRR = XIRR ## Ütemezett készpénzforgalom (cash flow) belső megtérülési kamatrátáját adja eredményül.
+XNPV = XNPV ## Ütemezett készpénzforgalom (cash flow) nettó jelenlegi értékét adja eredményül.
+YIELD = YIELD ## Periodikusan kamatozó értékpapÃr hozamát adja eredményül.
+YIELDDISC = YIELDDISC ## LeszámÃtolt értékpapÃr (például kincstárjegy) éves hozamát adja eredményül.
+YIELDMAT = YIELDMAT ## Lejáratkor kamatozó értékpapÃr éves hozamát adja eredményül.
+
+
+##
+## Information functions Információs függvények
+##
+CELL = CELLA ## Egy cella formátumára, elhelyezkedésére vagy tartalmára vonatkozó adatokat ad eredményül.
+ERROR.TYPE = HIBA.TÃPUS ## Egy hibatÃpushoz tartozó számot ad eredményül.
+INFO = INFÓ ## A rendszer- és munkakörnyezet pillanatnyi állapotáról ad felvilágosÃtást.
+ISBLANK = ÜRES ## Eredménye IGAZ, ha az érték üres.
+ISERR = HIBA ## Eredménye IGAZ, ha az érték valamelyik hibaérték a #HIÃNYZIK kivételével.
+ISERROR = HIBÃS ## Eredménye IGAZ, ha az érték valamelyik hibaérték.
+ISEVEN = ISEVEN ## Eredménye IGAZ, ha argumentuma páros szám.
+ISLOGICAL = LOGIKAI ## Eredménye IGAZ, ha az érték logikai érték.
+ISNA = NINCS ## Eredménye IGAZ, ha az érték a #HIÃNYZIK hibaérték.
+ISNONTEXT = NEM.SZÖVEG ## Eredménye IGAZ, ha az érték nem szöveg.
+ISNUMBER = SZÃM ## Eredménye IGAZ, ha az érték szám.
+ISODD = ISODD ## Eredménye IGAZ, ha argumentuma páratlan szám.
+ISREF = HIVATKOZÃS ## Eredménye IGAZ, ha az érték hivatkozás.
+ISTEXT = SZÖVEG.E ## Eredménye IGAZ, ha az érték szöveg.
+N = N ## Argumentumának értékét számmá alakÃtja.
+NA = HIÃNYZIK ## Eredménye a #HIÃNYZIK hibaérték.
+TYPE = TÃPUS ## Érték adattÃpusának azonosÃtószámát adja eredményül.
+
+
+##
+## Logical functions Logikai függvények
+##
+AND = ÉS ## Eredménye IGAZ, ha minden argumentuma IGAZ.
+FALSE = HAMIS ## A HAMIS logikai értéket adja eredményül.
+IF = HA ## Logikai vizsgálatot hajt végre.
+IFERROR = HAHIBA ## A megadott értéket adja vissza, ha egy képlet hibához vezet; más esetben a képlet értékét adja eredményül.
+NOT = NEM ## Argumentuma értékének ellentettjét adja eredményül.
+OR = VAGY ## Eredménye IGAZ, ha bármely argumentuma IGAZ.
+TRUE = IGAZ ## Az IGAZ logikai értéket adja eredményül.
+
+
+##
+## Lookup and reference functions Keresési és hivatkozási függvények
+##
+ADDRESS = CÃM ## A munkalap egy cellájára való hivatkozást adja szövegként eredményül.
+AREAS = TERÜLET ## Hivatkozásban a területek számát adja eredményül.
+CHOOSE = VÃLASZT ## Értékek listájából választ ki egy elemet.
+COLUMN = OSZLOP ## Egy hivatkozás oszlopszámát adja eredményül.
+COLUMNS = OSZLOPOK ## A hivatkozásban található oszlopok számát adja eredményül.
+HLOOKUP = VKERES ## A megadott tömb felső sorában adott értékű elemet keres, és a megtalált elem oszlopából adott sorban elhelyezkedő értékkel tér vissza.
+HYPERLINK = HIPERHIVATKOZÃS ## Hálózati kiszolgálón, intraneten vagy az interneten tárolt dokumentumot megnyitó parancsikont vagy hivatkozást hoz létre.
+INDEX = INDEX ## Tömb- vagy hivatkozás indexszel megadott értékét adja vissza.
+INDIRECT = INDIREKT ## Szöveg megadott hivatkozást ad eredményül.
+LOOKUP = KERES ## Vektorban vagy tömbben keres meg értékeket.
+MATCH = HOL.VAN ## Hivatkozásban vagy tömbben értékeket keres.
+OFFSET = OFSZET ## Hivatkozás egy másik hivatkozástól számÃtott távolságát adja meg.
+ROW = SOR ## Egy hivatkozás sorának számát adja meg.
+ROWS = SOROK ## Egy hivatkozás sorainak számát adja meg.
+RTD = RTD ## Valós idejű adatokat keres vissza a COM automatizmust (automatizálás: Egy alkalmazás objektumaival való munka másik alkalmazásból vagy fejlesztőeszközből. A korábban OLE automatizmusnak nevezett automatizálás iparági szabvány, a Component Object Model (COM) szolgáltatása.) támogató programból.
+TRANSPOSE = TRANSZPONÃLÃS ## Egy tömb transzponáltját adja eredményül.
+VLOOKUP = FKERES ## A megadott tömb bal szélső oszlopában megkeres egy értéket, majd annak sora és a megadott oszlop metszéspontjában levő értéked adja eredményül.
+
+
+##
+## Math and trigonometry functions Matematikai és trigonometrikus függvények
+##
+ABS = ABS ## Egy szám abszolút értékét adja eredményül.
+ACOS = ARCCOS ## Egy szám arkusz koszinuszát számÃtja ki.
+ACOSH = ACOSH ## Egy szám inverz koszinusz hiperbolikuszát számÃtja ki.
+ASIN = ARCSIN ## Egy szám arkusz szinuszát számÃtja ki.
+ASINH = ASINH ## Egy szám inverz szinusz hiperbolikuszát számÃtja ki.
+ATAN = ARCTAN ## Egy szám arkusz tangensét számÃtja ki.
+ATAN2 = ARCTAN2 ## X és y koordináták alapján számÃtja ki az arkusz tangens értéket.
+ATANH = ATANH ## A szám inverz tangens hiperbolikuszát számÃtja ki.
+CEILING = PLAFON ## Egy számot a legközelebbi egészre vagy a pontosságként megadott érték legközelebb esÅ‘ többszörösére kerekÃt.
+COMBIN = KOMBINÃCIÓK ## Adott számú objektum összes lehetséges kombinációinak számát számÃtja ki.
+COS = COS ## Egy szám koszinuszát számÃtja ki.
+COSH = COSH ## Egy szám koszinusz hiperbolikuszát számÃtja ki.
+DEGREES = FOK ## Radiánt fokká alakÃt át.
+EVEN = PÃROS ## Egy számot a legközelebbi páros egész számra kerekÃt.
+EXP = KITEVŠ## Az e adott kitevőjű hatványát adja eredményül.
+FACT = FAKT ## Egy szám faktoriálisát számÃtja ki.
+FACTDOUBLE = FACTDOUBLE ## Egy szám dupla faktoriálisát adja eredményül.
+FLOOR = PADLÓ ## Egy számot lefelé, a nulla felé kerekÃt.
+GCD = GCD ## A legnagyobb közös osztót adja eredményül.
+INT = INT ## Egy számot lefelé kerekÃt a legközelebbi egészre.
+LCM = LCM ## A legkisebb közös többszöröst adja eredményül.
+LN = LN ## Egy szám természetes logaritmusát számÃtja ki.
+LOG = LOG ## Egy szám adott alapú logaritmusát számÃtja ki.
+LOG10 = LOG10 ## Egy szám 10-es alapú logaritmusát számÃtja ki.
+MDETERM = MDETERM ## Egy tömb mátrix-determinánsát számÃtja ki.
+MINVERSE = INVERZ.MÃTRIX ## Egy tömb mátrix inverzét adja eredményül.
+MMULT = MSZORZAT ## Két tömb mátrix-szorzatát adja meg.
+MOD = MARADÉK ## Egy szám osztási maradékát adja eredményül.
+MROUND = MROUND ## A kÃvánt többszörösére kerekÃtett értéket ad eredményül.
+MULTINOMIAL = MULTINOMIAL ## Számhalmaz multinomiálisát adja eredményül.
+ODD = PÃRATLAN ## Egy számot a legközelebbi páratlan számra kerekÃt.
+PI = PI ## A pi matematikai állandót adja vissza.
+POWER = HATVÃNY ## Egy szám adott kitevÅ‘jű hatványát számÃtja ki.
+PRODUCT = SZORZAT ## Argumentumai szorzatát számÃtja ki.
+QUOTIENT = QUOTIENT ## Egy hányados egész részét adja eredményül.
+RADIANS = RADIÃN ## Fokot radiánná alakÃt át.
+RAND = VÉL ## Egy 0 és 1 közötti véletlen számot ad eredményül.
+RANDBETWEEN = RANDBETWEEN ## Megadott számok közé esÅ‘ véletlen számot állÃt elÅ‘.
+ROMAN = RÓMAI ## Egy számot római számokkal kifejezve szövegként ad eredményül.
+ROUND = KEREKÃTÉS ## Egy számot adott számú számjegyre kerekÃt.
+ROUNDDOWN = KEREKÃTÉS.LE ## Egy számot lefelé, a nulla felé kerekÃt.
+ROUNDUP = KEREKÃTÉS.FEL ## Egy számot felfelé, a nullától távolabbra kerekÃt.
+SERIESSUM = SERIESSUM ## Hatványsor összegét adja eredményül.
+SIGN = ELÅJEL ## Egy szám elÅ‘jelét adja meg.
+SIN = SIN ## Egy szög szinuszát számÃtja ki.
+SINH = SINH ## Egy szám szinusz hiperbolikuszát számÃtja ki.
+SQRT = GYÖK ## Egy szám pozitÃv négyzetgyökét számÃtja ki.
+SQRTPI = SQRTPI ## A (szám*pi) négyzetgyökét adja eredményül.
+SUBTOTAL = RÉSZÖSSZEG ## Lista vagy adatbázis részösszegét adja eredményül.
+SUM = SZUM ## Összeadja az argumentumlistájában lévő számokat.
+SUMIF = SZUMHA ## A megadott feltételeknek eleget tevő cellákban található értékeket adja össze.
+SUMIFS = SZUMHATÖBB ## Több megadott feltételnek eleget tévő tartománycellák összegét adja eredményül.
+SUMPRODUCT = SZORZATÖSSZEG ## A megfelelÅ‘ tömbelemek szorzatának összegét számÃtja ki.
+SUMSQ = NÉGYZETÖSSZEG ## Argumentumai négyzetének összegét számÃtja ki.
+SUMX2MY2 = SZUMX2BÅLY2 ## Két tömb megfelelÅ‘ elemei négyzetének különbségét összegzi.
+SUMX2PY2 = SZUMX2MEGY2 ## Két tömb megfelelő elemei négyzetének összegét összegzi.
+SUMXMY2 = SZUMXBÅLY2 ## Két tömb megfelelÅ‘ elemei különbségének négyzetösszegét számÃtja ki.
+TAN = TAN ## Egy szám tangensét számÃtja ki.
+TANH = TANH ## Egy szám tangens hiperbolikuszát számÃtja ki.
+TRUNC = CSONK ## Egy számot egésszé csonkÃt.
+
+
+##
+## Statistical functions Statisztikai függvények
+##
+AVEDEV = ÃTL.ELTÉRÉS ## Az adatpontoknak átlaguktól való átlagos abszolút eltérését számÃtja ki.
+AVERAGE = ÃTLAG ## Argumentumai átlagát számÃtja ki.
+AVERAGEA = ÃTLAGA ## Argumentumai átlagát számÃtja ki (beleértve a számokat, szöveget és logikai értékeket).
+AVERAGEIF = ÃTLAGHA ## A megadott feltételnek eleget tévÅ‘ tartomány celláinak átlagát (számtani közepét) adja eredményül.
+AVERAGEIFS = ÃTLAGHATÖBB ## A megadott feltételeknek eleget tévÅ‘ cellák átlagát (számtani közepét) adja eredményül.
+BETADIST = BÉTA.ELOSZLÃS ## A béta-eloszlás függvényt számÃtja ki.
+BETAINV = INVERZ.BÉTA ## Adott béta-eloszláshoz kiszámÃtja a béta eloszlásfüggvény inverzét.
+BINOMDIST = BINOM.ELOSZLÃS ## A diszkrét binomiális eloszlás valószÃnűségértékét számÃtja ki.
+CHIDIST = KHI.ELOSZLÃS ## A khi-négyzet-eloszlás egyszélű valószÃnűségértékét számÃtja ki.
+CHIINV = INVERZ.KHI ## A khi-négyzet-eloszlás egyszélű valószÃnűségértékének inverzét számÃtja ki.
+CHITEST = KHI.PRÓBA ## Függetlenségvizsgálatot hajt végre.
+CONFIDENCE = MEGBÃZHATÓSÃG ## Egy statisztikai sokaság várható értékének megbÃzhatósági intervallumát adja eredményül.
+CORREL = KORREL ## Két adathalmaz korrelációs együtthatóját számÃtja ki.
+COUNT = DARAB ## Megszámolja, hogy argumentumlistájában hány szám található.
+COUNTA = DARAB2 ## Megszámolja, hogy argumentumlistájában hány érték található.
+COUNTBLANK = DARABÜRES ## Egy tartományban összeszámolja az üres cellákat.
+COUNTIF = DARABTELI ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek a megadott feltételnek.
+COUNTIFS = DARABHATÖBB ## Egy tartományban összeszámolja azokat a cellákat, amelyek eleget tesznek több feltételnek.
+COVAR = KOVAR ## A kovarianciát, azaz a páronkénti eltérések szorzatának átlagát számÃtja ki.
+CRITBINOM = KRITBINOM ## Azt a legkisebb számot adja eredményül, amelyre a binomiális eloszlásfüggvény értéke nem kisebb egy adott határértéknél.
+DEVSQ = SQ ## Az átlagtól való eltérések négyzetének összegét számÃtja ki.
+EXPONDIST = EXP.ELOSZLÃS ## Az exponenciális eloszlás értékét számÃtja ki.
+FDIST = F.ELOSZLÃS ## Az F-eloszlás értékét számÃtja ki.
+FINV = INVERZ.F ## Az F-eloszlás inverzének értékét számÃtja ki.
+FISHER = FISHER ## Fisher-transzformációt hajt végre.
+FISHERINV = INVERZ.FISHER ## A Fisher-transzformáció inverzét hajtja végre.
+FORECAST = ELÅREJELZÉS ## Az ismert értékek alapján lineáris regresszióval becsült értéket ad eredményül.
+FREQUENCY = GYAKORISÃG ## A gyakorisági vagy empirikus eloszlás értékét függÅ‘leges tömbként adja eredményül.
+FTEST = F.PRÓBA ## Az F-próba értékét adja eredményül.
+GAMMADIST = GAMMA.ELOSZLÃS ## A gamma-eloszlás értékét számÃtja ki.
+GAMMAINV = INVERZ.GAMMA ## A gamma-eloszlás eloszlásfüggvénye inverzének értékét számÃtja ki.
+GAMMALN = GAMMALN ## A gamma-függvény természetes logaritmusát számÃtja ki.
+GEOMEAN = MÉRTANI.KÖZÉP ## Argumentumai mértani középértékét számÃtja ki.
+GROWTH = NÖV ## Exponenciális regresszió alapján ad becslést.
+HARMEAN = HARM.KÖZÉP ## Argumentumai harmonikus átlagát számÃtja ki.
+HYPGEOMDIST = HIPERGEOM.ELOSZLÃS ## A hipergeometriai eloszlás értékét számÃtja ki.
+INTERCEPT = METSZ ## A regressziós egyenes y tengellyel való metszéspontját határozza meg.
+KURT = CSÚCSOSSÃG ## Egy adathalmaz csúcsosságát számÃtja ki.
+LARGE = NAGY ## Egy adathalmaz k-adik legnagyobb elemét adja eredményül.
+LINEST = LIN.ILL ## A legkisebb négyzetek módszerével az adatokra illesztett egyenes paramétereit határozza meg.
+LOGEST = LOG.ILL ## Az adatokra illesztett exponenciális görbe paramétereit határozza meg.
+LOGINV = INVERZ.LOG.ELOSZLÃS ## A lognormális eloszlás inverzét számÃtja ki.
+LOGNORMDIST = LOG.ELOSZLÃS ## A lognormális eloszlásfüggvény értékét számÃtja ki.
+MAX = MAX ## Az argumentumai között szereplő legnagyobb számot adja meg.
+MAXA = MAX2 ## Az argumentumai között szereplő legnagyobb számot adja meg (beleértve a számokat, szöveget és logikai értékeket).
+MEDIAN = MEDIÃN ## Adott számhalmaz mediánját számÃtja ki.
+MIN = MIN ## Az argumentumai között szereplő legkisebb számot adja meg.
+MINA = MIN2 ## Az argumentumai között szereplő legkisebb számot adja meg, beleértve a számokat, szöveget és logikai értékeket.
+MODE = MÓDUSZ ## Egy adathalmazból kiválasztja a leggyakrabban előforduló számot.
+NEGBINOMDIST = NEGBINOM.ELOSZL ## A negatÃv binomiális eloszlás értékét számÃtja ki.
+NORMDIST = NORM.ELOSZL ## A normális eloszlás értékét számÃtja ki.
+NORMINV = INVERZ.NORM ## A normális eloszlás eloszlásfüggvénye inverzének értékét számÃtja ki.
+NORMSDIST = STNORMELOSZL ## A standard normális eloszlás eloszlásfüggvényének értékét számÃtja ki.
+NORMSINV = INVERZ.STNORM ## A standard normális eloszlás eloszlásfüggvénye inverzének értékét számÃtja ki.
+PEARSON = PEARSON ## A Pearson-féle korrelációs együtthatót számÃtja ki.
+PERCENTILE = PERCENTILIS ## Egy tartományban található értékek k-adik percentilisét, azaz százalékosztályát adja eredményül.
+PERCENTRANK = SZÃZALÉKRANG ## Egy értéknek egy adathalmazon belül vett százalékos rangját (elhelyezkedését) számÃtja ki.
+PERMUT = VARIÃCIÓK ## Adott számú objektum k-ad osztályú ismétlés nélküli variációinak számát számÃtja ki.
+POISSON = POISSON ## A Poisson-eloszlás értékét számÃtja ki.
+PROB = VALÓSZÃNÅ°SÉG ## Annak valószÃnűségét számÃtja ki, hogy adott értékek két határérték közé esnek.
+QUARTILE = KVARTILIS ## Egy adathalmaz kvartilisét (negyedszintjét) számÃtja ki.
+RANK = SORSZÃM ## KiszámÃtja, hogy egy szám hányadik egy számsorozatban.
+RSQ = RNÉGYZET ## KiszámÃtja a Pearson-féle szorzatmomentum korrelációs együtthatójának négyzetét.
+SKEW = FERDESÉG ## Egy eloszlás ferdeségét határozza meg.
+SLOPE = MEREDEKSÉG ## Egy lineáris regressziós egyenes meredekségét számÃtja ki.
+SMALL = KICSI ## Egy adathalmaz k-adik legkisebb elemét adja meg.
+STANDARDIZE = NORMALIZÃLÃS ## Normalizált értéket ad eredményül.
+STDEV = SZÓRÃS ## Egy statisztikai sokaság mintájából kiszámÃtja annak szórását.
+STDEVA = SZÓRÃSA ## Egy statisztikai sokaság mintájából kiszámÃtja annak szórását (beleértve a számokat, szöveget és logikai értékeket).
+STDEVP = SZÓRÃSP ## Egy statisztikai sokaság egészébÅ‘l kiszámÃtja annak szórását.
+STDEVPA = SZÓRÃSPA ## Egy statisztikai sokaság egészébÅ‘l kiszámÃtja annak szórását (beleértve számokat, szöveget és logikai értékeket).
+STEYX = STHIBAYX ## Egy regresszió esetén az egyes x-értékek alapján meghatározott y-értékek standard hibáját számÃtja ki.
+TDIST = T.ELOSZLÃS ## A Student-féle t-eloszlás értékét számÃtja ki.
+TINV = INVERZ.T ## A Student-féle t-eloszlás inverzét számÃtja ki.
+TREND = TREND ## Lineáris trend értékeit számÃtja ki.
+TRIMMEAN = RÉSZÃTLAG ## Egy adathalmaz középsÅ‘ részének átlagát számÃtja ki.
+TTEST = T.PRÓBA ## A Student-féle t-próbához tartozó valószÃnűséget számÃtja ki.
+VAR = VAR ## Minta alapján becslést ad a varianciára.
+VARA = VARA ## Minta alapján becslést ad a varianciára (beleértve számokat, szöveget és logikai értékeket).
+VARP = VARP ## Egy statisztikai sokaság varianciáját számÃtja ki.
+VARPA = VARPA ## Egy statisztikai sokaság varianciáját számÃtja ki (beleértve számokat, szöveget és logikai értékeket).
+WEIBULL = WEIBULL ## A Weibull-féle eloszlás értékét számÃtja ki.
+ZTEST = Z.PRÓBA ## Az egyszélű z-próbával kapott valószÃnűségértéket számÃtja ki.
+
+
+##
+## Text functions Szövegműveletekhez használható függvények
+##
+ASC = ASC ## Szöveg teljes szélességű (kétbájtos) latin és katakana karaktereit félszélességű (egybájtos) karakterekké alakÃtja.
+BAHTTEXT = BAHTSZÖVEG ## Számot szöveggé alakÃt a ß (baht) pénznemformátum használatával.
+CHAR = KARAKTER ## A kódszámmal meghatározott karaktert adja eredményül.
+CLEAN = TISZTÃT ## A szövegbÅ‘l eltávolÃtja az összes nem nyomtatható karaktert.
+CODE = KÓD ## Karaktersorozat első karakterének numerikus kódját adja eredményül.
+CONCATENATE = ÖSSZEFŰZ ## Több szövegelemet egyetlen szöveges elemmé fűz össze.
+DOLLAR = FORINT ## Számot pénznem formátumú szöveggé alakÃt át.
+EXACT = AZONOS ## Megvizsgálja, hogy két érték azonos-e.
+FIND = SZÖVEG.TALÃL ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével).
+FINDB = SZÖVEG.TALÃL2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk megkülönböztetésével).
+FIXED = FIX ## Számot szöveges formátumúra alakÃt adott számú tizedesjegyre kerekÃtve.
+JIS = JIS ## A félszélességű (egybájtos) latin és a katakana karaktereket teljes szélességű (kétbájtos) karakterekké alakÃtja.
+LEFT = BAL ## Szöveg bal szélső karaktereit adja eredményül.
+LEFTB = BAL2 ## Szöveg bal szélső karaktereit adja eredményül.
+LEN = HOSSZ ## Szöveg karakterekben mért hosszát adja eredményül.
+LENB = HOSSZ2 ## Szöveg karakterekben mért hosszát adja eredményül.
+LOWER = KISBETÅ° ## Szöveget kisbetűssé alakÃt át.
+MID = KÖZÉP ## A szöveg adott pozÃciójától kezdve megadott számú karaktert ad vissza eredményként.
+MIDB = KÖZÉP2 ## A szöveg adott pozÃciójától kezdve megadott számú karaktert ad vissza eredményként.
+PHONETIC = PHONETIC ## Szöveg furigana (fonetikus) karaktereit adja vissza.
+PROPER = TNÉV ## Szöveg minden szavának kezdőbetűjét nagybetűsre cseréli.
+REPLACE = CSERE ## A szövegen belül karaktereket cserél.
+REPLACEB = CSERE2 ## A szövegen belül karaktereket cserél.
+REPT = SOKSZOR ## Megadott számú alkalommal megismétel egy szövegrészt.
+RIGHT = JOBB ## Szövegrész jobb szélső karaktereit adja eredményül.
+RIGHTB = JOBB2 ## Szövegrész jobb szélső karaktereit adja eredményül.
+SEARCH = SZÖVEG.KERES ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget).
+SEARCHB = SZÖVEG.KERES2 ## Karaktersorozatot keres egy másikban (a kis- és nagybetűk között nem tesz különbséget).
+SUBSTITUTE = HELYETTE ## Szövegben adott karaktereket másikra cserél.
+T = T ## Argumentumát szöveggé alakÃtja át.
+TEXT = SZÖVEG ## Számértéket alakÃt át adott számformátumú szöveggé.
+TRIM = TRIM ## A szövegbÅ‘l eltávolÃtja a szóközöket.
+UPPER = NAGYBETÅ°S ## Szöveget nagybetűssé alakÃt át.
+VALUE = ÉRTÉK ## Szöveget számmá alakÃt át.
diff --git a/Classes/PHPExcel/locale/it/config b/Classes/PHPExcel/locale/it/config
new file mode 100644
index 0000000..c3afa75
--- /dev/null
+++ b/Classes/PHPExcel/locale/it/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULLO!
+DIV0 = #DIV/0!
+VALUE = #VALORE!
+REF = #RIF!
+NAME = #NOME?
+NUM = #NUM!
+NA = #N/D
diff --git a/Classes/PHPExcel/locale/it/functions b/Classes/PHPExcel/locale/it/functions
new file mode 100644
index 0000000..d371f3d
--- /dev/null
+++ b/Classes/PHPExcel/locale/it/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Funzioni di automazione e dei componenti aggiuntivi
+##
+GETPIVOTDATA = INFO.DATI.TAB.PIVOT ## Restituisce i dati memorizzati in un rapporto di tabella pivot
+
+
+##
+## Cube functions Funzioni cubo
+##
+CUBEKPIMEMBER = MEMBRO.KPI.CUBO ## Restituisce il nome, la proprietà e la misura di un indicatore di prestazioni chiave (KPI) e visualizza il nome e la proprietà nella cella. Un KPI è una misura quantificabile, ad esempio l'utile lordo mensile o il fatturato trimestrale dei dipendenti, utilizzata per il monitoraggio delle prestazioni di un'organizzazione.
+CUBEMEMBER = MEMBRO.CUBO ## Restituisce un membro o una tupla in una gerarchia di cubi. Consente di verificare l'esistenza del membro o della tupla nel cubo.
+CUBEMEMBERPROPERTY = PROPRIETÀ.MEMBRO.CUBO ## Restituisce il valore di una proprietà di un membro del cubo. Consente di verificare l'esistenza di un nome di membro all'interno del cubo e di restituire la proprietà specificata per tale membro.
+CUBERANKEDMEMBER = MEMBRO.CUBO.CON.RANGO ## Restituisce l'n-esimo membro o il membro ordinato di un insieme. Consente di restituire uno o più elementi in un insieme, ad esempio l'agente di vendita migliore o i primi 10 studenti.
+CUBESET = SET.CUBO ## Definisce un insieme di tuple o membri calcolati mediante l'invio di un'espressione di insieme al cubo sul server. In questo modo l'insieme viene creato e restituito a Microsoft Office Excel.
+CUBESETCOUNT = CONTA.SET.CUBO ## Restituisce il numero di elementi di un insieme.
+CUBEVALUE = VALORE.CUBO ## Restituisce un valore aggregato da un cubo.
+
+
+##
+## Database functions Funzioni di database
+##
+DAVERAGE = DB.MEDIA ## Restituisce la media di voci del database selezionate
+DCOUNT = DB.CONTA.NUMERI ## Conta le celle di un database contenenti numeri
+DCOUNTA = DB.CONTA.VALORI ## Conta le celle non vuote in un database
+DGET = DB.VALORI ## Estrae da un database un singolo record che soddisfa i criteri specificati
+DMAX = DB.MAX ## Restituisce il valore massimo dalle voci selezionate in un database
+DMIN = DB.MIN ## Restituisce il valore minimo dalle voci di un database selezionate
+DPRODUCT = DB.PRODOTTO ## Moltiplica i valori in un determinato campo di record che soddisfano i criteri del database
+DSTDEV = DB.DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione di voci di un database selezionate
+DSTDEVP = DB.DEV.ST.POP ## Calcola la deviazione standard sulla base di tutte le voci di un database selezionate
+DSUM = DB.SOMMA ## Aggiunge i numeri nel campo colonna di record del database che soddisfa determinati criteri
+DVAR = DB.VAR ## Restituisce una stima della varianza sulla base di un campione da voci di un database selezionate
+DVARP = DB.VAR.POP ## Calcola la varianza sulla base di tutte le voci di un database selezionate
+
+
+##
+## Date and time functions Funzioni data e ora
+##
+DATE = DATA ## Restituisce il numero seriale di una determinata data
+DATEVALUE = DATA.VALORE ## Converte una data sotto forma di testo in un numero seriale
+DAY = GIORNO ## Converte un numero seriale in un giorno del mese
+DAYS360 = GIORNO360 ## Calcola il numero di giorni compreso tra due date basandosi su un anno di 360 giorni
+EDATE = DATA.MESE ## Restituisce il numero seriale della data che rappresenta il numero di mesi prima o dopo la data di inizio
+EOMONTH = FINE.MESE ## Restituisce il numero seriale dell'ultimo giorno del mese, prima o dopo un determinato numero di mesi
+HOUR = ORA ## Converte un numero seriale in un'ora
+MINUTE = MINUTO ## Converte un numero seriale in un minuto
+MONTH = MESE ## Converte un numero seriale in un mese
+NETWORKDAYS = GIORNI.LAVORATIVI.TOT ## Restituisce il numero di tutti i giorni lavorativi compresi fra due date
+NOW = ADESSO ## Restituisce il numero seriale della data e dell'ora corrente
+SECOND = SECONDO ## Converte un numero seriale in un secondo
+TIME = ORARIO ## Restituisce il numero seriale di una determinata ora
+TIMEVALUE = ORARIO.VALORE ## Converte un orario in forma di testo in un numero seriale
+TODAY = OGGI ## Restituisce il numero seriale relativo alla data odierna
+WEEKDAY = GIORNO.SETTIMANA ## Converte un numero seriale in un giorno della settimana
+WEEKNUM = NUM.SETTIMANA ## Converte un numero seriale in un numero che rappresenta la posizione numerica di una settimana nell'anno
+WORKDAY = GIORNO.LAVORATIVO ## Restituisce il numero della data prima o dopo un determinato numero di giorni lavorativi
+YEAR = ANNO ## Converte un numero seriale in un anno
+YEARFRAC = FRAZIONE.ANNO ## Restituisce la frazione dell'anno che rappresenta il numero dei giorni compresi tra una data_ iniziale e una data_finale
+
+
+##
+## Engineering functions Funzioni ingegneristiche
+##
+BESSELI = BESSEL.I ## Restituisce la funzione di Bessel modificata In(x)
+BESSELJ = BESSEL.J ## Restituisce la funzione di Bessel Jn(x)
+BESSELK = BESSEL.K ## Restituisce la funzione di Bessel modificata Kn(x)
+BESSELY = BESSEL.Y ## Restituisce la funzione di Bessel Yn(x)
+BIN2DEC = BINARIO.DECIMALE ## Converte un numero binario in decimale
+BIN2HEX = BINARIO.HEX ## Converte un numero binario in esadecimale
+BIN2OCT = BINARIO.OCT ## Converte un numero binario in ottale
+COMPLEX = COMPLESSO ## Converte i coefficienti reali e immaginari in numeri complessi
+CONVERT = CONVERTI ## Converte un numero da un sistema di misura in un altro
+DEC2BIN = DECIMALE.BINARIO ## Converte un numero decimale in binario
+DEC2HEX = DECIMALE.HEX ## Converte un numero decimale in esadecimale
+DEC2OCT = DECIMALE.OCT ## Converte un numero decimale in ottale
+DELTA = DELTA ## Verifica se due valori sono uguali
+ERF = FUNZ.ERRORE ## Restituisce la funzione di errore
+ERFC = FUNZ.ERRORE.COMP ## Restituisce la funzione di errore complementare
+GESTEP = SOGLIA ## Verifica se un numero è maggiore del valore di soglia
+HEX2BIN = HEX.BINARIO ## Converte un numero esadecimale in binario
+HEX2DEC = HEX.DECIMALE ## Converte un numero esadecimale in decimale
+HEX2OCT = HEX.OCT ## Converte un numero esadecimale in ottale
+IMABS = COMP.MODULO ## Restituisce il valore assoluto (modulo) di un numero complesso
+IMAGINARY = COMP.IMMAGINARIO ## Restituisce il coefficiente immaginario di un numero complesso
+IMARGUMENT = COMP.ARGOMENTO ## Restituisce l'argomento theta, un angolo espresso in radianti
+IMCONJUGATE = COMP.CONIUGATO ## Restituisce il complesso coniugato del numero complesso
+IMCOS = COMP.COS ## Restituisce il coseno di un numero complesso
+IMDIV = COMP.DIV ## Restituisce il quoziente di due numeri complessi
+IMEXP = COMP.EXP ## Restituisce il valore esponenziale di un numero complesso
+IMLN = COMP.LN ## Restituisce il logaritmo naturale di un numero complesso
+IMLOG10 = COMP.LOG10 ## Restituisce il logaritmo in base 10 di un numero complesso
+IMLOG2 = COMP.LOG2 ## Restituisce un logaritmo in base 2 di un numero complesso
+IMPOWER = COMP.POTENZA ## Restituisce il numero complesso elevato a una potenza intera
+IMPRODUCT = COMP.PRODOTTO ## Restituisce il prodotto di numeri complessi compresi tra 2 e 29
+IMREAL = COMP.PARTE.REALE ## Restituisce il coefficiente reale di un numero complesso
+IMSIN = COMP.SEN ## Restituisce il seno di un numero complesso
+IMSQRT = COMP.RADQ ## Restituisce la radice quadrata di un numero complesso
+IMSUB = COMP.DIFF ## Restituisce la differenza fra due numeri complessi
+IMSUM = COMP.SOMMA ## Restituisce la somma di numeri complessi
+OCT2BIN = OCT.BINARIO ## Converte un numero ottale in binario
+OCT2DEC = OCT.DECIMALE ## Converte un numero ottale in decimale
+OCT2HEX = OCT.HEX ## Converte un numero ottale in esadecimale
+
+
+##
+## Financial functions Funzioni finanziarie
+##
+ACCRINT = INT.MATURATO.PER ## Restituisce l'interesse maturato di un titolo che paga interessi periodici
+ACCRINTM = INT.MATURATO.SCAD ## Restituisce l'interesse maturato di un titolo che paga interessi alla scadenza
+AMORDEGRC = AMMORT.DEGR ## Restituisce l'ammortamento per ogni periodo contabile utilizzando un coefficiente di ammortamento
+AMORLINC = AMMORT.PER ## Restituisce l'ammortamento per ogni periodo contabile
+COUPDAYBS = GIORNI.CED.INIZ.LIQ ## Restituisce il numero dei giorni che vanno dall'inizio del periodo di durata della cedola alla data di liquidazione
+COUPDAYS = GIORNI.CED ## Restituisce il numero dei giorni relativi al periodo della cedola che contiene la data di liquidazione
+COUPDAYSNC = GIORNI.CED.NUOVA ## Restituisce il numero di giorni che vanno dalla data di liquidazione alla data della cedola successiva
+COUPNCD = DATA.CED.SUCC ## Restituisce un numero che rappresenta la data della cedola successiva alla data di liquidazione
+COUPNUM = NUM.CED ## Restituisce il numero di cedole pagabili fra la data di liquidazione e la data di scadenza
+COUPPCD = DATA.CED.PREC ## Restituisce un numero che rappresenta la data della cedola precedente alla data di liquidazione
+CUMIPMT = INT.CUMUL ## Restituisce l'interesse cumulativo pagato fra due periodi
+CUMPRINC = CAP.CUM ## Restituisce il capitale cumulativo pagato per estinguere un debito fra due periodi
+DB = DB ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a quote fisse decrescenti
+DDB = AMMORT ## Restituisce l'ammortamento di un bene per un periodo specificato utilizzando il metodo di ammortamento a doppie quote decrescenti o altri metodi specificati
+DISC = TASSO.SCONTO ## Restituisce il tasso di sconto per un titolo
+DOLLARDE = VALUTA.DEC ## Converte un prezzo valuta, espresso come frazione, in prezzo valuta, espresso come numero decimale
+DOLLARFR = VALUTA.FRAZ ## Converte un prezzo valuta, espresso come numero decimale, in prezzo valuta, espresso come frazione
+DURATION = DURATA ## Restituisce la durata annuale di un titolo con i pagamenti di interesse periodico
+EFFECT = EFFETTIVO ## Restituisce l'effettivo tasso di interesse annuo
+FV = VAL.FUT ## Restituisce il valore futuro di un investimento
+FVSCHEDULE = VAL.FUT.CAPITALE ## Restituisce il valore futuro di un capitale iniziale dopo aver applicato una serie di tassi di interesse composti
+INTRATE = TASSO.INT ## Restituisce il tasso di interesse per un titolo interamente investito
+IPMT = INTERESSI ## Restituisce il valore degli interessi per un investimento relativo a un periodo specifico
+IRR = TIR.COST ## Restituisce il tasso di rendimento interno per una serie di flussi di cassa
+ISPMT = INTERESSE.RATA ## Calcola l'interesse di un investimento pagato durante un periodo specifico
+MDURATION = DURATA.M ## Restituisce la durata Macauley modificata per un titolo con un valore presunto di € 100
+MIRR = TIR.VAR ## Restituisce il tasso di rendimento interno in cui i flussi di cassa positivi e negativi sono finanziati a tassi differenti
+NOMINAL = NOMINALE ## Restituisce il tasso di interesse nominale annuale
+NPER = NUM.RATE ## Restituisce un numero di periodi relativi a un investimento
+NPV = VAN ## Restituisce il valore attuale netto di un investimento basato su una serie di flussi di cassa periodici e sul tasso di sconto
+ODDFPRICE = PREZZO.PRIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente il primo periodo di durata irregolare
+ODDFYIELD = REND.PRIMO.IRR ## Restituisce il rendimento di un titolo avente il primo periodo di durata irregolare
+ODDLPRICE = PREZZO.ULTIMO.IRR ## Restituisce il prezzo di un titolo dal valore nominale di € 100 avente l'ultimo periodo di durata irregolare
+ODDLYIELD = REND.ULTIMO.IRR ## Restituisce il rendimento di un titolo avente l'ultimo periodo di durata irregolare
+PMT = RATA ## Restituisce il pagamento periodico di una rendita annua
+PPMT = P.RATA ## Restituisce il pagamento sul capitale di un investimento per un dato periodo
+PRICE = PREZZO ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga interessi periodici
+PRICEDISC = PREZZO.SCONT ## Restituisce il prezzo di un titolo scontato dal valore nominale di € 100
+PRICEMAT = PREZZO.SCAD ## Restituisce il prezzo di un titolo dal valore nominale di € 100 che paga gli interessi alla scadenza
+PV = VA ## Restituisce il valore attuale di un investimento
+RATE = TASSO ## Restituisce il tasso di interesse per un periodo di un'annualitÃ
+RECEIVED = RICEV.SCAD ## Restituisce l'ammontare ricevuto alla scadenza di un titolo interamente investito
+SLN = AMMORT.COST ## Restituisce l'ammortamento a quote costanti di un bene per un singolo periodo
+SYD = AMMORT.ANNUO ## Restituisce l'ammortamento a somma degli anni di un bene per un periodo specificato
+TBILLEQ = BOT.EQUIV ## Restituisce il rendimento equivalente ad un'obbligazione per un Buono ordinario del Tesoro
+TBILLPRICE = BOT.PREZZO ## Restituisce il prezzo di un Buono del Tesoro dal valore nominale di € 100
+TBILLYIELD = BOT.REND ## Restituisce il rendimento di un Buono del Tesoro
+VDB = AMMORT.VAR ## Restituisce l'ammortamento di un bene per un periodo specificato o parziale utilizzando il metodo a doppie quote proporzionali ai valori residui
+XIRR = TIR.X ## Restituisce il tasso di rendimento interno di un impiego di flussi di cassa
+XNPV = VAN.X ## Restituisce il valore attuale netto di un impiego di flussi di cassa non necessariamente periodici
+YIELD = REND ## Restituisce il rendimento di un titolo che frutta interessi periodici
+YIELDDISC = REND.TITOLI.SCONT ## Restituisce il rendimento annuale di un titolo scontato, ad esempio un Buono del Tesoro
+YIELDMAT = REND.SCAD ## Restituisce il rendimento annuo di un titolo che paga interessi alla scadenza
+
+
+##
+## Information functions Funzioni relative alle informazioni
+##
+CELL = CELLA ## Restituisce le informazioni sulla formattazione, la posizione o i contenuti di una cella
+ERROR.TYPE = ERRORE.TIPO ## Restituisce un numero che corrisponde a un tipo di errore
+INFO = INFO ## Restituisce le informazioni sull'ambiente operativo corrente
+ISBLANK = VAL.VUOTO ## Restituisce VERO se il valore è vuoto
+ISERR = VAL.ERR ## Restituisce VERO se il valore è un valore di errore qualsiasi tranne #N/D
+ISERROR = VAL.ERRORE ## Restituisce VERO se il valore è un valore di errore qualsiasi
+ISEVEN = VAL.PARI ## Restituisce VERO se il numero è pari
+ISLOGICAL = VAL.LOGICO ## Restituisce VERO se il valore è un valore logico
+ISNA = VAL.NON.DISP ## Restituisce VERO se il valore è un valore di errore #N/D
+ISNONTEXT = VAL.NON.TESTO ## Restituisce VERO se il valore non è in formato testo
+ISNUMBER = VAL.NUMERO ## Restituisce VERO se il valore è un numero
+ISODD = VAL.DISPARI ## Restituisce VERO se il numero è dispari
+ISREF = VAL.RIF ## Restituisce VERO se il valore è un riferimento
+ISTEXT = VAL.TESTO ## Restituisce VERO se il valore è in formato testo
+N = NUM ## Restituisce un valore convertito in numero
+NA = NON.DISP ## Restituisce il valore di errore #N/D
+TYPE = TIPO ## Restituisce un numero che indica il tipo di dati relativi a un valore
+
+
+##
+## Logical functions Funzioni logiche
+##
+AND = E ## Restituisce VERO se tutti gli argomenti sono VERO
+FALSE = FALSO ## Restituisce il valore logico FALSO
+IF = SE ## Specifica un test logico da eseguire
+IFERROR = SE.ERRORE ## Restituisce un valore specificato se una formula fornisce un errore come risultato; in caso contrario, restituisce il risultato della formula
+NOT = NON ## Inverte la logica degli argomenti
+OR = O ## Restituisce VERO se un argomento qualsiasi è VERO
+TRUE = VERO ## Restituisce il valore logico VERO
+
+
+##
+## Lookup and reference functions Funzioni di ricerca e di riferimento
+##
+ADDRESS = INDIRIZZO ## Restituisce un riferimento come testo in una singola cella di un foglio di lavoro
+AREAS = AREE ## Restituisce il numero di aree in un riferimento
+CHOOSE = SCEGLI ## Sceglie un valore da un elenco di valori
+COLUMN = RIF.COLONNA ## Restituisce il numero di colonna di un riferimento
+COLUMNS = COLONNE ## Restituisce il numero di colonne in un riferimento
+HLOOKUP = CERCA.ORIZZ ## Effettua una ricerca nella riga superiore di una matrice e restituisce il valore della cella specificata
+HYPERLINK = COLLEG.IPERTESTUALE ## Crea un collegamento che apre un documento memorizzato in un server di rete, una rete Intranet o Internet
+INDEX = INDICE ## Utilizza un indice per scegliere un valore da un riferimento o da una matrice
+INDIRECT = INDIRETTO ## Restituisce un riferimento specificato da un valore testo
+LOOKUP = CERCA ## Ricerca i valori in un vettore o in una matrice
+MATCH = CONFRONTA ## Ricerca i valori in un riferimento o in una matrice
+OFFSET = SCARTO ## Restituisce uno scarto di riferimento da un riferimento dato
+ROW = RIF.RIGA ## Restituisce il numero di riga di un riferimento
+ROWS = RIGHE ## Restituisce il numero delle righe in un riferimento
+RTD = DATITEMPOREALE ## Recupera dati in tempo reale da un programma che supporta l'automazione COM (automazione: Metodo per utilizzare gli oggetti di un'applicazione da un'altra applicazione o da un altro strumento di sviluppo. Precedentemente nota come automazione OLE, l'automazione è uno standard del settore e una caratteristica del modello COM (Component Object Model).)
+TRANSPOSE = MATR.TRASPOSTA ## Restituisce la trasposizione di una matrice
+VLOOKUP = CERCA.VERT ## Effettua una ricerca nella prima colonna di una matrice e si sposta attraverso la riga per restituire il valore di una cella
+
+
+##
+## Math and trigonometry functions Funzioni matematiche e trigonometriche
+##
+ABS = ASS ## Restituisce il valore assoluto di un numero.
+ACOS = ARCCOS ## Restituisce l'arcocoseno di un numero
+ACOSH = ARCCOSH ## Restituisce l'inverso del coseno iperbolico di un numero
+ASIN = ARCSEN ## Restituisce l'arcoseno di un numero
+ASINH = ARCSENH ## Restituisce l'inverso del seno iperbolico di un numero
+ATAN = ARCTAN ## Restituisce l'arcotangente di un numero
+ATAN2 = ARCTAN.2 ## Restituisce l'arcotangente delle coordinate x e y specificate
+ATANH = ARCTANH ## Restituisce l'inverso della tangente iperbolica di un numero
+CEILING = ARROTONDA.ECCESSO ## Arrotonda un numero per eccesso all'intero più vicino o al multiplo più vicino a peso
+COMBIN = COMBINAZIONE ## Restituisce il numero di combinazioni possibili per un numero assegnato di elementi
+COS = COS ## Restituisce il coseno dell'angolo specificato
+COSH = COSH ## Restituisce il coseno iperbolico di un numero
+DEGREES = GRADI ## Converte i radianti in gradi
+EVEN = PARI ## Arrotonda il valore assoluto di un numero per eccesso al più vicino intero pari
+EXP = ESP ## Restituisce il numero e elevato alla potenza di num
+FACT = FATTORIALE ## Restituisce il fattoriale di un numero
+FACTDOUBLE = FATT.DOPPIO ## Restituisce il fattoriale doppio di un numero
+FLOOR = ARROTONDA.DIFETTO ## Arrotonda un numero per difetto al multiplo più vicino a zero
+GCD = MCD ## Restituisce il massimo comune divisore
+INT = INT ## Arrotonda un numero per difetto al numero intero più vicino
+LCM = MCM ## Restituisce il minimo comune multiplo
+LN = LN ## Restituisce il logaritmo naturale di un numero
+LOG = LOG ## Restituisce il logaritmo di un numero in una specificata base
+LOG10 = LOG10 ## Restituisce il logaritmo in base 10 di un numero
+MDETERM = MATR.DETERM ## Restituisce il determinante di una matrice
+MINVERSE = MATR.INVERSA ## Restituisce l'inverso di una matrice
+MMULT = MATR.PRODOTTO ## Restituisce il prodotto di due matrici
+MOD = RESTO ## Restituisce il resto della divisione
+MROUND = ARROTONDA.MULTIPLO ## Restituisce un numero arrotondato al multiplo desiderato
+MULTINOMIAL = MULTINOMIALE ## Restituisce il multinomiale di un insieme di numeri
+ODD = DISPARI ## Arrotonda un numero per eccesso al più vicino intero dispari
+PI = PI.GRECO ## Restituisce il valore di pi greco
+POWER = POTENZA ## Restituisce il risultato di un numero elevato a potenza
+PRODUCT = PRODOTTO ## Moltiplica i suoi argomenti
+QUOTIENT = QUOZIENTE ## Restituisce la parte intera di una divisione
+RADIANS = RADIANTI ## Converte i gradi in radianti
+RAND = CASUALE ## Restituisce un numero casuale compreso tra 0 e 1
+RANDBETWEEN = CASUALE.TRA ## Restituisce un numero casuale compreso tra i numeri specificati
+ROMAN = ROMANO ## Restituisce il numero come numero romano sotto forma di testo
+ROUND = ARROTONDA ## Arrotonda il numero al numero di cifre specificato
+ROUNDDOWN = ARROTONDA.PER.DIF ## Arrotonda il valore assoluto di un numero per difetto
+ROUNDUP = ARROTONDA.PER.ECC ## Arrotonda il valore assoluto di un numero per eccesso
+SERIESSUM = SOMMA.SERIE ## Restituisce la somma di una serie di potenze in base alla formula
+SIGN = SEGNO ## Restituisce il segno di un numero
+SIN = SEN ## Restituisce il seno di un dato angolo
+SINH = SENH ## Restituisce il seno iperbolico di un numero
+SQRT = RADQ ## Restituisce una radice quadrata
+SQRTPI = RADQ.PI.GRECO ## Restituisce la radice quadrata di un numero (numero * pi greco)
+SUBTOTAL = SUBTOTALE ## Restituisce un subtotale in un elenco o in un database
+SUM = SOMMA ## Somma i suoi argomenti
+SUMIF = SOMMA.SE ## Somma le celle specificate da un dato criterio
+SUMIFS = SOMMA.PIÙ.SE ## Somma le celle in un intervallo che soddisfano più criteri
+SUMPRODUCT = MATR.SOMMA.PRODOTTO ## Restituisce la somma dei prodotti dei componenti corrispondenti della matrice
+SUMSQ = SOMMA.Q ## Restituisce la somma dei quadrati degli argomenti
+SUMX2MY2 = SOMMA.DIFF.Q ## Restituisce la somma della differenza dei quadrati dei corrispondenti elementi in due matrici
+SUMX2PY2 = SOMMA.SOMMA.Q ## Restituisce la somma della somma dei quadrati dei corrispondenti elementi in due matrici
+SUMXMY2 = SOMMA.Q.DIFF ## Restituisce la somma dei quadrati delle differenze dei corrispondenti elementi in due matrici
+TAN = TAN ## Restituisce la tangente di un numero
+TANH = TANH ## Restituisce la tangente iperbolica di un numero
+TRUNC = TRONCA ## Tronca la parte decimale di un numero
+
+
+##
+## Statistical functions Funzioni statistiche
+##
+AVEDEV = MEDIA.DEV ## Restituisce la media delle deviazioni assolute delle coordinate rispetto alla loro media
+AVERAGE = MEDIA ## Restituisce la media degli argomenti
+AVERAGEA = MEDIA.VALORI ## Restituisce la media degli argomenti, inclusi i numeri, il testo e i valori logici
+AVERAGEIF = MEDIA.SE ## Restituisce la media aritmetica di tutte le celle in un intervallo che soddisfano un determinato criterio
+AVERAGEIFS = MEDIA.PIÙ.SE ## Restituisce la media aritmetica di tutte le celle che soddisfano più criteri
+BETADIST = DISTRIB.BETA ## Restituisce la funzione di distribuzione cumulativa beta
+BETAINV = INV.BETA ## Restituisce l'inverso della funzione di distribuzione cumulativa per una distribuzione beta specificata
+BINOMDIST = DISTRIB.BINOM ## Restituisce la distribuzione binomiale per il termine individuale
+CHIDIST = DISTRIB.CHI ## Restituisce la probabilità a una coda per la distribuzione del chi quadrato
+CHIINV = INV.CHI ## Restituisce l'inverso della probabilità ad una coda per la distribuzione del chi quadrato
+CHITEST = TEST.CHI ## Restituisce il test per l'indipendenza
+CONFIDENCE = CONFIDENZA ## Restituisce l'intervallo di confidenza per una popolazione
+CORREL = CORRELAZIONE ## Restituisce il coefficiente di correlazione tra due insiemi di dati
+COUNT = CONTA.NUMERI ## Conta la quantità di numeri nell'elenco di argomenti
+COUNTA = CONTA.VALORI ## Conta il numero di valori nell'elenco di argomenti
+COUNTBLANK = CONTA.VUOTE ## Conta il numero di celle vuote all'interno di un intervallo
+COUNTIF = CONTA.SE ## Conta il numero di celle all'interno di un intervallo che soddisfa i criteri specificati
+COUNTIFS = CONTA.PIÙ.SE ## Conta il numero di celle in un intervallo che soddisfano più criteri.
+COVAR = COVARIANZA ## Calcola la covarianza, la media dei prodotti delle deviazioni accoppiate
+CRITBINOM = CRIT.BINOM ## Restituisce il più piccolo valore per il quale la distribuzione cumulativa binomiale risulta maggiore o uguale ad un valore di criterio
+DEVSQ = DEV.Q ## Restituisce la somma dei quadrati delle deviazioni
+EXPONDIST = DISTRIB.EXP ## Restituisce la distribuzione esponenziale
+FDIST = DISTRIB.F ## Restituisce la distribuzione di probabilità F
+FINV = INV.F ## Restituisce l'inverso della distribuzione della probabilità F
+FISHER = FISHER ## Restituisce la trasformazione di Fisher
+FISHERINV = INV.FISHER ## Restituisce l'inverso della trasformazione di Fisher
+FORECAST = PREVISIONE ## Restituisce i valori lungo una tendenza lineare
+FREQUENCY = FREQUENZA ## Restituisce la distribuzione di frequenza come matrice verticale
+FTEST = TEST.F ## Restituisce il risultato di un test F
+GAMMADIST = DISTRIB.GAMMA ## Restituisce la distribuzione gamma
+GAMMAINV = INV.GAMMA ## Restituisce l'inverso della distribuzione cumulativa gamma
+GAMMALN = LN.GAMMA ## Restituisce il logaritmo naturale della funzione gamma, G(x)
+GEOMEAN = MEDIA.GEOMETRICA ## Restituisce la media geometrica
+GROWTH = CRESCITA ## Restituisce i valori lungo una linea di tendenza esponenziale
+HARMEAN = MEDIA.ARMONICA ## Restituisce la media armonica
+HYPGEOMDIST = DISTRIB.IPERGEOM ## Restituisce la distribuzione ipergeometrica
+INTERCEPT = INTERCETTA ## Restituisce l'intercetta della retta di regressione lineare
+KURT = CURTOSI ## Restituisce la curtosi di un insieme di dati
+LARGE = GRANDE ## Restituisce il k-esimo valore più grande in un insieme di dati
+LINEST = REGR.LIN ## Restituisce i parametri di una tendenza lineare
+LOGEST = REGR.LOG ## Restituisce i parametri di una linea di tendenza esponenziale
+LOGINV = INV.LOGNORM ## Restituisce l'inverso di una distribuzione lognormale
+LOGNORMDIST = DISTRIB.LOGNORM ## Restituisce la distribuzione lognormale cumulativa
+MAX = MAX ## Restituisce il valore massimo in un elenco di argomenti
+MAXA = MAX.VALORI ## Restituisce il valore massimo in un elenco di argomenti, inclusi i numeri, il testo e i valori logici
+MEDIAN = MEDIANA ## Restituisce la mediana dei numeri specificati
+MIN = MIN ## Restituisce il valore minimo in un elenco di argomenti
+MINA = MIN.VALORI ## Restituisce il più piccolo valore in un elenco di argomenti, inclusi i numeri, il testo e i valori logici
+MODE = MODA ## Restituisce il valore più comune in un insieme di dati
+NEGBINOMDIST = DISTRIB.BINOM.NEG ## Restituisce la distribuzione binomiale negativa
+NORMDIST = DISTRIB.NORM ## Restituisce la distribuzione cumulativa normale
+NORMINV = INV.NORM ## Restituisce l'inverso della distribuzione cumulativa normale standard
+NORMSDIST = DISTRIB.NORM.ST ## Restituisce la distribuzione cumulativa normale standard
+NORMSINV = INV.NORM.ST ## Restituisce l'inverso della distribuzione cumulativa normale
+PEARSON = PEARSON ## Restituisce il coefficiente del momento di correlazione di Pearson
+PERCENTILE = PERCENTILE ## Restituisce il k-esimo dato percentile di valori in un intervallo
+PERCENTRANK = PERCENT.RANGO ## Restituisce il rango di un valore in un insieme di dati come percentuale
+PERMUT = PERMUTAZIONE ## Restituisce il numero delle permutazioni per un determinato numero di oggetti
+POISSON = POISSON ## Restituisce la distribuzione di Poisson
+PROB = PROBABILITÀ ## Calcola la probabilità che dei valori in un intervallo siano compresi tra due limiti
+QUARTILE = QUARTILE ## Restituisce il quartile di un insieme di dati
+RANK = RANGO ## Restituisce il rango di un numero in un elenco di numeri
+RSQ = RQ ## Restituisce la radice quadrata del coefficiente di momento di correlazione di Pearson
+SKEW = ASIMMETRIA ## Restituisce il grado di asimmetria di una distribuzione
+SLOPE = PENDENZA ## Restituisce la pendenza di una retta di regressione lineare
+SMALL = PICCOLO ## Restituisce il k-esimo valore più piccolo in un insieme di dati
+STANDARDIZE = NORMALIZZA ## Restituisce un valore normalizzato
+STDEV = DEV.ST ## Restituisce una stima della deviazione standard sulla base di un campione
+STDEVA = DEV.ST.VALORI ## Restituisce una stima della deviazione standard sulla base di un campione, inclusi i numeri, il testo e i valori logici
+STDEVP = DEV.ST.POP ## Calcola la deviazione standard sulla base di un'intera popolazione
+STDEVPA = DEV.ST.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici
+STEYX = ERR.STD.YX ## Restituisce l'errore standard del valore previsto per y per ogni valore x nella regressione
+TDIST = DISTRIB.T ## Restituisce la distribuzione t di Student
+TINV = INV.T ## Restituisce l'inversa della distribuzione t di Student
+TREND = TENDENZA ## Restituisce i valori lungo una linea di tendenza lineare
+TRIMMEAN = MEDIA.TRONCATA ## Restituisce la media della parte interna di un insieme di dati
+TTEST = TEST.T ## Restituisce la probabilità associata ad un test t di Student
+VAR = VAR ## Stima la varianza sulla base di un campione
+VARA = VAR.VALORI ## Stima la varianza sulla base di un campione, inclusi i numeri, il testo e i valori logici
+VARP = VAR.POP ## Calcola la varianza sulla base dell'intera popolazione
+VARPA = VAR.POP.VALORI ## Calcola la deviazione standard sulla base sull'intera popolazione, inclusi i numeri, il testo e i valori logici
+WEIBULL = WEIBULL ## Restituisce la distribuzione di Weibull
+ZTEST = TEST.Z ## Restituisce il valore di probabilità a una coda per un test z
+
+
+##
+## Text functions Funzioni di testo
+##
+ASC = ASC ## Modifica le lettere inglesi o il katakana a doppio byte all'interno di una stringa di caratteri in caratteri a singolo byte
+BAHTTEXT = BAHTTESTO ## Converte un numero in testo, utilizzando il formato valuta ß (baht)
+CHAR = CODICE.CARATT ## Restituisce il carattere specificato dal numero di codice
+CLEAN = LIBERA ## Elimina dal testo tutti i caratteri che non è possibile stampare
+CODE = CODICE ## Restituisce il codice numerico del primo carattere di una stringa di testo
+CONCATENATE = CONCATENA ## Unisce diversi elementi di testo in un unico elemento di testo
+DOLLAR = VALUTA ## Converte un numero in testo, utilizzando il formato valuta € (euro)
+EXACT = IDENTICO ## Verifica se due valori di testo sono uguali
+FIND = TROVA ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole)
+FINDB = TROVA.B ## Rileva un valore di testo all'interno di un altro (distinzione tra maiuscole e minuscole)
+FIXED = FISSO ## Formatta un numero come testo con un numero fisso di decimali
+JIS = ORDINAMENTO.JIS ## Modifica le lettere inglesi o i caratteri katakana a byte singolo all'interno di una stringa di caratteri in caratteri a byte doppio.
+LEFT = SINISTRA ## Restituisce il carattere più a sinistra di un valore di testo
+LEFTB = SINISTRA.B ## Restituisce il carattere più a sinistra di un valore di testo
+LEN = LUNGHEZZA ## Restituisce il numero di caratteri di una stringa di testo
+LENB = LUNB ## Restituisce il numero di caratteri di una stringa di testo
+LOWER = MINUSC ## Converte il testo in lettere minuscole
+MID = MEDIA ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata
+MIDB = MEDIA.B ## Restituisce un numero specifico di caratteri di una stringa di testo a partire dalla posizione specificata
+PHONETIC = FURIGANA ## Estrae i caratteri fonetici (furigana) da una stringa di testo.
+PROPER = MAIUSC.INIZ ## Converte in maiuscolo la prima lettera di ogni parola di un valore di testo
+REPLACE = RIMPIAZZA ## Sostituisce i caratteri all'interno di un testo
+REPLACEB = SOSTITUISCI.B ## Sostituisce i caratteri all'interno di un testo
+REPT = RIPETI ## Ripete un testo per un dato numero di volte
+RIGHT = DESTRA ## Restituisce il carattere più a destra di un valore di testo
+RIGHTB = DESTRA.B ## Restituisce il carattere più a destra di un valore di testo
+SEARCH = RICERCA ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole)
+SEARCHB = CERCA.B ## Rileva un valore di testo all'interno di un altro (non è sensibile alle maiuscole e minuscole)
+SUBSTITUTE = SOSTITUISCI ## Sostituisce il nuovo testo al testo contenuto in una stringa
+T = T ## Converte gli argomenti in testo
+TEXT = TESTO ## Formatta un numero e lo converte in testo
+TRIM = ANNULLA.SPAZI ## Elimina gli spazi dal testo
+UPPER = MAIUSC ## Converte il testo in lettere maiuscole
+VALUE = VALORE ## Converte un argomento di testo in numero
diff --git a/Classes/PHPExcel/locale/nl/config b/Classes/PHPExcel/locale/nl/config
new file mode 100644
index 0000000..48dcc15
--- /dev/null
+++ b/Classes/PHPExcel/locale/nl/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #LEEG!
+DIV0 = #DEEL/0!
+VALUE = #WAARDE!
+REF = #VERW!
+NAME = #NAAM?
+NUM = #GETAL!
+NA = #N/B
diff --git a/Classes/PHPExcel/locale/nl/functions b/Classes/PHPExcel/locale/nl/functions
new file mode 100644
index 0000000..573600a
--- /dev/null
+++ b/Classes/PHPExcel/locale/nl/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Automatiseringsfuncties en functies in invoegtoepassingen
+##
+GETPIVOTDATA = DRAAITABEL.OPHALEN ## Geeft gegevens uit een draaitabelrapport als resultaat
+
+
+##
+## Cube functions Kubusfuncties
+##
+CUBEKPIMEMBER = KUBUSKPILID ## Retourneert de naam, eigenschap en waarde van een KPI (prestatie-indicator) en geeft de naam en de eigenschap in de cel weer. Een KPI is een meetbare waarde, zoals de maandelijkse brutowinst of de omzet per kwartaal per werknemer, die wordt gebruikt om de prestaties van een organisatie te bewaken
+CUBEMEMBER = KUBUSLID ## Retourneert een lid of tupel in een kubushiërarchie. Wordt gebruikt om te controleren of het lid of de tupel in de kubus aanwezig is
+CUBEMEMBERPROPERTY = KUBUSLIDEIGENSCHAP ## Retourneert de waarde van een lideigenschap in de kubus. Wordt gebruikt om te controleren of de lidnaam in de kubus bestaat en retourneert de opgegeven eigenschap voor dit lid
+CUBERANKEDMEMBER = KUBUSGERANGCHIKTLID ## Retourneert het zoveelste, gerangschikte lid in een set. Wordt gebruikt om een of meer elementen in een set te retourneren, zoals de tien beste verkopers of de tien beste studenten
+CUBESET = KUBUSSET ## Definieert een berekende set leden of tupels door een ingestelde expressie naar de kubus op de server te sturen, alwaar de set wordt gemaakt en vervolgens wordt geretourneerd naar Microsoft Office Excel
+CUBESETCOUNT = KUBUSSETAANTAL ## Retourneert het aantal onderdelen in een set
+CUBEVALUE = KUBUSWAARDE ## Retourneert een samengestelde waarde van een kubus
+
+
+##
+## Database functions Databasefuncties
+##
+DAVERAGE = DBGEMIDDELDE ## Berekent de gemiddelde waarde in geselecteerde databasegegevens
+DCOUNT = DBAANTAL ## Telt de cellen met getallen in een database
+DCOUNTA = DBAANTALC ## Telt de niet-lege cellen in een database
+DGET = DBLEZEN ## Retourneert één record dat voldoet aan de opgegeven criteria uit een database
+DMAX = DBMAX ## Retourneert de maximumwaarde in de geselecteerde databasegegevens
+DMIN = DBMIN ## Retourneert de minimumwaarde in de geselecteerde databasegegevens
+DPRODUCT = DBPRODUCT ## Vermenigvuldigt de waarden in een bepaald veld van de records die voldoen aan de criteria in een database
+DSTDEV = DBSTDEV ## Maakt een schatting van de standaarddeviatie op basis van een steekproef uit geselecteerde databasegegevens
+DSTDEVP = DBSTDEVP ## Berekent de standaarddeviatie op basis van de volledige populatie van geselecteerde databasegegevens
+DSUM = DBSOM ## Telt de getallen uit een kolom records in de database op die voldoen aan de criteria
+DVAR = DBVAR ## Maakt een schatting van de variantie op basis van een steekproef uit geselecteerde databasegegevens
+DVARP = DBVARP ## Berekent de variantie op basis van de volledige populatie van geselecteerde databasegegevens
+
+
+##
+## Date and time functions Datum- en tijdfuncties
+##
+DATE = DATUM ## Geeft als resultaat het seriële getal van een opgegeven datum
+DATEVALUE = DATUMWAARDE ## Converteert een datum in de vorm van tekst naar een serieel getal
+DAY = DAG ## Converteert een serieel getal naar een dag van de maand
+DAYS360 = DAGEN360 ## Berekent het aantal dagen tussen twee datums op basis van een jaar met 360 dagen
+EDATE = ZELFDE.DAG ## Geeft als resultaat het seriële getal van een datum die het opgegeven aantal maanden voor of na de begindatum ligt
+EOMONTH = LAATSTE.DAG ## Geeft als resultaat het seriële getal van de laatste dag van de maand voor of na het opgegeven aantal maanden
+HOUR = UUR ## Converteert een serieel getal naar uren
+MINUTE = MINUUT ## Converteert een serieel naar getal minuten
+MONTH = MAAND ## Converteert een serieel getal naar een maand
+NETWORKDAYS = NETTO.WERKDAGEN ## Geeft als resultaat het aantal hele werkdagen tussen twee datums
+NOW = NU ## Geeft als resultaat het seriële getal van de huidige datum en tijd
+SECOND = SECONDE ## Converteert een serieel getal naar seconden
+TIME = TIJD ## Geeft als resultaat het seriële getal van een bepaald tijdstip
+TIMEVALUE = TIJDWAARDE ## Converteert de tijd in de vorm van tekst naar een serieel getal
+TODAY = VANDAAG ## Geeft als resultaat het seriële getal van de huidige datum
+WEEKDAY = WEEKDAG ## Converteert een serieel getal naar een weekdag
+WEEKNUM = WEEKNUMMER ## Converteert een serieel getal naar een weeknummer
+WORKDAY = WERKDAG ## Geeft als resultaat het seriële getal van de datum voor of na een bepaald aantal werkdagen
+YEAR = JAAR ## Converteert een serieel getal naar een jaar
+YEARFRAC = JAAR.DEEL ## Geeft als resultaat het gedeelte van het jaar, uitgedrukt in het aantal hele dagen tussen begindatum en einddatum
+
+
+##
+## Engineering functions Technische functies
+##
+BESSELI = BESSEL.Y ## Geeft als resultaat de gewijzigde Bessel-functie In(x)
+BESSELJ = BESSEL.J ## Geeft als resultaat de Bessel-functie Jn(x)
+BESSELK = BESSEL.K ## Geeft als resultaat de gewijzigde Bessel-functie Kn(x)
+BESSELY = BESSEL.Y ## Geeft als resultaat de gewijzigde Bessel-functie Yn(x)
+BIN2DEC = BIN.N.DEC ## Converteert een binair getal naar een decimaal getal
+BIN2HEX = BIN.N.HEX ## Converteert een binair getal naar een hexadecimaal getal
+BIN2OCT = BIN.N.OCT ## Converteert een binair getal naar een octaal getal
+COMPLEX = COMPLEX ## Converteert reële en imaginaire coëfficiënten naar een complex getal
+CONVERT = CONVERTEREN ## Converteert een getal in de ene maateenheid naar een getal in een andere maateenheid
+DEC2BIN = DEC.N.BIN ## Converteert een decimaal getal naar een binair getal
+DEC2HEX = DEC.N.HEX ## Converteert een decimaal getal naar een hexadecimaal getal
+DEC2OCT = DEC.N.OCT ## Converteert een decimaal getal naar een octaal getal
+DELTA = DELTA ## Test of twee waarden gelijk zijn
+ERF = FOUTFUNCTIE ## Geeft als resultaat de foutfunctie
+ERFC = FOUT.COMPLEMENT ## Geeft als resultaat de complementaire foutfunctie
+GESTEP = GROTER.DAN ## Test of een getal groter is dan de drempelwaarde
+HEX2BIN = HEX.N.BIN ## Converteert een hexadecimaal getal naar een binair getal
+HEX2DEC = HEX.N.DEC ## Converteert een hexadecimaal getal naar een decimaal getal
+HEX2OCT = HEX.N.OCT ## Converteert een hexadecimaal getal naar een octaal getal
+IMABS = C.ABS ## Geeft als resultaat de absolute waarde (modulus) van een complex getal
+IMAGINARY = C.IM.DEEL ## Geeft als resultaat de imaginaire coëfficiënt van een complex getal
+IMARGUMENT = C.ARGUMENT ## Geeft als resultaat het argument thèta, een hoek uitgedrukt in radialen
+IMCONJUGATE = C.TOEGEVOEGD ## Geeft als resultaat het complexe toegevoegde getal van een complex getal
+IMCOS = C.COS ## Geeft als resultaat de cosinus van een complex getal
+IMDIV = C.QUOTIENT ## Geeft als resultaat het quotiënt van twee complexe getallen
+IMEXP = C.EXP ## Geeft als resultaat de exponent van een complex getal
+IMLN = C.LN ## Geeft als resultaat de natuurlijke logaritme van een complex getal
+IMLOG10 = C.LOG10 ## Geeft als resultaat de logaritme met grondtal 10 van een complex getal
+IMLOG2 = C.LOG2 ## Geeft als resultaat de logaritme met grondtal 2 van een complex getal
+IMPOWER = C.MACHT ## Geeft als resultaat een complex getal dat is verheven tot de macht van een geheel getal
+IMPRODUCT = C.PRODUCT ## Geeft als resultaat het product van complexe getallen
+IMREAL = C.REEEL.DEEL ## Geeft als resultaat de reële coëfficiënt van een complex getal
+IMSIN = C.SIN ## Geeft als resultaat de sinus van een complex getal
+IMSQRT = C.WORTEL ## Geeft als resultaat de vierkantswortel van een complex getal
+IMSUB = C.VERSCHIL ## Geeft als resultaat het verschil tussen twee complexe getallen
+IMSUM = C.SOM ## Geeft als resultaat de som van complexe getallen
+OCT2BIN = OCT.N.BIN ## Converteert een octaal getal naar een binair getal
+OCT2DEC = OCT.N.DEC ## Converteert een octaal getal naar een decimaal getal
+OCT2HEX = OCT.N.HEX ## Converteert een octaal getal naar een hexadecimaal getal
+
+
+##
+## Financial functions Financiële functies
+##
+ACCRINT = SAMENG.RENTE ## Berekent de opgelopen rente voor een waardepapier waarvan de rente periodiek wordt uitgekeerd
+ACCRINTM = SAMENG.RENTE.V ## Berekent de opgelopen rente voor een waardepapier waarvan de rente op de vervaldatum wordt uitgekeerd
+AMORDEGRC = AMORDEGRC ## Geeft als resultaat de afschrijving voor elke boekingsperiode door een afschrijvingscoëfficiënt toe te passen
+AMORLINC = AMORLINC ## Berekent de afschrijving voor elke boekingsperiode
+COUPDAYBS = COUP.DAGEN.BB ## Berekent het aantal dagen vanaf het begin van de coupontermijn tot de stortingsdatum
+COUPDAYS = COUP.DAGEN ## Geeft als resultaat het aantal dagen in de coupontermijn waarin de stortingsdatum valt
+COUPDAYSNC = COUP.DAGEN.VV ## Geeft als resultaat het aantal dagen vanaf de stortingsdatum tot de volgende couponvervaldatum
+COUPNCD = COUP.DATUM.NB ## Geeft als resultaat de volgende coupondatum na de stortingsdatum
+COUPNUM = COUP.AANTAL ## Geeft als resultaat het aantal coupons dat nog moet worden uitbetaald tussen de stortingsdatum en de vervaldatum
+COUPPCD = COUP.DATUM.VB ## Geeft als resultaat de vorige couponvervaldatum vóór de stortingsdatum
+CUMIPMT = CUM.RENTE ## Geeft als resultaat de cumulatieve rente die tussen twee termijnen is uitgekeerd
+CUMPRINC = CUM.HOOFDSOM ## Geeft als resultaat de cumulatieve hoofdsom van een lening die tussen twee termijnen is terugbetaald
+DB = DB ## Geeft als resultaat de afschrijving van activa voor een bepaalde periode met behulp van de 'fixed declining balance'-methode
+DDB = DDB ## Geeft als resultaat de afschrijving van activa over een bepaalde termijn met behulp van de 'double declining balance'-methode of een andere methode die u opgeeft
+DISC = DISCONTO ## Geeft als resultaat het discontopercentage voor een waardepapier
+DOLLARDE = EURO.DE ## Converteert een prijs in euro's, uitgedrukt in een breuk, naar een prijs in euro's, uitgedrukt in een decimaal getal
+DOLLARFR = EURO.BR ## Converteert een prijs in euro's, uitgedrukt in een decimaal getal, naar een prijs in euro's, uitgedrukt in een breuk
+DURATION = DUUR ## Geeft als resultaat de gewogen gemiddelde looptijd voor een waardepapier met periodieke rentebetalingen
+EFFECT = EFFECT.RENTE ## Geeft als resultaat het effectieve jaarlijkse rentepercentage
+FV = TW ## Geeft als resultaat de toekomstige waarde van een investering
+FVSCHEDULE = TOEK.WAARDE2 ## Geeft als resultaat de toekomstige waarde van een bepaalde hoofdsom na het toepassen van een reeks samengestelde rentepercentages
+INTRATE = RENTEPERCENTAGE ## Geeft als resultaat het rentepercentage voor een volgestort waardepapier
+IPMT = IBET ## Geeft als resultaat de te betalen rente voor een investering over een bepaalde termijn
+IRR = IR ## Geeft als resultaat de interne rentabiliteit voor een reeks cashflows
+ISPMT = ISBET ## Geeft als resultaat de rente die is betaald tijdens een bepaalde termijn van een investering
+MDURATION = AANG.DUUR ## Geeft als resultaat de aangepaste Macauley-looptijd voor een waardepapier, aangenomen dat de nominale waarde € 100 bedraagt
+MIRR = GIR ## Geeft als resultaat de interne rentabiliteit voor een serie cashflows, waarbij voor betalingen een ander rentepercentage geldt dan voor inkomsten
+NOMINAL = NOMINALE.RENTE ## Geeft als resultaat het nominale jaarlijkse rentepercentage
+NPER = NPER ## Geeft als resultaat het aantal termijnen van een investering
+NPV = NHW ## Geeft als resultaat de netto huidige waarde van een investering op basis van een reeks periodieke cashflows en een discontopercentage
+ODDFPRICE = AFW.ET.PRIJS ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier met een afwijkende eerste termijn
+ODDFYIELD = AFW.ET.REND ## Geeft als resultaat het rendement voor een waardepapier met een afwijkende eerste termijn
+ODDLPRICE = AFW.LT.PRIJS ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier met een afwijkende laatste termijn
+ODDLYIELD = AFW.LT.REND ## Geeft als resultaat het rendement voor een waardepapier met een afwijkende laatste termijn
+PMT = BET ## Geeft als resultaat de periodieke betaling voor een annuïteit
+PPMT = PBET ## Geeft als resultaat de afbetaling op de hoofdsom voor een bepaalde termijn
+PRICE = PRIJS.NOM ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier waarvan de rente periodiek wordt uitgekeerd
+PRICEDISC = PRIJS.DISCONTO ## Geeft als resultaat de prijs per € 100 nominale waarde voor een verdisconteerd waardepapier
+PRICEMAT = PRIJS.VERVALDAG ## Geeft als resultaat de prijs per € 100 nominale waarde voor een waardepapier waarvan de rente wordt uitgekeerd op de vervaldatum
+PV = HW ## Geeft als resultaat de huidige waarde van een investering
+RATE = RENTE ## Geeft als resultaat het periodieke rentepercentage voor een annuïteit
+RECEIVED = OPBRENGST ## Geeft als resultaat het bedrag dat op de vervaldatum wordt uitgekeerd voor een volgestort waardepapier
+SLN = LIN.AFSCHR ## Geeft als resultaat de lineaire afschrijving van activa over één termijn
+SYD = SYD ## Geeft als resultaat de afschrijving van activa over een bepaalde termijn met behulp van de 'Sum-Of-Years-Digits'-methode
+TBILLEQ = SCHATK.OBL ## Geeft als resultaat het rendement op schatkistpapier, dat op dezelfde manier wordt berekend als het rendement op obligaties
+TBILLPRICE = SCHATK.PRIJS ## Bepaalt de prijs per € 100 nominale waarde voor schatkistpapier
+TBILLYIELD = SCHATK.REND ## Berekent het rendement voor schatkistpapier
+VDB = VDB ## Geeft als resultaat de afschrijving van activa over een gehele of gedeeltelijke termijn met behulp van de 'declining balance'-methode
+XIRR = IR.SCHEMA ## Berekent de interne rentabiliteit voor een betalingsschema van cashflows
+XNPV = NHW2 ## Berekent de huidige nettowaarde voor een betalingsschema van cashflows
+YIELD = RENDEMENT ## Geeft als resultaat het rendement voor een waardepapier waarvan de rente periodiek wordt uitgekeerd
+YIELDDISC = REND.DISCONTO ## Geeft als resultaat het jaarlijkse rendement voor een verdisconteerd waardepapier, bijvoorbeeld schatkistpapier
+YIELDMAT = REND.VERVAL ## Geeft als resultaat het jaarlijkse rendement voor een waardepapier waarvan de rente wordt uitgekeerd op de vervaldatum
+
+
+##
+## Information functions Informatiefuncties
+##
+CELL = CEL ## Geeft als resultaat informatie over de opmaak, locatie of inhoud van een cel
+ERROR.TYPE = TYPE.FOUT ## Geeft als resultaat een getal dat overeenkomt met een van de foutwaarden van Microsoft Excel
+INFO = INFO ## Geeft als resultaat informatie over de huidige besturingsomgeving
+ISBLANK = ISLEEG ## Geeft als resultaat WAAR als de waarde leeg is
+ISERR = ISFOUT2 ## Geeft als resultaat WAAR als de waarde een foutwaarde is, met uitzondering van #N/B
+ISERROR = ISFOUT ## Geeft als resultaat WAAR als de waarde een foutwaarde is
+ISEVEN = IS.EVEN ## Geeft als resultaat WAAR als het getal even is
+ISLOGICAL = ISLOGISCH ## Geeft als resultaat WAAR als de waarde een logische waarde is
+ISNA = ISNB ## Geeft als resultaat WAAR als de waarde de foutwaarde #N/B is
+ISNONTEXT = ISGEENTEKST ## Geeft als resultaat WAAR als de waarde geen tekst is
+ISNUMBER = ISGETAL ## Geeft als resultaat WAAR als de waarde een getal is
+ISODD = IS.ONEVEN ## Geeft als resultaat WAAR als het getal oneven is
+ISREF = ISVERWIJZING ## Geeft als resultaat WAAR als de waarde een verwijzing is
+ISTEXT = ISTEKST ## Geeft als resultaat WAAR als de waarde tekst is
+N = N ## Geeft als resultaat een waarde die is geconverteerd naar een getal
+NA = NB ## Geeft als resultaat de foutwaarde #N/B
+TYPE = TYPE ## Geeft als resultaat een getal dat het gegevenstype van een waarde aangeeft
+
+
+##
+## Logical functions Logische functies
+##
+AND = EN ## Geeft als resultaat WAAR als alle argumenten WAAR zijn
+FALSE = ONWAAR ## Geeft als resultaat de logische waarde ONWAAR
+IF = ALS ## Geeft een logische test aan
+IFERROR = ALS.FOUT ## Retourneert een waarde die u opgeeft als een formule een fout oplevert, anders wordt het resultaat van de formule geretourneerd
+NOT = NIET ## Keert de logische waarde van het argument om
+OR = OF ## Geeft als resultaat WAAR als minimaal een van de argumenten WAAR is
+TRUE = WAAR ## Geeft als resultaat de logische waarde WAAR
+
+
+##
+## Lookup and reference functions Zoek- en verwijzingsfuncties
+##
+ADDRESS = ADRES ## Geeft als resultaat een verwijzing, in de vorm van tekst, naar één bepaalde cel in een werkblad
+AREAS = BEREIKEN ## Geeft als resultaat het aantal bereiken in een verwijzing
+CHOOSE = KIEZEN ## Kiest een waarde uit een lijst met waarden
+COLUMN = KOLOM ## Geeft als resultaat het kolomnummer van een verwijzing
+COLUMNS = KOLOMMEN ## Geeft als resultaat het aantal kolommen in een verwijzing
+HLOOKUP = HORIZ.ZOEKEN ## Zoekt in de bovenste rij van een matrix naar een bepaalde waarde en geeft als resultaat de gevonden waarde in de opgegeven cel
+HYPERLINK = HYPERLINK ## Maakt een snelkoppeling of een sprong waarmee een document wordt geopend dat is opgeslagen op een netwerkserver, een intranet of op internet
+INDEX = INDEX ## Kiest met een index een waarde uit een verwijzing of een matrix
+INDIRECT = INDIRECT ## Geeft als resultaat een verwijzing die wordt aangegeven met een tekstwaarde
+LOOKUP = ZOEKEN ## Zoekt naar bepaalde waarden in een vector of een matrix
+MATCH = VERGELIJKEN ## Zoekt naar bepaalde waarden in een verwijzing of een matrix
+OFFSET = VERSCHUIVING ## Geeft als resultaat een nieuwe verwijzing die is verschoven ten opzichte van een bepaalde verwijzing
+ROW = RIJ ## Geeft als resultaat het rijnummer van een verwijzing
+ROWS = RIJEN ## Geeft als resultaat het aantal rijen in een verwijzing
+RTD = RTG ## Haalt realtimegegevens op uit een programma dat COM-automatisering (automatisering: een methode waarmee de ene toepassing objecten van een andere toepassing of ontwikkelprogramma kan besturen. Automatisering werd vroeger OLE-automatisering genoemd. Automatisering is een industrienorm die deel uitmaakt van het Component Object Model (COM).) ondersteunt
+TRANSPOSE = TRANSPONEREN ## Geeft als resultaat de getransponeerde van een matrix
+VLOOKUP = VERT.ZOEKEN ## Zoekt in de meest linkse kolom van een matrix naar een bepaalde waarde en geeft als resultaat de waarde in de opgegeven cel
+
+
+##
+## Math and trigonometry functions Wiskundige en trigonometrische functies
+##
+ABS = ABS ## Geeft als resultaat de absolute waarde van een getal
+ACOS = BOOGCOS ## Geeft als resultaat de boogcosinus van een getal
+ACOSH = BOOGCOSH ## Geeft als resultaat de inverse cosinus hyperbolicus van een getal
+ASIN = BOOGSIN ## Geeft als resultaat de boogsinus van een getal
+ASINH = BOOGSINH ## Geeft als resultaat de inverse sinus hyperbolicus van een getal
+ATAN = BOOGTAN ## Geeft als resultaat de boogtangens van een getal
+ATAN2 = BOOGTAN2 ## Geeft als resultaat de boogtangens van de x- en y-coördinaten
+ATANH = BOOGTANH ## Geeft als resultaat de inverse tangens hyperbolicus van een getal
+CEILING = AFRONDEN.BOVEN ## Rondt de absolute waarde van een getal naar boven af op het dichtstbijzijnde gehele getal of het dichtstbijzijnde significante veelvoud
+COMBIN = COMBINATIES ## Geeft als resultaat het aantal combinaties voor een bepaald aantal objecten
+COS = COS ## Geeft als resultaat de cosinus van een getal
+COSH = COSH ## Geeft als resultaat de cosinus hyperbolicus van een getal
+DEGREES = GRADEN ## Converteert radialen naar graden
+EVEN = EVEN ## Rondt het getal af op het dichtstbijzijnde gehele even getal
+EXP = EXP ## Verheft e tot de macht van een bepaald getal
+FACT = FACULTEIT ## Geeft als resultaat de faculteit van een getal
+FACTDOUBLE = DUBBELE.FACULTEIT ## Geeft als resultaat de dubbele faculteit van een getal
+FLOOR = AFRONDEN.BENEDEN ## Rondt de absolute waarde van een getal naar beneden af
+GCD = GGD ## Geeft als resultaat de grootste gemene deler
+INT = INTEGER ## Rondt een getal naar beneden af op het dichtstbijzijnde gehele getal
+LCM = KGV ## Geeft als resultaat het kleinste gemene veelvoud
+LN = LN ## Geeft als resultaat de natuurlijke logaritme van een getal
+LOG = LOG ## Geeft als resultaat de logaritme met het opgegeven grondtal van een getal
+LOG10 = LOG10 ## Geeft als resultaat de logaritme met grondtal 10 van een getal
+MDETERM = DETERMINANTMAT ## Geeft als resultaat de determinant van een matrix
+MINVERSE = INVERSEMAT ## Geeft als resultaat de inverse van een matrix
+MMULT = PRODUCTMAT ## Geeft als resultaat het product van twee matrices
+MOD = REST ## Geeft als resultaat het restgetal van een deling
+MROUND = AFRONDEN.N.VEELVOUD ## Geeft als resultaat een getal afgerond op het gewenste veelvoud
+MULTINOMIAL = MULTINOMIAAL ## Geeft als resultaat de multinomiaalcoëfficiënt van een reeks getallen
+ODD = ONEVEN ## Rondt de absolute waarde van het getal naar boven af op het dichtstbijzijnde gehele oneven getal
+PI = PI ## Geeft als resultaat de waarde van pi
+POWER = MACHT ## Verheft een getal tot een macht
+PRODUCT = PRODUCT ## Vermenigvuldigt de argumenten met elkaar
+QUOTIENT = QUOTIENT ## Geeft als resultaat de uitkomst van een deling als geheel getal
+RADIANS = RADIALEN ## Converteert graden naar radialen
+RAND = ASELECT ## Geeft als resultaat een willekeurig getal tussen 0 en 1
+RANDBETWEEN = ASELECTTUSSEN ## Geeft een willekeurig getal tussen de getallen die u hebt opgegeven
+ROMAN = ROMEINS ## Converteert een Arabisch getal naar een Romeins getal en geeft het resultaat weer in de vorm van tekst
+ROUND = AFRONDEN ## Rondt een getal af op het opgegeven aantal decimalen
+ROUNDDOWN = AFRONDEN.NAAR.BENEDEN ## Rondt de absolute waarde van een getal naar beneden af
+ROUNDUP = AFRONDEN.NAAR.BOVEN ## Rondt de absolute waarde van een getal naar boven af
+SERIESSUM = SOM.MACHTREEKS ## Geeft als resultaat de som van een machtreeks die is gebaseerd op de formule
+SIGN = POS.NEG ## Geeft als resultaat het teken van een getal
+SIN = SIN ## Geeft als resultaat de sinus van de opgegeven hoek
+SINH = SINH ## Geeft als resultaat de sinus hyperbolicus van een getal
+SQRT = WORTEL ## Geeft als resultaat de positieve vierkantswortel van een getal
+SQRTPI = WORTEL.PI ## Geeft als resultaat de vierkantswortel van (getal * pi)
+SUBTOTAL = SUBTOTAAL ## Geeft als resultaat een subtotaal voor een bereik
+SUM = SOM ## Telt de argumenten op
+SUMIF = SOM.ALS ## Telt de getallen bij elkaar op die voldoen aan een bepaald criterium
+SUMIFS = SOMMEN.ALS ## Telt de cellen in een bereik op die aan meerdere criteria voldoen
+SUMPRODUCT = SOMPRODUCT ## Geeft als resultaat de som van de producten van de corresponderende matrixelementen
+SUMSQ = KWADRATENSOM ## Geeft als resultaat de som van de kwadraten van de argumenten
+SUMX2MY2 = SOM.X2MINY2 ## Geeft als resultaat de som van het verschil tussen de kwadraten van corresponderende waarden in twee matrices
+SUMX2PY2 = SOM.X2PLUSY2 ## Geeft als resultaat de som van de kwadratensom van corresponderende waarden in twee matrices
+SUMXMY2 = SOM.XMINY.2 ## Geeft als resultaat de som van de kwadraten van de verschillen tussen de corresponderende waarden in twee matrices
+TAN = TAN ## Geeft als resultaat de tangens van een getal
+TANH = TANH ## Geeft als resultaat de tangens hyperbolicus van een getal
+TRUNC = GEHEEL ## Kapt een getal af tot een geheel getal
+
+
+##
+## Statistical functions Statistische functies
+##
+AVEDEV = GEM.DEVIATIE ## Geeft als resultaat het gemiddelde van de absolute deviaties van gegevenspunten ten opzichte van hun gemiddelde waarde
+AVERAGE = GEMIDDELDE ## Geeft als resultaat het gemiddelde van de argumenten
+AVERAGEA = GEMIDDELDEA ## Geeft als resultaat het gemiddelde van de argumenten, inclusief getallen, tekst en logische waarden
+AVERAGEIF = GEMIDDELDE.ALS ## Geeft het gemiddelde (rekenkundig gemiddelde) als resultaat van alle cellen in een bereik die voldoen aan de opgegeven criteria
+AVERAGEIFS = GEMIDDELDEN.ALS ## Geeft het gemiddelde (rekenkundig gemiddelde) als resultaat van alle cellen die aan meerdere criteria voldoen
+BETADIST = BETA.VERD ## Geeft als resultaat de cumulatieve bèta-verdelingsfunctie
+BETAINV = BETA.INV ## Geeft als resultaat de inverse van de cumulatieve verdelingsfunctie voor een gegeven bèta-verdeling
+BINOMDIST = BINOMIALE.VERD ## Geeft als resultaat de binomiale verdeling
+CHIDIST = CHI.KWADRAAT ## Geeft als resultaat de eenzijdige kans van de chi-kwadraatverdeling
+CHIINV = CHI.KWADRAAT.INV ## Geeft als resultaat de inverse van een eenzijdige kans van de chi-kwadraatverdeling
+CHITEST = CHI.TOETS ## Geeft als resultaat de onafhankelijkheidstoets
+CONFIDENCE = BETROUWBAARHEID ## Geeft als resultaat het betrouwbaarheidsinterval van een gemiddelde waarde voor de elementen van een populatie
+CORREL = CORRELATIE ## Geeft als resultaat de correlatiecoëfficiënt van twee gegevensverzamelingen
+COUNT = AANTAL ## Telt het aantal getallen in de argumentenlijst
+COUNTA = AANTALARG ## Telt het aantal waarden in de argumentenlijst
+COUNTBLANK = AANTAL.LEGE.CELLEN ## Telt het aantal lege cellen in een bereik
+COUNTIF = AANTAL.ALS ## Telt in een bereik het aantal cellen die voldoen aan een bepaald criterium
+COUNTIFS = AANTALLEN.ALS ## Telt in een bereik het aantal cellen die voldoen aan meerdere criteria
+COVAR = COVARIANTIE ## Geeft als resultaat de covariantie, het gemiddelde van de producten van de gepaarde deviaties
+CRITBINOM = CRIT.BINOM ## Geeft als resultaat de kleinste waarde waarvoor de binomiale verdeling kleiner is dan of gelijk is aan het criterium
+DEVSQ = DEV.KWAD ## Geeft als resultaat de som van de deviaties in het kwadraat
+EXPONDIST = EXPON.VERD ## Geeft als resultaat de exponentiële verdeling
+FDIST = F.VERDELING ## Geeft als resultaat de F-verdeling
+FINV = F.INVERSE ## Geeft als resultaat de inverse van de F-verdeling
+FISHER = FISHER ## Geeft als resultaat de Fisher-transformatie
+FISHERINV = FISHER.INV ## Geeft als resultaat de inverse van de Fisher-transformatie
+FORECAST = VOORSPELLEN ## Geeft als resultaat een waarde op basis van een lineaire trend
+FREQUENCY = FREQUENTIE ## Geeft als resultaat een frequentieverdeling in de vorm van een verticale matrix
+FTEST = F.TOETS ## Geeft als resultaat een F-toets
+GAMMADIST = GAMMA.VERD ## Geeft als resultaat de gamma-verdeling
+GAMMAINV = GAMMA.INV ## Geeft als resultaat de inverse van de cumulatieve gamma-verdeling
+GAMMALN = GAMMA.LN ## Geeft als resultaat de natuurlijke logaritme van de gamma-functie, G(x)
+GEOMEAN = MEETK.GEM ## Geeft als resultaat het meetkundige gemiddelde
+GROWTH = GROEI ## Geeft als resultaat de waarden voor een exponentiële trend
+HARMEAN = HARM.GEM ## Geeft als resultaat het harmonische gemiddelde
+HYPGEOMDIST = HYPERGEO.VERD ## Geeft als resultaat de hypergeometrische verdeling
+INTERCEPT = SNIJPUNT ## Geeft als resultaat het snijpunt van de lineaire regressielijn met de y-as
+KURT = KURTOSIS ## Geeft als resultaat de kurtosis van een gegevensverzameling
+LARGE = GROOTSTE ## Geeft als resultaat de op k-1 na grootste waarde in een gegevensverzameling
+LINEST = LIJNSCH ## Geeft als resultaat de parameters van een lineaire trend
+LOGEST = LOGSCH ## Geeft als resultaat de parameters van een exponentiële trend
+LOGINV = LOG.NORM.INV ## Geeft als resultaat de inverse van de logaritmische normale verdeling
+LOGNORMDIST = LOG.NORM.VERD ## Geeft als resultaat de cumulatieve logaritmische normale verdeling
+MAX = MAX ## Geeft als resultaat de maximumwaarde in een lijst met argumenten
+MAXA = MAXA ## Geeft als resultaat de maximumwaarde in een lijst met argumenten, inclusief getallen, tekst en logische waarden
+MEDIAN = MEDIAAN ## Geeft als resultaat de mediaan van de opgegeven getallen
+MIN = MIN ## Geeft als resultaat de minimumwaarde in een lijst met argumenten
+MINA = MINA ## Geeft als resultaat de minimumwaarde in een lijst met argumenten, inclusief getallen, tekst en logische waarden
+MODE = MODUS ## Geeft als resultaat de meest voorkomende waarde in een gegevensverzameling
+NEGBINOMDIST = NEG.BINOM.VERD ## Geeft als resultaat de negatieve binomiaalverdeling
+NORMDIST = NORM.VERD ## Geeft als resultaat de cumulatieve normale verdeling
+NORMINV = NORM.INV ## Geeft als resultaat de inverse van de cumulatieve standaardnormale verdeling
+NORMSDIST = STAND.NORM.VERD ## Geeft als resultaat de cumulatieve standaardnormale verdeling
+NORMSINV = STAND.NORM.INV ## Geeft als resultaat de inverse van de cumulatieve normale verdeling
+PEARSON = PEARSON ## Geeft als resultaat de correlatiecoëfficiënt van Pearson
+PERCENTILE = PERCENTIEL ## Geeft als resultaat het k-de percentiel van waarden in een bereik
+PERCENTRANK = PERCENT.RANG ## Geeft als resultaat de positie, in procenten uitgedrukt, van een waarde in de rangorde van een gegevensverzameling
+PERMUT = PERMUTATIES ## Geeft als resultaat het aantal permutaties voor een gegeven aantal objecten
+POISSON = POISSON ## Geeft als resultaat de Poisson-verdeling
+PROB = KANS ## Geeft als resultaat de kans dat waarden zich tussen twee grenzen bevinden
+QUARTILE = KWARTIEL ## Geeft als resultaat het kwartiel van een gegevensverzameling
+RANK = RANG ## Geeft als resultaat het rangnummer van een getal in een lijst getallen
+RSQ = R.KWADRAAT ## Geeft als resultaat het kwadraat van de Pearson-correlatiecoëfficiënt
+SKEW = SCHEEFHEID ## Geeft als resultaat de mate van asymmetrie van een verdeling
+SLOPE = RICHTING ## Geeft als resultaat de richtingscoëfficiënt van een lineaire regressielijn
+SMALL = KLEINSTE ## Geeft als resultaat de op k-1 na kleinste waarde in een gegevensverzameling
+STANDARDIZE = NORMALISEREN ## Geeft als resultaat een genormaliseerde waarde
+STDEV = STDEV ## Maakt een schatting van de standaarddeviatie op basis van een steekproef
+STDEVA = STDEVA ## Maakt een schatting van de standaarddeviatie op basis van een steekproef, inclusief getallen, tekst en logische waarden
+STDEVP = STDEVP ## Berekent de standaarddeviatie op basis van de volledige populatie
+STDEVPA = STDEVPA ## Berekent de standaarddeviatie op basis van de volledige populatie, inclusief getallen, tekst en logische waarden
+STEYX = STAND.FOUT.YX ## Geeft als resultaat de standaardfout in de voorspelde y-waarde voor elke x in een regressie
+TDIST = T.VERD ## Geeft als resultaat de Student T-verdeling
+TINV = T.INV ## Geeft als resultaat de inverse van de Student T-verdeling
+TREND = TREND ## Geeft als resultaat de waarden voor een lineaire trend
+TRIMMEAN = GETRIMD.GEM ## Geeft als resultaat het gemiddelde van waarden in een gegevensverzameling
+TTEST = T.TOETS ## Geeft als resultaat de kans met behulp van de Student T-toets
+VAR = VAR ## Maakt een schatting van de variantie op basis van een steekproef
+VARA = VARA ## Maakt een schatting van de variantie op basis van een steekproef, inclusief getallen, tekst en logische waarden
+VARP = VARP ## Berekent de variantie op basis van de volledige populatie
+VARPA = VARPA ## Berekent de standaarddeviatie op basis van de volledige populatie, inclusief getallen, tekst en logische waarden
+WEIBULL = WEIBULL ## Geeft als resultaat de Weibull-verdeling
+ZTEST = Z.TOETS ## Geeft als resultaat de eenzijdige kanswaarde van een Z-toets
+
+
+##
+## Text functions Tekstfuncties
+##
+ASC = ASC ## Wijzigt Nederlandse letters of katakanatekens over de volle breedte (dubbel-bytetekens) binnen een tekenreeks in tekens over de halve breedte (enkel-bytetekens)
+BAHTTEXT = BAHT.TEKST ## Converteert een getal naar tekst met de valutanotatie ß (baht)
+CHAR = TEKEN ## Geeft als resultaat het teken dat hoort bij de opgegeven code
+CLEAN = WISSEN.CONTROL ## Verwijdert alle niet-afdrukbare tekens uit een tekst
+CODE = CODE ## Geeft als resultaat de numerieke code voor het eerste teken in een tekenreeks
+CONCATENATE = TEKST.SAMENVOEGEN ## Voegt verschillende tekstfragmenten samen tot één tekstfragment
+DOLLAR = EURO ## Converteert een getal naar tekst met de valutanotatie € (euro)
+EXACT = GELIJK ## Controleert of twee tekenreeksen identiek zijn
+FIND = VIND.ALLES ## Zoekt een bepaalde tekenreeks in een tekst (waarbij onderscheid wordt gemaakt tussen hoofdletters en kleine letters)
+FINDB = VIND.ALLES.B ## Zoekt een bepaalde tekenreeks in een tekst (waarbij onderscheid wordt gemaakt tussen hoofdletters en kleine letters)
+FIXED = VAST ## Maakt een getal als tekst met een vast aantal decimalen op
+JIS = JIS ## Wijzigt Nederlandse letters of katakanatekens over de halve breedte (enkel-bytetekens) binnen een tekenreeks in tekens over de volle breedte (dubbel-bytetekens)
+LEFT = LINKS ## Geeft als resultaat de meest linkse tekens in een tekenreeks
+LEFTB = LINKSB ## Geeft als resultaat de meest linkse tekens in een tekenreeks
+LEN = LENGTE ## Geeft als resultaat het aantal tekens in een tekenreeks
+LENB = LENGTEB ## Geeft als resultaat het aantal tekens in een tekenreeks
+LOWER = KLEINE.LETTERS ## Zet tekst om in kleine letters
+MID = MIDDEN ## Geeft als resultaat een bepaald aantal tekens van een tekenreeks vanaf de positie die u opgeeft
+MIDB = DEELB ## Geeft als resultaat een bepaald aantal tekens van een tekenreeks vanaf de positie die u opgeeft
+PHONETIC = FONETISCH ## Haalt de fonetische tekens (furigana) uit een tekenreeks op
+PROPER = BEGINLETTERS ## Zet de eerste letter van elk woord in een tekst om in een hoofdletter
+REPLACE = VERVANG ## Vervangt tekens binnen een tekst
+REPLACEB = VERVANGENB ## Vervangt tekens binnen een tekst
+REPT = HERHALING ## Herhaalt een tekst een aantal malen
+RIGHT = RECHTS ## Geeft als resultaat de meest rechtse tekens in een tekenreeks
+RIGHTB = RECHTSB ## Geeft als resultaat de meest rechtse tekens in een tekenreeks
+SEARCH = VIND.SPEC ## Zoekt een bepaalde tekenreeks in een tekst (waarbij geen onderscheid wordt gemaakt tussen hoofdletters en kleine letters)
+SEARCHB = VIND.SPEC.B ## Zoekt een bepaalde tekenreeks in een tekst (waarbij geen onderscheid wordt gemaakt tussen hoofdletters en kleine letters)
+SUBSTITUTE = SUBSTITUEREN ## Vervangt oude tekst door nieuwe tekst in een tekenreeks
+T = T ## Converteert de argumenten naar tekst
+TEXT = TEKST ## Maakt een getal op en converteert het getal naar tekst
+TRIM = SPATIES.WISSEN ## Verwijdert de spaties uit een tekst
+UPPER = HOOFDLETTERS ## Zet tekst om in hoofdletters
+VALUE = WAARDE ## Converteert tekst naar een getal
diff --git a/Classes/PHPExcel/locale/no/config b/Classes/PHPExcel/locale/no/config
new file mode 100644
index 0000000..bf2d34a
--- /dev/null
+++ b/Classes/PHPExcel/locale/no/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = kr
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULL!
+DIV0 = #DIV/0!
+VALUE = #VERDI!
+REF = #REF!
+NAME = #NAVN?
+NUM = #NUM!
+NA = #I/T
diff --git a/Classes/PHPExcel/locale/no/functions b/Classes/PHPExcel/locale/no/functions
new file mode 100644
index 0000000..10d0a20
--- /dev/null
+++ b/Classes/PHPExcel/locale/no/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Funksjonene Tillegg og Automatisering
+##
+GETPIVOTDATA = HENTPIVOTDATA ## Returnerer data som er lagret i en pivottabellrapport
+
+
+##
+## Cube functions Kubefunksjoner
+##
+CUBEKPIMEMBER = KUBEKPIMEDLEM ## Returnerer navnet, egenskapen og målet for en viktig ytelsesindikator (KPI), og viser navnet og egenskapen i cellen. En KPI er en målbar enhet, for eksempel månedlig bruttoinntjening eller kvartalsvis inntjening per ansatt, og brukes til å overvåke ytelsen i en organisasjon.
+CUBEMEMBER = KUBEMEDLEM ## Returnerer et medlem eller en tuppel i et kubehierarki. Brukes til å validere at medlemmet eller tuppelen finnes i kuben.
+CUBEMEMBERPROPERTY = KUBEMEDLEMEGENSKAP ## Returnerer verdien til en medlemsegenskap i kuben. Brukes til å validere at et medlemsnavn finnes i kuben, og til å returnere den angitte egenskapen for dette medlemmet.
+CUBERANKEDMEMBER = KUBERANGERTMEDLEM ## Returnerer det n-te, eller rangerte, medlemmet i et sett. Brukes til å returnere ett eller flere elementer i et sett, for eksempel de 10 beste studentene.
+CUBESET = KUBESETT ## Definerer et beregnet sett av medlemmer eller tuppeler ved å sende et settuttrykk til kuben på serveren, noe som oppretter settet og deretter returnerer dette settet til Microsoft Office Excel.
+CUBESETCOUNT = KUBESETTANTALL ## Returnerer antallet elementer i et sett.
+CUBEVALUE = KUBEVERDI ## Returnerer en aggregert verdi fra en kube.
+
+
+##
+## Database functions Databasefunksjoner
+##
+DAVERAGE = DGJENNOMSNITT ## Returnerer gjennomsnittet av merkede databaseposter
+DCOUNT = DANTALL ## Teller celler som inneholder tall i en database
+DCOUNTA = DANTALLA ## Teller celler som ikke er tomme i en database
+DGET = DHENT ## Trekker ut fra en database en post som oppfyller angitte vilkår
+DMAX = DMAKS ## Returnerer maksimumsverdien fra merkede databaseposter
+DMIN = DMIN ## Returnerer minimumsverdien fra merkede databaseposter
+DPRODUCT = DPRODUKT ## Multipliserer verdiene i et bestemt felt med poster som oppfyller vilkårene i en database
+DSTDEV = DSTDAV ## Estimerer standardavviket basert på et utvalg av merkede databaseposter
+DSTDEVP = DSTAVP ## Beregner standardavviket basert på at merkede databaseposter utgjør hele populasjonen
+DSUM = DSUMMER ## Legger til tallene i feltkolonnen med poster, i databasen som oppfyller vilkårene
+DVAR = DVARIANS ## Estimerer variansen basert på et utvalg av merkede databaseposter
+DVARP = DVARIANSP ## Beregner variansen basert på at merkede databaseposter utgjør hele populasjonen
+
+
+##
+## Date and time functions Dato- og tidsfunksjoner
+##
+DATE = DATO ## Returnerer serienummeret som svarer til en bestemt dato
+DATEVALUE = DATOVERDI ## Konverterer en dato med tekstformat til et serienummer
+DAY = DAG ## Konverterer et serienummer til en dag i måneden
+DAYS360 = DAGER360 ## Beregner antall dager mellom to datoer basert på et år med 360 dager
+EDATE = DAG.ETTER ## Returnerer serienummeret som svarer til datoen som er det indikerte antall måneder før eller etter startdatoen
+EOMONTH = MÅNEDSSLUTT ## Returnerer serienummeret som svarer til siste dag i måneden, før eller etter et angitt antall måneder
+HOUR = TIME ## Konverterer et serienummer til en time
+MINUTE = MINUTT ## Konverterer et serienummer til et minutt
+MONTH = MÅNED ## Konverterer et serienummer til en måned
+NETWORKDAYS = NETT.ARBEIDSDAGER ## Returnerer antall hele arbeidsdager mellom to datoer
+NOW = NÃ… ## Returnerer serienummeret som svarer til gjeldende dato og klokkeslett
+SECOND = SEKUND ## Konverterer et serienummer til et sekund
+TIME = TID ## Returnerer serienummeret som svarer til et bestemt klokkeslett
+TIMEVALUE = TIDSVERDI ## Konverterer et klokkeslett i tekstformat til et serienummer
+TODAY = IDAG ## Returnerer serienummeret som svarer til dagens dato
+WEEKDAY = UKEDAG ## Konverterer et serienummer til en ukedag
+WEEKNUM = UKENR ## Konverterer et serienummer til et tall som representerer hvilket nummer uken har i et år
+WORKDAY = ARBEIDSDAG ## Returnerer serienummeret som svarer til datoen før eller etter et angitt antall arbeidsdager
+YEAR = ÅR ## Konverterer et serienummer til et år
+YEARFRAC = ÅRDEL ## Returnerer brøkdelen for året, som svarer til antall hele dager mellom startdato og sluttdato
+
+
+##
+## Engineering functions Tekniske funksjoner
+##
+BESSELI = BESSELI ## Returnerer den endrede Bessel-funksjonen In(x)
+BESSELJ = BESSELJ ## Returnerer Bessel-funksjonen Jn(x)
+BESSELK = BESSELK ## Returnerer den endrede Bessel-funksjonen Kn(x)
+BESSELY = BESSELY ## Returnerer Bessel-funksjonen Yn(x)
+BIN2DEC = BINTILDES ## Konverterer et binært tall til et desimaltall
+BIN2HEX = BINTILHEKS ## Konverterer et binært tall til et heksadesimaltall
+BIN2OCT = BINTILOKT ## Konverterer et binært tall til et oktaltall
+COMPLEX = KOMPLEKS ## Konverterer reelle og imaginære koeffisienter til et komplekst tall
+CONVERT = KONVERTER ## Konverterer et tall fra ett målsystem til et annet
+DEC2BIN = DESTILBIN ## Konverterer et desimaltall til et binærtall
+DEC2HEX = DESTILHEKS ## Konverterer et heltall i 10-tallsystemet til et heksadesimalt tall
+DEC2OCT = DESTILOKT ## Konverterer et heltall i 10-tallsystemet til et oktaltall
+DELTA = DELTA ## Undersøker om to verdier er like
+ERF = FEILF ## Returnerer feilfunksjonen
+ERFC = FEILFK ## Returnerer den komplementære feilfunksjonen
+GESTEP = GRENSEVERDI ## Tester om et tall er større enn en terskelverdi
+HEX2BIN = HEKSTILBIN ## Konverterer et heksadesimaltall til et binært tall
+HEX2DEC = HEKSTILDES ## Konverterer et heksadesimalt tall til et heltall i 10-tallsystemet
+HEX2OCT = HEKSTILOKT ## Konverterer et heksadesimalt tall til et oktaltall
+IMABS = IMABS ## Returnerer absoluttverdien (koeffisienten) til et komplekst tall
+IMAGINARY = IMAGINÆR ## Returnerer den imaginære koeffisienten til et komplekst tall
+IMARGUMENT = IMARGUMENT ## Returnerer argumentet theta, som er en vinkel uttrykt i radianer
+IMCONJUGATE = IMKONJUGERT ## Returnerer den komplekse konjugaten til et komplekst tall
+IMCOS = IMCOS ## Returnerer cosinus til et komplekst tall
+IMDIV = IMDIV ## Returnerer kvotienten til to komplekse tall
+IMEXP = IMEKSP ## Returnerer eksponenten til et komplekst tall
+IMLN = IMLN ## Returnerer den naturlige logaritmen for et komplekst tall
+IMLOG10 = IMLOG10 ## Returnerer logaritmen med grunntall 10 for et komplekst tall
+IMLOG2 = IMLOG2 ## Returnerer logaritmen med grunntall 2 for et komplekst tall
+IMPOWER = IMOPPHØY ## Returnerer et komplekst tall opphøyd til en heltallspotens
+IMPRODUCT = IMPRODUKT ## Returnerer produktet av komplekse tall
+IMREAL = IMREELL ## Returnerer den reelle koeffisienten til et komplekst tall
+IMSIN = IMSIN ## Returnerer sinus til et komplekst tall
+IMSQRT = IMROT ## Returnerer kvadratroten av et komplekst tall
+IMSUB = IMSUB ## Returnerer differansen mellom to komplekse tall
+IMSUM = IMSUMMER ## Returnerer summen av komplekse tall
+OCT2BIN = OKTTILBIN ## Konverterer et oktaltall til et binært tall
+OCT2DEC = OKTTILDES ## Konverterer et oktaltall til et desimaltall
+OCT2HEX = OKTTILHEKS ## Konverterer et oktaltall til et heksadesimaltall
+
+
+##
+## Financial functions Økonomiske funksjoner
+##
+ACCRINT = PÅLØPT.PERIODISK.RENTE ## Returnerer påløpte renter for et verdipapir som betaler periodisk rente
+ACCRINTM = PÅLØPT.FORFALLSRENTE ## Returnerer den påløpte renten for et verdipapir som betaler rente ved forfall
+AMORDEGRC = AMORDEGRC ## Returnerer avskrivningen for hver regnskapsperiode ved hjelp av en avskrivingskoeffisient
+AMORLINC = AMORLINC ## Returnerer avskrivingen for hver regnskapsperiode
+COUPDAYBS = OBLIG.DAGER.FF ## Returnerer antall dager fra begynnelsen av den rentebærende perioden til innløsningsdatoen
+COUPDAYS = OBLIG.DAGER ## Returnerer antall dager i den rentebærende perioden som inneholder innløsningsdatoen
+COUPDAYSNC = OBLIG.DAGER.NF ## Returnerer antall dager fra betalingsdato til neste renteinnbetalingsdato
+COUPNCD = OBLIG.DAGER.EF ## Returnerer obligasjonsdatoen som kommer etter oppgjørsdatoen
+COUPNUM = OBLIG.ANTALL ## Returnerer antall obligasjoner som skal betales mellom oppgjørsdatoen og forfallsdatoen
+COUPPCD = OBLIG.DAG.FORRIGE ## Returnerer obligasjonsdatoen som kommer før oppgjørsdatoen
+CUMIPMT = SAMLET.RENTE ## Returnerer den kumulative renten som er betalt mellom to perioder
+CUMPRINC = SAMLET.HOVEDSTOL ## Returnerer den kumulative hovedstolen som er betalt for et lån mellom to perioder
+DB = DAVSKR ## Returnerer avskrivningen for et aktivum i en angitt periode, foretatt med fast degressiv avskrivning
+DDB = DEGRAVS ## Returnerer avskrivningen for et aktivum for en gitt periode, ved hjelp av dobbel degressiv avskrivning eller en metode som du selv angir
+DISC = DISKONTERT ## Returnerer diskonteringsraten for et verdipapir
+DOLLARDE = DOLLARDE ## Konverterer en valutapris uttrykt som en brøk, til en valutapris uttrykt som et desimaltall
+DOLLARFR = DOLLARBR ## Konverterer en valutapris uttrykt som et desimaltall, til en valutapris uttrykt som en brøk
+DURATION = VARIGHET ## Returnerer årlig varighet for et verdipapir med renter som betales periodisk
+EFFECT = EFFEKTIV.RENTE ## Returnerer den effektive årlige rentesatsen
+FV = SLUTTVERDI ## Returnerer fremtidig verdi for en investering
+FVSCHEDULE = SVPLAN ## Returnerer den fremtidige verdien av en inngående hovedstol etter å ha anvendt en serie med sammensatte rentesatser
+INTRATE = RENTESATS ## Returnerer rentefoten av et fullfinansiert verdipapir
+IPMT = RAVDRAG ## Returnerer betalte renter på en investering for en gitt periode
+IRR = IR ## Returnerer internrenten for en serie kontantstrømmer
+ISPMT = ER.AVDRAG ## Beregner renten som er betalt for en investering i løpet av en bestemt periode
+MDURATION = MVARIGHET ## Returnerer Macauleys modifiserte varighet for et verdipapir med en antatt pålydende verdi på kr 100,00
+MIRR = MODIR ## Returnerer internrenten der positive og negative kontantstrømmer finansieres med forskjellige satser
+NOMINAL = NOMINELL ## Returnerer årlig nominell rentesats
+NPER = PERIODER ## Returnerer antall perioder for en investering
+NPV = NNV ## Returnerer netto nåverdi for en investering, basert på en serie periodiske kontantstrømmer og en rentesats
+ODDFPRICE = AVVIKFP.PRIS ## Returnerer pris pålydende kr 100 for et verdipapir med en odde første periode
+ODDFYIELD = AVVIKFP.AVKASTNING ## Returnerer avkastingen for et verdipapir med en odde første periode
+ODDLPRICE = AVVIKSP.PRIS ## Returnerer pris pålydende kr 100 for et verdipapir med en odde siste periode
+ODDLYIELD = AVVIKSP.AVKASTNING ## Returnerer avkastingen for et verdipapir med en odde siste periode
+PMT = AVDRAG ## Returnerer periodisk betaling for en annuitet
+PPMT = AMORT ## Returnerer betalingen på hovedstolen for en investering i en gitt periode
+PRICE = PRIS ## Returnerer prisen per pålydende kr 100 for et verdipapir som gir periodisk avkastning
+PRICEDISC = PRIS.DISKONTERT ## Returnerer prisen per pålydende kr 100 for et diskontert verdipapir
+PRICEMAT = PRIS.FORFALL ## Returnerer prisen per pålydende kr 100 av et verdipapir som betaler rente ved forfall
+PV = NÅVERDI ## Returnerer nåverdien av en investering
+RATE = RENTE ## Returnerer rentesatsen per periode for en annuitet
+RECEIVED = MOTTATT.AVKAST ## Returnerer summen som mottas ved forfallsdato for et fullinvestert verdipapir
+SLN = LINAVS ## Returnerer den lineære avskrivningen for et aktivum i én periode
+SYD = ÅRSAVS ## Returnerer årsavskrivningen for et aktivum i en angitt periode
+TBILLEQ = TBILLEKV ## Returnerer den obligasjonsekvivalente avkastningen for en statsobligasjon
+TBILLPRICE = TBILLPRIS ## Returnerer prisen per pålydende kr 100 for en statsobligasjon
+TBILLYIELD = TBILLAVKASTNING ## Returnerer avkastningen til en statsobligasjon
+VDB = VERDIAVS ## Returnerer avskrivningen for et aktivum i en angitt periode eller delperiode, ved hjelp av degressiv avskrivning
+XIRR = XIR ## Returnerer internrenten for en serie kontantstrømmer som ikke nødvendigvis er periodiske
+XNPV = XNNV ## Returnerer netto nåverdi for en serie kontantstrømmer som ikke nødvendigvis er periodiske
+YIELD = AVKAST ## Returnerer avkastningen på et verdipapir som betaler periodisk rente
+YIELDDISC = AVKAST.DISKONTERT ## Returnerer årlig avkastning for et diskontert verdipapir, for eksempel en statskasseveksel
+YIELDMAT = AVKAST.FORFALL ## Returnerer den årlige avkastningen for et verdipapir som betaler rente ved forfallsdato
+
+
+##
+## Information functions Informasjonsfunksjoner
+##
+CELL = CELLE ## Returnerer informasjon om formatering, plassering eller innholdet til en celle
+ERROR.TYPE = FEIL.TYPE ## Returnerer et tall som svarer til en feiltype
+INFO = INFO ## Returnerer informasjon om gjeldende operativmiljø
+ISBLANK = ERTOM ## Returnerer SANN hvis verdien er tom
+ISERR = ERFEIL ## Returnerer SANN hvis verdien er en hvilken som helst annen feilverdi enn #I/T
+ISERROR = ERFEIL ## Returnerer SANN hvis verdien er en hvilken som helst feilverdi
+ISEVEN = ERPARTALL ## Returnerer SANN hvis tallet er et partall
+ISLOGICAL = ERLOGISK ## Returnerer SANN hvis verdien er en logisk verdi
+ISNA = ERIT ## Returnerer SANN hvis verdien er feilverdien #I/T
+ISNONTEXT = ERIKKETEKST ## Returnerer SANN hvis verdien ikke er tekst
+ISNUMBER = ERTALL ## Returnerer SANN hvis verdien er et tall
+ISODD = ERODDETALL ## Returnerer SANN hvis tallet er et oddetall
+ISREF = ERREF ## Returnerer SANN hvis verdien er en referanse
+ISTEXT = ERTEKST ## Returnerer SANN hvis verdien er tekst
+N = N ## Returnerer en verdi som er konvertert til et tall
+NA = IT ## Returnerer feilverdien #I/T
+TYPE = VERDITYPE ## Returnerer et tall som indikerer datatypen til en verdi
+
+
+##
+## Logical functions Logiske funksjoner
+##
+AND = OG ## Returnerer SANN hvis alle argumentene er lik SANN
+FALSE = USANN ## Returnerer den logiske verdien USANN
+IF = HVIS ## Angir en logisk test som skal utføres
+IFERROR = HVISFEIL ## Returnerer en verdi du angir hvis en formel evaluerer til en feil. Ellers returnerer den resultatet av formelen.
+NOT = IKKE ## Reverserer logikken til argumentet
+OR = ELLER ## Returnerer SANN hvis ett eller flere argumenter er lik SANN
+TRUE = SANN ## Returnerer den logiske verdien SANN
+
+
+##
+## Lookup and reference functions Oppslag- og referansefunksjoner
+##
+ADDRESS = ADRESSE ## Returnerer en referanse som tekst til en enkelt celle i et regneark
+AREAS = OMRÅDER ## Returnerer antall områder i en referanse
+CHOOSE = VELG ## Velger en verdi fra en liste med verdier
+COLUMN = KOLONNE ## Returnerer kolonnenummeret for en referanse
+COLUMNS = KOLONNER ## Returnerer antall kolonner i en referanse
+HLOOKUP = FINN.KOLONNE ## Leter i den øverste raden i en matrise og returnerer verdien for den angitte cellen
+HYPERLINK = HYPERKOBLING ## Oppretter en snarvei eller et hopp som åpner et dokument som er lagret på en nettverksserver, et intranett eller Internett
+INDEX = INDEKS ## Bruker en indeks til å velge en verdi fra en referanse eller matrise
+INDIRECT = INDIREKTE ## Returnerer en referanse angitt av en tekstverdi
+LOOKUP = SLÅ.OPP ## Slår opp verdier i en vektor eller matrise
+MATCH = SAMMENLIGNE ## Slår opp verdier i en referanse eller matrise
+OFFSET = FORSKYVNING ## Returnerer en referanseforskyvning fra en gitt referanse
+ROW = RAD ## Returnerer radnummeret for en referanse
+ROWS = RADER ## Returnerer antall rader i en referanse
+RTD = RTD ## Henter sanntidsdata fra et program som støtter COM-automatisering (automatisering: En måte å arbeide på med programobjekter fra et annet program- eller utviklingsverktøy. Tidligere kalt OLE-automatisering. Automatisering er en bransjestandard og en funksjon i Component Object Model (COM).)
+TRANSPOSE = TRANSPONER ## Returnerer transponeringen av en matrise
+VLOOKUP = FINN.RAD ## Leter i den første kolonnen i en matrise og flytter bortover raden for å returnere verdien til en celle
+
+
+##
+## Math and trigonometry functions Matematikk- og trigonometrifunksjoner
+##
+ABS = ABS ## Returnerer absoluttverdien til et tall
+ACOS = ARCCOS ## Returnerer arcus cosinus til et tall
+ACOSH = ARCCOSH ## Returnerer den inverse hyperbolske cosinus til et tall
+ASIN = ARCSIN ## Returnerer arcus sinus til et tall
+ASINH = ARCSINH ## Returnerer den inverse hyperbolske sinus til et tall
+ATAN = ARCTAN ## Returnerer arcus tangens til et tall
+ATAN2 = ARCTAN2 ## Returnerer arcus tangens fra x- og y-koordinater
+ATANH = ARCTANH ## Returnerer den inverse hyperbolske tangens til et tall
+CEILING = AVRUND.GJELDENDE.MULTIPLUM ## Runder av et tall til nærmeste heltall eller til nærmeste signifikante multiplum
+COMBIN = KOMBINASJON ## Returnerer antall kombinasjoner for ett gitt antall objekter
+COS = COS ## Returnerer cosinus til et tall
+COSH = COSH ## Returnerer den hyperbolske cosinus til et tall
+DEGREES = GRADER ## Konverterer radianer til grader
+EVEN = AVRUND.TIL.PARTALL ## Runder av et tall oppover til nærmeste heltall som er et partall
+EXP = EKSP ## Returnerer e opphøyd i en angitt potens
+FACT = FAKULTET ## Returnerer fakultet til et tall
+FACTDOUBLE = DOBBELFAKT ## Returnerer et talls doble fakultet
+FLOOR = AVRUND.GJELDENDE.MULTIPLUM.NED ## Avrunder et tall nedover, mot null
+GCD = SFF ## Returnerer høyeste felles divisor
+INT = HELTALL ## Avrunder et tall nedover til nærmeste heltall
+LCM = MFM ## Returnerer minste felles multiplum
+LN = LN ## Returnerer den naturlige logaritmen til et tall
+LOG = LOG ## Returnerer logaritmen for et tall til et angitt grunntall
+LOG10 = LOG10 ## Returnerer logaritmen med grunntall 10 for et tall
+MDETERM = MDETERM ## Returnerer matrisedeterminanten til en matrise
+MINVERSE = MINVERS ## Returnerer den inverse matrisen til en matrise
+MMULT = MMULT ## Returnerer matriseproduktet av to matriser
+MOD = REST ## Returnerer resten fra en divisjon
+MROUND = MRUND ## Returnerer et tall avrundet til det ønskede multiplum
+MULTINOMIAL = MULTINOMINELL ## Returnerer det multinominelle for et sett med tall
+ODD = AVRUND.TIL.ODDETALL ## Runder av et tall oppover til nærmeste heltall som er et oddetall
+PI = PI ## Returnerer verdien av pi
+POWER = OPPHØYD.I ## Returnerer resultatet av et tall opphøyd i en potens
+PRODUCT = PRODUKT ## Multipliserer argumentene
+QUOTIENT = KVOTIENT ## Returnerer heltallsdelen av en divisjon
+RADIANS = RADIANER ## Konverterer grader til radianer
+RAND = TILFELDIG ## Returnerer et tilfeldig tall mellom 0 og 1
+RANDBETWEEN = TILFELDIGMELLOM ## Returnerer et tilfeldig tall innenfor et angitt område
+ROMAN = ROMERTALL ## Konverterer vanlige tall til romertall, som tekst
+ROUND = AVRUND ## Avrunder et tall til et angitt antall sifre
+ROUNDDOWN = AVRUND.NED ## Avrunder et tall nedover, mot null
+ROUNDUP = AVRUND.OPP ## Runder av et tall oppover, bort fra null
+SERIESSUM = SUMMER.REKKE ## Returnerer summen av en geometrisk rekke, basert på formelen
+SIGN = FORTEGN ## Returnerer fortegnet for et tall
+SIN = SIN ## Returnerer sinus til en gitt vinkel
+SINH = SINH ## Returnerer den hyperbolske sinus til et tall
+SQRT = ROT ## Returnerer en positiv kvadratrot
+SQRTPI = ROTPI ## Returnerer kvadratroten av (tall * pi)
+SUBTOTAL = DELSUM ## Returnerer en delsum i en liste eller database
+SUM = SUMMER ## Legger sammen argumentene
+SUMIF = SUMMERHVIS ## Legger sammen cellene angitt ved et gitt vilkår
+SUMIFS = SUMMER.HVIS.SETT ## Legger sammen cellene i et område som oppfyller flere vilkår
+SUMPRODUCT = SUMMERPRODUKT ## Returnerer summen av produktene av tilsvarende matrisekomponenter
+SUMSQ = SUMMERKVADRAT ## Returnerer kvadratsummen av argumentene
+SUMX2MY2 = SUMMERX2MY2 ## Returnerer summen av differansen av kvadratene for tilsvarende verdier i to matriser
+SUMX2PY2 = SUMMERX2PY2 ## Returnerer summen av kvadratsummene for tilsvarende verdier i to matriser
+SUMXMY2 = SUMMERXMY2 ## Returnerer summen av kvadratene av differansen for tilsvarende verdier i to matriser
+TAN = TAN ## Returnerer tangens for et tall
+TANH = TANH ## Returnerer den hyperbolske tangens for et tall
+TRUNC = AVKORT ## Korter av et tall til et heltall
+
+
+##
+## Statistical functions Statistiske funksjoner
+##
+AVEDEV = GJENNOMSNITTSAVVIK ## Returnerer datapunktenes gjennomsnittlige absoluttavvik fra middelverdien
+AVERAGE = GJENNOMSNITT ## Returnerer gjennomsnittet for argumentene
+AVERAGEA = GJENNOMSNITTA ## Returnerer gjennomsnittet for argumentene, inkludert tall, tekst og logiske verdier
+AVERAGEIF = GJENNOMSNITTHVIS ## Returnerer gjennomsnittet (aritmetisk gjennomsnitt) av alle cellene i et område som oppfyller et bestemt vilkår
+AVERAGEIFS = GJENNOMSNITT.HVIS.SETT ## Returnerer gjennomsnittet (aritmetisk middelverdi) av alle celler som oppfyller flere vilkår.
+BETADIST = BETA.FORDELING ## Returnerer den kumulative betafordelingsfunksjonen
+BETAINV = INVERS.BETA.FORDELING ## Returnerer den inverse verdien til fordelingsfunksjonen for en angitt betafordeling
+BINOMDIST = BINOM.FORDELING ## Returnerer den individuelle binomiske sannsynlighetsfordelingen
+CHIDIST = KJI.FORDELING ## Returnerer den ensidige sannsynligheten for en kjikvadrert fordeling
+CHIINV = INVERS.KJI.FORDELING ## Returnerer den inverse av den ensidige sannsynligheten for den kjikvadrerte fordelingen
+CHITEST = KJI.TEST ## Utfører testen for uavhengighet
+CONFIDENCE = KONFIDENS ## Returnerer konfidensintervallet til gjennomsnittet for en populasjon
+CORREL = KORRELASJON ## Returnerer korrelasjonskoeffisienten mellom to datasett
+COUNT = ANTALL ## Teller hvor mange tall som er i argumentlisten
+COUNTA = ANTALLA ## Teller hvor mange verdier som er i argumentlisten
+COUNTBLANK = TELLBLANKE ## Teller antall tomme celler i et område.
+COUNTIF = ANTALL.HVIS ## Teller antall celler i et område som oppfyller gitte vilkår
+COUNTIFS = ANTALL.HVIS.SETT ## Teller antallet ikke-tomme celler i et område som oppfyller flere vilkår
+COVAR = KOVARIANS ## Returnerer kovariansen, gjennomsnittet av produktene av parvise avvik
+CRITBINOM = GRENSE.BINOM ## Returnerer den minste verdien der den kumulative binomiske fordelingen er mindre enn eller lik en vilkårsverdi
+DEVSQ = AVVIK.KVADRERT ## Returnerer summen av kvadrerte avvik
+EXPONDIST = EKSP.FORDELING ## Returnerer eksponentialfordelingen
+FDIST = FFORDELING ## Returnerer F-sannsynlighetsfordelingen
+FINV = FFORDELING.INVERS ## Returnerer den inverse av den sannsynlige F-fordelingen
+FISHER = FISHER ## Returnerer Fisher-transformasjonen
+FISHERINV = FISHERINV ## Returnerer den inverse av Fisher-transformasjonen
+FORECAST = PROGNOSE ## Returnerer en verdi langs en lineær trend
+FREQUENCY = FREKVENS ## Returnerer en frekvensdistribusjon som en loddrett matrise
+FTEST = FTEST ## Returnerer resultatet av en F-test
+GAMMADIST = GAMMAFORDELING ## Returnerer gammafordelingen
+GAMMAINV = GAMMAINV ## Returnerer den inverse av den gammakumulative fordelingen
+GAMMALN = GAMMALN ## Returnerer den naturlige logaritmen til gammafunksjonen G(x)
+GEOMEAN = GJENNOMSNITT.GEOMETRISK ## Returnerer den geometriske middelverdien
+GROWTH = VEKST ## Returnerer verdier langs en eksponentiell trend
+HARMEAN = GJENNOMSNITT.HARMONISK ## Returnerer den harmoniske middelverdien
+HYPGEOMDIST = HYPGEOM.FORDELING ## Returnerer den hypergeometriske fordelingen
+INTERCEPT = SKJÆRINGSPUNKT ## Returnerer skjæringspunktet til den lineære regresjonslinjen
+KURT = KURT ## Returnerer kurtosen til et datasett
+LARGE = N.STØRST ## Returnerer den n-te største verdien i et datasett
+LINEST = RETTLINJE ## Returnerer parameterne til en lineær trend
+LOGEST = KURVE ## Returnerer parameterne til en eksponentiell trend
+LOGINV = LOGINV ## Returnerer den inverse lognormale fordelingen
+LOGNORMDIST = LOGNORMFORD ## Returnerer den kumulative lognormale fordelingen
+MAX = STØRST ## Returnerer maksimumsverdien i en argumentliste
+MAXA = MAKSA ## Returnerer maksimumsverdien i en argumentliste, inkludert tall, tekst og logiske verdier
+MEDIAN = MEDIAN ## Returnerer medianen til tallene som er gitt
+MIN = MIN ## Returnerer minimumsverdien i en argumentliste
+MINA = MINA ## Returnerer den minste verdien i en argumentliste, inkludert tall, tekst og logiske verdier
+MODE = MODUS ## Returnerer den vanligste verdien i et datasett
+NEGBINOMDIST = NEGBINOM.FORDELING ## Returnerer den negative binomiske fordelingen
+NORMDIST = NORMALFORDELING ## Returnerer den kumulative normalfordelingen
+NORMINV = NORMINV ## Returnerer den inverse kumulative normalfordelingen
+NORMSDIST = NORMSFORDELING ## Returnerer standard kumulativ normalfordeling
+NORMSINV = NORMSINV ## Returnerer den inverse av den den kumulative standard normalfordelingen
+PEARSON = PEARSON ## Returnerer produktmomentkorrelasjonskoeffisienten, Pearson
+PERCENTILE = PERSENTIL ## Returnerer den n-te persentil av verdiene i et område
+PERCENTRANK = PROSENTDEL ## Returnerer prosentrangeringen av en verdi i et datasett
+PERMUT = PERMUTER ## Returnerer antall permutasjoner for et gitt antall objekter
+POISSON = POISSON ## Returnerer Poissons sannsynlighetsfordeling
+PROB = SANNSYNLIG ## Returnerer sannsynligheten for at verdier i et område ligger mellom to grenser
+QUARTILE = KVARTIL ## Returnerer kvartilen til et datasett
+RANK = RANG ## Returnerer rangeringen av et tall, eller plassen tallet har i en rekke
+RSQ = RKVADRAT ## Returnerer kvadratet av produktmomentkorrelasjonskoeffisienten (Pearsons r)
+SKEW = SKJEVFORDELING ## Returnerer skjevheten i en fordeling
+SLOPE = STIGNINGSTALL ## Returnerer stigningtallet for den lineære regresjonslinjen
+SMALL = N.MINST ## Returnerer den n-te minste verdien i et datasett
+STANDARDIZE = NORMALISER ## Returnerer en normalisert verdi
+STDEV = STDAV ## Estimere standardavvik på grunnlag av et utvalg
+STDEVA = STDAVVIKA ## Estimerer standardavvik basert på et utvalg, inkludert tall, tekst og logiske verdier
+STDEVP = STDAVP ## Beregner standardavvik basert på hele populasjonen
+STDEVPA = STDAVVIKPA ## Beregner standardavvik basert på hele populasjonen, inkludert tall, tekst og logiske verdier
+STEYX = STANDARDFEIL ## Returnerer standardfeilen for den predikerte y-verdien for hver x i regresjonen
+TDIST = TFORDELING ## Returnerer en Student t-fordeling
+TINV = TINV ## Returnerer den inverse Student t-fordelingen
+TREND = TREND ## Returnerer verdier langs en lineær trend
+TRIMMEAN = TRIMMET.GJENNOMSNITT ## Returnerer den interne middelverdien til et datasett
+TTEST = TTEST ## Returnerer sannsynligheten assosiert med en Student t-test
+VAR = VARIANS ## Estimerer varians basert på et utvalg
+VARA = VARIANSA ## Estimerer varians basert på et utvalg, inkludert tall, tekst og logiske verdier
+VARP = VARIANSP ## Beregner varians basert på hele populasjonen
+VARPA = VARIANSPA ## Beregner varians basert på hele populasjonen, inkludert tall, tekst og logiske verdier
+WEIBULL = WEIBULL.FORDELING ## Returnerer Weibull-fordelingen
+ZTEST = ZTEST ## Returnerer den ensidige sannsynlighetsverdien for en z-test
+
+
+##
+## Text functions Tekstfunksjoner
+##
+ASC = STIGENDE ## Endrer fullbreddes (dobbeltbyte) engelske bokstaver eller katakana i en tegnstreng, til halvbreddes (enkeltbyte) tegn
+BAHTTEXT = BAHTTEKST ## Konverterer et tall til tekst, og bruker valutaformatet ß (baht)
+CHAR = TEGNKODE ## Returnerer tegnet som svarer til kodenummeret
+CLEAN = RENSK ## Fjerner alle tegn som ikke kan skrives ut, fra teksten
+CODE = KODE ## Returnerer en numerisk kode for det første tegnet i en tekststreng
+CONCATENATE = KJEDE.SAMMEN ## Slår sammen flere tekstelementer til ett tekstelement
+DOLLAR = VALUTA ## Konverterer et tall til tekst, og bruker valutaformatet $ (dollar)
+EXACT = EKSAKT ## Kontrollerer om to tekstverdier er like
+FIND = FINN ## Finner en tekstverdi inne i en annen (skiller mellom store og små bokstaver)
+FINDB = FINNB ## Finner en tekstverdi inne i en annen (skiller mellom store og små bokstaver)
+FIXED = FASTSATT ## Formaterer et tall som tekst med et bestemt antall desimaler
+JIS = JIS ## Endrer halvbreddes (enkeltbyte) engelske bokstaver eller katakana i en tegnstreng, til fullbreddes (dobbeltbyte) tegn
+LEFT = VENSTRE ## Returnerer tegnene lengst til venstre i en tekstverdi
+LEFTB = VENSTREB ## Returnerer tegnene lengst til venstre i en tekstverdi
+LEN = LENGDE ## Returnerer antall tegn i en tekststreng
+LENB = LENGDEB ## Returnerer antall tegn i en tekststreng
+LOWER = SMÅ ## Konverterer tekst til små bokstaver
+MID = DELTEKST ## Returnerer et angitt antall tegn fra en tekststreng, og begynner fra posisjonen du angir
+MIDB = DELTEKSTB ## Returnerer et angitt antall tegn fra en tekststreng, og begynner fra posisjonen du angir
+PHONETIC = FURIGANA ## Trekker ut fonetiske tegn (furigana) fra en tekststreng
+PROPER = STOR.FORBOKSTAV ## Gir den første bokstaven i hvert ord i en tekstverdi stor forbokstav
+REPLACE = ERSTATT ## Erstatter tegn i en tekst
+REPLACEB = ERSTATTB ## Erstatter tegn i en tekst
+REPT = GJENTA ## Gjentar tekst et gitt antall ganger
+RIGHT = HØYRE ## Returnerer tegnene lengst til høyre i en tekstverdi
+RIGHTB = HØYREB ## Returnerer tegnene lengst til høyre i en tekstverdi
+SEARCH = SØK ## Finner en tekstverdi inne i en annen (skiller ikke mellom store og små bokstaver)
+SEARCHB = SØKB ## Finner en tekstverdi inne i en annen (skiller ikke mellom store og små bokstaver)
+SUBSTITUTE = BYTT.UT ## Bytter ut gammel tekst med ny tekst i en tekststreng
+T = T ## Konverterer argumentene til tekst
+TEXT = TEKST ## Formaterer et tall og konverterer det til tekst
+TRIM = TRIMME ## Fjerner mellomrom fra tekst
+UPPER = STORE ## Konverterer tekst til store bokstaver
+VALUE = VERDI ## Konverterer et tekstargument til et tall
diff --git a/Classes/PHPExcel/locale/pl/config b/Classes/PHPExcel/locale/pl/config
new file mode 100644
index 0000000..4dd75be
--- /dev/null
+++ b/Classes/PHPExcel/locale/pl/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = zł
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #ZERO!
+DIV0 = #DZIEL/0!
+VALUE = #ARG!
+REF = #ADR!
+NAME = #NAZWA?
+NUM = #LICZBA!
+NA = #N/D!
diff --git a/Classes/PHPExcel/locale/pl/functions b/Classes/PHPExcel/locale/pl/functions
new file mode 100644
index 0000000..1881a71
--- /dev/null
+++ b/Classes/PHPExcel/locale/pl/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Funkcje dodatków i automatyzacji
+##
+GETPIVOTDATA = WEŹDANETABELI ## Zwraca dane przechowywane w raporcie tabeli przestawnej.
+
+
+##
+## Cube functions Funkcje modułów
+##
+CUBEKPIMEMBER = ELEMENT.KPI.MODUÅU ## Zwraca nazwÄ™, wÅ‚aÅ›ciwość i miarÄ™ kluczowego wskaźnika wydajnoÅ›ci (KPI) oraz wyÅ›wietla nazwÄ™ i wÅ‚aÅ›ciwość w komórce. Wskaźnik KPI jest miarÄ… iloÅ›ciowÄ…, takÄ… jak miesiÄ™czny zysk brutto lub kwartalna fluktuacja pracowników, używanÄ… do monitorowania wydajnoÅ›ci organizacji.
+CUBEMEMBER = ELEMENT.MODUÅU ## Zwraca element lub krotkÄ™ z hierarchii moduÅ‚u. SÅ‚uży do sprawdzania, czy element lub krotka istnieje w module.
+CUBEMEMBERPROPERTY = WÅAÅšCIWOŚĆ.ELEMENTU.MODUÅU ## Zwraca wartość wÅ‚aÅ›ciwoÅ›ci elementu w module. SÅ‚uży do sprawdzania, czy nazwa elementu istnieje w module, i zwracania okreÅ›lonej wÅ‚aÅ›ciwoÅ›ci dla tego elementu.
+CUBERANKEDMEMBER = USZEREGOWANY.ELEMENT.MODUÅU ## Zwraca n-ty (albo uszeregowany) element zestawu. SÅ‚uży do zwracania elementu lub elementów zestawu, na przykÅ‚ad najlepszego sprzedawcy lub 10 najlepszych studentów.
+CUBESET = ZESTAW.MODUÅÓW ## Definiuje obliczony zestaw elementów lub krotek, wysyÅ‚ajÄ…c wyrażenie zestawu do serwera moduÅ‚u, który tworzy zestaw i zwraca go do programu Microsoft Office Excel.
+CUBESETCOUNT = LICZNIK.MODUÅÓW.ZESTAWU ## Zwraca liczbÄ™ elementów zestawu.
+CUBEVALUE = WARTOŚĆ.MODUÅU ## Zwraca zagregowanÄ… wartość z moduÅ‚u.
+
+
+##
+## Database functions Funkcje baz danych
+##
+DAVERAGE = BD.ŚREDNIA ## Zwraca wartość średniej wybranych wpisów bazy danych.
+DCOUNT = BD.ILE.REKORDÓW ## Zlicza komórki zawierające liczby w bazie danych.
+DCOUNTA = BD.ILE.REKORDÓW.A ## Zlicza niepuste komórki w bazie danych.
+DGET = BD.POLE ## Wyodrębnia z bazy danych jeden rekord spełniający określone kryteria.
+DMAX = BD.MAX ## Zwraca wartość maksymalną z wybranych wpisów bazy danych.
+DMIN = BD.MIN ## Zwraca wartość minimalną z wybranych wpisów bazy danych.
+DPRODUCT = BD.ILOCZYN ## Mnoży wartości w konkretnym, spełniającym kryteria polu rekordów bazy danych.
+DSTDEV = BD.ODCH.STANDARD ## Szacuje odchylenie standardowe na podstawie próbki z wybranych wpisów bazy danych.
+DSTDEVP = BD.ODCH.STANDARD.POPUL ## Oblicza odchylenie standardowe na podstawie całej populacji wybranych wpisów bazy danych.
+DSUM = BD.SUMA ## Dodaje liczby w kolumnie pól rekordów bazy danych, które spełniają kryteria.
+DVAR = BD.WARIANCJA ## Szacuje wariancję na podstawie próbki z wybranych wpisów bazy danych.
+DVARP = BD.WARIANCJA.POPUL ## Oblicza wariancję na podstawie całej populacji wybranych wpisów bazy danych.
+
+
+##
+## Date and time functions Funkcje dat, godzin i czasu
+##
+DATE = DATA ## Zwraca liczbÄ™ seryjnÄ… dla wybranej daty.
+DATEVALUE = DATA.WARTOŚĆ ## Konwertuje datę w formie tekstu na liczbę seryjną.
+DAY = DZIEŃ ## Konwertuje liczbę seryjną na dzień miesiąca.
+DAYS360 = DNI.360 ## Oblicza liczbę dni między dwiema datami na podstawie roku 360-dniowego.
+EDATE = UPÅDNI ## Zwraca liczbÄ™ seryjnÄ… daty jako wskazanÄ… liczbÄ™ miesiÄ™cy przed okreÅ›lonÄ… datÄ… poczÄ…tkowÄ… lub po niej.
+EOMONTH = EOMONTH ## Zwraca liczbę seryjną ostatniego dnia miesiąca przed określoną liczbą miesięcy lub po niej.
+HOUR = GODZINA ## Konwertuje liczbÄ™ seryjnÄ… na godzinÄ™.
+MINUTE = MINUTA ## Konwertuje liczbÄ™ seryjnÄ… na minutÄ™.
+MONTH = MIESIÄ„C ## Konwertuje liczbÄ™ seryjnÄ… na miesiÄ…c.
+NETWORKDAYS = NETWORKDAYS ## Zwraca liczbę pełnych dni roboczych między dwiema datami.
+NOW = TERAZ ## Zwraca liczbę seryjną bieżącej daty i godziny.
+SECOND = SEKUNDA ## Konwertuje liczbÄ™ seryjnÄ… na sekundÄ™.
+TIME = CZAS ## Zwraca liczbę seryjną określonego czasu.
+TIMEVALUE = CZAS.WARTOŚĆ ## Konwertuje czas w formie tekstu na liczbę seryjną.
+TODAY = DZIŚ ## Zwraca liczbę seryjną dla daty bieżącej.
+WEEKDAY = DZIEŃ.TYG ## Konwertuje liczbę seryjną na dzień tygodnia.
+WEEKNUM = WEEKNUM ## Konwertuje liczbÄ™ seryjnÄ… na liczbÄ™ reprezentujÄ…cÄ… numer tygodnia w roku.
+WORKDAY = WORKDAY ## Zwraca liczbę seryjną dla daty przed określoną liczbą dni roboczych lub po niej.
+YEAR = ROK ## Konwertuje liczbÄ™ seryjnÄ… na rok.
+YEARFRAC = YEARFRAC ## Zwraca część roku reprezentowaną przez pełną liczbę dni między datą początkową a datą końcową.
+
+
+##
+## Engineering functions Funkcje inżynierskie
+##
+BESSELI = BESSELI ## Zwraca wartość zmodyfikowanej funkcji Bessela In(x).
+BESSELJ = BESSELJ ## Zwraca wartość funkcji Bessela Jn(x).
+BESSELK = BESSELK ## Zwraca wartość zmodyfikowanej funkcji Bessela Kn(x).
+BESSELY = BESSELY ## Zwraca wartość funkcji Bessela Yn(x).
+BIN2DEC = BIN2DEC ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci dziesiętnej.
+BIN2HEX = BIN2HEX ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci szesnastkowej.
+BIN2OCT = BIN2OCT ## Konwertuje liczbę w postaci dwójkowej na liczbę w postaci ósemkowej.
+COMPLEX = COMPLEX ## Konwertuje część rzeczywistą i urojoną na liczbę zespoloną.
+CONVERT = CONVERT ## Konwertuje liczbÄ™ z jednego systemu miar na inny.
+DEC2BIN = DEC2BIN ## Konwertuje liczbę w postaci dziesiętnej na postać dwójkową.
+DEC2HEX = DEC2HEX ## Konwertuje liczbę w postaci dziesiętnej na liczbę w postaci szesnastkowej.
+DEC2OCT = DEC2OCT ## Konwertuje liczbę w postaci dziesiętnej na liczbę w postaci ósemkowej.
+DELTA = DELTA ## Sprawdza, czy dwie wartości są równe.
+ERF = ERF ## Zwraca wartość funkcji błędu.
+ERFC = ERFC ## Zwraca wartość komplementarnej funkcji błędu.
+GESTEP = GESTEP ## Sprawdza, czy liczba jest większa niż wartość progowa.
+HEX2BIN = HEX2BIN ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci dwójkowej.
+HEX2DEC = HEX2DEC ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci dziesiętnej.
+HEX2OCT = HEX2OCT ## Konwertuje liczbę w postaci szesnastkowej na liczbę w postaci ósemkowej.
+IMABS = IMABS ## Zwraca wartość bezwzględną (moduł) liczby zespolonej.
+IMAGINARY = IMAGINARY ## Zwraca wartość części urojonej liczby zespolonej.
+IMARGUMENT = IMARGUMENT ## Zwraca wartość argumentu liczby zespolonej, przy czym kąt wyrażony jest w radianach.
+IMCONJUGATE = IMCONJUGATE ## Zwraca wartość liczby sprzężonej danej liczby zespolonej.
+IMCOS = IMCOS ## Zwraca wartość cosinusa liczby zespolonej.
+IMDIV = IMDIV ## Zwraca wartość ilorazu dwóch liczb zespolonych.
+IMEXP = IMEXP ## Zwraca postać wykładniczą liczby zespolonej.
+IMLN = IMLN ## Zwraca wartość logarytmu naturalnego liczby zespolonej.
+IMLOG10 = IMLOG10 ## Zwraca wartość logarytmu dziesiętnego liczby zespolonej.
+IMLOG2 = IMLOG2 ## Zwraca wartość logarytmu liczby zespolonej przy podstawie 2.
+IMPOWER = IMPOWER ## Zwraca wartość liczby zespolonej podniesionej do potęgi całkowitej.
+IMPRODUCT = IMPRODUCT ## Zwraca wartość iloczynu liczb zespolonych.
+IMREAL = IMREAL ## Zwraca wartość części rzeczywistej liczby zespolonej.
+IMSIN = IMSIN ## Zwraca wartość sinusa liczby zespolonej.
+IMSQRT = IMSQRT ## Zwraca wartość pierwiastka kwadratowego z liczby zespolonej.
+IMSUB = IMSUB ## Zwraca wartość różnicy dwóch liczb zespolonych.
+IMSUM = IMSUM ## Zwraca wartość sumy liczb zespolonych.
+OCT2BIN = OCT2BIN ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci dwójkowej.
+OCT2DEC = OCT2DEC ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci dziesiętnej.
+OCT2HEX = OCT2HEX ## Konwertuje liczbę w postaci ósemkowej na liczbę w postaci szesnastkowej.
+
+
+##
+## Financial functions Funkcje finansowe
+##
+ACCRINT = ACCRINT ## Zwraca narosłe odsetki dla papieru wartościowego z oprocentowaniem okresowym.
+ACCRINTM = ACCRINTM ## Zwraca narosłe odsetki dla papieru wartościowego z oprocentowaniem w terminie wykupu.
+AMORDEGRC = AMORDEGRC ## Zwraca amortyzację dla każdego okresu rozliczeniowego z wykorzystaniem współczynnika amortyzacji.
+AMORLINC = AMORLINC ## Zwraca amortyzację dla każdego okresu rozliczeniowego.
+COUPDAYBS = COUPDAYBS ## Zwraca liczbÄ™ dni od poczÄ…tku okresu dywidendy do dnia rozliczeniowego.
+COUPDAYS = COUPDAYS ## Zwraca liczbę dni w okresie dywidendy, z uwzględnieniem dnia rozliczeniowego.
+COUPDAYSNC = COUPDAYSNC ## Zwraca liczbę dni od dnia rozliczeniowego do daty następnego dnia dywidendy.
+COUPNCD = COUPNCD ## Zwraca dzień następnej dywidendy po dniu rozliczeniowym.
+COUPNUM = COUPNUM ## Zwraca liczbę dywidend płatnych między dniem rozliczeniowym a dniem wykupu.
+COUPPCD = COUPPCD ## Zwraca dzień poprzedniej dywidendy przed dniem rozliczeniowym.
+CUMIPMT = CUMIPMT ## Zwraca wartość procentu składanego płatnego między dwoma okresami.
+CUMPRINC = CUMPRINC ## Zwraca wartość kapitału skumulowanego spłaty pożyczki między dwoma okresami.
+DB = DB ## Zwraca amortyzację środka trwałego w danym okresie metodą degresywną z zastosowaniem stałej bazowej.
+DDB = DDB ## Zwraca amortyzację środka trwałego za podany okres metodą degresywną z zastosowaniem podwójnej bazowej lub metodą określoną przez użytkownika.
+DISC = DISC ## Zwraca wartość stopy dyskontowej papieru wartościowego.
+DOLLARDE = DOLLARDE ## Konwertuje cenę w postaci ułamkowej na cenę wyrażoną w postaci dziesiętnej.
+DOLLARFR = DOLLARFR ## Konwertuje cenę wyrażoną w postaci dziesiętnej na cenę wyrażoną w postaci ułamkowej.
+DURATION = DURATION ## Zwraca wartość rocznego przychodu z papieru wartościowego o okresowych wypłatach oprocentowania.
+EFFECT = EFFECT ## Zwraca wartość efektywnej rocznej stopy procentowej.
+FV = FV ## Zwraca przyszłą wartość lokaty.
+FVSCHEDULE = FVSCHEDULE ## Zwraca przyszłą wartość kapitału początkowego wraz z szeregiem procentów składanych.
+INTRATE = INTRATE ## Zwraca wartość stopy procentowej papieru wartościowego całkowicie ulokowanego.
+IPMT = IPMT ## Zwraca wysokość spłaty oprocentowania lokaty za dany okres.
+IRR = IRR ## Zwraca wartość wewnętrznej stopy zwrotu dla serii przepływów gotówkowych.
+ISPMT = ISPMT ## Oblicza wysokość spłaty oprocentowania za dany okres lokaty.
+MDURATION = MDURATION ## Zwraca wartość zmodyfikowanego okresu Macauleya dla papieru wartościowego o założonej wartości nominalnej 100 zł.
+MIRR = MIRR ## Zwraca wartość wewnętrznej stopy zwrotu dla przypadku, gdy dodatnie i ujemne przepływy gotówkowe mają różne stopy.
+NOMINAL = NOMINAL ## Zwraca wysokość nominalnej rocznej stopy procentowej.
+NPER = NPER ## Zwraca liczbę okresów dla lokaty.
+NPV = NPV ## Zwraca wartość bieżącą netto lokaty na podstawie szeregu okresowych przepływów gotówkowych i stopy dyskontowej.
+ODDFPRICE = ODDFPRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z nietypowym pierwszym okresem.
+ODDFYIELD = ODDFYIELD ## Zwraca rentowność papieru wartościowego z nietypowym pierwszym okresem.
+ODDLPRICE = ODDLPRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z nietypowym ostatnim okresem.
+ODDLYIELD = ODDLYIELD ## Zwraca rentowność papieru wartościowego z nietypowym ostatnim okresem.
+PMT = PMT ## Zwraca wartość okresowej płatności raty rocznej.
+PPMT = PPMT ## Zwraca wysokość spłaty kapitału w przypadku lokaty dla danego okresu.
+PRICE = PRICE ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z oprocentowaniem okresowym.
+PRICEDISC = PRICEDISC ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego zdyskontowanego.
+PRICEMAT = PRICEMAT ## Zwraca cenę za 100 zł wartości nominalnej papieru wartościowego z oprocentowaniem w terminie wykupu.
+PV = PV ## Zwraca wartość bieżącą lokaty.
+RATE = RATE ## Zwraca wysokość stopy procentowej w okresie raty rocznej.
+RECEIVED = RECEIVED ## Zwraca wartość kapitału otrzymanego przy wykupie papieru wartościowego całkowicie ulokowanego.
+SLN = SLN ## Zwraca amortyzację środka trwałego za jeden okres metodą liniową.
+SYD = SYD ## Zwraca amortyzację środka trwałego za dany okres metodą sumy cyfr lat amortyzacji.
+TBILLEQ = TBILLEQ ## Zwraca rentowność ekwiwalentu obligacji dla bonu skarbowego.
+TBILLPRICE = TBILLPRICE ## Zwraca cenę za 100 zł wartości nominalnej bonu skarbowego.
+TBILLYIELD = TBILLYIELD ## Zwraca rentowność bonu skarbowego.
+VDB = VDB ## Oblicza amortyzację środka trwałego w danym okresie lub jego części metodą degresywną.
+XIRR = XIRR ## Zwraca wartość wewnętrznej stopy zwrotu dla serii rozłożonych w czasie przepływów gotówkowych, niekoniecznie okresowych.
+XNPV = XNPV ## Zwraca wartość bieżącą netto dla serii rozłożonych w czasie przepływów gotówkowych, niekoniecznie okresowych.
+YIELD = YIELD ## Zwraca rentowność papieru wartościowego z oprocentowaniem okresowym.
+YIELDDISC = YIELDDISC ## Zwraca roczną rentowność zdyskontowanego papieru wartościowego, na przykład bonu skarbowego.
+YIELDMAT = YIELDMAT ## Zwraca roczną rentowność papieru wartościowego oprocentowanego przy wykupie.
+
+
+##
+## Information functions Funkcje informacyjne
+##
+CELL = KOMÓRKA ## Zwraca informacje o formacie, położeniu lub zawartości komórki.
+ERROR.TYPE = NR.BÅĘDU ## Zwraca liczbÄ™ odpowiadajÄ…cÄ… typowi bÅ‚Ä™du.
+INFO = INFO ## Zwraca informację o aktualnym środowisku pracy.
+ISBLANK = CZY.PUSTA ## Zwraca wartość PRAWDA, jeśli wartość jest pusta.
+ISERR = CZY.BŠ## Zwraca wartość PRAWDA, jeśli wartość jest dowolną wartością błędu, z wyjątkiem #N/D!.
+ISERROR = CZY.BÅÄ„D ## Zwraca wartość PRAWDA, jeÅ›li wartość jest dowolnÄ… wartoÅ›ciÄ… bÅ‚Ä™du.
+ISEVEN = ISEVEN ## Zwraca wartość PRAWDA, jeśli liczba jest parzysta.
+ISLOGICAL = CZY.LOGICZNA ## Zwraca wartość PRAWDA, jeśli wartość jest wartością logiczną.
+ISNA = CZY.BRAK ## Zwraca wartość PRAWDA, jeśli wartość jest wartością błędu #N/D!.
+ISNONTEXT = CZY.NIE.TEKST ## Zwraca wartość PRAWDA, jeśli wartość nie jest tekstem.
+ISNUMBER = CZY.LICZBA ## Zwraca wartość PRAWDA, jeśli wartość jest liczbą.
+ISODD = ISODD ## Zwraca wartość PRAWDA, jeśli liczba jest nieparzysta.
+ISREF = CZY.ADR ## Zwraca wartość PRAWDA, jeśli wartość jest odwołaniem.
+ISTEXT = CZY.TEKST ## Zwraca wartość PRAWDA, jeśli wartość jest tekstem.
+N = L ## Zwraca wartość przekonwertowaną na postać liczbową.
+NA = BRAK ## Zwraca wartość błędu #N/D!.
+TYPE = TYP ## Zwraca liczbę wskazującą typ danych wartości.
+
+
+##
+## Logical functions Funkcje logiczne
+##
+AND = ORAZ ## Zwraca wartość PRAWDA, jeśli wszystkie argumenty mają wartość PRAWDA.
+FALSE = FAÅSZ ## Zwraca wartość logicznÄ… FAÅSZ.
+IF = JEŻELI ## Określa warunek logiczny do sprawdzenia.
+IFERROR = JEÅ»ELI.BÅÄ„D ## Zwraca okreÅ›lonÄ… wartość, jeÅ›li wynikiem obliczenia formuÅ‚y jest bÅ‚Ä…d; w przeciwnym przypadku zwraca wynik formuÅ‚y.
+NOT = NIE ## Odwraca wartość logiczną argumentu.
+OR = LUB ## Zwraca wartość PRAWDA, jeśli co najmniej jeden z argumentów ma wartość PRAWDA.
+TRUE = PRAWDA ## Zwraca wartość logiczną PRAWDA.
+
+
+##
+## Lookup and reference functions Funkcje wyszukiwania i odwołań
+##
+ADDRESS = ADRES ## Zwraca odwołanie do jednej komórki w arkuszu jako wartość tekstową.
+AREAS = OBSZARY ## Zwraca liczbę obszarów występujących w odwołaniu.
+CHOOSE = WYBIERZ ## Wybiera wartość z listy wartości.
+COLUMN = NR.KOLUMNY ## Zwraca numer kolumny z odwołania.
+COLUMNS = LICZBA.KOLUMN ## Zwraca liczbę kolumn dla danego odwołania.
+HLOOKUP = WYSZUKAJ.POZIOMO ## Przegląda górny wiersz tablicy i zwraca wartość wskazanej komórki.
+HYPERLINK = HIPERÅÄ„CZE ## Tworzy skrót lub skok, który pozwala otwierać dokument przechowywany na serwerze sieciowym, w sieci intranet lub w Internecie.
+INDEX = INDEKS ## Używa indeksu do wybierania wartości z odwołania lub tablicy.
+INDIRECT = ADR.POŚR ## Zwraca odwołanie określone przez wartość tekstową.
+LOOKUP = WYSZUKAJ ## Wyszukuje wartości w wektorze lub tablicy.
+MATCH = PODAJ.POZYCJĘ ## Wyszukuje wartości w odwołaniu lub w tablicy.
+OFFSET = PRZESUNIĘCIE ## Zwraca adres przesunięty od danego odwołania.
+ROW = WIERSZ ## Zwraca numer wiersza odwołania.
+ROWS = ILE.WIERSZY ## Zwraca liczbę wierszy dla danego odwołania.
+RTD = RTD ## Pobiera dane w czasie rzeczywistym z programu obsługującego automatyzację COM (Automatyzacja: Sposób pracy z obiektami aplikacji pochodzącymi z innej aplikacji lub narzędzia projektowania. Nazywana wcześniej Automatyzacją OLE, Automatyzacja jest standardem przemysłowym i funkcją obiektowego modelu składników (COM, Component Object Model).).
+TRANSPOSE = TRANSPONUJ ## Zwraca transponowanÄ… tablicÄ™.
+VLOOKUP = WYSZUKAJ.PIONOWO ## Przeszukuje pierwszą kolumnę tablicy i przechodzi wzdłuż wiersza, aby zwrócić wartość komórki.
+
+
+##
+## Math and trigonometry functions Funkcje matematyczne i trygonometryczne
+##
+ABS = MODUÅ.LICZBY ## Zwraca wartość absolutnÄ… liczby.
+ACOS = ACOS ## Zwraca arcus cosinus liczby.
+ACOSH = ACOSH ## Zwraca arcus cosinus hiperboliczny liczby.
+ASIN = ASIN ## Zwraca arcus sinus liczby.
+ASINH = ASINH ## Zwraca arcus sinus hiperboliczny liczby.
+ATAN = ATAN ## Zwraca arcus tangens liczby.
+ATAN2 = ATAN2 ## Zwraca arcus tangens liczby na podstawie współrzędnych x i y.
+ATANH = ATANH ## Zwraca arcus tangens hiperboliczny liczby.
+CEILING = ZAOKR.W.GÓRĘ ## Zaokrągla liczbę do najbliższej liczby całkowitej lub do najbliższej wielokrotności dokładności.
+COMBIN = KOMBINACJE ## Zwraca liczbę kombinacji dla danej liczby obiektów.
+COS = COS ## Zwraca cosinus liczby.
+COSH = COSH ## Zwraca cosinus hiperboliczny liczby.
+DEGREES = STOPNIE ## Konwertuje radiany na stopnie.
+EVEN = ZAOKR.DO.PARZ ## Zaokrągla liczbę w górę do najbliższej liczby parzystej.
+EXP = EXP ## Zwraca wartość liczby e podniesionej do potęgi określonej przez podaną liczbę.
+FACT = SILNIA ## Zwraca silniÄ™ liczby.
+FACTDOUBLE = FACTDOUBLE ## Zwraca podwójną silnię liczby.
+FLOOR = ZAOKR.W.DÓŠ## Zaokrągla liczbę w dół, w kierunku zera.
+GCD = GCD ## Zwraca największy wspólny dzielnik.
+INT = ZAOKR.DO.CAÅK ## ZaokrÄ…gla liczbÄ™ w dół do najbliższej liczby caÅ‚kowitej.
+LCM = LCM ## Zwraca najmniejszą wspólną wielokrotność.
+LN = LN ## Zwraca logarytm naturalny podanej liczby.
+LOG = LOG ## Zwraca logarytm danej liczby przy zadanej podstawie.
+LOG10 = LOG10 ## Zwraca logarytm dziesiętny liczby.
+MDETERM = WYZNACZNIK.MACIERZY ## Zwraca wyznacznik macierzy tablicy.
+MINVERSE = MACIERZ.ODW ## Zwraca odwrotność macierzy tablicy.
+MMULT = MACIERZ.ILOCZYN ## Zwraca iloczyn macierzy dwóch tablic.
+MOD = MOD ## Zwraca resztÄ™ z dzielenia.
+MROUND = MROUND ## Zwraca liczbę zaokrągloną do żądanej wielokrotności.
+MULTINOMIAL = MULTINOMIAL ## Zwraca wielomian dla zbioru liczb.
+ODD = ZAOKR.DO.NPARZ ## Zaokrągla liczbę w górę do najbliższej liczby nieparzystej.
+PI = PI ## Zwraca wartość liczby Pi.
+POWER = POTĘGA ## Zwraca liczbę podniesioną do potęgi.
+PRODUCT = ILOCZYN ## Mnoży argumenty.
+QUOTIENT = QUOTIENT ## Zwraca iloraz (całkowity).
+RADIANS = RADIANY ## Konwertuje stopnie na radiany.
+RAND = LOS ## Zwraca liczbÄ™ pseudolosowÄ… z zakresu od 0 do 1.
+RANDBETWEEN = RANDBETWEEN ## Zwraca liczbę pseudolosową z zakresu określonego przez podane argumenty.
+ROMAN = RZYMSKIE ## Konwertuje liczbÄ™ arabskÄ… na rzymskÄ… jako tekst.
+ROUND = ZAOKR ## Zaokrągla liczbę do określonej liczby cyfr.
+ROUNDDOWN = ZAOKR.DÓŠ## Zaokrągla liczbę w dół, w kierunku zera.
+ROUNDUP = ZAOKR.GÓRA ## Zaokrągla liczbę w górę, w kierunku od zera.
+SERIESSUM = SERIESSUM ## Zwraca sumę szeregu potęgowego na podstawie wzoru.
+SIGN = ZNAK.LICZBY ## Zwraca znak liczby.
+SIN = SIN ## Zwraca sinus danego kÄ…ta.
+SINH = SINH ## Zwraca sinus hiperboliczny liczby.
+SQRT = PIERWIASTEK ## Zwraca dodatni pierwiastek kwadratowy.
+SQRTPI = SQRTPI ## Zwraca pierwiastek kwadratowy iloczynu (liczba * Pi).
+SUBTOTAL = SUMY.POŚREDNIE ## Zwraca sumę częściową listy lub bazy danych.
+SUM = SUMA ## Dodaje argumenty.
+SUMIF = SUMA.JEŻELI ## Dodaje komórki określone przez podane kryterium.
+SUMIFS = SUMA.WARUNKÓW ## Dodaje komórki w zakresie, które spełniają wiele kryteriów.
+SUMPRODUCT = SUMA.ILOCZYNÓW ## Zwraca sumę iloczynów odpowiednich elementów tablicy.
+SUMSQ = SUMA.KWADRATÓW ## Zwraca sumę kwadratów argumentów.
+SUMX2MY2 = SUMA.X2.M.Y2 ## Zwraca sumę różnic kwadratów odpowiednich wartości w dwóch tablicach.
+SUMX2PY2 = SUMA.X2.P.Y2 ## Zwraca sumę sum kwadratów odpowiednich wartości w dwóch tablicach.
+SUMXMY2 = SUMA.XMY.2 ## Zwraca sumę kwadratów różnic odpowiednich wartości w dwóch tablicach.
+TAN = TAN ## Zwraca tangens liczby.
+TANH = TANH ## Zwraca tangens hiperboliczny liczby.
+TRUNC = LICZBA.CAÅK ## Przycina liczbÄ™ do wartoÅ›ci caÅ‚kowitej.
+
+
+##
+## Statistical functions Funkcje statystyczne
+##
+AVEDEV = ODCH.ŚREDNIE ## Zwraca średnią wartość odchyleń absolutnych punktów danych od ich wartości średniej.
+AVERAGE = ŚREDNIA ## Zwraca wartość średnią argumentów.
+AVERAGEA = ŚREDNIA.A ## Zwraca wartość średnią argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych.
+AVERAGEIF = ŚREDNIA.JEŻELI ## Zwraca średnią (średnią arytmetyczną) wszystkich komórek w zakresie, które spełniają podane kryteria.
+AVERAGEIFS = ŚREDNIA.WARUNKÓW ## Zwraca średnią (średnią arytmetyczną) wszystkich komórek, które spełniają jedno lub więcej kryteriów.
+BETADIST = ROZKÅAD.BETA ## Zwraca skumulowanÄ… funkcjÄ™ gÄ™stoÅ›ci prawdopodobieÅ„stwa beta.
+BETAINV = ROZKÅAD.BETA.ODW ## Zwraca odwrotność skumulowanej funkcji gÄ™stoÅ›ci prawdopodobieÅ„stwa beta.
+BINOMDIST = ROZKÅAD.DWUM ## Zwraca pojedynczy skÅ‚adnik dwumianowego rozkÅ‚adu prawdopodobieÅ„stwa.
+CHIDIST = ROZKÅAD.CHI ## Zwraca wartość jednostronnego prawdopodobieÅ„stwa rozkÅ‚adu chi-kwadrat.
+CHIINV = ROZKÅAD.CHI.ODW ## Zwraca odwrotność wartoÅ›ci jednostronnego prawdopodobieÅ„stwa rozkÅ‚adu chi-kwadrat.
+CHITEST = TEST.CHI ## Zwraca test niezależności.
+CONFIDENCE = UFNOŚĆ ## Zwraca interwał ufności dla średniej populacji.
+CORREL = WSP.KORELACJI ## Zwraca współczynnik korelacji dwóch zbiorów danych.
+COUNT = ILE.LICZB ## Zlicza liczby znajdujące się na liście argumentów.
+COUNTA = ILE.NIEPUSTYCH ## Zlicza wartości znajdujące się na liście argumentów.
+COUNTBLANK = LICZ.PUSTE ## Zwraca liczbę pustych komórek w pewnym zakresie.
+COUNTIF = LICZ.JEŻELI ## Zlicza komórki wewnątrz zakresu, które spełniają podane kryteria.
+COUNTIFS = LICZ.WARUNKI ## Zlicza komórki wewnątrz zakresu, które spełniają wiele kryteriów.
+COVAR = KOWARIANCJA ## Zwraca kowariancję, czyli średnią wartość iloczynów odpowiednich odchyleń.
+CRITBINOM = PRÓG.ROZKÅAD.DWUM ## Zwraca najmniejszÄ… wartość, dla której skumulowany rozkÅ‚ad dwumianowy jest mniejszy niż wartość kryterium lub równy jej.
+DEVSQ = ODCH.KWADRATOWE ## Zwraca sumę kwadratów odchyleń.
+EXPONDIST = ROZKÅAD.EXP ## Zwraca rozkÅ‚ad wykÅ‚adniczy.
+FDIST = ROZKÅAD.F ## Zwraca rozkÅ‚ad prawdopodobieÅ„stwa F.
+FINV = ROZKÅAD.F.ODW ## Zwraca odwrotność rozkÅ‚adu prawdopodobieÅ„stwa F.
+FISHER = ROZKÅAD.FISHER ## Zwraca transformacjÄ™ Fishera.
+FISHERINV = ROZKÅAD.FISHER.ODW ## Zwraca odwrotność transformacji Fishera.
+FORECAST = REGLINX ## Zwraca wartość trendu liniowego.
+FREQUENCY = CZĘSTOŚĆ ## Zwraca rozkład częstotliwości jako tablicę pionową.
+FTEST = TEST.F ## Zwraca wynik testu F.
+GAMMADIST = ROZKÅAD.GAMMA ## Zwraca rozkÅ‚ad gamma.
+GAMMAINV = ROZKÅAD.GAMMA.ODW ## Zwraca odwrotność skumulowanego rozkÅ‚adu gamma.
+GAMMALN = ROZKÅAD.LIN.GAMMA ## Zwraca logarytm naturalny funkcji gamma, Γ(x).
+GEOMEAN = ŚREDNIA.GEOMETRYCZNA ## Zwraca średnią geometryczną.
+GROWTH = REGEXPW ## Zwraca wartości trendu wykładniczego.
+HARMEAN = ŚREDNIA.HARMONICZNA ## Zwraca średnią harmoniczną.
+HYPGEOMDIST = ROZKÅAD.HIPERGEOM ## Zwraca rozkÅ‚ad hipergeometryczny.
+INTERCEPT = ODCIĘTA ## Zwraca punkt przecięcia osi pionowej z linią regresji liniowej.
+KURT = KURTOZA ## Zwraca kurtozÄ™ zbioru danych.
+LARGE = MAX.K ## Zwraca k-tą największą wartość ze zbioru danych.
+LINEST = REGLINP ## Zwraca parametry trendu liniowego.
+LOGEST = REGEXPP ## Zwraca parametry trendu wykładniczego.
+LOGINV = ROZKÅAD.LOG.ODW ## Zwraca odwrotność rozkÅ‚adu logarytmu naturalnego.
+LOGNORMDIST = ROZKÅAD.LOG ## Zwraca skumulowany rozkÅ‚ad logarytmu naturalnego.
+MAX = MAX ## Zwraca maksymalną wartość listy argumentów.
+MAXA = MAX.A ## Zwraca maksymalną wartość listy argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych.
+MEDIAN = MEDIANA ## Zwraca medianÄ™ podanych liczb.
+MIN = MIN ## Zwraca minimalną wartość listy argumentów.
+MINA = MIN.A ## Zwraca najmniejszą wartość listy argumentów, z uwzględnieniem liczb, tekstów i wartości logicznych.
+MODE = WYST.NAJCZĘŚCIEJ ## Zwraca wartość najczęściej występującą w zbiorze danych.
+NEGBINOMDIST = ROZKÅAD.DWUM.PRZEC ## Zwraca ujemny rozkÅ‚ad dwumianowy.
+NORMDIST = ROZKÅAD.NORMALNY ## Zwraca rozkÅ‚ad normalny skumulowany.
+NORMINV = ROZKÅAD.NORMALNY.ODW ## Zwraca odwrotność rozkÅ‚adu normalnego skumulowanego.
+NORMSDIST = ROZKÅAD.NORMALNY.S ## Zwraca standardowy rozkÅ‚ad normalny skumulowany.
+NORMSINV = ROZKÅAD.NORMALNY.S.ODW ## Zwraca odwrotność standardowego rozkÅ‚adu normalnego skumulowanego.
+PEARSON = PEARSON ## Zwraca współczynnik korelacji momentu iloczynu Pearsona.
+PERCENTILE = PERCENTYL ## Wyznacza k-ty percentyl wartości w zakresie.
+PERCENTRANK = PROCENT.POZYCJA ## Zwraca procentową pozycję wartości w zbiorze danych.
+PERMUT = PERMUTACJE ## Zwraca liczbę permutacji dla danej liczby obiektów.
+POISSON = ROZKÅAD.POISSON ## Zwraca rozkÅ‚ad Poissona.
+PROB = PRAWDPD ## Zwraca prawdopodobieństwo, że wartości w zakresie leżą pomiędzy dwiema granicami.
+QUARTILE = KWARTYL ## Wyznacza kwartyl zbioru danych.
+RANK = POZYCJA ## Zwraca pozycję liczby na liście liczb.
+RSQ = R.KWADRAT ## Zwraca kwadrat współczynnika korelacji momentu iloczynu Pearsona.
+SKEW = SKOŚNOŚĆ ## Zwraca skośność rozkładu.
+SLOPE = NACHYLENIE ## Zwraca nachylenie linii regresji liniowej.
+SMALL = MIN.K ## Zwraca k-tą najmniejszą wartość ze zbioru danych.
+STANDARDIZE = NORMALIZUJ ## Zwraca wartość znormalizowaną.
+STDEV = ODCH.STANDARDOWE ## Szacuje odchylenie standardowe na podstawie próbki.
+STDEVA = ODCH.STANDARDOWE.A ## Szacuje odchylenie standardowe na podstawie próbki, z uwzględnieniem liczb, tekstów i wartości logicznych.
+STDEVP = ODCH.STANDARD.POPUL ## Oblicza odchylenie standardowe na podstawie całej populacji.
+STDEVPA = ODCH.STANDARD.POPUL.A ## Oblicza odchylenie standardowe na podstawie całej populacji, z uwzględnieniem liczb, teksów i wartości logicznych.
+STEYX = REGBÅSTD ## Zwraca bÅ‚Ä…d standardowy przewidzianej wartoÅ›ci y dla każdej wartoÅ›ci x w regresji.
+TDIST = ROZKÅAD.T ## Zwraca rozkÅ‚ad t-Studenta.
+TINV = ROZKÅAD.T.ODW ## Zwraca odwrotność rozkÅ‚adu t-Studenta.
+TREND = REGLINW ## Zwraca wartości trendu liniowego.
+TRIMMEAN = ŚREDNIA.WEWN ## Zwraca średnią wartość dla wnętrza zbioru danych.
+TTEST = TEST.T ## Zwraca prawdopodobieństwo związane z testem t-Studenta.
+VAR = WARIANCJA ## Szacuje wariancję na podstawie próbki.
+VARA = WARIANCJA.A ## Szacuje wariancję na podstawie próbki, z uwzględnieniem liczb, tekstów i wartości logicznych.
+VARP = WARIANCJA.POPUL ## Oblicza wariancję na podstawie całej populacji.
+VARPA = WARIANCJA.POPUL.A ## Oblicza wariancję na podstawie całej populacji, z uwzględnieniem liczb, tekstów i wartości logicznych.
+WEIBULL = ROZKÅAD.WEIBULL ## Zwraca rozkÅ‚ad Weibulla.
+ZTEST = TEST.Z ## Zwraca wartość jednostronnego prawdopodobieństwa testu z.
+
+
+##
+## Text functions Funkcje tekstowe
+##
+ASC = ASC ## Zamienia litery angielskie lub katakana o pełnej szerokości (dwubajtowe) w ciągu znaków na znaki o szerokości połówkowej (jednobajtowe).
+BAHTTEXT = BAHTTEXT ## Konwertuje liczbę na tekst, stosując format walutowy ß (baht).
+CHAR = ZNAK ## Zwraca znak o podanym numerze kodu.
+CLEAN = OCZYŚĆ ## Usuwa z tekstu wszystkie znaki, które nie mogą być drukowane.
+CODE = KOD ## Zwraca kod numeryczny pierwszego znaku w ciÄ…gu tekstowym.
+CONCATENATE = ZÅÄ„CZ.TEKSTY ## ÅÄ…czy kilka oddzielnych tekstów w jeden tekst.
+DOLLAR = KWOTA ## Konwertuje liczbÄ™ na tekst, stosujÄ…c format walutowy $ (dolar).
+EXACT = PORÓWNAJ ## Sprawdza identyczność dwóch wartości tekstowych.
+FIND = ZNAJDŹ ## Znajduje jedną wartość tekstową wewnątrz innej (z uwzględnieniem wielkich i małych liter).
+FINDB = ZNAJDŹB ## Znajduje jedną wartość tekstową wewnątrz innej (z uwzględnieniem wielkich i małych liter).
+FIXED = ZAOKR.DO.TEKST ## Formatuje liczbę jako tekst przy stałej liczbie miejsc dziesiętnych.
+JIS = JIS ## Zmienia litery angielskie lub katakana o szerokości połówkowej (jednobajtowe) w ciągu znaków na znaki o pełnej szerokości (dwubajtowe).
+LEFT = LEWY ## Zwraca skrajne lewe znaki z wartości tekstowej.
+LEFTB = LEWYB ## Zwraca skrajne lewe znaki z wartości tekstowej.
+LEN = DŠ## Zwraca liczbę znaków ciągu tekstowego.
+LENB = DÅ.B ## Zwraca liczbÄ™ znaków ciÄ…gu tekstowego.
+LOWER = LITERY.MAÅE ## Konwertuje wielkie litery tekstu na maÅ‚e litery.
+MID = FRAGMENT.TEKSTU ## Zwraca określoną liczbę znaków z ciągu tekstowego, zaczynając od zadanej pozycji.
+MIDB = FRAGMENT.TEKSTU.B ## Zwraca określoną liczbę znaków z ciągu tekstowego, zaczynając od zadanej pozycji.
+PHONETIC = PHONETIC ## Wybiera znaki fonetyczne (furigana) z ciÄ…gu tekstowego.
+PROPER = Z.WIELKIEJ.LITERY ## Zastępuje pierwszą literę każdego wyrazu tekstu wielką literą.
+REPLACE = ZASTĄP ## Zastępuje znaki w tekście.
+REPLACEB = ZASTĄP.B ## Zastępuje znaki w tekście.
+REPT = POWT ## Powiela tekst danÄ… liczbÄ™ razy.
+RIGHT = PRAWY ## Zwraca skrajne prawe znaki z wartości tekstowej.
+RIGHTB = PRAWYB ## Zwraca skrajne prawe znaki z wartości tekstowej.
+SEARCH = SZUKAJ.TEKST ## Wyszukuje jedną wartość tekstową wewnątrz innej (bez uwzględniania wielkości liter).
+SEARCHB = SZUKAJ.TEKST.B ## Wyszukuje jedną wartość tekstową wewnątrz innej (bez uwzględniania wielkości liter).
+SUBSTITUTE = PODSTAW ## Podstawia nowy tekst w miejsce poprzedniego tekstu w ciÄ…gu tekstowym.
+T = T ## Konwertuje argumenty na tekst.
+TEXT = TEKST ## Formatuje liczbÄ™ i konwertuje jÄ… na tekst.
+TRIM = USUŃ.ZBĘDNE.ODSTĘPY ## Usuwa spacje z tekstu.
+UPPER = LITERY.WIELKIE ## Konwertuje znaki tekstu na wielkie litery.
+VALUE = WARTOŚĆ ## Konwertuje argument tekstowy na liczbę.
diff --git a/Classes/PHPExcel/locale/pt/br/config b/Classes/PHPExcel/locale/pt/br/config
new file mode 100644
index 0000000..45b6fbd
--- /dev/null
+++ b/Classes/PHPExcel/locale/pt/br/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = R$
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULO!
+DIV0 = #DIV/0!
+VALUE = #VALOR!
+REF = #REF!
+NAME = #NOME?
+NUM = #NÚM!
+NA = #N/D
diff --git a/Classes/PHPExcel/locale/pt/br/functions b/Classes/PHPExcel/locale/pt/br/functions
new file mode 100644
index 0000000..f3ba3a3
--- /dev/null
+++ b/Classes/PHPExcel/locale/pt/br/functions
@@ -0,0 +1,408 @@
+##
+## Add-in and Automation functions Funções Suplemento e Automação
+##
+GETPIVOTDATA = INFODADOSTABELADINÂMICA ## Retorna os dados armazenados em um relatório de tabela dinâmica
+
+
+##
+## Cube functions Funções de Cubo
+##
+CUBEKPIMEMBER = MEMBROKPICUBO ## Retorna o nome de um KPI (indicador de desempenho-chave), uma propriedade e uma medida e exibe o nome e a propriedade na célula. Um KPI é uma medida quantificável, como o lucro bruto mensal ou a rotatividade trimestral dos funcionários, usada para monitorar o desempenho de uma organização.
+CUBEMEMBER = MEMBROCUBO ## Retorna um membro ou tupla em uma hierarquia de cubo. Use para validar se o membro ou tupla existe no cubo.
+CUBEMEMBERPROPERTY = PROPRIEDADEMEMBROCUBO ## Retorna o valor da propriedade de um membro no cubo. Usada para validar a existência do nome do membro no cubo e para retornar a propriedade especificada para esse membro.
+CUBERANKEDMEMBER = MEMBROCLASSIFICADOCUBO ## Retorna o enésimo membro, ou o membro ordenado, em um conjunto. Use para retornar um ou mais elementos em um conjunto, assim como o melhor vendedor ou os dez melhores alunos.
+CUBESET = CONJUNTOCUBO ## Define um conjunto calculado de membros ou tuplas enviando uma expressão do conjunto para o cubo no servidor, que cria o conjunto e o retorna para o Microsoft Office Excel.
+CUBESETCOUNT = CONTAGEMCONJUNTOCUBO ## Retorna o número de itens em um conjunto.
+CUBEVALUE = VALORCUBO ## Retorna um valor agregado de um cubo.
+
+
+##
+## Database functions Funções de banco de dados
+##
+DAVERAGE = BDMÉDIA ## Retorna a média das entradas selecionadas de um banco de dados
+DCOUNT = BDCONTAR ## Conta as células que contêm números em um banco de dados
+DCOUNTA = BDCONTARA ## Conta células não vazias em um banco de dados
+DGET = BDEXTRAIR ## Extrai de um banco de dados um único registro que corresponde a um critério especÃfico
+DMAX = BDMÃX ## Retorna o valor máximo de entradas selecionadas de um banco de dados
+DMIN = BDMÃN ## Retorna o valor mÃnimo de entradas selecionadas de um banco de dados
+DPRODUCT = BDMULTIPL ## Multiplica os valores em um campo especÃfico de registros que correspondem ao critério em um banco de dados
+DSTDEV = BDEST ## Estima o desvio padrão com base em uma amostra de entradas selecionadas de um banco de dados
+DSTDEVP = BDDESVPA ## Calcula o desvio padrão com base na população inteira de entradas selecionadas de um banco de dados
+DSUM = BDSOMA ## Adiciona os números à coluna de campos de registros do banco de dados que correspondem ao critério
+DVAR = BDVAREST ## Estima a variância com base em uma amostra de entradas selecionadas de um banco de dados
+DVARP = BDVARP ## Calcula a variância com base na população inteira de entradas selecionadas de um banco de dados
+
+
+##
+## Date and time functions Funções de data e hora
+##
+DATE = DATA ## Retorna o número de série de uma data especÃfica
+DATEVALUE = DATA.VALOR ## Converte uma data na forma de texto para um número de série
+DAY = DIA ## Converte um número de série em um dia do mês
+DAYS360 = DIAS360 ## Calcula o número de dias entre duas datas com base em um ano de 360 dias
+EDATE = DATAM ## Retorna o número de série da data que é o número indicado de meses antes ou depois da data inicial
+EOMONTH = FIMMÊS ## Retorna o número de série do último dia do mês antes ou depois de um número especificado de meses
+HOUR = HORA ## Converte um número de série em uma hora
+MINUTE = MINUTO ## Converte um número de série em um minuto
+MONTH = MÊS ## Converte um número de série em um mês
+NETWORKDAYS = DIATRABALHOTOTAL ## Retorna o número de dias úteis inteiros entre duas datas
+NOW = AGORA ## Retorna o número de série seqüencial da data e hora atuais
+SECOND = SEGUNDO ## Converte um número de série em um segundo
+TIME = HORA ## Retorna o número de série de uma hora especÃfica
+TIMEVALUE = VALOR.TEMPO ## Converte um horário na forma de texto para um número de série
+TODAY = HOJE ## Retorna o número de série da data de hoje
+WEEKDAY = DIA.DA.SEMANA ## Converte um número de série em um dia da semana
+WEEKNUM = NÚMSEMANA ## Converte um número de série em um número que representa onde a semana cai numericamente em um ano
+WORKDAY = DIATRABALHO ## Retorna o número de série da data antes ou depois de um número especÃfico de dias úteis
+YEAR = ANO ## Converte um número de série em um ano
+YEARFRAC = FRAÇÃOANO ## Retorna a fração do ano que representa o número de dias entre data_inicial e data_final
+
+
+##
+## Engineering functions Funções de engenharia
+##
+BESSELI = BESSELI ## Retorna a função de Bessel In(x) modificada
+BESSELJ = BESSELJ ## Retorna a função de Bessel Jn(x)
+BESSELK = BESSELK ## Retorna a função de Bessel Kn(x) modificada
+BESSELY = BESSELY ## Retorna a função de Bessel Yn(x)
+BIN2DEC = BIN2DEC ## Converte um número binário em decimal
+BIN2HEX = BIN2HEX ## Converte um número binário em hexadecimal
+BIN2OCT = BIN2OCT ## Converte um número binário em octal
+COMPLEX = COMPLEX ## Converte coeficientes reais e imaginários e um número complexo
+CONVERT = CONVERTER ## Converte um número de um sistema de medida para outro
+DEC2BIN = DECABIN ## Converte um número decimal em binário
+DEC2HEX = DECAHEX ## Converte um número decimal em hexadecimal
+DEC2OCT = DECAOCT ## Converte um número decimal em octal
+DELTA = DELTA ## Testa se dois valores são iguais
+ERF = FUNERRO ## Retorna a função de erro
+ERFC = FUNERROCOMPL ## Retorna a função de erro complementar
+GESTEP = DEGRAU ## Testa se um número é maior do que um valor limite
+HEX2BIN = HEXABIN ## Converte um número hexadecimal em binário
+HEX2DEC = HEXADEC ## Converte um número hexadecimal em decimal
+HEX2OCT = HEXAOCT ## Converte um número hexadecimal em octal
+IMABS = IMABS ## Retorna o valor absoluto (módulo) de um número complexo
+IMAGINARY = IMAGINÃRIO ## Retorna o coeficiente imaginário de um número complexo
+IMARGUMENT = IMARG ## Retorna o argumento teta, um ângulo expresso em radianos
+IMCONJUGATE = IMCONJ ## Retorna o conjugado complexo de um número complexo
+IMCOS = IMCOS ## Retorna o cosseno de um número complexo
+IMDIV = IMDIV ## Retorna o quociente de dois números complexos
+IMEXP = IMEXP ## Retorna o exponencial de um número complexo
+IMLN = IMLN ## Retorna o logaritmo natural de um número complexo
+IMLOG10 = IMLOG10 ## Retorna o logaritmo de base 10 de um número complexo
+IMLOG2 = IMLOG2 ## Retorna o logaritmo de base 2 de um número complexo
+IMPOWER = IMPOT ## Retorna um número complexo elevado a uma potência inteira
+IMPRODUCT = IMPROD ## Retorna o produto de números complexos
+IMREAL = IMREAL ## Retorna o coeficiente real de um número complexo
+IMSIN = IMSENO ## Retorna o seno de um número complexo
+IMSQRT = IMRAIZ ## Retorna a raiz quadrada de um número complexo
+IMSUB = IMSUBTR ## Retorna a diferença entre dois números complexos
+IMSUM = IMSOMA ## Retorna a soma de números complexos
+OCT2BIN = OCTABIN ## Converte um número octal em binário
+OCT2DEC = OCTADEC ## Converte um número octal em decimal
+OCT2HEX = OCTAHEX ## Converte um número octal em hexadecimal
+
+
+##
+## Financial functions Funções financeiras
+##
+ACCRINT = JUROSACUM ## Retorna a taxa de juros acumulados de um tÃtulo que paga uma taxa periódica de juros
+ACCRINTM = JUROSACUMV ## Retorna os juros acumulados de um tÃtulo que paga juros no vencimento
+AMORDEGRC = AMORDEGRC ## Retorna a depreciação para cada perÃodo contábil usando o coeficiente de depreciação
+AMORLINC = AMORLINC ## Retorna a depreciação para cada perÃodo contábil
+COUPDAYBS = CUPDIASINLIQ ## Retorna o número de dias do inÃcio do perÃodo de cupom até a data de liquidação
+COUPDAYS = CUPDIAS ## Retorna o número de dias no perÃodo de cupom que contém a data de quitação
+COUPDAYSNC = CUPDIASPRÓX ## Retorna o número de dias da data de liquidação até a data do próximo cupom
+COUPNCD = CUPDATAPRÓX ## Retorna a próxima data de cupom após a data de quitação
+COUPNUM = CUPNÚM ## Retorna o número de cupons pagáveis entre as datas de quitação e vencimento
+COUPPCD = CUPDATAANT ## Retorna a data de cupom anterior à data de quitação
+CUMIPMT = PGTOJURACUM ## Retorna os juros acumulados pagos entre dois perÃodos
+CUMPRINC = PGTOCAPACUM ## Retorna o capital acumulado pago sobre um empréstimo entre dois perÃodos
+DB = BD ## Retorna a depreciação de um ativo para um perÃodo especificado, usando o método de balanço de declÃnio fixo
+DDB = BDD ## Retorna a depreciação de um ativo com relação a um perÃodo especificado usando o método de saldos decrescentes duplos ou qualquer outro método especificado por você
+DISC = DESC ## Retorna a taxa de desconto de um tÃtulo
+DOLLARDE = MOEDADEC ## Converte um preço em formato de moeda, na forma fracionária, em um preço na forma decimal
+DOLLARFR = MOEDAFRA ## Converte um preço, apresentado na forma decimal, em um preço apresentado na forma fracionária
+DURATION = DURAÇÃO ## Retorna a duração anual de um tÃtulo com pagamentos de juros periódicos
+EFFECT = EFETIVA ## Retorna a taxa de juros anual efetiva
+FV = VF ## Retorna o valor futuro de um investimento
+FVSCHEDULE = VFPLANO ## Retorna o valor futuro de um capital inicial após a aplicação de uma série de taxas de juros compostas
+INTRATE = TAXAJUROS ## Retorna a taxa de juros de um tÃtulo totalmente investido
+IPMT = IPGTO ## Retorna o pagamento de juros para um investimento em um determinado perÃodo
+IRR = TIR ## Retorna a taxa interna de retorno de uma série de fluxos de caixa
+ISPMT = ÉPGTO ## Calcula os juros pagos durante um perÃodo especÃfico de um investimento
+MDURATION = MDURAÇÃO ## Retorna a duração de Macauley modificada para um tÃtulo com um valor de paridade equivalente a R$ 100
+MIRR = MTIR ## Calcula a taxa interna de retorno em que fluxos de caixa positivos e negativos são financiados com diferentes taxas
+NOMINAL = NOMINAL ## Retorna a taxa de juros nominal anual
+NPER = NPER ## Retorna o número de perÃodos de um investimento
+NPV = VPL ## Retorna o valor lÃquido atual de um investimento com base em uma série de fluxos de caixa periódicos e em uma taxa de desconto
+ODDFPRICE = PREÇOPRIMINC ## Retorna o preço por R$ 100 de valor nominal de um tÃtulo com um primeiro perÃodo indefinido
+ODDFYIELD = LUCROPRIMINC ## Retorna o rendimento de um tÃtulo com um primeiro perÃodo indefinido
+ODDLPRICE = PREÇOÚLTINC ## Retorna o preço por R$ 100 de valor nominal de um tÃtulo com um último perÃodo de cupom indefinido
+ODDLYIELD = LUCROÚLTINC ## Retorna o rendimento de um tÃtulo com um último perÃodo indefinido
+PMT = PGTO ## Retorna o pagamento periódico de uma anuidade
+PPMT = PPGTO ## Retorna o pagamento de capital para determinado perÃodo de investimento
+PRICE = PREÇO ## Retorna a preço por R$ 100,00 de valor nominal de um tÃtulo que paga juros periódicos
+PRICEDISC = PREÇODESC ## Retorna o preço por R$ 100,00 de valor nominal de um tÃtulo descontado
+PRICEMAT = PREÇOVENC ## Retorna o preço por R$ 100,00 de valor nominal de um tÃtulo que paga juros no vencimento
+PV = VP ## Retorna o valor presente de um investimento
+RATE = TAXA ## Retorna a taxa de juros por perÃodo de uma anuidade
+RECEIVED = RECEBER ## Retorna a quantia recebida no vencimento de um tÃtulo totalmente investido
+SLN = DPD ## Retorna a depreciação em linha reta de um ativo durante um perÃodo
+SYD = SDA ## Retorna a depreciação dos dÃgitos da soma dos anos de um ativo para um perÃodo especificado
+TBILLEQ = OTN ## Retorna o rendimento de um tÃtulo equivalente a uma obrigação do Tesouro
+TBILLPRICE = OTNVALOR ## Retorna o preço por R$ 100,00 de valor nominal de uma obrigação do Tesouro
+TBILLYIELD = OTNLUCRO ## Retorna o rendimento de uma obrigação do Tesouro
+VDB = BDV ## Retorna a depreciação de um ativo para um perÃodo especificado ou parcial usando um método de balanço declinante
+XIRR = XTIR ## Fornece a taxa interna de retorno para um programa de fluxos de caixa que não é necessariamente periódico
+XNPV = XVPL ## Retorna o valor presente lÃquido de um programa de fluxos de caixa que não é necessariamente periódico
+YIELD = LUCRO ## Retorna o lucro de um tÃtulo que paga juros periódicos
+YIELDDISC = LUCRODESC ## Retorna o rendimento anual de um tÃtulo descontado. Por exemplo, uma obrigação do Tesouro
+YIELDMAT = LUCROVENC ## Retorna o lucro anual de um tÃtulo que paga juros no vencimento
+
+
+##
+## Information functions Funções de informação
+##
+CELL = CÉL ## Retorna informações sobre formatação, localização ou conteúdo de uma célula
+ERROR.TYPE = TIPO.ERRO ## Retorna um número correspondente a um tipo de erro
+INFO = INFORMAÇÃO ## Retorna informações sobre o ambiente operacional atual
+ISBLANK = ÉCÉL.VAZIA ## Retorna VERDADEIRO se o valor for vazio
+ISERR = ÉERRO ## Retorna VERDADEIRO se o valor for um valor de erro diferente de #N/D
+ISERROR = ÉERROS ## Retorna VERDADEIRO se o valor for um valor de erro
+ISEVEN = ÉPAR ## Retorna VERDADEIRO se o número for par
+ISLOGICAL = ÉLÓGICO ## Retorna VERDADEIRO se o valor for um valor lógico
+ISNA = É.NÃO.DISP ## Retorna VERDADEIRO se o valor for o valor de erro #N/D
+ISNONTEXT = É.NÃO.TEXTO ## Retorna VERDADEIRO se o valor for diferente de texto
+ISNUMBER = ÉNÚM ## Retorna VERDADEIRO se o valor for um número
+ISODD = ÉIMPAR ## Retorna VERDADEIRO se o número for Ãmpar
+ISREF = ÉREF ## Retorna VERDADEIRO se o valor for uma referência
+ISTEXT = ÉTEXTO ## Retorna VERDADEIRO se o valor for texto
+N = N ## Retorna um valor convertido em um número
+NA = NÃO.DISP ## Retorna o valor de erro #N/D
+TYPE = TIPO ## Retorna um número indicando o tipo de dados de um valor
+
+
+##
+## Logical functions Funções lógicas
+##
+AND = E ## Retorna VERDADEIRO se todos os seus argumentos forem VERDADEIROS
+FALSE = FALSO ## Retorna o valor lógico FALSO
+IF = SE ## Especifica um teste lógico a ser executado
+IFERROR = SEERRO ## Retornará um valor que você especifica se uma fórmula for avaliada para um erro; do contrário, retornará o resultado da fórmula
+NOT = NÃO ## Inverte o valor lógico do argumento
+OR = OU ## Retorna VERDADEIRO se um dos argumentos for VERDADEIRO
+TRUE = VERDADEIRO ## Retorna o valor lógico VERDADEIRO
+
+
+##
+## Lookup and reference functions Funções de pesquisa e referência
+##
+ADDRESS = ENDEREÇO ## Retorna uma referência como texto para uma única célula em uma planilha
+AREAS = ÃREAS ## Retorna o número de áreas em uma referência
+CHOOSE = ESCOLHER ## Escolhe um valor a partir de uma lista de valores
+COLUMN = COL ## Retorna o número da coluna de uma referência
+COLUMNS = COLS ## Retorna o número de colunas em uma referência
+HLOOKUP = PROCH ## Procura na linha superior de uma matriz e retorna o valor da célula especificada
+HYPERLINK = HYPERLINK ## Cria um atalho ou salto que abre um documento armazenado em um servidor de rede, uma intranet ou na Internet
+INDEX = ÃNDICE ## Usa um Ãndice para escolher um valor de uma referência ou matriz
+INDIRECT = INDIRETO ## Retorna uma referência indicada por um valor de texto
+LOOKUP = PROC ## Procura valores em um vetor ou em uma matriz
+MATCH = CORRESP ## Procura valores em uma referência ou em uma matriz
+OFFSET = DESLOC ## Retorna um deslocamento de referência com base em uma determinada referência
+ROW = LIN ## Retorna o número da linha de uma referência
+ROWS = LINS ## Retorna o número de linhas em uma referência
+RTD = RTD ## Recupera dados em tempo real de um programa que ofereça suporte a automação COM (automação: uma forma de trabalhar com objetos de um aplicativo a partir de outro aplicativo ou ferramenta de desenvolvimento. Chamada inicialmente de automação OLE, a automação é um padrão industrial e um recurso do modelo de objeto componente (COM).)
+TRANSPOSE = TRANSPOR ## Retorna a transposição de uma matriz
+VLOOKUP = PROCV ## Procura na primeira coluna de uma matriz e move ao longo da linha para retornar o valor de uma célula
+
+
+##
+## Math and trigonometry functions Funções matemáticas e trigonométricas
+##
+ABS = ABS ## Retorna o valor absoluto de um número
+ACOS = ACOS ## Retorna o arco cosseno de um número
+ACOSH = ACOSH ## Retorna o cosseno hiperbólico inverso de um número
+ASIN = ASEN ## Retorna o arco seno de um número
+ASINH = ASENH ## Retorna o seno hiperbólico inverso de um número
+ATAN = ATAN ## Retorna o arco tangente de um número
+ATAN2 = ATAN2 ## Retorna o arco tangente das coordenadas x e y especificadas
+ATANH = ATANH ## Retorna a tangente hiperbólica inversa de um número
+CEILING = TETO ## Arredonda um número para o inteiro mais próximo ou para o múltiplo mais próximo de significância
+COMBIN = COMBIN ## Retorna o número de combinações de um determinado número de objetos
+COS = COS ## Retorna o cosseno de um número
+COSH = COSH ## Retorna o cosseno hiperbólico de um número
+DEGREES = GRAUS ## Converte radianos em graus
+EVEN = PAR ## Arredonda um número para cima até o inteiro par mais próximo
+EXP = EXP ## Retorna e elevado à potência de um número especificado
+FACT = FATORIAL ## Retorna o fatorial de um número
+FACTDOUBLE = FATDUPLO ## Retorna o fatorial duplo de um número
+FLOOR = ARREDMULTB ## Arredonda um número para baixo até zero
+GCD = MDC ## Retorna o máximo divisor comum
+INT = INT ## Arredonda um número para baixo até o número inteiro mais próximo
+LCM = MMC ## Retorna o mÃnimo múltiplo comum
+LN = LN ## Retorna o logaritmo natural de um número
+LOG = LOG ## Retorna o logaritmo de um número de uma base especificada
+LOG10 = LOG10 ## Retorna o logaritmo de base 10 de um número
+MDETERM = MATRIZ.DETERM ## Retorna o determinante de uma matriz de uma variável do tipo matriz
+MINVERSE = MATRIZ.INVERSO ## Retorna a matriz inversa de uma matriz
+MMULT = MATRIZ.MULT ## Retorna o produto de duas matrizes
+MOD = RESTO ## Retorna o resto da divisão
+MROUND = MARRED ## Retorna um número arredondado ao múltiplo desejado
+MULTINOMIAL = MULTINOMIAL ## Retorna o multinomial de um conjunto de números
+ODD = ÃMPAR ## Arredonda um número para cima até o inteiro Ãmpar mais próximo
+PI = PI ## Retorna o valor de Pi
+POWER = POTÊNCIA ## Fornece o resultado de um número elevado a uma potência
+PRODUCT = MULT ## Multiplica seus argumentos
+QUOTIENT = QUOCIENTE ## Retorna a parte inteira de uma divisão
+RADIANS = RADIANOS ## Converte graus em radianos
+RAND = ALEATÓRIO ## Retorna um número aleatório entre 0 e 1
+RANDBETWEEN = ALEATÓRIOENTRE ## Retorna um número aleatório entre os números especificados
+ROMAN = ROMANO ## Converte um algarismo arábico em romano, como texto
+ROUND = ARRED ## Arredonda um número até uma quantidade especificada de dÃgitos
+ROUNDDOWN = ARREDONDAR.PARA.BAIXO ## Arredonda um número para baixo até zero
+ROUNDUP = ARREDONDAR.PARA.CIMA ## Arredonda um número para cima, afastando-o de zero
+SERIESSUM = SOMASEQÜÊNCIA ## Retorna a soma de uma série polinomial baseada na fórmula
+SIGN = SINAL ## Retorna o sinal de um número
+SIN = SEN ## Retorna o seno de um ângulo dado
+SINH = SENH ## Retorna o seno hiperbólico de um número
+SQRT = RAIZ ## Retorna uma raiz quadrada positiva
+SQRTPI = RAIZPI ## Retorna a raiz quadrada de (núm* pi)
+SUBTOTAL = SUBTOTAL ## Retorna um subtotal em uma lista ou em um banco de dados
+SUM = SOMA ## Soma seus argumentos
+SUMIF = SOMASE ## Adiciona as células especificadas por um determinado critério
+SUMIFS = SOMASE ## Adiciona as células em um intervalo que atende a vários critérios
+SUMPRODUCT = SOMARPRODUTO ## Retorna a soma dos produtos de componentes correspondentes de matrizes
+SUMSQ = SOMAQUAD ## Retorna a soma dos quadrados dos argumentos
+SUMX2MY2 = SOMAX2DY2 ## Retorna a soma da diferença dos quadrados dos valores correspondentes em duas matrizes
+SUMX2PY2 = SOMAX2SY2 ## Retorna a soma da soma dos quadrados dos valores correspondentes em duas matrizes
+SUMXMY2 = SOMAXMY2 ## Retorna a soma dos quadrados das diferenças dos valores correspondentes em duas matrizes
+TAN = TAN ## Retorna a tangente de um número
+TANH = TANH ## Retorna a tangente hiperbólica de um número
+TRUNC = TRUNCAR ## Trunca um número para um inteiro
+
+
+##
+## Statistical functions Funções estatÃsticas
+##
+AVEDEV = DESV.MÉDIO ## Retorna a média aritmética dos desvios médios dos pontos de dados a partir de sua média
+AVERAGE = MÉDIA ## Retorna a média dos argumentos
+AVERAGEA = MÉDIAA ## Retorna a média dos argumentos, inclusive números, texto e valores lógicos
+AVERAGEIF = MÉDIASE ## Retorna a média (média aritmética) de todas as células em um intervalo que atendem a um determinado critério
+AVERAGEIFS = MÉDIASES ## Retorna a média (média aritmética) de todas as células que atendem a múltiplos critérios.
+BETADIST = DISTBETA ## Retorna a função de distribuição cumulativa beta
+BETAINV = BETA.ACUM.INV ## Retorna o inverso da função de distribuição cumulativa para uma distribuição beta especificada
+BINOMDIST = DISTRBINOM ## Retorna a probabilidade de distribuição binomial do termo individual
+CHIDIST = DIST.QUI ## Retorna a probabilidade unicaudal da distribuição qui-quadrada
+CHIINV = INV.QUI ## Retorna o inverso da probabilidade uni-caudal da distribuição qui-quadrada
+CHITEST = TESTE.QUI ## Retorna o teste para independência
+CONFIDENCE = INT.CONFIANÇA ## Retorna o intervalo de confiança para uma média da população
+CORREL = CORREL ## Retorna o coeficiente de correlação entre dois conjuntos de dados
+COUNT = CONT.NÚM ## Calcula quantos números há na lista de argumentos
+COUNTA = CONT.VALORES ## Calcula quantos valores há na lista de argumentos
+COUNTBLANK = CONTAR.VAZIO ## Conta o número de células vazias no intervalo especificado
+COUNTIF = CONT.SE ## Calcula o número de células não vazias em um intervalo que corresponde a determinados critérios
+COUNTIFS = CONT.SES ## Conta o número de células dentro de um intervalo que atende a múltiplos critérios
+COVAR = COVAR ## Retorna a covariância, a média dos produtos dos desvios pares
+CRITBINOM = CRIT.BINOM ## Retorna o menor valor para o qual a distribuição binomial cumulativa é menor ou igual ao valor padrão
+DEVSQ = DESVQ ## Retorna a soma dos quadrados dos desvios
+EXPONDIST = DISTEXPON ## Retorna a distribuição exponencial
+FDIST = DISTF ## Retorna a distribuição de probabilidade F
+FINV = INVF ## Retorna o inverso da distribuição de probabilidades F
+FISHER = FISHER ## Retorna a transformação Fisher
+FISHERINV = FISHERINV ## Retorna o inverso da transformação Fisher
+FORECAST = PREVISÃO ## Retorna um valor ao longo de uma linha reta
+FREQUENCY = FREQÜÊNCIA ## Retorna uma distribuição de freqüência como uma matriz vertical
+FTEST = TESTEF ## Retorna o resultado de um teste F
+GAMMADIST = DISTGAMA ## Retorna a distribuição gama
+GAMMAINV = INVGAMA ## Retorna o inverso da distribuição cumulativa gama
+GAMMALN = LNGAMA ## Retorna o logaritmo natural da função gama, G(x)
+GEOMEAN = MÉDIA.GEOMÉTRICA ## Retorna a média geométrica
+GROWTH = CRESCIMENTO ## Retorna valores ao longo de uma tendência exponencial
+HARMEAN = MÉDIA.HARMÔNICA ## Retorna a média harmônica
+HYPGEOMDIST = DIST.HIPERGEOM ## Retorna a distribuição hipergeométrica
+INTERCEPT = INTERCEPÇÃO ## Retorna a intercepção da linha de regressão linear
+KURT = CURT ## Retorna a curtose de um conjunto de dados
+LARGE = MAIOR ## Retorna o maior valor k-ésimo de um conjunto de dados
+LINEST = PROJ.LIN ## Retorna os parâmetros de uma tendência linear
+LOGEST = PROJ.LOG ## Retorna os parâmetros de uma tendência exponencial
+LOGINV = INVLOG ## Retorna o inverso da distribuição lognormal
+LOGNORMDIST = DIST.LOGNORMAL ## Retorna a distribuição lognormal cumulativa
+MAX = MÃXIMO ## Retorna o valor máximo em uma lista de argumentos
+MAXA = MÃXIMOA ## Retorna o maior valor em uma lista de argumentos, inclusive números, texto e valores lógicos
+MEDIAN = MED ## Retorna a mediana dos números indicados
+MIN = MÃNIMO ## Retorna o valor mÃnimo em uma lista de argumentos
+MINA = MÃNIMOA ## Retorna o menor valor em uma lista de argumentos, inclusive números, texto e valores lógicos
+MODE = MODO ## Retorna o valor mais comum em um conjunto de dados
+NEGBINOMDIST = DIST.BIN.NEG ## Retorna a distribuição binomial negativa
+NORMDIST = DIST.NORM ## Retorna a distribuição cumulativa normal
+NORMINV = INV.NORM ## Retorna o inverso da distribuição cumulativa normal
+NORMSDIST = DIST.NORMP ## Retorna a distribuição cumulativa normal padrão
+NORMSINV = INV.NORMP ## Retorna o inverso da distribuição cumulativa normal padrão
+PEARSON = PEARSON ## Retorna o coeficiente de correlação do momento do produto Pearson
+PERCENTILE = PERCENTIL ## Retorna o k-ésimo percentil de valores em um intervalo
+PERCENTRANK = ORDEM.PORCENTUAL ## Retorna a ordem percentual de um valor em um conjunto de dados
+PERMUT = PERMUT ## Retorna o número de permutações de um determinado número de objetos
+POISSON = POISSON ## Retorna a distribuição Poisson
+PROB = PROB ## Retorna a probabilidade de valores em um intervalo estarem entre dois limites
+QUARTILE = QUARTIL ## Retorna o quartil do conjunto de dados
+RANK = ORDEM ## Retorna a posição de um número em uma lista de números
+RSQ = RQUAD ## Retorna o quadrado do coeficiente de correlação do momento do produto de Pearson
+SKEW = DISTORÇÃO ## Retorna a distorção de uma distribuição
+SLOPE = INCLINAÇÃO ## Retorna a inclinação da linha de regressão linear
+SMALL = MENOR ## Retorna o menor valor k-ésimo do conjunto de dados
+STANDARDIZE = PADRONIZAR ## Retorna um valor normalizado
+STDEV = DESVPAD ## Estima o desvio padrão com base em uma amostra
+STDEVA = DESVPADA ## Estima o desvio padrão com base em uma amostra, inclusive números, texto e valores lógicos
+STDEVP = DESVPADP ## Calcula o desvio padrão com base na população total
+STDEVPA = DESVPADPA ## Calcula o desvio padrão com base na população total, inclusive números, texto e valores lógicos
+STEYX = EPADYX ## Retorna o erro padrão do valor-y previsto para cada x da regressão
+TDIST = DISTT ## Retorna a distribuição t de Student
+TINV = INVT ## Retorna o inverso da distribuição t de Student
+TREND = TENDÊNCIA ## Retorna valores ao longo de uma tendência linear
+TRIMMEAN = MÉDIA.INTERNA ## Retorna a média do interior de um conjunto de dados
+TTEST = TESTET ## Retorna a probabilidade associada ao teste t de Student
+VAR = VAR ## Estima a variância com base em uma amostra
+VARA = VARA ## Estima a variância com base em uma amostra, inclusive números, texto e valores lógicos
+VARP = VARP ## Calcula a variância com base na população inteira
+VARPA = VARPA ## Calcula a variância com base na população total, inclusive números, texto e valores lógicos
+WEIBULL = WEIBULL ## Retorna a distribuição Weibull
+ZTEST = TESTEZ ## Retorna o valor de probabilidade uni-caudal de um teste-z
+
+
+##
+## Text functions Funções de texto
+##
+ASC = ASC ## Altera letras do inglês ou katakana de largura total (bytes duplos) dentro de uma seqüência de caracteres para caracteres de meia largura (byte único)
+BAHTTEXT = BAHTTEXT ## Converte um número em um texto, usando o formato de moeda ß (baht)
+CHAR = CARACT ## Retorna o caractere especificado pelo número de código
+CLEAN = TIRAR ## Remove todos os caracteres do texto que não podem ser impressos
+CODE = CÓDIGO ## Retorna um código numérico para o primeiro caractere de uma seqüência de caracteres de texto
+CONCATENATE = CONCATENAR ## Agrupa vários itens de texto em um único item de texto
+DOLLAR = MOEDA ## Converte um número em texto, usando o formato de moeda $ (dólar)
+EXACT = EXATO ## Verifica se dois valores de texto são idênticos
+FIND = PROCURAR ## Procura um valor de texto dentro de outro (diferencia maiúsculas de minúsculas)
+FINDB = PROCURARB ## Procura um valor de texto dentro de outro (diferencia maiúsculas de minúsculas)
+FIXED = DEF.NÚM.DEC ## Formata um número como texto com um número fixo de decimais
+JIS = JIS ## Altera letras do inglês ou katakana de meia largura (byte único) dentro de uma seqüência de caracteres para caracteres de largura total (bytes duplos)
+LEFT = ESQUERDA ## Retorna os caracteres mais à esquerda de um valor de texto
+LEFTB = ESQUERDAB ## Retorna os caracteres mais à esquerda de um valor de texto
+LEN = NÚM.CARACT ## Retorna o número de caracteres em uma seqüência de texto
+LENB = NÚM.CARACTB ## Retorna o número de caracteres em uma seqüência de texto
+LOWER = MINÚSCULA ## Converte texto para minúsculas
+MID = EXT.TEXTO ## Retorna um número especÃfico de caracteres de uma seqüência de texto começando na posição especificada
+MIDB = EXT.TEXTOB ## Retorna um número especÃfico de caracteres de uma seqüência de texto começando na posição especificada
+PHONETIC = FONÉTICA ## Extrai os caracteres fonéticos (furigana) de uma seqüência de caracteres de texto
+PROPER = PRI.MAIÚSCULA ## Coloca a primeira letra de cada palavra em maiúscula em um valor de texto
+REPLACE = MUDAR ## Muda os caracteres dentro do texto
+REPLACEB = MUDARB ## Muda os caracteres dentro do texto
+REPT = REPT ## Repete o texto um determinado número de vezes
+RIGHT = DIREITA ## Retorna os caracteres mais à direita de um valor de texto
+RIGHTB = DIREITAB ## Retorna os caracteres mais à direita de um valor de texto
+SEARCH = LOCALIZAR ## Localiza um valor de texto dentro de outro (não diferencia maiúsculas de minúsculas)
+SEARCHB = LOCALIZARB ## Localiza um valor de texto dentro de outro (não diferencia maiúsculas de minúsculas)
+SUBSTITUTE = SUBSTITUIR ## Substitui um novo texto por um texto antigo em uma seqüência de texto
+T = T ## Converte os argumentos em texto
+TEXT = TEXTO ## Formata um número e o converte em texto
+TRIM = ARRUMAR ## Remove espaços do texto
+UPPER = MAIÚSCULA ## Converte o texto em maiúsculas
+VALUE = VALOR ## Converte um argumento de texto em um número
diff --git a/Classes/PHPExcel/locale/pt/config b/Classes/PHPExcel/locale/pt/config
new file mode 100644
index 0000000..8bb8d8b
--- /dev/null
+++ b/Classes/PHPExcel/locale/pt/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = €
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #NULO!
+DIV0 = #DIV/0!
+VALUE = #VALOR!
+REF = #REF!
+NAME = #NOME?
+NUM = #NÚM!
+NA = #N/D
diff --git a/Classes/PHPExcel/locale/pt/functions b/Classes/PHPExcel/locale/pt/functions
new file mode 100644
index 0000000..7fe9e3b
--- /dev/null
+++ b/Classes/PHPExcel/locale/pt/functions
@@ -0,0 +1,408 @@
+##
+## Add-in and Automation functions Funções de Suplemento e Automatização
+##
+GETPIVOTDATA = OBTERDADOSDIN ## Devolve dados armazenados num relatório de Tabela Dinâmica
+
+
+##
+## Cube functions Funções de cubo
+##
+CUBEKPIMEMBER = MEMBROKPICUBO ## Devolve o nome, propriedade e medição de um KPI (key performance indicator) e apresenta o nome e a propriedade na célula. Um KPI é uma medida quantificável, como, por exemplo, o lucro mensal bruto ou a rotatividade trimestral de pessoal, utilizada para monitorizar o desempenho de uma organização.
+CUBEMEMBER = MEMBROCUBO ## Devolve um membro ou cadeia de identificação numa hierarquia de cubo. Utilizada para validar a existência do membro ou cadeia de identificação no cubo.
+CUBEMEMBERPROPERTY = PROPRIEDADEMEMBROCUBO ## Devolve o valor de uma propriedade de membro no cubo. Utilizada para validar a existência de um nome de membro no cubo e para devolver a propriedade especificada para esse membro.
+CUBERANKEDMEMBER = MEMBROCLASSIFICADOCUBO ## Devolve o enésimo ou a classificação mais alta num conjunto. Utilizada para devolver um ou mais elementos num conjunto, tal como o melhor vendedor ou os 10 melhores alunos.
+CUBESET = CONJUNTOCUBO ## Define um conjunto calculado de membros ou cadeias de identificação enviando uma expressão de conjunto para o cubo no servidor, que cria o conjunto e, em seguida, devolve o conjunto ao Microsoft Office Excel.
+CUBESETCOUNT = CONTARCONJUNTOCUBO ## Devolve o número de itens num conjunto.
+CUBEVALUE = VALORCUBO ## Devolve um valor agregado do cubo.
+
+
+##
+## Database functions Funções de base de dados
+##
+DAVERAGE = BDMÉDIA ## Devolve a média das entradas da base de dados seleccionadas
+DCOUNT = BDCONTAR ## Conta as células que contêm números numa base de dados
+DCOUNTA = BDCONTAR.VAL ## Conta as células que não estejam em branco numa base de dados
+DGET = BDOBTER ## Extrai de uma base de dados um único registo que corresponde aos critérios especificados
+DMAX = BDMÃX ## Devolve o valor máximo das entradas da base de dados seleccionadas
+DMIN = BDMÃN ## Devolve o valor mÃnimo das entradas da base de dados seleccionadas
+DPRODUCT = BDMULTIPL ## Multiplica os valores de um determinado campo de registos que correspondem aos critérios numa base de dados
+DSTDEV = BDDESVPAD ## Calcula o desvio-padrão com base numa amostra de entradas da base de dados seleccionadas
+DSTDEVP = BDDESVPADP ## Calcula o desvio-padrão com base na população total das entradas da base de dados seleccionadas
+DSUM = BDSOMA ## Adiciona os números na coluna de campo dos registos de base de dados que correspondem aos critérios
+DVAR = BDVAR ## Calcula a variância com base numa amostra das entradas de base de dados seleccionadas
+DVARP = BDVARP ## Calcula a variância com base na população total das entradas de base de dados seleccionadas
+
+
+##
+## Date and time functions Funções de data e hora
+##
+DATE = DATA ## Devolve o número de série de uma determinada data
+DATEVALUE = DATA.VALOR ## Converte uma data em forma de texto num número de série
+DAY = DIA ## Converte um número de série num dia do mês
+DAYS360 = DIAS360 ## Calcula o número de dias entre duas datas com base num ano com 360 dias
+EDATE = DATAM ## Devolve um número de série de data que corresponde ao número de meses indicado antes ou depois da data de inÃcio
+EOMONTH = FIMMÊS ## Devolve o número de série do último dia do mês antes ou depois de um número de meses especificado
+HOUR = HORA ## Converte um número de série numa hora
+MINUTE = MINUTO ## Converte um número de série num minuto
+MONTH = MÊS ## Converte um número de série num mês
+NETWORKDAYS = DIATRABALHOTOTAL ## Devolve o número total de dias úteis entre duas datas
+NOW = AGORA ## Devolve o número de série da data e hora actuais
+SECOND = SEGUNDO ## Converte um número de série num segundo
+TIME = TEMPO ## Devolve o número de série de um determinado tempo
+TIMEVALUE = VALOR.TEMPO ## Converte um tempo em forma de texto num número de série
+TODAY = HOJE ## Devolve o número de série da data actual
+WEEKDAY = DIA.SEMANA ## Converte um número de série num dia da semana
+WEEKNUM = NÚMSEMANA ## Converte um número de série num número que representa o número da semana num determinado ano
+WORKDAY = DIA.TRABALHO ## Devolve o número de série da data antes ou depois de um número de dias úteis especificado
+YEAR = ANO ## Converte um número de série num ano
+YEARFRAC = FRACÇÃOANO ## Devolve a fracção de ano que representa o número de dias inteiros entre a data_de_inÃcio e a data_de_fim
+
+
+##
+## Engineering functions Funções de engenharia
+##
+BESSELI = BESSELI ## Devolve a função de Bessel modificada In(x)
+BESSELJ = BESSELJ ## Devolve a função de Bessel Jn(x)
+BESSELK = BESSELK ## Devolve a função de Bessel modificada Kn(x)
+BESSELY = BESSELY ## Devolve a função de Bessel Yn(x)
+BIN2DEC = BINADEC ## Converte um número binário em decimal
+BIN2HEX = BINAHEX ## Converte um número binário em hexadecimal
+BIN2OCT = BINAOCT ## Converte um número binário em octal
+COMPLEX = COMPLEXO ## Converte coeficientes reais e imaginários num número complexo
+CONVERT = CONVERTER ## Converte um número de um sistema de medida noutro
+DEC2BIN = DECABIN ## Converte um número decimal em binário
+DEC2HEX = DECAHEX ## Converte um número decimal em hexadecimal
+DEC2OCT = DECAOCT ## Converte um número decimal em octal
+DELTA = DELTA ## Testa se dois valores são iguais
+ERF = FUNCERRO ## Devolve a função de erro
+ERFC = FUNCERROCOMPL ## Devolve a função de erro complementar
+GESTEP = DEGRAU ## Testa se um número é maior do que um valor limite
+HEX2BIN = HEXABIN ## Converte um número hexadecimal em binário
+HEX2DEC = HEXADEC ## Converte um número hexadecimal em decimal
+HEX2OCT = HEXAOCT ## Converte um número hexadecimal em octal
+IMABS = IMABS ## Devolve o valor absoluto (módulo) de um número complexo
+IMAGINARY = IMAGINÃRIO ## Devolve o coeficiente imaginário de um número complexo
+IMARGUMENT = IMARG ## Devolve o argumento Teta, um ângulo expresso em radianos
+IMCONJUGATE = IMCONJ ## Devolve o conjugado complexo de um número complexo
+IMCOS = IMCOS ## Devolve o co-seno de um número complexo
+IMDIV = IMDIV ## Devolve o quociente de dois números complexos
+IMEXP = IMEXP ## Devolve o exponencial de um número complexo
+IMLN = IMLN ## Devolve o logaritmo natural de um número complexo
+IMLOG10 = IMLOG10 ## Devolve o logaritmo de base 10 de um número complexo
+IMLOG2 = IMLOG2 ## Devolve o logaritmo de base 2 de um número complexo
+IMPOWER = IMPOT ## Devolve um número complexo elevado a uma potência inteira
+IMPRODUCT = IMPROD ## Devolve o produto de números complexos
+IMREAL = IMREAL ## Devolve o coeficiente real de um número complexo
+IMSIN = IMSENO ## Devolve o seno de um número complexo
+IMSQRT = IMRAIZ ## Devolve a raiz quadrada de um número complexo
+IMSUB = IMSUBTR ## Devolve a diferença entre dois números complexos
+IMSUM = IMSOMA ## Devolve a soma de números complexos
+OCT2BIN = OCTABIN ## Converte um número octal em binário
+OCT2DEC = OCTADEC ## Converte um número octal em decimal
+OCT2HEX = OCTAHEX ## Converte um número octal em hexadecimal
+
+
+##
+## Financial functions Funções financeiras
+##
+ACCRINT = JUROSACUM ## Devolve os juros acumulados de um tÃtulo que paga juros periódicos
+ACCRINTM = JUROSACUMV ## Devolve os juros acumulados de um tÃtulo que paga juros no vencimento
+AMORDEGRC = AMORDEGRC ## Devolve a depreciação correspondente a cada perÃodo contabilÃstico utilizando um coeficiente de depreciação
+AMORLINC = AMORLINC ## Devolve a depreciação correspondente a cada perÃodo contabilÃstico
+COUPDAYBS = CUPDIASINLIQ ## Devolve o número de dias entre o inÃcio do perÃodo do cupão e a data de regularização
+COUPDAYS = CUPDIAS ## Devolve o número de dias no perÃodo do cupão que contém a data de regularização
+COUPDAYSNC = CUPDIASPRÓX ## Devolve o número de dias entre a data de regularização e a data do cupão seguinte
+COUPNCD = CUPDATAPRÓX ## Devolve a data do cupão seguinte após a data de regularização
+COUPNUM = CUPNÚM ## Devolve o número de cupões a serem pagos entre a data de regularização e a data de vencimento
+COUPPCD = CUPDATAANT ## Devolve a data do cupão anterior antes da data de regularização
+CUMIPMT = PGTOJURACUM ## Devolve os juros cumulativos pagos entre dois perÃodos
+CUMPRINC = PGTOCAPACUM ## Devolve o capital cumulativo pago a tÃtulo de empréstimo entre dois perÃodos
+DB = BD ## Devolve a depreciação de um activo relativo a um perÃodo especificado utilizando o método das quotas degressivas fixas
+DDB = BDD ## Devolve a depreciação de um activo relativo a um perÃodo especificado utilizando o método das quotas degressivas duplas ou qualquer outro método especificado
+DISC = DESC ## Devolve a taxa de desconto de um tÃtulo
+DOLLARDE = MOEDADEC ## Converte um preço em unidade monetária, expresso como uma fracção, num preço em unidade monetária, expresso como um número decimal
+DOLLARFR = MOEDAFRA ## Converte um preço em unidade monetária, expresso como um número decimal, num preço em unidade monetária, expresso como uma fracção
+DURATION = DURAÇÃO ## Devolve a duração anual de um tÃtulo com pagamentos de juros periódicos
+EFFECT = EFECTIVA ## Devolve a taxa de juros anual efectiva
+FV = VF ## Devolve o valor futuro de um investimento
+FVSCHEDULE = VFPLANO ## Devolve o valor futuro de um capital inicial após a aplicação de uma série de taxas de juro compostas
+INTRATE = TAXAJUROS ## Devolve a taxa de juros de um tÃtulo investido na totalidade
+IPMT = IPGTO ## Devolve o pagamento dos juros de um investimento durante um determinado perÃodo
+IRR = TIR ## Devolve a taxa de rentabilidade interna para uma série de fluxos monetários
+ISPMT = É.PGTO ## Calcula os juros pagos durante um perÃodo especÃfico de um investimento
+MDURATION = MDURAÇÃO ## Devolve a duração modificada de Macauley de um tÃtulo com um valor de paridade equivalente a € 100
+MIRR = MTIR ## Devolve a taxa interna de rentabilidade em que os fluxos monetários positivos e negativos são financiados com taxas diferentes
+NOMINAL = NOMINAL ## Devolve a taxa de juros nominal anual
+NPER = NPER ## Devolve o número de perÃodos de um investimento
+NPV = VAL ## Devolve o valor actual lÃquido de um investimento com base numa série de fluxos monetários periódicos e numa taxa de desconto
+ODDFPRICE = PREÇOPRIMINC ## Devolve o preço por € 100 do valor nominal de um tÃtulo com um perÃodo inicial incompleto
+ODDFYIELD = LUCROPRIMINC ## Devolve o lucro de um tÃtulo com um perÃodo inicial incompleto
+ODDLPRICE = PREÇOÚLTINC ## Devolve o preço por € 100 do valor nominal de um tÃtulo com um perÃodo final incompleto
+ODDLYIELD = LUCROÚLTINC ## Devolve o lucro de um tÃtulo com um perÃodo final incompleto
+PMT = PGTO ## Devolve o pagamento periódico de uma anuidade
+PPMT = PPGTO ## Devolve o pagamento sobre o capital de um investimento num determinado perÃodo
+PRICE = PREÇO ## Devolve o preço por € 100 do valor nominal de um tÃtulo que paga juros periódicos
+PRICEDISC = PREÇODESC ## Devolve o preço por € 100 do valor nominal de um tÃtulo descontado
+PRICEMAT = PREÇOVENC ## Devolve o preço por € 100 do valor nominal de um tÃtulo que paga juros no vencimento
+PV = VA ## Devolve o valor actual de um investimento
+RATE = TAXA ## Devolve a taxa de juros por perÃodo de uma anuidade
+RECEIVED = RECEBER ## Devolve o montante recebido no vencimento de um tÃtulo investido na totalidade
+SLN = AMORT ## Devolve uma depreciação linear de um activo durante um perÃodo
+SYD = AMORTD ## Devolve a depreciação por algarismos da soma dos anos de um activo durante um perÃodo especificado
+TBILLEQ = OTN ## Devolve o lucro de um tÃtulo equivalente a uma Obrigação do Tesouro
+TBILLPRICE = OTNVALOR ## Devolve o preço por € 100 de valor nominal de uma Obrigação do Tesouro
+TBILLYIELD = OTNLUCRO ## Devolve o lucro de uma Obrigação do Tesouro
+VDB = BDV ## Devolve a depreciação de um activo relativo a um perÃodo especÃfico ou parcial utilizando um método de quotas degressivas
+XIRR = XTIR ## Devolve a taxa interna de rentabilidade de um plano de fluxos monetários que não seja necessariamente periódica
+XNPV = XVAL ## Devolve o valor actual lÃquido de um plano de fluxos monetários que não seja necessariamente periódico
+YIELD = LUCRO ## Devolve o lucro de um tÃtulo que paga juros periódicos
+YIELDDISC = LUCRODESC ## Devolve o lucro anual de um tÃtulo emitido abaixo do valor nominal, por exemplo, uma Obrigação do Tesouro
+YIELDMAT = LUCROVENC ## Devolve o lucro anual de um tÃtulo que paga juros na data de vencimento
+
+
+##
+## Information functions Funções de informação
+##
+CELL = CÉL ## Devolve informações sobre a formatação, localização ou conteúdo de uma célula
+ERROR.TYPE = TIPO.ERRO ## Devolve um número correspondente a um tipo de erro
+INFO = INFORMAÇÃO ## Devolve informações sobre o ambiente de funcionamento actual
+ISBLANK = É.CÉL.VAZIA ## Devolve VERDADEIRO se o valor estiver em branco
+ISERR = É.ERROS ## Devolve VERDADEIRO se o valor for um valor de erro diferente de #N/D
+ISERROR = É.ERRO ## Devolve VERDADEIRO se o valor for um valor de erro
+ISEVEN = ÉPAR ## Devolve VERDADEIRO se o número for par
+ISLOGICAL = É.LÓGICO ## Devolve VERDADEIRO se o valor for lógico
+ISNA = É.NÃO.DISP ## Devolve VERDADEIRO se o valor for o valor de erro #N/D
+ISNONTEXT = É.NÃO.TEXTO ## Devolve VERDADEIRO se o valor não for texto
+ISNUMBER = É.NÚM ## Devolve VERDADEIRO se o valor for um número
+ISODD = ÉÃMPAR ## Devolve VERDADEIRO se o número for Ãmpar
+ISREF = É.REF ## Devolve VERDADEIRO se o valor for uma referência
+ISTEXT = É.TEXTO ## Devolve VERDADEIRO se o valor for texto
+N = N ## Devolve um valor convertido num número
+NA = NÃO.DISP ## Devolve o valor de erro #N/D
+TYPE = TIPO ## Devolve um número que indica o tipo de dados de um valor
+
+
+##
+## Logical functions Funções lógicas
+##
+AND = E ## Devolve VERDADEIRO se todos os respectivos argumentos corresponderem a VERDADEIRO
+FALSE = FALSO ## Devolve o valor lógico FALSO
+IF = SE ## Especifica um teste lógico a ser executado
+IFERROR = SE.ERRO ## Devolve um valor definido pelo utilizador se ocorrer um erro na fórmula, e devolve o resultado da fórmula se não ocorrer nenhum erro
+NOT = NÃO ## Inverte a lógica do respectivo argumento
+OR = OU ## Devolve VERDADEIRO se qualquer argumento for VERDADEIRO
+TRUE = VERDADEIRO ## Devolve o valor lógico VERDADEIRO
+
+
+##
+## Lookup and reference functions Funções de pesquisa e referência
+##
+ADDRESS = ENDEREÇO ## Devolve uma referência a uma única célula numa folha de cálculo como texto
+AREAS = ÃREAS ## Devolve o número de áreas numa referência
+CHOOSE = SELECCIONAR ## Selecciona um valor a partir de uma lista de valores
+COLUMN = COL ## Devolve o número da coluna de uma referência
+COLUMNS = COLS ## Devolve o número de colunas numa referência
+HLOOKUP = PROCH ## Procura na linha superior de uma matriz e devolve o valor da célula indicada
+HYPERLINK = HIPERLIGAÇÃO ## Cria um atalho ou hiperligação que abre um documento armazenado num servidor de rede, numa intranet ou na Internet
+INDEX = ÃNDICE ## Utiliza um Ãndice para escolher um valor de uma referência ou de uma matriz
+INDIRECT = INDIRECTO ## Devolve uma referência indicada por um valor de texto
+LOOKUP = PROC ## Procura valores num vector ou numa matriz
+MATCH = CORRESP ## Procura valores numa referência ou numa matriz
+OFFSET = DESLOCAMENTO ## Devolve o deslocamento de referência de uma determinada referência
+ROW = LIN ## Devolve o número da linha de uma referência
+ROWS = LINS ## Devolve o número de linhas numa referência
+RTD = RTD ## Obtém dados em tempo real a partir de um programa que suporte automatização COM (automatização: modo de trabalhar com objectos de uma aplicação a partir de outra aplicação ou ferramenta de desenvolvimento. Anteriormente conhecida como automatização OLE, a automatização é uma norma da indústria de software e uma funcionalidade COM (Component Object Model).)
+TRANSPOSE = TRANSPOR ## Devolve a transposição de uma matriz
+VLOOKUP = PROCV ## Procura na primeira coluna de uma matriz e percorre a linha para devolver o valor de uma célula
+
+
+##
+## Math and trigonometry functions Funções matemáticas e trigonométricas
+##
+ABS = ABS ## Devolve o valor absoluto de um número
+ACOS = ACOS ## Devolve o arco de co-seno de um número
+ACOSH = ACOSH ## Devolve o co-seno hiperbólico inverso de um número
+ASIN = ASEN ## Devolve o arco de seno de um número
+ASINH = ASENH ## Devolve o seno hiperbólico inverso de um número
+ATAN = ATAN ## Devolve o arco de tangente de um número
+ATAN2 = ATAN2 ## Devolve o arco de tangente das coordenadas x e y
+ATANH = ATANH ## Devolve a tangente hiperbólica inversa de um número
+CEILING = ARRED.EXCESSO ## Arredonda um número para o número inteiro mais próximo ou para o múltiplo de significância mais próximo
+COMBIN = COMBIN ## Devolve o número de combinações de um determinado número de objectos
+COS = COS ## Devolve o co-seno de um número
+COSH = COSH ## Devolve o co-seno hiperbólico de um número
+DEGREES = GRAUS ## Converte radianos em graus
+EVEN = PAR ## Arredonda um número por excesso para o número inteiro mais próximo
+EXP = EXP ## Devolve e elevado à potência de um determinado número
+FACT = FACTORIAL ## Devolve o factorial de um número
+FACTDOUBLE = FACTDUPLO ## Devolve o factorial duplo de um número
+FLOOR = ARRED.DEFEITO ## Arredonda um número por defeito até zero
+GCD = MDC ## Devolve o maior divisor comum
+INT = INT ## Arredonda um número por defeito para o número inteiro mais próximo
+LCM = MMC ## Devolve o mÃnimo múltiplo comum
+LN = LN ## Devolve o logaritmo natural de um número
+LOG = LOG ## Devolve o logaritmo de um número com uma base especificada
+LOG10 = LOG10 ## Devolve o logaritmo de base 10 de um número
+MDETERM = MATRIZ.DETERM ## Devolve o determinante matricial de uma matriz
+MINVERSE = MATRIZ.INVERSA ## Devolve o inverso matricial de uma matriz
+MMULT = MATRIZ.MULT ## Devolve o produto matricial de duas matrizes
+MOD = RESTO ## Devolve o resto da divisão
+MROUND = MARRED ## Devolve um número arredondado para o múltiplo pretendido
+MULTINOMIAL = POLINOMIAL ## Devolve o polinomial de um conjunto de números
+ODD = ÃMPAR ## Arredonda por excesso um número para o número inteiro Ãmpar mais próximo
+PI = PI ## Devolve o valor de pi
+POWER = POTÊNCIA ## Devolve o resultado de um número elevado a uma potência
+PRODUCT = PRODUTO ## Multiplica os respectivos argumentos
+QUOTIENT = QUOCIENTE ## Devolve a parte inteira de uma divisão
+RADIANS = RADIANOS ## Converte graus em radianos
+RAND = ALEATÓRIO ## Devolve um número aleatório entre 0 e 1
+RANDBETWEEN = ALEATÓRIOENTRE ## Devolve um número aleatório entre os números especificados
+ROMAN = ROMANO ## Converte um número árabe em romano, como texto
+ROUND = ARRED ## Arredonda um número para um número de dÃgitos especificado
+ROUNDDOWN = ARRED.PARA.BAIXO ## Arredonda um número por defeito até zero
+ROUNDUP = ARRED.PARA.CIMA ## Arredonda um número por excesso, afastando-o de zero
+SERIESSUM = SOMASÉRIE ## Devolve a soma de uma série de potências baseada na fórmula
+SIGN = SINAL ## Devolve o sinal de um número
+SIN = SEN ## Devolve o seno de um determinado ângulo
+SINH = SENH ## Devolve o seno hiperbólico de um número
+SQRT = RAIZQ ## Devolve uma raiz quadrada positiva
+SQRTPI = RAIZPI ## Devolve a raiz quadrada de (núm * pi)
+SUBTOTAL = SUBTOTAL ## Devolve um subtotal numa lista ou base de dados
+SUM = SOMA ## Adiciona os respectivos argumentos
+SUMIF = SOMA.SE ## Adiciona as células especificadas por um determinado critério
+SUMIFS = SOMA.SE.S ## Adiciona as células num intervalo que cumpre vários critérios
+SUMPRODUCT = SOMARPRODUTO ## Devolve a soma dos produtos de componentes de matrizes correspondentes
+SUMSQ = SOMARQUAD ## Devolve a soma dos quadrados dos argumentos
+SUMX2MY2 = SOMAX2DY2 ## Devolve a soma da diferença dos quadrados dos valores correspondentes em duas matrizes
+SUMX2PY2 = SOMAX2SY2 ## Devolve a soma da soma dos quadrados dos valores correspondentes em duas matrizes
+SUMXMY2 = SOMAXMY2 ## Devolve a soma dos quadrados da diferença dos valores correspondentes em duas matrizes
+TAN = TAN ## Devolve a tangente de um número
+TANH = TANH ## Devolve a tangente hiperbólica de um número
+TRUNC = TRUNCAR ## Trunca um número para um número inteiro
+
+
+##
+## Statistical functions Funções estatÃsticas
+##
+AVEDEV = DESV.MÉDIO ## Devolve a média aritmética dos desvios absolutos à média dos pontos de dados
+AVERAGE = MÉDIA ## Devolve a média dos respectivos argumentos
+AVERAGEA = MÉDIAA ## Devolve uma média dos respectivos argumentos, incluindo números, texto e valores lógicos
+AVERAGEIF = MÉDIA.SE ## Devolve a média aritmética de todas as células num intervalo que cumprem determinado critério
+AVERAGEIFS = MÉDIA.SE.S ## Devolve a média aritmética de todas as células que cumprem múltiplos critérios
+BETADIST = DISTBETA ## Devolve a função de distribuição cumulativa beta
+BETAINV = BETA.ACUM.INV ## Devolve o inverso da função de distribuição cumulativa relativamente a uma distribuição beta especÃfica
+BINOMDIST = DISTRBINOM ## Devolve a probabilidade de distribuição binomial de termo individual
+CHIDIST = DIST.CHI ## Devolve a probabilidade unicaudal da distribuição qui-quadrada
+CHIINV = INV.CHI ## Devolve o inverso da probabilidade unicaudal da distribuição qui-quadrada
+CHITEST = TESTE.CHI ## Devolve o teste para independência
+CONFIDENCE = INT.CONFIANÇA ## Devolve o intervalo de confiança correspondente a uma média de população
+CORREL = CORREL ## Devolve o coeficiente de correlação entre dois conjuntos de dados
+COUNT = CONTAR ## Conta os números que existem na lista de argumentos
+COUNTA = CONTAR.VAL ## Conta os valores que existem na lista de argumentos
+COUNTBLANK = CONTAR.VAZIO ## Conta o número de células em branco num intervalo
+COUNTIF = CONTAR.SE ## Calcula o número de células num intervalo que corresponde aos critérios determinados
+COUNTIFS = CONTAR.SE.S ## Conta o número de células num intervalo que cumprem múltiplos critérios
+COVAR = COVAR ## Devolve a covariância, que é a média dos produtos de desvios de pares
+CRITBINOM = CRIT.BINOM ## Devolve o menor valor em que a distribuição binomial cumulativa é inferior ou igual a um valor de critério
+DEVSQ = DESVQ ## Devolve a soma dos quadrados dos desvios
+EXPONDIST = DISTEXPON ## Devolve a distribuição exponencial
+FDIST = DISTF ## Devolve a distribuição da probabilidade F
+FINV = INVF ## Devolve o inverso da distribuição da probabilidade F
+FISHER = FISHER ## Devolve a transformação Fisher
+FISHERINV = FISHERINV ## Devolve o inverso da transformação Fisher
+FORECAST = PREVISÃO ## Devolve um valor ao longo de uma tendência linear
+FREQUENCY = FREQUÊNCIA ## Devolve uma distribuição de frequência como uma matriz vertical
+FTEST = TESTEF ## Devolve o resultado de um teste F
+GAMMADIST = DISTGAMA ## Devolve a distribuição gama
+GAMMAINV = INVGAMA ## Devolve o inverso da distribuição gama cumulativa
+GAMMALN = LNGAMA ## Devolve o logaritmo natural da função gama, Γ(x)
+GEOMEAN = MÉDIA.GEOMÉTRICA ## Devolve a média geométrica
+GROWTH = CRESCIMENTO ## Devolve valores ao longo de uma tendência exponencial
+HARMEAN = MÉDIA.HARMÓNICA ## Devolve a média harmónica
+HYPGEOMDIST = DIST.HIPERGEOM ## Devolve a distribuição hipergeométrica
+INTERCEPT = INTERCEPTAR ## Devolve a intercepção da linha de regressão linear
+KURT = CURT ## Devolve a curtose de um conjunto de dados
+LARGE = MAIOR ## Devolve o maior valor k-ésimo de um conjunto de dados
+LINEST = PROJ.LIN ## Devolve os parâmetros de uma tendência linear
+LOGEST = PROJ.LOG ## Devolve os parâmetros de uma tendência exponencial
+LOGINV = INVLOG ## Devolve o inverso da distribuição normal logarÃtmica
+LOGNORMDIST = DIST.NORMALLOG ## Devolve a distribuição normal logarÃtmica cumulativa
+MAX = MÃXIMO ## Devolve o valor máximo numa lista de argumentos
+MAXA = MÃXIMOA ## Devolve o valor máximo numa lista de argumentos, incluindo números, texto e valores lógicos
+MEDIAN = MED ## Devolve a mediana dos números indicados
+MIN = MÃNIMO ## Devolve o valor mÃnimo numa lista de argumentos
+MINA = MÃNIMOA ## Devolve o valor mÃnimo numa lista de argumentos, incluindo números, texto e valores lógicos
+MODE = MODA ## Devolve o valor mais comum num conjunto de dados
+NEGBINOMDIST = DIST.BIN.NEG ## Devolve a distribuição binominal negativa
+NORMDIST = DIST.NORM ## Devolve a distribuição cumulativa normal
+NORMINV = INV.NORM ## Devolve o inverso da distribuição cumulativa normal
+NORMSDIST = DIST.NORMP ## Devolve a distribuição cumulativa normal padrão
+NORMSINV = INV.NORMP ## Devolve o inverso da distribuição cumulativa normal padrão
+PEARSON = PEARSON ## Devolve o coeficiente de correlação momento/produto de Pearson
+PERCENTILE = PERCENTIL ## Devolve o k-ésimo percentil de valores num intervalo
+PERCENTRANK = ORDEM.PERCENTUAL ## Devolve a ordem percentual de um valor num conjunto de dados
+PERMUT = PERMUTAR ## Devolve o número de permutações de um determinado número de objectos
+POISSON = POISSON ## Devolve a distribuição de Poisson
+PROB = PROB ## Devolve a probabilidade dos valores num intervalo se encontrarem entre dois limites
+QUARTILE = QUARTIL ## Devolve o quartil de um conjunto de dados
+RANK = ORDEM ## Devolve a ordem de um número numa lista numérica
+RSQ = RQUAD ## Devolve o quadrado do coeficiente de correlação momento/produto de Pearson
+SKEW = DISTORÇÃO ## Devolve a distorção de uma distribuição
+SLOPE = DECLIVE ## Devolve o declive da linha de regressão linear
+SMALL = MENOR ## Devolve o menor valor de k-ésimo de um conjunto de dados
+STANDARDIZE = NORMALIZAR ## Devolve um valor normalizado
+STDEV = DESVPAD ## Calcula o desvio-padrão com base numa amostra
+STDEVA = DESVPADA ## Calcula o desvio-padrão com base numa amostra, incluindo números, texto e valores lógicos
+STDEVP = DESVPADP ## Calcula o desvio-padrão com base na população total
+STDEVPA = DESVPADPA ## Calcula o desvio-padrão com base na população total, incluindo números, texto e valores lógicos
+STEYX = EPADYX ## Devolve o erro-padrão do valor de y previsto para cada x na regressão
+TDIST = DISTT ## Devolve a distribuição t de Student
+TINV = INVT ## Devolve o inverso da distribuição t de Student
+TREND = TENDÊNCIA ## Devolve valores ao longo de uma tendência linear
+TRIMMEAN = MÉDIA.INTERNA ## Devolve a média do interior de um conjunto de dados
+TTEST = TESTET ## Devolve a probabilidade associada ao teste t de Student
+VAR = VAR ## Calcula a variância com base numa amostra
+VARA = VARA ## Calcula a variância com base numa amostra, incluindo números, texto e valores lógicos
+VARP = VARP ## Calcula a variância com base na população total
+VARPA = VARPA ## Calcula a variância com base na população total, incluindo números, texto e valores lógicos
+WEIBULL = WEIBULL ## Devolve a distribuição Weibull
+ZTEST = TESTEZ ## Devolve o valor de probabilidade unicaudal de um teste-z
+
+
+##
+## Text functions Funções de texto
+##
+ASC = ASC ## Altera letras ou katakana de largura total (byte duplo) numa cadeia de caracteres para caracteres de largura média (byte único)
+BAHTTEXT = TEXTO.BAHT ## Converte um número em texto, utilizando o formato monetário ß (baht)
+CHAR = CARÃCT ## Devolve o carácter especificado pelo número de código
+CLEAN = LIMPAR ## Remove do texto todos os caracteres não imprimÃveis
+CODE = CÓDIGO ## Devolve um código numérico correspondente ao primeiro carácter numa cadeia de texto
+CONCATENATE = CONCATENAR ## Agrupa vários itens de texto num único item de texto
+DOLLAR = MOEDA ## Converte um número em texto, utilizando o formato monetário € (Euro)
+EXACT = EXACTO ## Verifica se dois valores de texto são idênticos
+FIND = LOCALIZAR ## Localiza um valor de texto dentro de outro (sensÃvel à s maiúsculas e minúsculas)
+FINDB = LOCALIZARB ## Localiza um valor de texto dentro de outro (sensÃvel à s maiúsculas e minúsculas)
+FIXED = FIXA ## Formata um número como texto com um número fixo de decimais
+JIS = JIS ## Altera letras ou katakana de largura média (byte único) numa cadeia de caracteres para caracteres de largura total (byte duplo)
+LEFT = ESQUERDA ## Devolve os caracteres mais à esquerda de um valor de texto
+LEFTB = ESQUERDAB ## Devolve os caracteres mais à esquerda de um valor de texto
+LEN = NÚM.CARACT ## Devolve o número de caracteres de uma cadeia de texto
+LENB = NÚM.CARACTB ## Devolve o número de caracteres de uma cadeia de texto
+LOWER = MINÚSCULAS ## Converte o texto em minúsculas
+MID = SEG.TEXTO ## Devolve um número especÃfico de caracteres de uma cadeia de texto, a partir da posição especificada
+MIDB = SEG.TEXTOB ## Devolve um número especÃfico de caracteres de uma cadeia de texto, a partir da posição especificada
+PHONETIC = FONÉTICA ## Retira os caracteres fonéticos (furigana) de uma cadeia de texto
+PROPER = INICIAL.MAIÚSCULA ## Coloca em maiúsculas a primeira letra de cada palavra de um valor de texto
+REPLACE = SUBSTITUIR ## Substitui caracteres no texto
+REPLACEB = SUBSTITUIRB ## Substitui caracteres no texto
+REPT = REPETIR ## Repete texto um determinado número de vezes
+RIGHT = DIREITA ## Devolve os caracteres mais à direita de um valor de texto
+RIGHTB = DIREITAB ## Devolve os caracteres mais à direita de um valor de texto
+SEARCH = PROCURAR ## Localiza um valor de texto dentro de outro (não sensÃvel a maiúsculas e minúsculas)
+SEARCHB = PROCURARB ## Localiza um valor de texto dentro de outro (não sensÃvel a maiúsculas e minúsculas)
+SUBSTITUTE = SUBST ## Substitui texto novo por texto antigo numa cadeia de texto
+T = T ## Converte os respectivos argumentos em texto
+TEXT = TEXTO ## Formata um número e converte-o em texto
+TRIM = COMPACTAR ## Remove espaços do texto
+UPPER = MAIÚSCULAS ## Converte texto em maiúsculas
+VALUE = VALOR ## Converte um argumento de texto num número
diff --git a/Classes/PHPExcel/locale/ru/config b/Classes/PHPExcel/locale/ru/config
new file mode 100644
index 0000000..56e45bf
--- /dev/null
+++ b/Classes/PHPExcel/locale/ru/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = р
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #ПУСТО!
+DIV0 = #ДЕЛ/0!
+VALUE = #ЗÐÐЧ!
+REF = #ССЫЛ!
+NAME = #ИМЯ?
+NUM = #ЧИСЛО!
+NA = #Ð/Д
diff --git a/Classes/PHPExcel/locale/ru/functions b/Classes/PHPExcel/locale/ru/functions
new file mode 100644
index 0000000..5ff6d4f
--- /dev/null
+++ b/Classes/PHPExcel/locale/ru/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from information provided by web-junior (http://www.web-junior.net/)
+##
+##
+
+
+##
+## Add-in and Automation functions Функции надÑтроек и автоматизации
+##
+GETPIVOTDATA = ПОЛУЧИТЬ.ДÐÐÐЫЕ.СВОДÐОЙ.ТÐБЛИЦЫ ## Возвращает данные, хранÑщиеÑÑ Ð² отчете Ñводной таблицы.
+
+
+##
+## Cube functions Функции Куб
+##
+CUBEKPIMEMBER = КУБÐЛЕМЕÐТКИП ## Возвращает ÑвойÑтво ключевого индикатора производительноÑти «(КИП)» и отображает Ð¸Ð¼Ñ Â«ÐšÐ˜ÐŸÂ» в Ñчейке. «КИП» предÑтавлÑет Ñобой количеÑтвенную величину, такую как ежемеÑÑÑ‡Ð½Ð°Ñ Ð²Ð°Ð»Ð¾Ð²Ð°Ñ Ð¿Ñ€Ð¸Ð±Ñ‹Ð»ÑŒ или ÐµÐ¶ÐµÐºÐ²Ð°Ñ€Ñ‚Ð°Ð»ÑŒÐ½Ð°Ñ Ñ‚ÐµÐºÑƒÑ‡ÐµÑÑ‚ÑŒ кадров, иÑпользуемой Ð´Ð»Ñ ÐºÐ¾Ð½Ñ‚Ñ€Ð¾Ð»Ñ ÑффективноÑти работы организации.
+CUBEMEMBER = КУБÐЛЕМЕÐТ ## Возвращает Ñлемент или кортеж из куба. ИÑпользуетÑÑ Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÐ¸ ÑущеÑÑ‚Ð²Ð¾Ð²Ð°Ð½Ð¸Ñ Ñлемента или кортежа в кубе.
+CUBEMEMBERPROPERTY = КУБСВОЙСТВОÐЛЕМЕÐТР## Возвращает значение ÑвойÑтва Ñлемента из куба. ИÑпользуетÑÑ Ð´Ð»Ñ Ð¿Ñ€Ð¾Ð²ÐµÑ€ÐºÐ¸ ÑущеÑÑ‚Ð²Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¸Ð¼ÐµÐ½Ð¸ Ñлемента в кубе и возвращает указанное ÑвойÑтво Ð´Ð»Ñ Ñтого Ñлемента.
+CUBERANKEDMEMBER = КУБПОРÐЛЕМЕÐТ ## Возвращает n-ый или ранжированный Ñлемент в множеÑтво. ИÑпользуетÑÑ Ð´Ð»Ñ Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‰ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ или неÑкольких Ñлементов в множеÑтво, например, лучшего продавца или 10 лучших Ñтудентов.
+CUBESET = КУБМÐОЖ ## ОпределÑет вычиÑлительное множеÑтво Ñлементов или кортежей, отправлÑÑ Ð½Ð° Ñервер выражение, которое Ñоздает множеÑтво, а затем возвращает его в Microsoft Office Excel.
+CUBESETCOUNT = КУБЧИСЛОÐЛМÐОЖ ## Возвращает чиÑло Ñлементов множеÑтва.
+CUBEVALUE = КУБЗÐÐЧЕÐИЕ ## Возвращает обобщенное значение из куба.
+
+
+##
+## Database functions Функции Ð´Ð»Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ñ‹ Ñ Ð±Ð°Ð·Ð°Ð¼Ð¸ данных
+##
+DAVERAGE = ДСРЗÐÐЧ ## Возвращает Ñреднее значение выбранных запиÑей базы данных.
+DCOUNT = БСЧÐТ ## ПодÑчитывает количеÑтво чиÑловых Ñчеек в базе данных.
+DCOUNTA = БСЧÐТР## ПодÑчитывает количеÑтво непуÑÑ‚Ñ‹Ñ… Ñчеек в базе данных.
+DGET = БИЗВЛЕЧЬ ## Извлекает из базы данных одну запиÑÑŒ, удовлетворÑющую заданному уÑловию.
+DMAX = ДМÐКС ## Возвращает макÑимальное значение Ñреди выделенных запиÑей базы данных.
+DMIN = ДМИР## Возвращает минимальное значение Ñреди выделенных запиÑей базы данных.
+DPRODUCT = БДПРОИЗВЕД ## Перемножает Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð½Ð¾Ð³Ð¾ Ð¿Ð¾Ð»Ñ Ð² запиÑÑÑ… базы данных, удовлетворÑющих уÑловию.
+DSTDEV = ДСТÐÐДОТКЛ ## Оценивает Ñтандартное отклонение по выборке Ð´Ð»Ñ Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð½Ñ‹Ñ… запиÑей базы данных.
+DSTDEVP = ДСТÐÐДОТКЛП ## ВычиÑлÑет Ñтандартное отклонение по генеральной ÑовокупноÑти Ð´Ð»Ñ Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð½Ñ‹Ñ… запиÑей базы данных
+DSUM = БДСУММ ## Суммирует чиÑла в поле Ð´Ð»Ñ Ð·Ð°Ð¿Ð¸Ñей базы данных, удовлетворÑющих уÑловию.
+DVAR = БДДИСП ## Оценивает диÑперÑию по выборке из выделенных запиÑей базы данных
+DVARP = БДДИСПП ## ВычиÑлÑет диÑперÑию по генеральной ÑовокупноÑти Ð´Ð»Ñ Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð½Ñ‹Ñ… запиÑей базы данных
+
+
+##
+## Date and time functions Функции даты и времени
+##
+DATE = ДÐТР## Возвращает заданную дату в чиÑловом формате.
+DATEVALUE = ДÐТÐЗÐÐЧ ## Преобразует дату из текÑтового формата в чиÑловой формат.
+DAY = ДЕÐЬ ## Преобразует дату в чиÑловом формате в день меÑÑца.
+DAYS360 = ДÐЕЙ360 ## ВычиÑлÑет количеÑтво дней между Ð´Ð²ÑƒÐ¼Ñ Ð´Ð°Ñ‚Ð°Ð¼Ð¸ на оÑнове 360-дневного года.
+EDATE = ДÐТÐМЕС ## Возвращает дату в чиÑловом формате, отÑтоÑщую на заданное чиÑло меÑÑцев вперед или назад от начальной даты.
+EOMONTH = КОÐМЕСЯЦР## Возвращает дату в чиÑловом формате Ð´Ð»Ñ Ð¿Ð¾Ñледнего Ð´Ð½Ñ Ð¼ÐµÑÑца, отÑтоÑщего вперед или назад на заданное чиÑло меÑÑцев.
+HOUR = ЧÐС ## Преобразует дату в чиÑловом формате в чаÑÑ‹.
+MINUTE = МИÐУТЫ ## Преобразует дату в чиÑловом формате в минуты.
+MONTH = МЕСЯЦ ## Преобразует дату в чиÑловом формате в меÑÑцы.
+NETWORKDAYS = ЧИСТРÐБДÐИ ## Возвращает количеÑтво рабочих дней между Ð´Ð²ÑƒÐ¼Ñ Ð´Ð°Ñ‚Ð°Ð¼Ð¸.
+NOW = ТДÐТР## Возвращает текущую дату и Ð²Ñ€ÐµÐ¼Ñ Ð² чиÑловом формате.
+SECOND = СЕКУÐДЫ ## Преобразует дату в чиÑловом формате в Ñекунды.
+TIME = ВРЕМЯ ## Возвращает заданное Ð²Ñ€ÐµÐ¼Ñ Ð² чиÑловом формате.
+TIMEVALUE = ВРЕМЗÐÐЧ ## Преобразует Ð²Ñ€ÐµÐ¼Ñ Ð¸Ð· текÑтового формата в чиÑловой формат.
+TODAY = СЕГОДÐЯ ## Возвращает текущую дату в чиÑловом формате.
+WEEKDAY = ДЕÐЬÐЕД ## Преобразует дату в чиÑловом формате в день недели.
+WEEKNUM = ÐОМÐЕДЕЛИ ## Преобразует чиÑловое предÑтавление в чиÑло, которое указывает, на какую неделю года приходитÑÑ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð°Ñ Ð´Ð°Ñ‚Ð°.
+WORKDAY = Ð ÐБДЕÐЬ ## Возвращает дату в чиÑловом формате, отÑтоÑщую вперед или назад на заданное количеÑтво рабочих дней.
+YEAR = ГОД ## Преобразует дату в чиÑловом формате в год.
+YEARFRAC = ДОЛЯГОДР## Возвращает долю года, которую ÑоÑтавлÑет количеÑтво дней между начальной и конечной датами.
+
+
+##
+## Engineering functions Инженерные функции
+##
+BESSELI = БЕССЕЛЬ.I ## Возвращает модифицированную функцию БеÑÑÐµÐ»Ñ In(x).
+BESSELJ = БЕССЕЛЬ.J ## Возвращает функцию БеÑÑÐµÐ»Ñ Jn(x).
+BESSELK = БЕССЕЛЬ.K ## Возвращает модифицированную функцию БеÑÑÐµÐ»Ñ Kn(x).
+BESSELY = БЕССЕЛЬ.Y ## Возвращает функцию БеÑÑÐµÐ»Ñ Yn(x).
+BIN2DEC = ДВ.Ð’.ДЕС ## Преобразует двоичное чиÑло в деÑÑтичное.
+BIN2HEX = ДВ.Ð’.ШЕСТР## Преобразует двоичное чиÑло в шеÑтнадцатеричное.
+BIN2OCT = ДВ.Ð’.ВОСЬМ ## Преобразует двоичное чиÑло в воÑьмеричное.
+COMPLEX = КОМПЛЕКСР## Преобразует коÑффициенты при вещеÑтвенной и мнимой чаÑÑ‚ÑÑ… комплекÑного чиÑла в комплекÑное чиÑло.
+CONVERT = ПРЕОБР## Преобразует чиÑло из одной ÑиÑтемы единиц Ð¸Ð·Ð¼ÐµÑ€ÐµÐ½Ð¸Ñ Ð² другую.
+DEC2BIN = ДЕС.Ð’.ДВ ## Преобразует деÑÑтичное чиÑло в двоичное.
+DEC2HEX = ДЕС.Ð’.ШЕСТР## Преобразует деÑÑтичное чиÑло в шеÑтнадцатеричное.
+DEC2OCT = ДЕС.Ð’.ВОСЬМ ## Преобразует деÑÑтичное чиÑло в воÑьмеричное.
+DELTA = ДЕЛЬТР## ПроверÑет равенÑтво двух значений.
+ERF = ФОШ ## Возвращает функцию ошибки.
+ERFC = ДФОШ ## Возвращает дополнительную функцию ошибки.
+GESTEP = ПОРОГ ## ПроверÑет, не превышает ли данное чиÑло порогового значениÑ.
+HEX2BIN = ШЕСТÐ.Ð’.ДВ ## Преобразует шеÑтнадцатеричное чиÑло в двоичное.
+HEX2DEC = ШЕСТÐ.Ð’.ДЕС ## Преобразует шеÑтнадцатеричное чиÑло в деÑÑтичное.
+HEX2OCT = ШЕСТÐ.Ð’.ВОСЬМ ## Преобразует шеÑтнадцатеричное чиÑло в воÑьмеричное.
+IMABS = ÐœÐИМ.ABS ## Возвращает абÑолютную величину (модуль) комплекÑного чиÑла.
+IMAGINARY = ÐœÐИМ.ЧÐСТЬ ## Возвращает коÑффициент при мнимой чаÑти комплекÑного чиÑла.
+IMARGUMENT = ÐœÐИМ.ÐРГУМЕÐТ ## Возвращает значение аргумента комплекÑного чиÑла (тета) — угол, выраженный в радианах.
+IMCONJUGATE = ÐœÐИМ.СОПРЯЖ ## Возвращает комплекÑно-ÑопрÑженное комплекÑное чиÑло.
+IMCOS = ÐœÐИМ.COS ## Возвращает коÑÐ¸Ð½ÑƒÑ ÐºÐ¾Ð¼Ð¿Ð»ÐµÐºÑного чиÑла.
+IMDIV = ÐœÐИМ.ДЕЛ ## Возвращает чаÑтное от Ð´ÐµÐ»ÐµÐ½Ð¸Ñ Ð´Ð²ÑƒÑ… комплекÑных чиÑел.
+IMEXP = ÐœÐИМ.EXP ## Возвращает ÑкÑпоненту комплекÑного чиÑла.
+IMLN = ÐœÐИМ.LN ## Возвращает натуральный логарифм комплекÑного чиÑла.
+IMLOG10 = ÐœÐИМ.LOG10 ## Возвращает обычный (деÑÑтичный) логарифм комплекÑного чиÑла.
+IMLOG2 = ÐœÐИМ.LOG2 ## Возвращает двоичный логарифм комплекÑного чиÑла.
+IMPOWER = ÐœÐИМ.СТЕПЕÐЬ ## Возвращает комплекÑное чиÑло, возведенное в целую Ñтепень.
+IMPRODUCT = ÐœÐИМ.ПРОИЗВЕД ## Возвращает произведение от 2 до 29 комплекÑных чиÑел.
+IMREAL = ÐœÐИМ.ВЕЩ ## Возвращает коÑффициент при вещеÑтвенной чаÑти комплекÑного чиÑла.
+IMSIN = ÐœÐИМ.SIN ## Возвращает ÑÐ¸Ð½ÑƒÑ ÐºÐ¾Ð¼Ð¿Ð»ÐµÐºÑного чиÑла.
+IMSQRT = ÐœÐИМ.КОРЕÐЬ ## Возвращает значение квадратного ÐºÐ¾Ñ€Ð½Ñ Ð¸Ð· комплекÑного чиÑла.
+IMSUB = ÐœÐИМ.Ð ÐЗР## Возвращает разноÑÑ‚ÑŒ двух комплекÑных чиÑел.
+IMSUM = ÐœÐИМ.СУММ ## Возвращает Ñумму комплекÑных чиÑел.
+OCT2BIN = ВОСЬМ.Ð’.ДВ ## Преобразует воÑьмеричное чиÑло в двоичное.
+OCT2DEC = ВОСЬМ.Ð’.ДЕС ## Преобразует воÑьмеричное чиÑло в деÑÑтичное.
+OCT2HEX = ВОСЬМ.Ð’.ШЕСТР## Преобразует воÑьмеричное чиÑло в шеÑтнадцатеричное.
+
+
+##
+## Financial functions ФинанÑовые функции
+##
+ACCRINT = ÐÐКОПДОХОД ## Возвращает накопленный процент по ценным бумагам Ñ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑкой выплатой процентов.
+ACCRINTM = ÐÐКОПДОХОДПОГÐШ ## Возвращает накопленный процент по ценным бумагам, проценты по которым выплачиваютÑÑ Ð² Ñрок погашениÑ.
+AMORDEGRC = ÐМОРУМ ## Возвращает величину амортизации Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ периода, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ ÐºÐ¾Ñффициент амортизации.
+AMORLINC = ÐМОРУВ ## Возвращает величину амортизации Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ периода.
+COUPDAYBS = ДÐЕЙКУПОÐДО ## Возвращает количеÑтво дней от начала дейÑÑ‚Ð²Ð¸Ñ ÐºÑƒÐ¿Ð¾Ð½Ð° до даты ÑоглашениÑ.
+COUPDAYS = ДÐЕЙКУПОР## Возвращает чиÑло дней в периоде купона, Ñодержащем дату ÑоглашениÑ.
+COUPDAYSNC = ДÐЕЙКУПОÐПОСЛЕ ## Возвращает чиÑло дней от даты ÑÐ¾Ð³Ð»Ð°ÑˆÐµÐ½Ð¸Ñ Ð´Ð¾ Ñрока Ñледующего купона.
+COUPNCD = ДÐТÐКУПОÐПОСЛЕ ## Возвращает Ñледующую дату купона поÑле даты ÑоглашениÑ.
+COUPNUM = ЧИСЛКУПОР## Возвращает количеÑтво купонов, которые могут быть оплачены между датой ÑÐ¾Ð³Ð»Ð°ÑˆÐµÐ½Ð¸Ñ Ð¸ Ñроком вÑÑ‚ÑƒÐ¿Ð»ÐµÐ½Ð¸Ñ Ð² Ñилу.
+COUPPCD = ДÐТÐКУПОÐДО ## Возвращает предыдущую дату купона перед датой ÑоглашениÑ.
+CUMIPMT = ОБЩПЛÐТ ## Возвращает общую выплату, произведенную между Ð´Ð²ÑƒÐ¼Ñ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑкими выплатами.
+CUMPRINC = ОБЩДОХОД ## Возвращает общую выплату по займу между Ð´Ð²ÑƒÐ¼Ñ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð°Ð¼Ð¸.
+DB = ФУО ## Возвращает величину амортизации актива Ð´Ð»Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ периода, раÑÑчитанную методом фикÑированного ÑƒÐ¼ÐµÐ½ÑŒÑˆÐµÐ½Ð¸Ñ Ð¾Ñтатка.
+DDB = ДДОБ ## Возвращает величину амортизации актива за данный период, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ð¼ÐµÑ‚Ð¾Ð´ двойного ÑƒÐ¼ÐµÐ½ÑŒÑˆÐµÐ½Ð¸Ñ Ð¾Ñтатка или иной Ñвно указанный метод.
+DISC = СКИДКР## Возвращает норму Ñкидки Ð´Ð»Ñ Ñ†ÐµÐ½Ð½Ñ‹Ñ… бумаг.
+DOLLARDE = РУБЛЬ.ДЕС ## Преобразует цену в рублÑÑ…, выраженную в виде дроби, в цену в рублÑÑ…, выраженную деÑÑтичным чиÑлом.
+DOLLARFR = РУБЛЬ.ДРОБЬ ## Преобразует цену в рублÑÑ…, выраженную деÑÑтичным чиÑлом, в цену в рублÑÑ…, выраженную в виде дроби.
+DURATION = ДЛИТ ## Возвращает ежегодную продолжительноÑÑ‚ÑŒ дейÑÑ‚Ð²Ð¸Ñ Ñ†ÐµÐ½Ð½Ñ‹Ñ… бумаг Ñ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑкими выплатами по процентам.
+EFFECT = ÐФФЕКТ ## Возвращает дейÑтвующие ежегодные процентные Ñтавки.
+FV = БС ## Возвращает будущую ÑтоимоÑÑ‚ÑŒ инвеÑтиции.
+FVSCHEDULE = БЗРÐСПИС ## Возвращает будущую ÑтоимоÑÑ‚ÑŒ первоначальной оÑновной Ñуммы поÑле начиÑÐ»ÐµÐ½Ð¸Ñ Ñ€Ñда Ñложных процентов.
+INTRATE = ИÐОРМР## Возвращает процентную Ñтавку Ð´Ð»Ñ Ð¿Ð¾Ð»Ð½Ð¾Ñтью инвеÑтированных ценных бумаг.
+IPMT = ПРПЛТ ## Возвращает величину выплаты прибыли на Ð²Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð·Ð° данный период.
+IRR = ВСД ## Возвращает внутреннюю Ñтавку доходноÑти Ð´Ð»Ñ Ñ€Ñда потоков денежных ÑредÑтв.
+ISPMT = ПРОЦПЛÐТ ## ВычиÑлÑет выплаты за указанный период инвеÑтиции.
+MDURATION = МДЛИТ ## Возвращает модифицированную длительноÑÑ‚ÑŒ ÐœÐ°ÐºÐ¾Ð»ÐµÑ Ð´Ð»Ñ Ñ†ÐµÐ½Ð½Ñ‹Ñ… бумаг Ñ Ð¿Ñ€ÐµÐ´Ð¿Ð¾Ð»Ð°Ð³Ð°ÐµÐ¼Ð¾Ð¹ номинальной ÑтоимоÑтью 100 рублей.
+MIRR = МВСД ## Возвращает внутреннюю Ñтавку доходноÑти, при которой положительные и отрицательные денежные потоки имеют разные Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ñтавки.
+NOMINAL = ÐОМИÐÐЛ ## Возвращает номинальную годовую процентную Ñтавку.
+NPER = КПЕР## Возвращает общее количеÑтво периодов выплаты Ð´Ð»Ñ Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ вклада.
+NPV = ЧПС ## Возвращает чиÑтую приведенную ÑтоимоÑÑ‚ÑŒ инвеÑтиции, оÑнованной на Ñерии периодичеÑких денежных потоков и Ñтавке диÑконтированиÑ.
+ODDFPRICE = ЦЕÐÐПЕРВÐЕРЕГ ## Возвращает цену за 100 рублей нарицательной ÑтоимоÑти ценных бумаг Ñ Ð½ÐµÑ€ÐµÐ³ÑƒÐ»Ñрным первым периодом.
+ODDFYIELD = ДОХОДПЕРВÐЕРЕГ ## Возвращает доход по ценным бумагам Ñ Ð½ÐµÑ€ÐµÐ³ÑƒÐ»Ñрным первым периодом.
+ODDLPRICE = ЦЕÐÐПОСЛÐЕРЕГ ## Возвращает цену за 100 рублей нарицательной ÑтоимоÑти ценных бумаг Ñ Ð½ÐµÑ€ÐµÐ³ÑƒÐ»Ñрным поÑледним периодом.
+ODDLYIELD = ДОХОДПОСЛÐЕРЕГ ## Возвращает доход по ценным бумагам Ñ Ð½ÐµÑ€ÐµÐ³ÑƒÐ»Ñрным поÑледним периодом.
+PMT = ПЛТ ## Возвращает величину выплаты за один период аннуитета.
+PPMT = ОСПЛТ ## Возвращает величину выплат в погашение оÑновной Ñуммы по инвеÑтиции за заданный период.
+PRICE = ЦЕÐÐ ## Возвращает цену за 100 рублей нарицательной ÑтоимоÑти ценных бумаг, по которым производитÑÑ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑÐºÐ°Ñ Ð²Ñ‹Ð¿Ð»Ð°Ñ‚Ð° процентов.
+PRICEDISC = ЦЕÐÐСКИДКР## Возвращает цену за 100 рублей номинальной ÑтоимоÑти ценных бумаг, на которые Ñделана Ñкидка.
+PRICEMAT = ЦЕÐÐПОГÐШ ## Возвращает цену за 100 рублей номинальной ÑтоимоÑти ценных бумаг, проценты по которым выплачиваютÑÑ Ð² Ñрок погашениÑ.
+PV = ПС ## Возвращает приведенную (к текущему моменту) ÑтоимоÑÑ‚ÑŒ инвеÑтиции.
+RATE = СТÐВКР## Возвращает процентную Ñтавку по аннуитету за один период.
+RECEIVED = ПОЛУЧЕÐО ## Возвращает Ñумму, полученную к Ñроку Ð¿Ð¾Ð³Ð°ÑˆÐµÐ½Ð¸Ñ Ð¿Ð¾Ð»Ð½Ð¾Ñтью обеÑпеченных ценных бумаг.
+SLN = ÐПЛ ## Возвращает величину линейной амортизации актива за один период.
+SYD = ÐСЧ ## Возвращает величину амортизации актива за данный период, раÑÑчитанную методом Ñуммы годовых чиÑел.
+TBILLEQ = Ð ÐÐ’ÐОКЧЕК ## Возвращает Ñквивалентный облигации доход по казначейÑкому чеку.
+TBILLPRICE = ЦЕÐÐКЧЕК ## Возвращает цену за 100 рублей нарицательной ÑтоимоÑти Ð´Ð»Ñ ÐºÐ°Ð·Ð½Ð°Ñ‡ÐµÐ¹Ñкого чека.
+TBILLYIELD = ДОХОДКЧЕК ## Возвращает доход по казначейÑкому чеку.
+VDB = ПУО ## Возвращает величину амортизации актива Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð³Ð¾ или чаÑтичного периода при иÑпользовании метода ÑокращающегоÑÑ Ð±Ð°Ð»Ð°Ð½Ñа.
+XIRR = ЧИСТВÐДОХ ## Возвращает внутреннюю Ñтавку доходноÑти Ð´Ð»Ñ Ð³Ñ€Ð°Ñ„Ð¸ÐºÐ° денежных потоков, которые не обÑзательно ноÑÑÑ‚ периодичеÑкий характер.
+XNPV = ЧИСТÐЗ ## Возвращает чиÑтую приведенную ÑтоимоÑÑ‚ÑŒ Ð´Ð»Ñ Ð´ÐµÐ½ÐµÐ¶Ð½Ñ‹Ñ… потоков, которые не обÑзательно ÑвлÑÑŽÑ‚ÑÑ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑкими.
+YIELD = ДОХОД ## Возвращает доход от ценных бумаг, по которым производÑÑ‚ÑÑ Ð¿ÐµÑ€Ð¸Ð¾Ð´Ð¸Ñ‡ÐµÑкие выплаты процентов.
+YIELDDISC = ДОХОДСКИДКР## Возвращает годовой доход по ценным бумагам, на которые Ñделана Ñкидка (пример — казначейÑкие чеки).
+YIELDMAT = ДОХОДПОГÐШ ## Возвращает годовой доход от ценных бумаг, проценты по которым выплачиваютÑÑ Ð² Ñрок погашениÑ.
+
+
+##
+## Information functions Информационные функции
+##
+CELL = ЯЧЕЙКР## Возвращает информацию о формате, раÑположении или Ñодержимом Ñчейки.
+ERROR.TYPE = ТИП.ОШИБКИ ## Возвращает чиÑловой код, ÑоответÑтвующий типу ошибки.
+INFO = ИÐФОРМ ## Возвращает информацию о текущей операционной Ñреде.
+ISBLANK = ЕПУСТО ## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑвлÑетÑÑ ÑÑылкой на пуÑтую Ñчейку.
+ISERR = ЕОШ ## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑÑылаетÑÑ Ð½Ð° любое значение ошибки, кроме #Ð/Д.
+ISERROR = ЕОШИБКР## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑÑылаетÑÑ Ð½Ð° любое значение ошибки.
+ISEVEN = ЕЧÐТР## Возвращает значение ИСТИÐÐ, еÑли значение аргумента ÑвлÑетÑÑ Ñ‡ÐµÑ‚Ð½Ñ‹Ð¼ чиÑлом.
+ISLOGICAL = ЕЛОГИЧ ## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑÑылаетÑÑ Ð½Ð° логичеÑкое значение.
+ISNA = ЕÐД ## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑÑылаетÑÑ Ð½Ð° значение ошибки #Ð/Д.
+ISNONTEXT = ЕÐЕТЕКСТ ## Возвращает значение ИСТИÐÐ, еÑли значение аргумента не ÑвлÑетÑÑ Ñ‚ÐµÐºÑтом.
+ISNUMBER = ЕЧИСЛО ## Возвращает значение ИСТИÐÐ, еÑли аргумент ÑÑылаетÑÑ Ð½Ð° чиÑло.
+ISODD = ЕÐЕЧÐТ ## Возвращает значение ИСТИÐÐ, еÑли значение аргумента ÑвлÑетÑÑ Ð½ÐµÑ‡ÐµÑ‚Ð½Ñ‹Ð¼ чиÑлом.
+ISREF = ЕССЫЛКР## Возвращает значение ИСТИÐÐ, еÑли значение аргумента ÑвлÑетÑÑ ÑÑылкой.
+ISTEXT = ЕТЕКСТ ## Возвращает значение ИСТИÐÐ, еÑли значение аргумента ÑвлÑетÑÑ Ñ‚ÐµÐºÑтом.
+N = Ч ## Возвращает значение, преобразованное в чиÑло.
+NA = ÐД ## Возвращает значение ошибки #Ð/Д.
+TYPE = ТИП ## Возвращает чиÑло, обозначающее тип данных значениÑ.
+
+
+##
+## Logical functions ЛогичеÑкие функции
+##
+AND = И ## Renvoie VRAI si tous ses arguments sont VRAI.
+FALSE = ЛОЖЬ ## Возвращает логичеÑкое значение ЛОЖЬ.
+IF = ЕСЛИ ## ВыполнÑет проверку уÑловиÑ.
+IFERROR = ЕСЛИОШИБКР## Возвращает введённое значение, еÑли вычиÑление по формуле вызывает ошибку; в противном Ñлучае Ñ„ÑƒÐ½ÐºÑ†Ð¸Ñ Ð²Ð¾Ð·Ð²Ñ€Ð°Ñ‰Ð°ÐµÑ‚ результат вычиÑлениÑ.
+NOT = ÐЕ ## МенÑет логичеÑкое значение Ñвоего аргумента на противоположное.
+OR = ИЛИ ## Возвращает значение ИСТИÐÐ, еÑли Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ один аргумент имеет значение ИСТИÐÐ.
+TRUE = ИСТИÐÐ ## Возвращает логичеÑкое значение ИСТИÐÐ.
+
+
+##
+## Lookup and reference functions Функции ÑÑылки и поиÑка
+##
+ADDRESS = ÐДРЕС ## Возвращает ÑÑылку на отдельную Ñчейку лиÑта в виде текÑта.
+AREAS = ОБЛÐСТИ ## Возвращает количеÑтво облаÑтей в ÑÑылке.
+CHOOSE = ВЫБОР## Выбирает значение из ÑпиÑка значений по индекÑу.
+COLUMN = СТОЛБЕЦ ## Возвращает номер Ñтолбца, на который указывает ÑÑылка.
+COLUMNS = ЧИСЛСТОЛБ ## Возвращает количеÑтво Ñтолбцов в ÑÑылке.
+HLOOKUP = ГПР## Ищет в первой Ñтроке маÑÑива и возвращает значение отмеченной Ñчейки
+HYPERLINK = ГИПЕРССЫЛКР## Создает ÑÑылку, открывающую документ, который находитÑÑ Ð½Ð° Ñервере Ñети, в интраÑети или в Интернете.
+INDEX = ИÐДЕКС ## ИÑпользует Ð¸Ð½Ð´ÐµÐºÑ Ð´Ð»Ñ Ð²Ñ‹Ð±Ð¾Ñ€Ð° Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð¸Ð· ÑÑылки или маÑÑива.
+INDIRECT = ДВССЫЛ ## Возвращает ÑÑылку, заданную текÑтовым значением.
+LOOKUP = ПРОСМОТР## Ищет Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² векторе или маÑÑиве.
+MATCH = ПОИСКПОЗ ## Ищет Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² ÑÑылке или маÑÑиве.
+OFFSET = СМЕЩ ## Возвращает Ñмещение ÑÑылки отноÑительно заданной ÑÑылки.
+ROW = СТРОКР## Возвращает номер Ñтроки, определÑемой ÑÑылкой.
+ROWS = ЧСТРОК ## Возвращает количеÑтво Ñтрок в ÑÑылке.
+RTD = ДРВ ## Извлекает данные реального времени из программ, поддерживающих автоматизацию COM (Программирование объектов. Стандартное ÑредÑтво Ð´Ð»Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ñ‹ Ñ Ð¾Ð±ÑŠÐµÐºÑ‚Ð°Ð¼Ð¸ некоторого Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð· другого Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ ÑредÑтва разработки. Программирование объектов (ранее называемое программированием OLE) ÑвлÑетÑÑ Ñ„ÑƒÐ½ÐºÑ†Ð¸ÐµÐ¹ модели COM (Component Object Model, модель компонентных объектов).).
+TRANSPOSE = ТРÐÐСП ## Возвращает транÑпонированный маÑÑив.
+VLOOKUP = ВПР## Ищет значение в первом Ñтолбце маÑÑива и возвращает значение из Ñчейки в найденной Ñтроке и указанном Ñтолбце.
+
+
+##
+## Math and trigonometry functions МатематичеÑкие и тригонометричеÑкие функции
+##
+ABS = ABS ## Возвращает модуль (абÑолютную величину) чиÑла.
+ACOS = ACOS ## Возвращает арккоÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+ACOSH = ACOSH ## Возвращает гиперболичеÑкий арккоÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+ASIN = ASIN ## Возвращает аркÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+ASINH = ASINH ## Возвращает гиперболичеÑкий аркÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+ATAN = ATAN ## Возвращает Ð°Ñ€ÐºÑ‚Ð°Ð½Ð³ÐµÐ½Ñ Ñ‡Ð¸Ñла.
+ATAN2 = ATAN2 ## Возвращает Ð°Ñ€ÐºÑ‚Ð°Ð½Ð³ÐµÐ½Ñ Ð´Ð»Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ñ… координат x и y.
+ATANH = ATANH ## Возвращает гиперболичеÑкий Ð°Ñ€ÐºÑ‚Ð°Ð½Ð³ÐµÐ½Ñ Ñ‡Ð¸Ñла.
+CEILING = ОКРВВЕРХ ## ОкруглÑет чиÑло до ближайшего целого или до ближайшего кратного указанному значению.
+COMBIN = ЧИСЛКОМБ ## Возвращает количеÑтво комбинаций Ð´Ð»Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ чиÑла объектов.
+COS = COS ## Возвращает коÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+COSH = COSH ## Возвращает гиперболичеÑкий коÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+DEGREES = ГРÐДУСЫ ## Преобразует радианы в градуÑÑ‹.
+EVEN = ЧÐТР## ОкруглÑет чиÑло до ближайшего четного целого.
+EXP = EXP ## Возвращает чиÑло e, возведенное в указанную Ñтепень.
+FACT = ФÐКТР## Возвращает факториал чиÑла.
+FACTDOUBLE = ДВФÐКТР## Возвращает двойной факториал чиÑла.
+FLOOR = ОКРВÐИЗ ## ОкруглÑет чиÑло до ближайшего меньшего по модулю значениÑ.
+GCD = ÐОД ## Возвращает наибольший общий делитель.
+INT = ЦЕЛОЕ ## ОкруглÑет чиÑло до ближайшего меньшего целого.
+LCM = ÐОК ## Возвращает наименьшее общее кратное.
+LN = LN ## Возвращает натуральный логарифм чиÑла.
+LOG = LOG ## Возвращает логарифм чиÑла по заданному оÑнованию.
+LOG10 = LOG10 ## Возвращает деÑÑтичный логарифм чиÑла.
+MDETERM = МОПРЕД ## Возвращает определитель матрицы маÑÑива.
+MINVERSE = МОБР## Возвращает обратную матрицу маÑÑива.
+MMULT = МУМÐОЖ ## Возвращает произведение матриц двух маÑÑивов.
+MOD = ОСТÐТ ## Возвращает оÑтаток от делениÑ.
+MROUND = ОКРУГЛТ ## Возвращает чиÑло, округленное Ñ Ñ‚Ñ€ÐµÐ±ÑƒÐµÐ¼Ð¾Ð¹ точноÑтью.
+MULTINOMIAL = МУЛЬТИÐОМ ## Возвращает мультиномиальный коÑффициент множеÑтва чиÑел.
+ODD = ÐЕЧÐТ ## ОкруглÑет чиÑло до ближайшего нечетного целого.
+PI = ПИ ## Возвращает чиÑло пи.
+POWER = СТЕПЕÐЬ ## Возвращает результат Ð²Ð¾Ð·Ð²ÐµÐ´ÐµÐ½Ð¸Ñ Ñ‡Ð¸Ñла в Ñтепень.
+PRODUCT = ПРОИЗВЕД ## Возвращает произведение аргументов.
+QUOTIENT = ЧÐСТÐОЕ ## Возвращает целую чаÑÑ‚ÑŒ чаÑтного при делении.
+RADIANS = Ð ÐДИÐÐЫ ## Преобразует градуÑÑ‹ в радианы.
+RAND = СЛЧИС ## Возвращает Ñлучайное чиÑло в интервале от 0 до 1.
+RANDBETWEEN = СЛУЧМЕЖДУ ## Возвращает Ñлучайное чиÑло в интервале между Ð´Ð²ÑƒÐ¼Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ð¼Ð¸ чиÑлами.
+ROMAN = РИМСКОЕ ## Преобразует арабÑкие цифры в римÑкие в виде текÑта.
+ROUND = ОКРУГЛ ## ОкруглÑет чиÑло до указанного количеÑтва деÑÑтичных разрÑдов.
+ROUNDDOWN = ОКРУГЛВÐИЗ ## ОкруглÑет чиÑло до ближайшего меньшего по модулю значениÑ.
+ROUNDUP = ОКРУГЛВВЕРХ ## ОкруглÑет чиÑло до ближайшего большего по модулю значениÑ.
+SERIESSUM = РЯД.СУММ ## Возвращает Ñумму Ñтепенного Ñ€Ñда, вычиÑленную по формуле.
+SIGN = ЗÐÐК ## Возвращает знак чиÑла.
+SIN = SIN ## Возвращает ÑÐ¸Ð½ÑƒÑ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ угла.
+SINH = SINH ## Возвращает гиперболичеÑкий ÑÐ¸Ð½ÑƒÑ Ñ‡Ð¸Ñла.
+SQRT = КОРЕÐЬ ## Возвращает положительное значение квадратного корнÑ.
+SQRTPI = КОРЕÐЬПИ ## Возвращает квадратный корень из Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ (чиÑло * ПИ).
+SUBTOTAL = ПРОМЕЖУТОЧÐЫЕ.ИТОГИ ## Возвращает промежуточный итог в ÑпиÑке или базе данных.
+SUM = СУММ ## Суммирует аргументы.
+SUMIF = СУММЕСЛИ ## Суммирует Ñчейки, удовлетворÑющие заданному уÑловию.
+SUMIFS = СУММЕСЛИМР## Суммирует диапазон Ñчеек, удовлетворÑющих неÑкольким уÑловиÑм.
+SUMPRODUCT = СУММПРОИЗВ ## Возвращает Ñумму произведений ÑоответÑтвующих Ñлементов маÑÑивов.
+SUMSQ = СУММКВ ## Возвращает Ñумму квадратов аргументов.
+SUMX2MY2 = СУММРÐЗÐКВ ## Возвращает Ñумму разноÑтей квадратов ÑоответÑтвующих значений в двух маÑÑивах.
+SUMX2PY2 = СУММСУММКВ ## Возвращает Ñумму Ñумм квадратов ÑоответÑтвующих Ñлементов двух маÑÑивов.
+SUMXMY2 = СУММКВРÐЗР## Возвращает Ñумму квадратов разноÑтей ÑоответÑтвующих значений в двух маÑÑивах.
+TAN = TAN ## Возвращает Ñ‚Ð°Ð½Ð³ÐµÐ½Ñ Ñ‡Ð¸Ñла.
+TANH = TANH ## Возвращает гиперболичеÑкий Ñ‚Ð°Ð½Ð³ÐµÐ½Ñ Ñ‡Ð¸Ñла.
+TRUNC = ОТБР## ОтбраÑывает дробную чаÑÑ‚ÑŒ чиÑла.
+
+
+##
+## Statistical functions СтатиÑтичеÑкие функции
+##
+AVEDEV = СРОТКЛ ## Возвращает Ñреднее арифметичеÑкое абÑолютных значений отклонений точек данных от Ñреднего.
+AVERAGE = СРЗÐÐЧ ## Возвращает Ñреднее арифметичеÑкое аргументов.
+AVERAGEA = СРЗÐÐЧР## Возвращает Ñреднее арифметичеÑкое аргументов, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+AVERAGEIF = СРЗÐÐЧЕСЛИ ## Возвращает Ñреднее значение (Ñреднее арифметичеÑкое) вÑех Ñчеек в диапазоне, которые удовлетворÑÑŽÑ‚ данному уÑловию.
+AVERAGEIFS = СРЗÐÐЧЕСЛИМР## Возвращает Ñреднее значение (Ñреднее арифметичеÑкое) вÑех Ñчеек, которые удовлетворÑÑŽÑ‚ неÑкольким уÑловиÑм.
+BETADIST = БЕТÐÐ ÐСП ## Возвращает интегральную функцию бета-раÑпределениÑ.
+BETAINV = БЕТÐОБР## Возвращает обратную интегральную функцию указанного бета-раÑпределениÑ.
+BINOMDIST = БИÐОМРÐСП ## Возвращает отдельное значение биномиального раÑпределениÑ.
+CHIDIST = ХИ2Ð ÐСП ## Возвращает одноÑтороннюю вероÑтноÑÑ‚ÑŒ раÑÐ¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ñ…Ð¸-квадрат.
+CHIINV = ХИ2ОБР## Возвращает обратное значение одноÑторонней вероÑтноÑти раÑÐ¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ñ…Ð¸-квадрат.
+CHITEST = ХИ2ТЕСТ ## Возвращает теÑÑ‚ на незавиÑимоÑÑ‚ÑŒ.
+CONFIDENCE = ДОВЕРИТ ## Возвращает доверительный интервал Ð´Ð»Ñ Ñреднего Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð¿Ð¾ генеральной ÑовокупноÑти.
+CORREL = КОРРЕЛ ## Возвращает коÑффициент коррелÑции между Ð´Ð²ÑƒÐ¼Ñ Ð¼Ð½Ð¾Ð¶ÐµÑтвами данных.
+COUNT = СЧÐТ ## ПодÑчитывает количеÑтво чиÑел в ÑпиÑке аргументов.
+COUNTA = СЧÐТЗ ## ПодÑчитывает количеÑтво значений в ÑпиÑке аргументов.
+COUNTBLANK = СЧИТÐТЬПУСТОТЫ ## ПодÑчитывает количеÑтво пуÑÑ‚Ñ‹Ñ… Ñчеек в диапазоне
+COUNTIF = СЧÐТЕСЛИ ## ПодÑчитывает количеÑтво Ñчеек в диапазоне, удовлетворÑющих заданному уÑловию
+COUNTIFS = СЧÐТЕСЛИМР## ПодÑчитывает количеÑтво Ñчеек внутри диапазона, удовлетворÑющих неÑкольким уÑловиÑм.
+COVAR = КОВÐÐ ## Возвращает ковариацию, Ñреднее произведений парных отклонений
+CRITBINOM = КРИТБИÐОМ ## Возвращает наименьшее значение, Ð´Ð»Ñ ÐºÐ¾Ñ‚Ð¾Ñ€Ð¾Ð³Ð¾ интегральное биномиальное раÑпределение меньше или равно заданному критерию.
+DEVSQ = КВÐДРОТКЛ ## Возвращает Ñумму квадратов отклонений.
+EXPONDIST = ÐКСПРÐСП ## Возвращает ÑкÑпоненциальное раÑпределение.
+FDIST = FÐ ÐСП ## Возвращает F-раÑпределение вероÑтноÑти.
+FINV = FÐ ÐСПОБР## Возвращает обратное значение Ð´Ð»Ñ F-раÑÐ¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ Ð²ÐµÑ€Ð¾ÑтноÑти.
+FISHER = ФИШЕР## Возвращает преобразование Фишера.
+FISHERINV = ФИШЕРОБР## Возвращает обратное преобразование Фишера.
+FORECAST = ПРЕДСКÐЗ ## Возвращает значение линейного тренда.
+FREQUENCY = ЧÐСТОТР## Возвращает раÑпределение чаÑтот в виде вертикального маÑÑива.
+FTEST = ФТЕСТ ## Возвращает результат F-теÑта.
+GAMMADIST = ГÐММÐÐ ÐСП ## Возвращает гамма-раÑпределение.
+GAMMAINV = ГÐММÐОБР## Возвращает обратное гамма-раÑпределение.
+GAMMALN = ГÐММÐÐЛОГ ## Возвращает натуральный логарифм гамма функции, Γ(x).
+GEOMEAN = СРГЕОМ ## Возвращает Ñреднее геометричеÑкое.
+GROWTH = РОСТ ## Возвращает Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² ÑоответÑтвии Ñ ÑкÑпоненциальным трендом.
+HARMEAN = СРГÐÐ Ðœ ## Возвращает Ñреднее гармоничеÑкое.
+HYPGEOMDIST = ГИПЕРГЕОМЕТ ## Возвращает гипергеометричеÑкое раÑпределение.
+INTERCEPT = ОТРЕЗОК ## Возвращает отрезок, отÑекаемый на оÑи линией линейной регреÑÑии.
+KURT = ÐКСЦЕСС ## Возвращает ÑкÑцеÑÑ Ð¼Ð½Ð¾Ð¶ÐµÑтва данных.
+LARGE = ÐÐИБОЛЬШИЙ ## Возвращает k-ое наибольшее значение в множеÑтве данных.
+LINEST = ЛИÐЕЙР## Возвращает параметры линейного тренда.
+LOGEST = ЛГРФПРИБЛ ## Возвращает параметры ÑкÑпоненциального тренда.
+LOGINV = ЛОГÐОРМОБР## Возвращает обратное логарифмичеÑкое нормальное раÑпределение.
+LOGNORMDIST = ЛОГÐОРМРÐСП ## Возвращает интегральное логарифмичеÑкое нормальное раÑпределение.
+MAX = ÐœÐКС ## Возвращает наибольшее значение в ÑпиÑке аргументов.
+MAXA = ÐœÐКСР## Возвращает наибольшее значение в ÑпиÑке аргументов, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+MEDIAN = МЕДИÐÐÐ ## Возвращает медиану заданных чиÑел.
+MIN = МИР## Возвращает наименьшее значение в ÑпиÑке аргументов.
+MINA = МИÐÐ ## Возвращает наименьшее значение в ÑпиÑке аргументов, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+MODE = МОДР## Возвращает значение моды множеÑтва данных.
+NEGBINOMDIST = ОТРБИÐОМРÐСП ## Возвращает отрицательное биномиальное раÑпределение.
+NORMDIST = ÐОРМРÐСП ## Возвращает нормальную функцию раÑпределениÑ.
+NORMINV = ÐОРМОБР## Возвращает обратное нормальное раÑпределение.
+NORMSDIST = ÐОРМСТРÐСП ## Возвращает Ñтандартное нормальное интегральное раÑпределение.
+NORMSINV = ÐОРМСТОБР## Возвращает обратное значение Ñтандартного нормального раÑпределениÑ.
+PEARSON = ПИРСОР## Возвращает коÑффициент коррелÑции ПирÑона.
+PERCENTILE = ПЕРСЕÐТИЛЬ ## Возвращает k-ую перÑентиль Ð´Ð»Ñ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ð¹ диапазона.
+PERCENTRANK = ПРОЦЕÐТРÐÐГ ## Возвращает процентную норму Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² множеÑтве данных.
+PERMUT = ПЕРЕСТ ## Возвращает количеÑтво переÑтановок Ð´Ð»Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ð¾Ð³Ð¾ чиÑла объектов.
+POISSON = ПУÐССОР## Возвращает раÑпределение ПуаÑÑона.
+PROB = ВЕРОЯТÐОСТЬ ## Возвращает вероÑтноÑÑ‚ÑŒ того, что значение из диапазона находитÑÑ Ð²Ð½ÑƒÑ‚Ñ€Ð¸ заданных пределов.
+QUARTILE = КВÐРТИЛЬ ## Возвращает квартиль множеÑтва данных.
+RANK = Ð ÐÐГ ## Возвращает ранг чиÑла в ÑпиÑке чиÑел.
+RSQ = КВПИРСОР## Возвращает квадрат коÑффициента коррелÑции ПирÑона.
+SKEW = СКОС ## Возвращает аÑимметрию раÑпределениÑ.
+SLOPE = ÐÐКЛОР## Возвращает наклон линии линейной регреÑÑии.
+SMALL = ÐÐИМЕÐЬШИЙ ## Возвращает k-ое наименьшее значение в множеÑтве данных.
+STANDARDIZE = ÐОРМÐЛИЗÐЦИЯ ## Возвращает нормализованное значение.
+STDEV = СТÐÐДОТКЛОР## Оценивает Ñтандартное отклонение по выборке.
+STDEVA = СТÐÐДОТКЛОÐÐ ## Оценивает Ñтандартное отклонение по выборке, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+STDEVP = СТÐÐДОТКЛОÐП ## ВычиÑлÑет Ñтандартное отклонение по генеральной ÑовокупноÑти.
+STDEVPA = СТÐÐДОТКЛОÐПР## ВычиÑлÑет Ñтандартное отклонение по генеральной ÑовокупноÑти, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+STEYX = СТОШYX ## Возвращает Ñтандартную ошибку предÑказанных значений y Ð´Ð»Ñ ÐºÐ°Ð¶Ð´Ð¾Ð³Ð¾ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ x в регреÑÑии.
+TDIST = СТЬЮДРÐСП ## Возвращает t-раÑпределение Стьюдента.
+TINV = СТЬЮДРÐСПОБР## Возвращает обратное t-раÑпределение Стьюдента.
+TREND = ТЕÐДЕÐЦИЯ ## Возвращает Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² ÑоответÑтвии Ñ Ð»Ð¸Ð½ÐµÐ¹Ð½Ñ‹Ð¼ трендом.
+TRIMMEAN = УРЕЗСРЕДÐЕЕ ## Возвращает Ñреднее внутренноÑти множеÑтва данных.
+TTEST = ТТЕСТ ## Возвращает вероÑтноÑÑ‚ÑŒ, ÑоответÑтвующую критерию Стьюдента.
+VAR = ДИСП ## Оценивает диÑперÑию по выборке.
+VARA = ДИСПР## Оценивает диÑперÑию по выборке, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+VARP = ДИСПР## ВычиÑлÑет диÑперÑию Ð´Ð»Ñ Ð³ÐµÐ½ÐµÑ€Ð°Ð»ÑŒÐ½Ð¾Ð¹ ÑовокупноÑти.
+VARPA = ДИСПРР## ВычиÑлÑет диÑперÑию Ð´Ð»Ñ Ð³ÐµÐ½ÐµÑ€Ð°Ð»ÑŒÐ½Ð¾Ð¹ ÑовокупноÑти, Ð²ÐºÐ»ÑŽÑ‡Ð°Ñ Ñ‡Ð¸Ñла, текÑÑ‚ и логичеÑкие значениÑ.
+WEIBULL = ВЕЙБУЛЛ ## Возвращает раÑпределение Вейбулла.
+ZTEST = ZТЕСТ ## Возвращает двуÑтороннее P-значение z-теÑта.
+
+
+##
+## Text functions ТекÑтовые функции
+##
+ASC = ASC ## Ð”Ð»Ñ Ñзыков Ñ Ð´Ð²ÑƒÑ…Ð±Ð°Ð¹Ñ‚Ð¾Ð²Ñ‹Ð¼Ð¸ наборами знаков (например, катакана) преобразует полноширинные (двухбайтовые) знаки в полуширинные (однобайтовые).
+BAHTTEXT = БÐТТЕКСТ ## Преобразует чиÑло в текÑÑ‚, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ð´ÐµÐ½ÐµÐ¶Ð½Ñ‹Ð¹ формат ß (БÐТ).
+CHAR = СИМВОЛ ## Возвращает знак Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ð¼ кодом.
+CLEAN = ПЕЧСИМВ ## УдалÑет вÑе непечатаемые знаки из текÑта.
+CODE = КОДСИМВ ## Возвращает чиÑловой код первого знака в текÑтовой Ñтроке.
+CONCATENATE = СЦЕПИТЬ ## ОбъединÑет неÑколько текÑтовых Ñлементов в один.
+DOLLAR = РУБЛЬ ## Преобразует чиÑло в текÑÑ‚, иÑÐ¿Ð¾Ð»ÑŒÐ·ÑƒÑ Ð´ÐµÐ½ÐµÐ¶Ð½Ñ‹Ð¹ формат.
+EXACT = СОВПÐД ## ПроверÑет идентичноÑÑ‚ÑŒ двух текÑтовых значений.
+FIND = ÐÐЙТИ ## Ищет Ð²Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ текÑтового Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² другом (Ñ ÑƒÑ‡ÐµÑ‚Ð¾Ð¼ региÑтра).
+FINDB = ÐÐЙТИБ ## Ищет Ð²Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ текÑтового Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² другом (Ñ ÑƒÑ‡ÐµÑ‚Ð¾Ð¼ региÑтра).
+FIXED = ФИКСИРОВÐÐÐЫЙ ## Форматирует чиÑло и преобразует его в текÑÑ‚ Ñ Ð·Ð°Ð´Ð°Ð½Ð½Ñ‹Ð¼ чиÑлом деÑÑтичных знаков.
+JIS = JIS ## Ð”Ð»Ñ Ñзыков Ñ Ð´Ð²ÑƒÑ…Ð±Ð°Ð¹Ñ‚Ð¾Ð²Ñ‹Ð¼Ð¸ наборами знаков (например, катакана) преобразует полуширинные (однобайтовые) знаки в текÑтовой Ñтроке в полноширинные (двухбайтовые).
+LEFT = ЛЕВСИМВ ## Возвращает крайние Ñлева знаки текÑтового значениÑ.
+LEFTB = ЛЕВБ ## Возвращает крайние Ñлева знаки текÑтового значениÑ.
+LEN = ДЛСТР## Возвращает количеÑтво знаков в текÑтовой Ñтроке.
+LENB = ДЛИÐБ ## Возвращает количеÑтво знаков в текÑтовой Ñтроке.
+LOWER = СТРОЧР## Преобразует вÑе буквы текÑта в Ñтрочные.
+MID = ПСТР## Возвращает заданное чиÑло знаков из Ñтроки текÑта, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ позиции.
+MIDB = ПСТРБ ## Возвращает заданное чиÑло знаков из Ñтроки текÑта, Ð½Ð°Ñ‡Ð¸Ð½Ð°Ñ Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ позиции.
+PHONETIC = PHONETIC ## Извлекает фонетичеÑкие (фуригана) знаки из текÑтовой Ñтроки.
+PROPER = ПРОПÐÐЧ ## Преобразует первую букву в каждом Ñлове текÑта в пропиÑную.
+REPLACE = ЗÐМЕÐИТЬ ## ЗаменÑет знаки в текÑте.
+REPLACEB = ЗÐМЕÐИТЬБ ## ЗаменÑет знаки в текÑте.
+REPT = ПОВТОР## ПовторÑет текÑÑ‚ заданное чиÑло раз.
+RIGHT = ПРÐВСИМВ ## Возвращает крайние Ñправа знаки текÑтовой Ñтроки.
+RIGHTB = ПРÐВБ ## Возвращает крайние Ñправа знаки текÑтовой Ñтроки.
+SEARCH = ПОИСК ## Ищет Ð²Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ текÑтового Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² другом (без учета региÑтра).
+SEARCHB = ПОИСКБ ## Ищет Ð²Ñ…Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ текÑтового Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð² другом (без учета региÑтра).
+SUBSTITUTE = ПОДСТÐВИТЬ ## ЗаменÑет в текÑтовой Ñтроке Ñтарый текÑÑ‚ новым.
+T = Т ## Преобразует аргументы в текÑÑ‚.
+TEXT = ТЕКСТ ## Форматирует чиÑло и преобразует его в текÑÑ‚.
+TRIM = СЖПРОБЕЛЫ ## УдалÑет из текÑта пробелы.
+UPPER = ПРОПИСР## Преобразует вÑе буквы текÑта в пропиÑные.
+VALUE = ЗÐÐЧЕР## Преобразует текÑтовый аргумент в чиÑло.
diff --git a/Classes/PHPExcel/locale/sv/config b/Classes/PHPExcel/locale/sv/config
new file mode 100644
index 0000000..726f771
--- /dev/null
+++ b/Classes/PHPExcel/locale/sv/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = kr
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #Skärning!
+DIV0 = #Division/0!
+VALUE = #Värdefel!
+REF = #Referens!
+NAME = #Namn?
+NUM = #Ogiltigt!
+NA = #Saknas!
diff --git a/Classes/PHPExcel/locale/sv/functions b/Classes/PHPExcel/locale/sv/functions
new file mode 100644
index 0000000..9af37d8
--- /dev/null
+++ b/Classes/PHPExcel/locale/sv/functions
@@ -0,0 +1,408 @@
+##
+## Add-in and Automation functions Tilläggs- och automatiseringsfunktioner
+##
+GETPIVOTDATA = HÄMTA.PIVOTDATA ## Returnerar data som lagrats i en pivottabellrapport
+
+
+##
+## Cube functions Kubfunktioner
+##
+CUBEKPIMEMBER = KUBKPIMEDLEM ## Returnerar namn, egenskap och mått för en KPI och visar namnet och egenskapen i cellen. En KPI, eller prestandaindikator, är ett kvantifierbart mått, t.ex. månatlig bruttovinst eller personalomsättning per kvartal, som används för att analysera ett företags resultat.
+CUBEMEMBER = KUBMEDLEM ## Returnerar en medlem eller ett par i en kubhierarki. Används för att verifiera att medlemmen eller paret finns i kuben.
+CUBEMEMBERPROPERTY = KUBMEDLEMSEGENSKAP ## Returnerar värdet för en medlemsegenskap i kuben. Används för att verifiera att ett medlemsnamn finns i kuben, samt för att returnera den angivna egenskapen för medlemmen.
+CUBERANKEDMEMBER = KUBRANGORDNADMEDLEM ## Returnerar den n:te, eller rangordnade, medlemmen i en uppsättning. Används för att returnera ett eller flera element i en uppsättning, till exempelvis den bästa försäljaren eller de tio bästa eleverna.
+CUBESET = KUBINSTÄLLNING ## Definierar en beräknad uppsättning medlemmar eller par genom att skicka ett bestämt uttryck till kuben på servern, som skapar uppsättningen och sedan returnerar den till Microsoft Office Excel.
+CUBESETCOUNT = KUBINSTÄLLNINGANTAL ## Returnerar antalet objekt i en uppsättning.
+CUBEVALUE = KUBVÄRDE ## Returnerar ett mängdvärde från en kub.
+
+
+##
+## Database functions Databasfunktioner
+##
+DAVERAGE = DMEDEL ## Returnerar medelvärdet av databasposterna
+DCOUNT = DANTAL ## Räknar antalet celler som innehåller tal i en databas
+DCOUNTA = DANTALV ## Räknar ifyllda celler i en databas
+DGET = DHÄMTA ## Hämtar en enstaka post från en databas som uppfyller de angivna villkoren
+DMAX = DMAX ## Returnerar det största värdet från databasposterna
+DMIN = DMIN ## Returnerar det minsta värdet från databasposterna
+DPRODUCT = DPRODUKT ## Multiplicerar värdena i ett visst fält i poster som uppfyller villkoret
+DSTDEV = DSTDAV ## Uppskattar standardavvikelsen baserat på ett urval av databasposterna
+DSTDEVP = DSTDAVP ## Beräknar standardavvikelsen utifrån hela populationen av valda databasposter
+DSUM = DSUMMA ## Summerar talen i kolumnfält i databasposter som uppfyller villkoret
+DVAR = DVARIANS ## Uppskattar variansen baserat på ett urval av databasposterna
+DVARP = DVARIANSP ## Beräknar variansen utifrån hela populationen av valda databasposter
+
+
+##
+## Date and time functions Tid- och datumfunktioner
+##
+DATE = DATUM ## Returnerar ett serienummer för ett visst datum
+DATEVALUE = DATUMVÄRDE ## Konverterar ett datum i textformat till ett serienummer
+DAY = DAG ## Konverterar ett serienummer till dag i månaden
+DAYS360 = DAGAR360 ## Beräknar antalet dagar mellan två datum baserat på ett 360-dagarsår
+EDATE = EDATUM ## Returnerar serienumret för ett datum som infaller ett visst antal månader före eller efter startdatumet
+EOMONTH = SLUTMÅNAD ## Returnerar serienumret för sista dagen i månaden ett visst antal månader tidigare eller senare
+HOUR = TIMME ## Konverterar ett serienummer till en timme
+MINUTE = MINUT ## Konverterar ett serienummer till en minut
+MONTH = MÅNAD ## Konverterar ett serienummer till en månad
+NETWORKDAYS = NETTOARBETSDAGAR ## Returnerar antalet hela arbetsdagar mellan två datum
+NOW = NU ## Returnerar serienumret för dagens datum och aktuell tid
+SECOND = SEKUND ## Konverterar ett serienummer till en sekund
+TIME = KLOCKSLAG ## Returnerar serienumret för en viss tid
+TIMEVALUE = TIDVÄRDE ## Konverterar en tid i textformat till ett serienummer
+TODAY = IDAG ## Returnerar serienumret för dagens datum
+WEEKDAY = VECKODAG ## Konverterar ett serienummer till en dag i veckan
+WEEKNUM = VECKONR ## Konverterar ett serienummer till ett veckonummer
+WORKDAY = ARBETSDAGAR ## Returnerar serienumret för ett datum ett visst antal arbetsdagar tidigare eller senare
+YEAR = ÅR ## Konverterar ett serienummer till ett år
+YEARFRAC = ÅRDEL ## Returnerar en del av ett år som representerar antalet hela dagar mellan start- och slutdatum
+
+
+##
+## Engineering functions Tekniska funktioner
+##
+BESSELI = BESSELI ## Returnerar den modifierade Bessel-funktionen In(x)
+BESSELJ = BESSELJ ## Returnerar Bessel-funktionen Jn(x)
+BESSELK = BESSELK ## Returnerar den modifierade Bessel-funktionen Kn(x)
+BESSELY = BESSELY ## Returnerar Bessel-funktionen Yn(x)
+BIN2DEC = BIN.TILL.DEC ## Omvandlar ett binärt tal till decimalt
+BIN2HEX = BIN.TILL.HEX ## Omvandlar ett binärt tal till hexadecimalt
+BIN2OCT = BIN.TILL.OKT ## Omvandlar ett binärt tal till oktalt
+COMPLEX = KOMPLEX ## Omvandlar reella och imaginära koefficienter till ett komplext tal
+CONVERT = KONVERTERA ## Omvandlar ett tal från ett måttsystem till ett annat
+DEC2BIN = DEC.TILL.BIN ## Omvandlar ett decimalt tal till binärt
+DEC2HEX = DEC.TILL.HEX ## Omvandlar ett decimalt tal till hexadecimalt
+DEC2OCT = DEC.TILL.OKT ## Omvandlar ett decimalt tal till oktalt
+DELTA = DELTA ## Testar om två värden är lika
+ERF = FELF ## Returnerar felfunktionen
+ERFC = FELFK ## Returnerar den komplementära felfunktionen
+GESTEP = SLSTEG ## Testar om ett tal är större än ett tröskelvärde
+HEX2BIN = HEX.TILL.BIN ## Omvandlar ett hexadecimalt tal till binärt
+HEX2DEC = HEX.TILL.DEC ## Omvandlar ett hexadecimalt tal till decimalt
+HEX2OCT = HEX.TILL.OKT ## Omvandlar ett hexadecimalt tal till oktalt
+IMABS = IMABS ## Returnerar absolutvärdet (modulus) för ett komplext tal
+IMAGINARY = IMAGINÄR ## Returnerar den imaginära koefficienten för ett komplext tal
+IMARGUMENT = IMARGUMENT ## Returnerar det komplexa talets argument, en vinkel uttryckt i radianer
+IMCONJUGATE = IMKONJUGAT ## Returnerar det komplexa talets konjugat
+IMCOS = IMCOS ## Returnerar cosinus för ett komplext tal
+IMDIV = IMDIV ## Returnerar kvoten för två komplexa tal
+IMEXP = IMEUPPHÖJT ## Returnerar exponenten för ett komplext tal
+IMLN = IMLN ## Returnerar den naturliga logaritmen för ett komplext tal
+IMLOG10 = IMLOG10 ## Returnerar 10-logaritmen för ett komplext tal
+IMLOG2 = IMLOG2 ## Returnerar 2-logaritmen för ett komplext tal
+IMPOWER = IMUPPHÖJT ## Returnerar ett komplext tal upphöjt till en exponent
+IMPRODUCT = IMPRODUKT ## Returnerar produkten av komplexa tal
+IMREAL = IMREAL ## Returnerar den reella koefficienten för ett komplext tal
+IMSIN = IMSIN ## Returnerar sinus för ett komplext tal
+IMSQRT = IMROT ## Returnerar kvadratroten av ett komplext tal
+IMSUB = IMDIFF ## Returnerar differensen mellan två komplexa tal
+IMSUM = IMSUM ## Returnerar summan av komplexa tal
+OCT2BIN = OKT.TILL.BIN ## Omvandlar ett oktalt tal till binärt
+OCT2DEC = OKT.TILL.DEC ## Omvandlar ett oktalt tal till decimalt
+OCT2HEX = OKT.TILL.HEX ## Omvandlar ett oktalt tal till hexadecimalt
+
+
+##
+## Financial functions Finansiella funktioner
+##
+ACCRINT = UPPLRÄNTA ## Returnerar den upplupna räntan för värdepapper med periodisk ränta
+ACCRINTM = UPPLOBLRÄNTA ## Returnerar den upplupna räntan för ett värdepapper som ger avkastning på förfallodagen
+AMORDEGRC = AMORDEGRC ## Returnerar avskrivningen för varje redovisningsperiod med hjälp av en avskrivningskoefficient
+AMORLINC = AMORLINC ## Returnerar avskrivningen för varje redovisningsperiod
+COUPDAYBS = KUPDAGBB ## Returnerar antal dagar från början av kupongperioden till likviddagen
+COUPDAYS = KUPDAGARS ## Returnerar antalet dagar i kupongperioden som innehåller betalningsdatumet
+COUPDAYSNC = KUPDAGNK ## Returnerar antalet dagar från betalningsdatumet till nästa kupongdatum
+COUPNCD = KUPNKD ## Returnerar nästa kupongdatum efter likviddagen
+COUPNUM = KUPANT ## Returnerar kuponger som förfaller till betalning mellan likviddagen och förfallodagen
+COUPPCD = KUPFKD ## Returnerar föregående kupongdatum före likviddagen
+CUMIPMT = KUMRÄNTA ## Returnerar den ackumulerade räntan som betalats mellan två perioder
+CUMPRINC = KUMPRIS ## Returnerar det ackumulerade kapitalbeloppet som betalats på ett lån mellan två perioder
+DB = DB ## Returnerar avskrivningen för en tillgång under en angiven tid enligt metoden för fast degressiv avskrivning
+DDB = DEGAVSKR ## Returnerar en tillgångs värdeminskning under en viss period med hjälp av dubbel degressiv avskrivning eller någon annan metod som du anger
+DISC = DISK ## Returnerar diskonteringsräntan för ett värdepapper
+DOLLARDE = DECTAL ## Omvandlar ett pris uttryckt som ett bråk till ett decimaltal
+DOLLARFR = BRÅK ## Omvandlar ett pris i kronor uttryckt som ett decimaltal till ett bråk
+DURATION = LÖPTID ## Returnerar den årliga löptiden för en säkerhet med periodiska räntebetalningar
+EFFECT = EFFRÄNTA ## Returnerar den årliga effektiva räntesatsen
+FV = SLUTVÄRDE ## Returnerar det framtida värdet på en investering
+FVSCHEDULE = FÖRRÄNTNING ## Returnerar det framtida värdet av ett begynnelsekapital beräknat på olika räntenivåer
+INTRATE = ÅRSRÄNTA ## Returnerar räntesatsen för ett betalt värdepapper
+IPMT = RBETALNING ## Returnerar räntedelen av en betalning för en given period
+IRR = IR ## Returnerar internräntan för en serie betalningar
+ISPMT = RALÅN ## Beräknar räntan som har betalats under en specifik betalningsperiod
+MDURATION = MLÖPTID ## Returnerar den modifierade Macauley-löptiden för ett värdepapper med det antagna nominella värdet 100 kr
+MIRR = MODIR ## Returnerar internräntan där positiva och negativa betalningar finansieras med olika räntor
+NOMINAL = NOMRÄNTA ## Returnerar den årliga nominella räntesatsen
+NPER = PERIODER ## Returnerar antalet perioder för en investering
+NPV = NETNUVÄRDE ## Returnerar nuvärdet av en serie periodiska betalningar vid en given diskonteringsränta
+ODDFPRICE = UDDAFPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda första period
+ODDFYIELD = UDDAFAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda första period
+ODDLPRICE = UDDASPRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper med en udda sista period
+ODDLYIELD = UDDASAVKASTNING ## Returnerar avkastningen för en säkerhet med en udda sista period
+PMT = BETALNING ## Returnerar den periodiska betalningen för en annuitet
+PPMT = AMORT ## Returnerar amorteringsdelen av en annuitetsbetalning för en given period
+PRICE = PRIS ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger periodisk ränta
+PRICEDISC = PRISDISK ## Returnerar priset per 100 kr nominellt värde för ett diskonterat värdepapper
+PRICEMAT = PRISFÖRF ## Returnerar priset per 100 kr nominellt värde för ett värdepapper som ger ränta på förfallodagen
+PV = PV ## Returnerar nuvärdet av en serie lika stora periodiska betalningar
+RATE = RÄNTA ## Returnerar räntesatsen per period i en annuitet
+RECEIVED = BELOPP ## Returnerar beloppet som utdelas på förfallodagen för ett betalat värdepapper
+SLN = LINAVSKR ## Returnerar den linjära avskrivningen för en tillgång under en period
+SYD = ÅRSAVSKR ## Returnerar den årliga avskrivningssumman för en tillgång under en angiven period
+TBILLEQ = SSVXEKV ## Returnerar avkastningen motsvarande en obligation för en statsskuldväxel
+TBILLPRICE = SSVXPRIS ## Returnerar priset per 100 kr nominellt värde för en statsskuldväxel
+TBILLYIELD = SSVXRÄNTA ## Returnerar avkastningen för en statsskuldväxel
+VDB = VDEGRAVSKR ## Returnerar avskrivningen för en tillgång under en angiven period (med degressiv avskrivning)
+XIRR = XIRR ## Returnerar internräntan för en serie betalningar som inte nödvändigtvis är periodiska
+XNPV = XNUVÄRDE ## Returnerar det nuvarande nettovärdet för en serie betalningar som inte nödvändigtvis är periodiska
+YIELD = NOMAVK ## Returnerar avkastningen för ett värdepapper som ger periodisk ränta
+YIELDDISC = NOMAVKDISK ## Returnerar den årliga avkastningen för diskonterade värdepapper, exempelvis en statsskuldväxel
+YIELDMAT = NOMAVKFÖRF ## Returnerar den årliga avkastningen för ett värdepapper som ger ränta på förfallodagen
+
+
+##
+## Information functions Informationsfunktioner
+##
+CELL = CELL ## Returnerar information om formatering, plats och innehåll i en cell
+ERROR.TYPE = FEL.TYP ## Returnerar ett tal som motsvarar ett felvärde
+INFO = INFO ## Returnerar information om operativsystemet
+ISBLANK = ÄRREF ## Returnerar SANT om värdet är tomt
+ISERR = Ä ## Returnerar SANT om värdet är ett felvärde annat än #SAKNAS!
+ISERROR = ÄRFEL ## Returnerar SANT om värdet är ett felvärde
+ISEVEN = ÄRJÄMN ## Returnerar SANT om talet är jämnt
+ISLOGICAL = ÄREJTEXT ## Returnerar SANT om värdet är ett logiskt värde
+ISNA = ÄRLOGISK ## Returnerar SANT om värdet är felvärdet #SAKNAS!
+ISNONTEXT = ÄRSAKNAD ## Returnerar SANT om värdet inte är text
+ISNUMBER = ÄRTAL ## Returnerar SANT om värdet är ett tal
+ISODD = ÄRUDDA ## Returnerar SANT om talet är udda
+ISREF = ÄRTOM ## Returnerar SANT om värdet är en referens
+ISTEXT = ÄRTEXT ## Returnerar SANT om värdet är text
+N = N ## Returnerar ett värde omvandlat till ett tal
+NA = SAKNAS ## Returnerar felvärdet #SAKNAS!
+TYPE = VÄRDETYP ## Returnerar ett tal som anger värdets datatyp
+
+
+##
+## Logical functions Logiska funktioner
+##
+AND = OCH ## Returnerar SANT om alla argument är sanna
+FALSE = FALSKT ## Returnerar det logiska värdet FALSKT
+IF = OM ## Anger vilket logiskt test som ska utföras
+IFERROR = OMFEL ## Returnerar ett värde som du anger om en formel utvärderar till ett fel; annars returneras resultatet av formeln
+NOT = ICKE ## Inverterar logiken för argumenten
+OR = ELLER ## Returnerar SANT om något argument är SANT
+TRUE = SANT ## Returnerar det logiska värdet SANT
+
+
+##
+## Lookup and reference functions Sök- och referensfunktioner
+##
+ADDRESS = ADRESS ## Returnerar en referens som text till en enstaka cell i ett kalkylblad
+AREAS = OMRÅDEN ## Returnerar antalet områden i en referens
+CHOOSE = VÄLJ ## Väljer ett värde i en lista över värden
+COLUMN = KOLUMN ## Returnerar kolumnnumret för en referens
+COLUMNS = KOLUMNER ## Returnerar antalet kolumner i en referens
+HLOOKUP = LETAKOLUMN ## Söker i den översta raden i en matris och returnerar värdet för angiven cell
+HYPERLINK = HYPERLÄNK ## Skapar en genväg eller ett hopp till ett dokument i nätverket, i ett intranät eller på Internet
+INDEX = INDEX ## Använder ett index för ett välja ett värde i en referens eller matris
+INDIRECT = INDIREKT ## Returnerar en referens som anges av ett textvärde
+LOOKUP = LETAUPP ## Letar upp värden i en vektor eller matris
+MATCH = PASSA ## Letar upp värden i en referens eller matris
+OFFSET = FÖRSKJUTNING ## Returnerar en referens förskjuten i förhållande till en given referens
+ROW = RAD ## Returnerar radnumret för en referens
+ROWS = RADER ## Returnerar antalet rader i en referens
+RTD = RTD ## Hämtar realtidsdata från ett program som stöder COM-automation (Automation: Ett sätt att arbeta med ett programs objekt från ett annat program eller utvecklingsverktyg. Detta kallades tidigare för OLE Automation, och är en branschstandard och ingår i Component Object Model (COM).)
+TRANSPOSE = TRANSPONERA ## Transponerar en matris
+VLOOKUP = LETARAD ## Letar i den första kolumnen i en matris och flyttar över raden för att returnera värdet för en cell
+
+
+##
+## Math and trigonometry functions Matematiska och trigonometriska funktioner
+##
+ABS = ABS ## Returnerar absolutvärdet av ett tal
+ACOS = ARCCOS ## Returnerar arcus cosinus för ett tal
+ACOSH = ARCCOSH ## Returnerar inverterad hyperbolisk cosinus för ett tal
+ASIN = ARCSIN ## Returnerar arcus cosinus för ett tal
+ASINH = ARCSINH ## Returnerar hyperbolisk arcus sinus för ett tal
+ATAN = ARCTAN ## Returnerar arcus tangens för ett tal
+ATAN2 = ARCTAN2 ## Returnerar arcus tangens för en x- och en y- koordinat
+ATANH = ARCTANH ## Returnerar hyperbolisk arcus tangens för ett tal
+CEILING = RUNDA.UPP ## Avrundar ett tal till närmaste heltal eller närmaste signifikanta multipel
+COMBIN = KOMBIN ## Returnerar antalet kombinationer för ett givet antal objekt
+COS = COS ## Returnerar cosinus för ett tal
+COSH = COSH ## Returnerar hyperboliskt cosinus för ett tal
+DEGREES = GRADER ## Omvandlar radianer till grader
+EVEN = JÄMN ## Avrundar ett tal uppåt till närmaste heltal
+EXP = EXP ## Returnerar e upphöjt till ett givet tal
+FACT = FAKULTET ## Returnerar fakulteten för ett tal
+FACTDOUBLE = DUBBELFAKULTET ## Returnerar dubbelfakulteten för ett tal
+FLOOR = RUNDA.NED ## Avrundar ett tal nedåt mot noll
+GCD = SGD ## Returnerar den största gemensamma nämnaren
+INT = HELTAL ## Avrundar ett tal nedåt till närmaste heltal
+LCM = MGM ## Returnerar den minsta gemensamma multipeln
+LN = LN ## Returnerar den naturliga logaritmen för ett tal
+LOG = LOG ## Returnerar logaritmen för ett tal för en given bas
+LOG10 = LOG10 ## Returnerar 10-logaritmen för ett tal
+MDETERM = MDETERM ## Returnerar matrisen som är avgörandet av en matris
+MINVERSE = MINVERT ## Returnerar matrisinversen av en matris
+MMULT = MMULT ## Returnerar matrisprodukten av två matriser
+MOD = REST ## Returnerar resten vid en division
+MROUND = MAVRUNDA ## Returnerar ett tal avrundat till en given multipel
+MULTINOMIAL = MULTINOMIAL ## Returnerar multinomialen för en uppsättning tal
+ODD = UDDA ## Avrundar ett tal uppåt till närmaste udda heltal
+PI = PI ## Returnerar värdet pi
+POWER = UPPHÖJT.TILL ## Returnerar resultatet av ett tal upphöjt till en exponent
+PRODUCT = PRODUKT ## Multiplicerar argumenten
+QUOTIENT = KVOT ## Returnerar heltalsdelen av en division
+RADIANS = RADIANER ## Omvandlar grader till radianer
+RAND = SLUMP ## Returnerar ett slumptal mellan 0 och 1
+RANDBETWEEN = SLUMP.MELLAN ## Returnerar ett slumptal mellan de tal som du anger
+ROMAN = ROMERSK ## Omvandlar vanliga (arabiska) siffror till romerska som text
+ROUND = AVRUNDA ## Avrundar ett tal till ett angivet antal siffror
+ROUNDDOWN = AVRUNDA.NEDÅT ## Avrundar ett tal nedåt mot noll
+ROUNDUP = AVRUNDA.UPPÅT ## Avrundar ett tal uppåt, från noll
+SERIESSUM = SERIESUMMA ## Returnerar summan av en potensserie baserat på formeln
+SIGN = TECKEN ## Returnerar tecknet för ett tal
+SIN = SIN ## Returnerar sinus för en given vinkel
+SINH = SINH ## Returnerar hyperbolisk sinus för ett tal
+SQRT = ROT ## Returnerar den positiva kvadratroten
+SQRTPI = ROTPI ## Returnerar kvadratroten för (tal * pi)
+SUBTOTAL = DELSUMMA ## Returnerar en delsumma i en lista eller databas
+SUM = SUMMA ## Summerar argumenten
+SUMIF = SUMMA.OM ## Summerar celler enligt ett angivet villkor
+SUMIFS = SUMMA.OMF ## Lägger till cellerna i ett område som uppfyller flera kriterier
+SUMPRODUCT = PRODUKTSUMMA ## Returnerar summan av produkterna i motsvarande matriskomponenter
+SUMSQ = KVADRATSUMMA ## Returnerar summan av argumentens kvadrater
+SUMX2MY2 = SUMMAX2MY2 ## Returnerar summan av differensen mellan kvadraterna för motsvarande värden i två matriser
+SUMX2PY2 = SUMMAX2PY2 ## Returnerar summan av summan av kvadraterna av motsvarande värden i två matriser
+SUMXMY2 = SUMMAXMY2 ## Returnerar summan av kvadraten av skillnaden mellan motsvarande värden i två matriser
+TAN = TAN ## Returnerar tangens för ett tal
+TANH = TANH ## Returnerar hyperbolisk tangens för ett tal
+TRUNC = AVKORTA ## Avkortar ett tal till ett heltal
+
+
+##
+## Statistical functions Statistiska funktioner
+##
+AVEDEV = MEDELAVV ## Returnerar medelvärdet för datapunkters absoluta avvikelse från deras medelvärde
+AVERAGE = MEDEL ## Returnerar medelvärdet av argumenten
+AVERAGEA = AVERAGEA ## Returnerar medelvärdet av argumenten, inklusive tal, text och logiska värden
+AVERAGEIF = MEDELOM ## Returnerar medelvärdet (aritmetiskt medelvärde) för alla celler i ett område som uppfyller ett givet kriterium
+AVERAGEIFS = MEDELOMF ## Returnerar medelvärdet (det aritmetiska medelvärdet) för alla celler som uppfyller flera villkor.
+BETADIST = BETAFÖRD ## Returnerar den kumulativa betafördelningsfunktionen
+BETAINV = BETAINV ## Returnerar inversen till den kumulativa fördelningsfunktionen för en viss betafördelning
+BINOMDIST = BINOMFÖRD ## Returnerar den individuella binomialfördelningen
+CHIDIST = CHI2FÖRD ## Returnerar den ensidiga sannolikheten av c2-fördelningen
+CHIINV = CHI2INV ## Returnerar inversen av chi2-fördelningen
+CHITEST = CHI2TEST ## Returnerar oberoendetesten
+CONFIDENCE = KONFIDENS ## Returnerar konfidensintervallet för en populations medelvärde
+CORREL = KORREL ## Returnerar korrelationskoefficienten mellan två datamängder
+COUNT = ANTAL ## Räknar hur många tal som finns bland argumenten
+COUNTA = ANTALV ## Räknar hur många värden som finns bland argumenten
+COUNTBLANK = ANTAL.TOMMA ## Räknar antalet tomma celler i ett område
+COUNTIF = ANTAL.OM ## Räknar antalet celler i ett område som uppfyller angivna villkor.
+COUNTIFS = ANTAL.OMF ## Räknar antalet celler i ett område som uppfyller flera villkor.
+COVAR = KOVAR ## Returnerar kovariansen, d.v.s. medelvärdet av produkterna för parade avvikelser
+CRITBINOM = KRITBINOM ## Returnerar det minsta värdet för vilket den kumulativa binomialfördelningen är mindre än eller lika med ett villkorsvärde
+DEVSQ = KVADAVV ## Returnerar summan av kvadrater på avvikelser
+EXPONDIST = EXPONFÖRD ## Returnerar exponentialfördelningen
+FDIST = FFÖRD ## Returnerar F-sannolikhetsfördelningen
+FINV = FINV ## Returnerar inversen till F-sannolikhetsfördelningen
+FISHER = FISHER ## Returnerar Fisher-transformationen
+FISHERINV = FISHERINV ## Returnerar inversen till Fisher-transformationen
+FORECAST = PREDIKTION ## Returnerar ett värde längs en linjär trendlinje
+FREQUENCY = FREKVENS ## Returnerar en frekvensfördelning som en lodrät matris
+FTEST = FTEST ## Returnerar resultatet av en F-test
+GAMMADIST = GAMMAFÖRD ## Returnerar gammafördelningen
+GAMMAINV = GAMMAINV ## Returnerar inversen till den kumulativa gammafördelningen
+GAMMALN = GAMMALN ## Returnerar den naturliga logaritmen för gammafunktionen, G(x)
+GEOMEAN = GEOMEDEL ## Returnerar det geometriska medelvärdet
+GROWTH = EXPTREND ## Returnerar värden längs en exponentiell trend
+HARMEAN = HARMMEDEL ## Returnerar det harmoniska medelvärdet
+HYPGEOMDIST = HYPGEOMFÖRD ## Returnerar den hypergeometriska fördelningen
+INTERCEPT = SKÄRNINGSPUNKT ## Returnerar skärningspunkten för en linjär regressionslinje
+KURT = TOPPIGHET ## Returnerar toppigheten av en mängd data
+LARGE = STÖRSTA ## Returnerar det n:te största värdet i en mängd data
+LINEST = REGR ## Returnerar parametrar till en linjär trendlinje
+LOGEST = EXPREGR ## Returnerar parametrarna i en exponentiell trend
+LOGINV = LOGINV ## Returnerar inversen till den lognormala fördelningen
+LOGNORMDIST = LOGNORMFÖRD ## Returnerar den kumulativa lognormala fördelningen
+MAX = MAX ## Returnerar det största värdet i en lista av argument
+MAXA = MAXA ## Returnerar det största värdet i en lista av argument, inklusive tal, text och logiska värden
+MEDIAN = MEDIAN ## Returnerar medianen för angivna tal
+MIN = MIN ## Returnerar det minsta värdet i en lista med argument
+MINA = MINA ## Returnerar det minsta värdet i en lista över argument, inklusive tal, text och logiska värden
+MODE = TYPVÄRDE ## Returnerar det vanligaste värdet i en datamängd
+NEGBINOMDIST = NEGBINOMFÖRD ## Returnerar den negativa binomialfördelningen
+NORMDIST = NORMFÖRD ## Returnerar den kumulativa normalfördelningen
+NORMINV = NORMINV ## Returnerar inversen till den kumulativa normalfördelningen
+NORMSDIST = NORMSFÖRD ## Returnerar den kumulativa standardnormalfördelningen
+NORMSINV = NORMSINV ## Returnerar inversen till den kumulativa standardnormalfördelningen
+PEARSON = PEARSON ## Returnerar korrelationskoefficienten till Pearsons momentprodukt
+PERCENTILE = PERCENTIL ## Returnerar den n:te percentilen av värden i ett område
+PERCENTRANK = PROCENTRANG ## Returnerar procentrangen för ett värde i en datamängd
+PERMUT = PERMUT ## Returnerar antal permutationer för ett givet antal objekt
+POISSON = POISSON ## Returnerar Poisson-fördelningen
+PROB = SANNOLIKHET ## Returnerar sannolikheten att värden i ett område ligger mellan två gränser
+QUARTILE = KVARTIL ## Returnerar kvartilen av en mängd data
+RANK = RANG ## Returnerar rangordningen för ett tal i en lista med tal
+RSQ = RKV ## Returnerar kvadraten av Pearsons produktmomentkorrelationskoefficient
+SKEW = SNEDHET ## Returnerar snedheten för en fördelning
+SLOPE = LUTNING ## Returnerar lutningen på en linjär regressionslinje
+SMALL = MINSTA ## Returnerar det n:te minsta värdet i en mängd data
+STANDARDIZE = STANDARDISERA ## Returnerar ett normaliserat värde
+STDEV = STDAV ## Uppskattar standardavvikelsen baserat på ett urval
+STDEVA = STDEVA ## Uppskattar standardavvikelsen baserat på ett urval, inklusive tal, text och logiska värden
+STDEVP = STDAVP ## Beräknar standardavvikelsen baserat på hela populationen
+STDEVPA = STDEVPA ## Beräknar standardavvikelsen baserat på hela populationen, inklusive tal, text och logiska värden
+STEYX = STDFELYX ## Returnerar standardfelet för ett förutspått y-värde för varje x-värde i regressionen
+TDIST = TFÖRD ## Returnerar Students t-fördelning
+TINV = TINV ## Returnerar inversen till Students t-fördelning
+TREND = TREND ## Returnerar värden längs en linjär trend
+TRIMMEAN = TRIMMEDEL ## Returnerar medelvärdet av mittpunkterna i en datamängd
+TTEST = TTEST ## Returnerar sannolikheten beräknad ur Students t-test
+VAR = VARIANS ## Uppskattar variansen baserat på ett urval
+VARA = VARA ## Uppskattar variansen baserat på ett urval, inklusive tal, text och logiska värden
+VARP = VARIANSP ## Beräknar variansen baserat på hela populationen
+VARPA = VARPA ## Beräknar variansen baserat på hela populationen, inklusive tal, text och logiska värden
+WEIBULL = WEIBULL ## Returnerar Weibull-fördelningen
+ZTEST = ZTEST ## Returnerar det ensidiga sannolikhetsvärdet av ett z-test
+
+
+##
+## Text functions Textfunktioner
+##
+ASC = ASC ## Ändrar helbredds (dubbel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med halvt breddsteg (enkel byte)
+BAHTTEXT = BAHTTEXT ## Omvandlar ett tal till text med valutaformatet ß (baht)
+CHAR = TECKENKOD ## Returnerar tecknet som anges av kod
+CLEAN = STÄDA ## Tar bort alla icke utskrivbara tecken i en text
+CODE = KOD ## Returnerar en numerisk kod för det första tecknet i en textsträng
+CONCATENATE = SAMMANFOGA ## Sammanfogar flera textdelar till en textsträng
+DOLLAR = VALUTA ## Omvandlar ett tal till text med valutaformat
+EXACT = EXAKT ## Kontrollerar om två textvärden är identiska
+FIND = HITTA ## Hittar en text i en annan (skiljer på gemener och versaler)
+FINDB = HITTAB ## Hittar en text i en annan (skiljer på gemener och versaler)
+FIXED = FASTTAL ## Formaterar ett tal som text med ett fast antal decimaler
+JIS = JIS ## Ändrar halvbredds (enkel byte) engelska bokstäver eller katakana inom en teckensträng till tecken med helt breddsteg (dubbel byte)
+LEFT = VÄNSTER ## Returnerar tecken längst till vänster i en sträng
+LEFTB = VÄNSTERB ## Returnerar tecken längst till vänster i en sträng
+LEN = LÄNGD ## Returnerar antalet tecken i en textsträng
+LENB = LÄNGDB ## Returnerar antalet tecken i en textsträng
+LOWER = GEMENER ## Omvandlar text till gemener
+MID = EXTEXT ## Returnerar angivet antal tecken från en text med början vid den position som du anger
+MIDB = EXTEXTB ## Returnerar angivet antal tecken från en text med början vid den position som du anger
+PHONETIC = PHONETIC ## Returnerar de fonetiska (furigana) tecknen i en textsträng
+PROPER = INITIAL ## Ändrar första bokstaven i varje ord i ett textvärde till versal
+REPLACE = ERSÄTT ## Ersätter tecken i text
+REPLACEB = ERSÄTTB ## Ersätter tecken i text
+REPT = REP ## Upprepar en text ett bestämt antal gånger
+RIGHT = HÖGER ## Returnerar tecken längst till höger i en sträng
+RIGHTB = HÖGERB ## Returnerar tecken längst till höger i en sträng
+SEARCH = SÖK ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler)
+SEARCHB = SÖKB ## Hittar ett textvärde i ett annat (skiljer inte på gemener och versaler)
+SUBSTITUTE = BYT.UT ## Ersätter gammal text med ny text i en textsträng
+T = T ## Omvandlar argumenten till text
+TEXT = TEXT ## Formaterar ett tal och omvandlar det till text
+TRIM = RENSA ## Tar bort blanksteg från text
+UPPER = VERSALER ## Omvandlar text till versaler
+VALUE = TEXTNUM ## Omvandlar ett textargument till ett tal
diff --git a/Classes/PHPExcel/locale/tr/config b/Classes/PHPExcel/locale/tr/config
new file mode 100644
index 0000000..b69d425
--- /dev/null
+++ b/Classes/PHPExcel/locale/tr/config
@@ -0,0 +1,47 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Settings
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+##
+
+
+ArgumentSeparator = ;
+
+
+##
+## (For future use)
+##
+currencySymbol = YTL
+
+
+##
+## Excel Error Codes (For future use)
+##
+NULL = #BOÅž!
+DIV0 = #SAYI/0!
+VALUE = #DEÄžER!
+REF = #BAÅžV!
+NAME = #AD?
+NUM = #SAYI!
+NA = #YOK
diff --git a/Classes/PHPExcel/locale/tr/functions b/Classes/PHPExcel/locale/tr/functions
new file mode 100644
index 0000000..45d7df1
--- /dev/null
+++ b/Classes/PHPExcel/locale/tr/functions
@@ -0,0 +1,438 @@
+##
+## PHPExcel
+##
+## Copyright (c) 2006 - 2013 PHPExcel
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+##
+## @category PHPExcel
+## @package PHPExcel_Calculation
+## @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+## @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+## @version ##VERSION##, ##DATE##
+##
+## Data in this file derived from http://www.piuha.fi/excel-function-name-translation/
+##
+##
+
+
+##
+## Add-in and Automation functions Eklenti ve Otomasyon fonksiyonları
+##
+GETPIVOTDATA = ÖZETVERİAL ## Bir Özet Tablo raporunda saklanan verileri verir.
+
+
+##
+## Cube functions Küp işlevleri
+##
+CUBEKPIMEMBER = KÜPKPIÜYE ## Kilit performans göstergesi (KPI-Key Performance Indicator) adını, özelliğini ve ölçüsünü verir ve hücredeki ad ve özelliği gösterir. KPI, bir kurumun performansını izlemek için kullanılan aylık brüt kâr ya da üç aylık çalışan giriş çıkışları gibi ölçülebilen bir birimdir.
+CUBEMEMBER = KÜPÜYE ## Bir küp hiyerarşisinde bir üyeyi veya kaydı verir. Üye veya kaydın küpte varolduğunu doğrulamak için kullanılır.
+CUBEMEMBERPROPERTY = KÜPÜYEÖZELLİĞİ ## Bir küpte bir üyenin özelliğinin değerini verir. Küp içinde üye adının varlığını doğrulamak ve bu üyenin belli özelliklerini getirmek için kullanılır.
+CUBERANKEDMEMBER = KÜPÜYESIRASI ## Bir küme içindeki üyenin derecesini veya kaçıncı olduğunu verir. En iyi satış elemanı, veya en iyi on öğrenci gibi bir kümedeki bir veya daha fazla öğeyi getirmek için kullanılır.
+CUBESET = KÜPKÜME ## Kümeyi oluşturan ve ardından bu kümeyi Microsoft Office Excel'e getiren sunucudaki küpe küme ifadelerini göndererek hesaplanan üye veya kayıt kümesini tanımlar.
+CUBESETCOUNT = KÜPKÜMESAY ## Bir kümedeki öğelerin sayısını getirir.
+CUBEVALUE = KÜPDEĞER ## Bir küpten toplam değeri getirir.
+
+
+##
+## Database functions Veritabanı işlevleri
+##
+DAVERAGE = VSEÇORT ## Seçili veritabanı girdilerinin ortalamasını verir.
+DCOUNT = VSEÇSAY ## Veritabanında sayı içeren hücre sayısını hesaplar.
+DCOUNTA = VSEÇSAYDOLU ## Veritabanındaki boş olmayan hücreleri sayar.
+DGET = VAL ## Veritabanından, belirtilen ölçütlerle eşleşen tek bir rapor çıkarır.
+DMAX = VSEÇMAK ## Seçili veritabanı girişlerinin en yüksek değerini verir.
+DMIN = VSEÇMİN ## Seçili veritabanı girişlerinin en düşük değerini verir.
+DPRODUCT = VSEÇÇARP ## Kayıtların belli bir alanında bulunan, bir veritabanındaki ölçütlerle eşleşen değerleri çarpar.
+DSTDEV = VSEÇSTDSAPMA ## Seçili veritabanı girişlerinden oluşan bir örneğe dayanarak, standart sapmayı tahmin eder.
+DSTDEVP = VSEÇSTDSAPMAS ## Standart sapmayı, seçili veritabanı girişlerinin tüm popülasyonunu esas alarak hesaplar.
+DSUM = VSEÇTOPLA ## Kayıtların alan sütununda bulunan, ölçütle eşleşen sayıları toplar.
+DVAR = VSEÇVAR ## Seçili veritabanı girişlerinden oluşan bir örneği esas alarak farkı tahmin eder.
+DVARP = VSEÇVARS ## Seçili veritabanı girişlerinin tüm popülasyonunu esas alarak farkı hesaplar.
+
+
+##
+## Date and time functions Tarih ve saat iÅŸlevleri
+##
+DATE = TARİH ## Belirli bir tarihin seri numarasını verir.
+DATEVALUE = TARİHSAYISI ## Metin biçimindeki bir tarihi seri numarasına dönüştürür.
+DAY = GÜN ## Seri numarasını, ayın bir gününe dönüştürür.
+DAYS360 = GÜN360 ## İki tarih arasındaki gün sayısını, 360 günlük yılı esas alarak hesaplar.
+EDATE = SERİTARİH ## Başlangıç tarihinden itibaren, belirtilen ay sayısından önce veya sonraki tarihin seri numarasını verir.
+EOMONTH = SERİAY ## Belirtilen sayıda ay önce veya sonraki ayın son gününün seri numarasını verir.
+HOUR = SAAT ## Bir seri numarasını saate dönüştürür.
+MINUTE = DAKİKA ## Bir seri numarasını dakikaya dönüştürür.
+MONTH = AY ## Bir seri numarasını aya dönüştürür.
+NETWORKDAYS = TAMİŞGÜNÜ ## İki tarih arasındaki tam çalışma günlerinin sayısını verir.
+NOW = ŞİMDİ ## Geçerli tarihin ve saatin seri numarasını verir.
+SECOND = SANİYE ## Bir seri numarasını saniyeye dönüştürür.
+TIME = ZAMAN ## Belirli bir zamanın seri numarasını verir.
+TIMEVALUE = ZAMANSAYISI ## Metin biçimindeki zamanı seri numarasına dönüştürür.
+TODAY = BUGÜN ## Bugünün tarihini seri numarasına dönüştürür.
+WEEKDAY = HAFTANINGÜNÜ ## Bir seri numarasını, haftanın gününe dönüştürür.
+WEEKNUM = HAFTASAY ## Dizisel değerini, haftanın yıl içinde bulunduğu konumu sayısal olarak gösteren sayıya dönüştürür.
+WORKDAY = İŞGÜNÜ ## Belirtilen sayıda çalışma günü öncesinin ya da sonrasının tarihinin seri numarasını verir.
+YEAR = YIL ## Bir seri numarasını yıla dönüştürür.
+YEARFRAC = YILORAN ## Başlangıç_tarihi ve bitiş_tarihi arasındaki tam günleri gösteren yıl kesrini verir.
+
+
+##
+## Engineering functions Mühendislik işlevleri
+##
+BESSELI = BESSELI ## DeÄŸiÅŸtirilmiÅŸ Bessel fonksiyonu In(x)'i verir.
+BESSELJ = BESSELJ ## Bessel fonksiyonu Jn(x)'i verir.
+BESSELK = BESSELK ## DeÄŸiÅŸtirilmiÅŸ Bessel fonksiyonu Kn(x)'i verir.
+BESSELY = BESSELY ## Bessel fonksiyonu Yn(x)'i verir.
+BIN2DEC = BIN2DEC ## İkili bir sayıyı, ondalık sayıya dönüştürür.
+BIN2HEX = BIN2HEX ## İkili bir sayıyı, onaltılıya dönüştürür.
+BIN2OCT = BIN2OCT ## İkili bir sayıyı, sekizliye dönüştürür.
+COMPLEX = KARMAŞIK ## Gerçek ve sanal katsayıları, karmaşık sayıya dönüştürür.
+CONVERT = ÇEVİR ## Bir sayıyı, bir ölçüm sisteminden bir başka ölçüm sistemine dönüştürür.
+DEC2BIN = DEC2BIN ## Ondalık bir sayıyı, ikiliye dönüştürür.
+DEC2HEX = DEC2HEX ## Ondalık bir sayıyı, onaltılıya dönüştürür.
+DEC2OCT = DEC2OCT ## Ondalık bir sayıyı sekizliğe dönüştürür.
+DELTA = DELTA ## İki değerin eşit olup olmadığını sınar.
+ERF = HATAÄ°ÅžLEV ## Hata iÅŸlevini verir.
+ERFC = TÜMHATAİŞLEV ## Tümleyici hata işlevini verir.
+GESTEP = BESINIR ## Bir sayının eşik değerinden büyük olup olmadığını sınar.
+HEX2BIN = HEX2BIN ## Onaltılı bir sayıyı ikiliye dönüştürür.
+HEX2DEC = HEX2DEC ## Onaltılı bir sayıyı ondalığa dönüştürür.
+HEX2OCT = HEX2OCT ## Onaltılı bir sayıyı sekizliğe dönüştürür.
+IMABS = SANMUTLAK ## Karmaşık bir sayının mutlak değerini (modül) verir.
+IMAGINARY = SANAL ## Karmaşık bir sayının sanal katsayısını verir.
+IMARGUMENT = SANBAĞ_DEĞİŞKEN ## Radyanlarla belirtilen bir açı olan teta bağımsız değişkenini verir.
+IMCONJUGATE = SANEŞLENEK ## Karmaşık bir sayının karmaşık eşleniğini verir.
+IMCOS = SANCOS ## Karmaşık bir sayının kosinüsünü verir.
+IMDIV = SANBÖL ## İki karmaşık sayının bölümünü verir.
+IMEXP = SANÜS ## Karmaşık bir sayının üssünü verir.
+IMLN = SANLN ## Karmaşık bir sayının doğal logaritmasını verir.
+IMLOG10 = SANLOG10 ## Karmaşık bir sayının, 10 tabanında logaritmasını verir.
+IMLOG2 = SANLOG2 ## Karmaşık bir sayının 2 tabanında logaritmasını verir.
+IMPOWER = SANÜSSÜ ## Karmaşık bir sayıyı, bir tamsayı üssüne yükseltilmiş olarak verir.
+IMPRODUCT = SANÇARP ## Karmaşık sayıların çarpımını verir.
+IMREAL = SANGERÇEK ## Karmaşık bir sayının, gerçek katsayısını verir.
+IMSIN = SANSIN ## Karmaşık bir sayının sinüsünü verir.
+IMSQRT = SANKAREKÖK ## Karmaşık bir sayının karekökünü verir.
+IMSUB = SANÇIKAR ## İki karmaşık sayının farkını verir.
+IMSUM = SANTOPLA ## Karmaşık sayıların toplamını verir.
+OCT2BIN = OCT2BIN ## Sekizli bir sayıyı ikiliye dönüştürür.
+OCT2DEC = OCT2DEC ## Sekizli bir sayıyı ondalığa dönüştürür.
+OCT2HEX = OCT2HEX ## Sekizli bir sayıyı onaltılıya dönüştürür.
+
+
+##
+## Financial functions Finansal fonksiyonlar
+##
+ACCRINT = GERÇEKFAİZ ## Dönemsel faiz ödeyen hisse senedine ilişkin tahakkuk eden faizi getirir.
+ACCRINTM = GERÇEKFAİZV ## Vadesinde ödeme yapan bir tahvilin tahakkuk etmiş faizini verir.
+AMORDEGRC = AMORDEGRC ## Yıpranma katsayısı kullanarak her hesap döneminin değer kaybını verir.
+AMORLINC = AMORLINC ## Her hesap dönemi içindeki yıpranmayı verir.
+COUPDAYBS = KUPONGÜNBD ## Kupon süresinin başlangıcından alış tarihine kadar olan süredeki gün sayısını verir.
+COUPDAYS = KUPONGÜN ## Kupon süresindeki, gün sayısını, alış tarihini de içermek üzere, verir.
+COUPDAYSNC = KUPONGÜNDSK ## Alış tarihinden bir sonraki kupon tarihine kadar olan gün sayısını verir.
+COUPNCD = KUPONGÜNSKT ## Alış tarihinden bir sonraki kupon tarihini verir.
+COUPNUM = KUPONSAYI ## Alış tarihiyle vade tarihi arasında ödenecek kuponların sayısını verir.
+COUPPCD = KUPONGÜNÖKT ## Alış tarihinden bir önceki kupon tarihini verir.
+CUMIPMT = AİÇVERİMORANI ## İki dönem arasında ödenen kümülatif faizi verir.
+CUMPRINC = ANA_PARA_ÖDEMESİ ## İki dönem arasında bir borç üzerine ödenen birikimli temeli verir.
+DB = AZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, sabit azalan bakiye yöntemini kullanarak verir.
+DDB = ÇİFTAZALANBAKİYE ## Bir malın belirtilen bir süre içindeki yıpranmasını, çift azalan bakiye yöntemi ya da sizin belirttiğiniz başka bir yöntemi kullanarak verir.
+DISC = İNDİRİM ## Bir tahvilin indirim oranını verir.
+DOLLARDE = LİRAON ## Kesir olarak tanımlanmış lira fiyatını, ondalık sayı olarak tanımlanmış lira fiyatına dönüştürür.
+DOLLARFR = LİRAKES ## Ondalık sayı olarak tanımlanmış lira fiyatını, kesir olarak tanımlanmış lira fiyatına dönüştürür.
+DURATION = SÜRE ## Belli aralıklarla faiz ödemesi yapan bir tahvilin yıllık süresini verir.
+EFFECT = ETKİN ## Efektif yıllık faiz oranını verir.
+FV = ANBD ## Bir yatırımın gelecekteki değerini verir.
+FVSCHEDULE = GDPROGRAM ## Bir seri birleşik faiz oranı uyguladıktan sonra, bir başlangıçtaki anaparanın gelecekteki değerini verir.
+INTRATE = FAİZORANI ## Tam olarak yatırım yapılmış bir tahvilin faiz oranını verir.
+IPMT = FAİZTUTARI ## Bir yatırımın verilen bir süre için faiz ödemesini verir.
+IRR = İÇ_VERİM_ORANI ## Bir para akışı serisi için, iç verim oranını verir.
+ISPMT = ISPMT ## Yatırımın belirli bir dönemi boyunca ödenen faizi hesaplar.
+MDURATION = MSÜRE ## Varsayılan par değeri 10.000.000 lira olan bir tahvil için Macauley değiştirilmiş süreyi verir.
+MIRR = D_İÇ_VERİM_ORANI ## Pozitif ve negatif para akışlarının farklı oranlarda finanse edildiği durumlarda, iç verim oranını verir.
+NOMINAL = NOMİNAL ## Yıllık nominal faiz oranını verir.
+NPER = DÖNEM_SAYISI ## Bir yatırımın dönem sayısını verir.
+NPV = NBD ## Bir yatırımın bugünkü net değerini, bir dönemsel para akışları serisine ve bir indirim oranına bağlı olarak verir.
+ODDFPRICE = TEKYDEĞER ## Tek bir ilk dönemi olan bir tahvilin değerini, her 100.000.000 lirada bir verir.
+ODDFYIELD = TEKYÖDEME ## Tek bir ilk dönemi olan bir tahvilin ödemesini verir.
+ODDLPRICE = TEKSDEĞER ## Tek bir son dönemi olan bir tahvilin fiyatını her 10.000.000 lirada bir verir.
+ODDLYIELD = TEKSÖDEME ## Tek bir son dönemi olan bir tahvilin ödemesini verir.
+PMT = DEVRESEL_ÖDEME ## Bir yıllık dönemsel ödemeyi verir.
+PPMT = ANA_PARA_ÖDEMESİ ## Verilen bir süre için, bir yatırımın anaparasına dayanan ödemeyi verir.
+PRICE = DEĞER ## Dönemsel faiz ödeyen bir tahvilin fiyatını 10.000.00 liralık değer başına verir.
+PRICEDISC = DEĞERİND ## İndirimli bir tahvilin fiyatını 10.000.000 liralık nominal değer başına verir.
+PRICEMAT = DEĞERVADE ## Faizini vade sonunda ödeyen bir tahvilin fiyatını 10.000.000 nominal değer başına verir.
+PV = BD ## Bir yatırımın bugünkü değerini verir.
+RATE = FAİZ_ORANI ## Bir yıllık dönem başına düşen faiz oranını verir.
+RECEIVED = GETİRİ ## Tam olarak yatırılmış bir tahvilin vadesinin bitiminde alınan miktarı verir.
+SLN = DA ## Bir malın bir dönem içindeki doğrusal yıpranmasını verir.
+SYD = YAT ## Bir malın belirli bir dönem için olan amortismanını verir.
+TBILLEQ = HTAHEŞ ## Bir Hazine bonosunun bono eşdeğeri ödemesini verir.
+TBILLPRICE = HTAHDEĞER ## Bir Hazine bonosunun değerini, 10.000.000 liralık nominal değer başına verir.
+TBILLYIELD = HTAHÖDEME ## Bir Hazine bonosunun ödemesini verir.
+VDB = DAB ## Bir malın amortismanını, belirlenmiş ya da kısmi bir dönem için, bir azalan bakiye yöntemi kullanarak verir.
+XIRR = AİÇVERİMORANI ## Dönemsel olması gerekmeyen bir para akışları programı için, iç verim oranını verir.
+XNPV = ANBD ## Dönemsel olması gerekmeyen bir para akışları programı için, bugünkü net değeri verir.
+YIELD = ÖDEME ## Belirli aralıklarla faiz ödeyen bir tahvilin ödemesini verir.
+YIELDDISC = ÖDEMEİND ## İndirimli bir tahvilin yıllık ödemesini verir; örneğin, bir Hazine bonosunun.
+YIELDMAT = ÖDEMEVADE ## Vadesinin bitiminde faiz ödeyen bir tahvilin yıllık ödemesini verir.
+
+
+##
+## Information functions Bilgi fonksiyonları
+##
+CELL = HÜCRE ## Bir hücrenin biçimlendirmesi, konumu ya da içeriği hakkında bilgi verir.
+ERROR.TYPE = HATA.TİPİ ## Bir hata türüne ilişkin sayıları verir.
+INFO = BİLGİ ## Geçerli işletim ortamı hakkında bilgi verir.
+ISBLANK = EBOÅžSA ## DeÄŸer boÅŸsa, DOÄžRU verir.
+ISERR = EHATA ## Değer, #YOK dışındaki bir hata değeriyse, DOĞRU verir.
+ISERROR = EHATALIYSA ## DeÄŸer, herhangi bir hata deÄŸeriyse, DOÄžRU verir.
+ISEVEN = ÇİFTTİR ## Sayı çiftse, DOĞRU verir.
+ISLOGICAL = EMANTIKSALSA ## Değer, mantıksal bir değerse, DOĞRU verir.
+ISNA = EYOKSA ## DeÄŸer, #YOK hata deÄŸeriyse, DOÄžRU verir.
+ISNONTEXT = EMETİNDEĞİLSE ## Değer, metin değilse, DOĞRU verir.
+ISNUMBER = ESAYIYSA ## Değer, bir sayıysa, DOĞRU verir.
+ISODD = TEKTİR ## Sayı tekse, DOĞRU verir.
+ISREF = EREFSE ## DeÄŸer bir baÅŸvuruysa, DOÄžRU verir.
+ISTEXT = EMETÄ°NSE ## DeÄŸer bir metinse DOÄžRU verir.
+N = N ## Sayıya dönüştürülmüş bir değer verir.
+NA = YOKSAY ## #YOK hata deÄŸerini verir.
+TYPE = TİP ## Bir değerin veri türünü belirten bir sayı verir.
+
+
+##
+## Logical functions Mantıksal fonksiyonlar
+##
+AND = VE ## Bütün bağımsız değişkenleri DOĞRU ise, DOĞRU verir.
+FALSE = YANLIŞ ## YANLIŞ mantıksal değerini verir.
+IF = EĞER ## Gerçekleştirilecek bir mantıksal sınama belirtir.
+IFERROR = EĞERHATA ## Formül hatalıysa belirttiğiniz değeri verir; bunun dışındaki durumlarda formülün sonucunu verir.
+NOT = DEĞİL ## Bağımsız değişkeninin mantığını tersine çevirir.
+OR = YADA ## Bağımsız değişkenlerden herhangi birisi DOĞRU ise, DOĞRU verir.
+TRUE = DOĞRU ## DOĞRU mantıksal değerini verir.
+
+
+##
+## Lookup and reference functions Arama ve Başvuru fonksiyonları
+##
+ADDRESS = ADRES ## Bir başvuruyu, çalışma sayfasındaki tek bir hücreye metin olarak verir.
+AREAS = ALANSAY ## Renvoie le nombre de zones dans une référence.
+CHOOSE = ELEMAN ## Değerler listesinden bir değer seçer.
+COLUMN = SÜTUN ## Bir başvurunun sütun sayısını verir.
+COLUMNS = SÜTUNSAY ## Bir başvurudaki sütunların sayısını verir.
+HLOOKUP = YATAYARA ## Bir dizinin en üst satırına bakar ve belirtilen hücrenin değerini verir.
+HYPERLINK = KÖPRÜ ## Bir ağ sunucusunda, bir intranette ya da Internet'te depolanan bir belgeyi açan bir kısayol ya da atlama oluşturur.
+INDEX = İNDİS ## Başvurudan veya diziden bir değer seçmek için, bir dizin kullanır.
+INDIRECT = DOLAYLI ## Metin deÄŸeriyle belirtilen bir baÅŸvuru verir.
+LOOKUP = ARA ## Bir vektördeki veya dizideki değerleri arar.
+MATCH = KAÇINCI ## Bir başvurudaki veya dizideki değerleri arar.
+OFFSET = KAYDIR ## Verilen bir başvurudan, bir başvuru kaydırmayı verir.
+ROW = SATIR ## Bir başvurunun satır sayısını verir.
+ROWS = SATIRSAY ## Bir başvurudaki satırların sayısını verir.
+RTD = RTD ## COM otomasyonunu destekleyen programdan gerçek zaman verileri alır.
+TRANSPOSE = DEVRİK_DÖNÜŞÜM ## Bir dizinin devrik dönüşümünü verir.
+VLOOKUP = DÜŞEYARA ## Bir dizinin ilk sütununa bakar ve bir hücrenin değerini vermek için satır boyunca hareket eder.
+
+
+##
+## Math and trigonometry functions Matematik ve trigonometri fonksiyonları
+##
+ABS = MUTLAK ## Bir sayının mutlak değerini verir.
+ACOS = ACOS ## Bir sayının ark kosinüsünü verir.
+ACOSH = ACOSH ## Bir sayının ters hiperbolik kosinüsünü verir.
+ASIN = ASİN ## Bir sayının ark sinüsünü verir.
+ASINH = ASİNH ## Bir sayının ters hiperbolik sinüsünü verir.
+ATAN = ATAN ## Bir sayının ark tanjantını verir.
+ATAN2 = ATAN2 ## Ark tanjantı, x- ve y- koordinatlarından verir.
+ATANH = ATANH ## Bir sayının ters hiperbolik tanjantını verir.
+CEILING = TAVANAYUVARLA ## Bir sayıyı, en yakın tamsayıya ya da en yakın katına yuvarlar.
+COMBIN = KOMBİNASYON ## Verilen sayıda öğenin kombinasyon sayısını verir.
+COS = COS ## Bir sayının kosinüsünü verir.
+COSH = COSH ## Bir sayının hiperbolik kosinüsünü verir.
+DEGREES = DERECE ## Radyanları dereceye dönüştürür.
+EVEN = ÇİFT ## Bir sayıyı, en yakın daha büyük çift tamsayıya yuvarlar.
+EXP = ÜS ## e'yi, verilen bir sayının üssüne yükseltilmiş olarak verir.
+FACT = ÇARPINIM ## Bir sayının faktörünü verir.
+FACTDOUBLE = ÇİFTFAKTÖR ## Bir sayının çift çarpınımını verir.
+FLOOR = TABANAYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar.
+GCD = OBEB ## En büyük ortak böleni verir.
+INT = TAMSAYI ## Bir sayıyı aşağıya doğru en yakın tamsayıya yuvarlar.
+LCM = OKEK ## En küçük ortak katı verir.
+LN = LN ## Bir sayının doğal logaritmasını verir.
+LOG = LOG ## Bir sayının, belirtilen bir tabandaki logaritmasını verir.
+LOG10 = LOG10 ## Bir sayının 10 tabanında logaritmasını verir.
+MDETERM = DETERMİNANT ## Bir dizinin dizey determinantını verir.
+MINVERSE = DÄ°ZEY_TERS ## Bir dizinin dizey tersini verir.
+MMULT = DÇARP ## İki dizinin dizey çarpımını verir.
+MOD = MODÜLO ## Bölmeden kalanı verir.
+MROUND = KYUVARLA ## İstenen kata yuvarlanmış bir sayı verir.
+MULTINOMIAL = ÇOKTERİMLİ ## Bir sayılar kümesinin çok terimlisini verir.
+ODD = TEK ## Bir sayıyı en yakın daha büyük tek sayıya yuvarlar.
+PI = PÄ° ## Pi deÄŸerini verir.
+POWER = KUVVET ## Bir üsse yükseltilmiş sayının sonucunu verir.
+PRODUCT = ÇARPIM ## Bağımsız değişkenlerini çarpar.
+QUOTIENT = BÖLÜM ## Bir bölme işleminin tamsayı kısmını verir.
+RADIANS = RADYAN ## Dereceleri radyanlara dönüştürür.
+RAND = S_SAYI_ÜRET ## 0 ile 1 arasında rastgele bir sayı verir.
+RANDBETWEEN = RASTGELEARALIK ## Belirttiğiniz sayılar arasında rastgele bir sayı verir.
+ROMAN = ROMEN ## Bir normal rakamı, metin olarak, romen rakamına çevirir.
+ROUND = YUVARLA ## Bir sayıyı, belirtilen basamak sayısına yuvarlar.
+ROUNDDOWN = AŞAĞIYUVARLA ## Bir sayıyı, daha küçük sayıya, sıfıra yakınsayarak yuvarlar.
+ROUNDUP = YUKARIYUVARLA ## Bir sayıyı daha büyük sayıya, sıfırdan ıraksayarak yuvarlar.
+SERIESSUM = SERİTOPLA ## Bir üs serisinin toplamını, formüle bağlı olarak verir.
+SIGN = İŞARET ## Bir sayının işaretini verir.
+SIN = SİN ## Verilen bir açının sinüsünü verir.
+SINH = SİNH ## Bir sayının hiperbolik sinüsünü verir.
+SQRT = KAREKÖK ## Pozitif bir karekök verir.
+SQRTPI = KAREKÖKPİ ## (* Pi sayısının) kare kökünü verir.
+SUBTOTAL = ALTTOPLAM ## Bir listedeki ya da veritabanındaki bir alt toplamı verir.
+SUM = TOPLA ## Bağımsız değişkenlerini toplar.
+SUMIF = ETOPLA ## Verilen ölçütle belirlenen hücreleri toplar.
+SUMIFS = SUMIFS ## Bir aralıktaki, birden fazla ölçüte uyan hücreleri ekler.
+SUMPRODUCT = TOPLA.ÇARPIM ## İlişkili dizi bileşenlerinin çarpımlarının toplamını verir.
+SUMSQ = TOPKARE ## Bağımsız değişkenlerin karelerinin toplamını verir.
+SUMX2MY2 = TOPX2EY2 ## İki dizideki ilişkili değerlerin farkının toplamını verir.
+SUMX2PY2 = TOPX2AY2 ## İki dizideki ilişkili değerlerin karelerinin toplamının toplamını verir.
+SUMXMY2 = TOPXEY2 ## İki dizideki ilişkili değerlerin farklarının karelerinin toplamını verir.
+TAN = TAN ## Bir sayının tanjantını verir.
+TANH = TANH ## Bir sayının hiperbolik tanjantını verir.
+TRUNC = NSAT ## Bir sayının, tamsayı durumuna gelecek şekilde, fazlalıklarını atar.
+
+
+##
+## Statistical functions Ä°statistiksel fonksiyonlar
+##
+AVEDEV = ORTSAP ## Veri noktalarının ortalamalarından mutlak sapmalarının ortalamasını verir.
+AVERAGE = ORTALAMA ## Bağımsız değişkenlerinin ortalamasını verir.
+AVERAGEA = ORTALAMAA ## Bağımsız değişkenlerinin, sayılar, metin ve mantıksal değerleri içermek üzere ortalamasını verir.
+AVERAGEIF = EĞERORTALAMA ## Verili ölçütü karşılayan bir aralıktaki bütün hücrelerin ortalamasını (aritmetik ortalama) hesaplar.
+AVERAGEIFS = EĞERLERORTALAMA ## Birden çok ölçüte uyan tüm hücrelerin ortalamasını (aritmetik ortalama) hesaplar.
+BETADIST = BETADAĞ ## Beta birikimli dağılım fonksiyonunu verir.
+BETAINV = BETATERS ## Belirli bir beta dağılımı için birikimli dağılım fonksiyonunun tersini verir.
+BINOMDIST = BİNOMDAĞ ## Tek terimli binom dağılımı olasılığını verir.
+CHIDIST = KİKAREDAĞ ## Kikare dağılımın tek kuyruklu olasılığını verir.
+CHIINV = KİKARETERS ## Kikare dağılımın kuyruklu olasılığının tersini verir.
+CHITEST = KİKARETEST ## Bağımsızlık sınamalarını verir.
+CONFIDENCE = GÜVENİRLİK ## Bir popülasyon ortalaması için güvenirlik aralığını verir.
+CORREL = KORELASYON ## İki veri kümesi arasındaki bağlantı katsayısını verir.
+COUNT = BAĞ_DEĞ_SAY ## Bağımsız değişkenler listesinde kaç tane sayı bulunduğunu sayar.
+COUNTA = BAĞ_DEĞ_DOLU_SAY ## Bağımsız değişkenler listesinde kaç tane değer bulunduğunu sayar.
+COUNTBLANK = BOŞLUKSAY ## Aralıktaki boş hücre sayısını hesaplar.
+COUNTIF = EĞERSAY ## Verilen ölçütlere uyan bir aralık içindeki hücreleri sayar.
+COUNTIFS = ÇOKEĞERSAY ## Birden çok ölçüte uyan bir aralık içindeki hücreleri sayar.
+COVAR = KOVARYANS ## Eşleştirilmiş sapmaların ortalaması olan kovaryansı verir.
+CRITBINOM = KRİTİKBİNOM ## Birikimli binom dağılımının bir ölçüt değerinden küçük veya ölçüt değerine eşit olduğu en küçük değeri verir.
+DEVSQ = SAPKARE ## Sapmaların karelerinin toplamını verir.
+EXPONDIST = ÜSTELDAĞ ## Üstel dağılımı verir.
+FDIST = FDAĞ ## F olasılık dağılımını verir.
+FINV = FTERS ## F olasılık dağılımının tersini verir.
+FISHER = FISHER ## Fisher dönüşümünü verir.
+FISHERINV = FISHERTERS ## Fisher dönüşümünün tersini verir.
+FORECAST = TAHMÄ°N ## Bir doÄŸrusal eÄŸilim boyunca bir deÄŸer verir.
+FREQUENCY = SIKLIK ## Bir sıklık dağılımını, dikey bir dizi olarak verir.
+FTEST = FTEST ## Bir F-test'in sonucunu verir.
+GAMMADIST = GAMADAĞ ## Gama dağılımını verir.
+GAMMAINV = GAMATERS ## Gama kümülatif dağılımının tersini verir.
+GAMMALN = GAMALN ## Gama fonksiyonunun (?(x)) doğal logaritmasını verir.
+GEOMEAN = GEOORT ## Geometrik ortayı verir.
+GROWTH = BÃœYÃœME ## Ãœstel bir eÄŸilim boyunca deÄŸerler verir.
+HARMEAN = HARORT ## Harmonik ortayı verir.
+HYPGEOMDIST = HİPERGEOMDAĞ ## Hipergeometrik dağılımı verir.
+INTERCEPT = KESMENOKTASI ## Doğrusal çakıştırma çizgisinin kesişme noktasını verir.
+KURT = BASIKLIK ## Bir veri kümesinin basıklığını verir.
+LARGE = BÜYÜK ## Bir veri kümesinde k. en büyük değeri verir.
+LINEST = DOT ## DoÄŸrusal bir eÄŸilimin parametrelerini verir.
+LOGEST = LOT ## Ãœstel bir eÄŸilimin parametrelerini verir.
+LOGINV = LOGTERS ## Bir lognormal dağılımının tersini verir.
+LOGNORMDIST = LOGNORMDAĞ ## Birikimli lognormal dağılımını verir.
+MAX = MAK ## Bir bağımsız değişkenler listesindeki en büyük değeri verir.
+MAXA = MAKA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri içermek üzere, en büyük değeri verir.
+MEDIAN = ORTANCA ## Belirtilen sayıların orta değerini verir.
+MIN = MİN ## Bir bağımsız değişkenler listesindeki en küçük değeri verir.
+MINA = MİNA ## Bir bağımsız değişkenler listesindeki, sayılar, metin ve mantıksal değerleri de içermek üzere, en küçük değeri verir.
+MODE = ENÇOK_OLAN ## Bir veri kümesindeki en sık rastlanan değeri verir.
+NEGBINOMDIST = NEGBİNOMDAĞ ## Negatif binom dağılımını verir.
+NORMDIST = NORMDAĞ ## Normal birikimli dağılımı verir.
+NORMINV = NORMTERS ## Normal kümülatif dağılımın tersini verir.
+NORMSDIST = NORMSDAĞ ## Standart normal birikimli dağılımı verir.
+NORMSINV = NORMSTERS ## Standart normal birikimli dağılımın tersini verir.
+PEARSON = PEARSON ## Pearson çarpım moment korelasyon katsayısını verir.
+PERCENTILE = YÜZDEBİRLİK ## Bir aralık içerisinde bulunan değerlerin k. frekans toplamını verir.
+PERCENTRANK = YÜZDERANK ## Bir veri kümesindeki bir değerin yüzde mertebesini verir.
+PERMUT = PERMÜTASYON ## Verilen sayıda nesne için permütasyon sayısını verir.
+POISSON = POISSON ## Poisson dağılımını verir.
+PROB = OLASILIK ## Bir aralıktaki değerlerin iki sınır arasında olması olasılığını verir.
+QUARTILE = DÖRTTEBİRLİK ## Bir veri kümesinin dörtte birliğini verir.
+RANK = RANK ## Bir sayılar listesinde bir sayının mertebesini verir.
+RSQ = RKARE ## Pearson çarpım moment korelasyon katsayısının karesini verir.
+SKEW = ÇARPIKLIK ## Bir dağılımın çarpıklığını verir.
+SLOPE = EĞİM ## Doğrusal çakışma çizgisinin eğimini verir.
+SMALL = KÜÇÜK ## Bir veri kümesinde k. en küçük değeri verir.
+STANDARDIZE = STANDARTLAÅžTIRMA ## NormalleÅŸtirilmiÅŸ bir deÄŸer verir.
+STDEV = STDSAPMA ## Bir örneğe dayanarak standart sapmayı tahmin eder.
+STDEVA = STDSAPMAA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder.
+STDEVP = STDSAPMAS ## Standart sapmayı, tüm popülasyona bağlı olarak hesaplar.
+STDEVPA = STDSAPMASA ## Standart sapmayı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar.
+STEYX = STHYX ## Regresyondaki her x için tahmini y değerinin standart hatasını verir.
+TDIST = TDAĞ ## T-dağılımını verir.
+TINV = TTERS ## T-dağılımının tersini verir.
+TREND = EĞİLİM ## Doğrusal bir eğilim boyunca değerler verir.
+TRIMMEAN = KIRPORTALAMA ## Bir veri kümesinin içinin ortalamasını verir.
+TTEST = TTEST ## T-test'le ilişkilendirilmiş olasılığı verir.
+VAR = VAR ## Varyansı, bir örneğe bağlı olarak tahmin eder.
+VARA = VARA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, bir örneğe bağlı olarak tahmin eder.
+VARP = VARS ## Varyansı, tüm popülasyona dayanarak hesaplar.
+VARPA = VARSA ## Varyansı, sayılar, metin ve mantıksal değerleri içermek üzere, tüm popülasyona bağlı olarak hesaplar.
+WEIBULL = WEIBULL ## Weibull dağılımını hesaplar.
+ZTEST = ZTEST ## Z-testinin tek kuyruklu olasılık değerini hesaplar.
+
+
+##
+## Text functions Metin fonksiyonları
+##
+ASC = ASC ## Bir karakter dizesindeki çift enli (iki bayt) İngilizce harfleri veya katakanayı yarım enli (tek bayt) karakterlerle değiştirir.
+BAHTTEXT = BAHTTEXT ## Sayıyı, ß (baht) para birimi biçimini kullanarak metne dönüştürür.
+CHAR = DAMGA ## Kod sayısıyla belirtilen karakteri verir.
+CLEAN = TEMİZ ## Metindeki bütün yazdırılamaz karakterleri kaldırır.
+CODE = KOD ## Bir metin dizesindeki ilk karakter için sayısal bir kod verir.
+CONCATENATE = BİRLEŞTİR ## Pek çok metin öğesini bir metin öğesi olarak birleştirir.
+DOLLAR = LİRA ## Bir sayıyı YTL (yeni Türk lirası) para birimi biçimini kullanarak metne dönüştürür.
+EXACT = ÖZDEŞ ## İki metin değerinin özdeş olup olmadığını anlamak için, değerleri denetler.
+FIND = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır).
+FINDB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlıdır).
+FIXED = SAYIDÜZENLE ## Bir sayıyı, sabit sayıda ondalıkla, metin olarak biçimlendirir.
+JIS = JIS ## Bir karakter dizesindeki tek enli (tek bayt) İngilizce harfleri veya katakanayı çift enli (iki bayt) karakterlerle değiştirir.
+LEFT = SOL ## Bir metin deÄŸerinden en soldaki karakterleri verir.
+LEFTB = SOLB ## Bir metin deÄŸerinden en soldaki karakterleri verir.
+LEN = UZUNLUK ## Bir metin dizesindeki karakter sayısını verir.
+LENB = UZUNLUKB ## Bir metin dizesindeki karakter sayısını verir.
+LOWER = KÜÇÜKHARF ## Metni küçük harfe çevirir.
+MID = ORTA ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir.
+MIDB = ORTAB ## Bir metin dizesinden belirli sayıda karakteri, belirttiğiniz konumdan başlamak üzere verir.
+PHONETIC = SES ## Metin dizesinden ses (furigana) karakterlerini ayıklar.
+PROPER = YAZIM.DÜZENİ ## Bir metin değerinin her bir sözcüğünün ilk harfini büyük harfe çevirir.
+REPLACE = DEĞİŞTİR ## Metnin içindeki karakterleri değiştirir.
+REPLACEB = DEĞİŞTİRB ## Metnin içindeki karakterleri değiştirir.
+REPT = YİNELE ## Metni belirtilen sayıda yineler.
+RIGHT = SAÄž ## Bir metin deÄŸerinden en saÄŸdaki karakterleri verir.
+RIGHTB = SAÄžB ## Bir metin deÄŸerinden en saÄŸdaki karakterleri verir.
+SEARCH = BUL ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir).
+SEARCHB = BULB ## Bir metin değerini, bir başkasının içinde bulur (büyük küçük harf duyarlı değildir).
+SUBSTITUTE = YERÄ°NEKOY ## Bir metin dizesinde, eski metnin yerine yeni metin koyar.
+T = M ## Bağımsız değerlerini metne dönüştürür.
+TEXT = METNEÇEVİR ## Bir sayıyı biçimlendirir ve metne dönüştürür.
+TRIM = KIRP ## Metindeki boşlukları kaldırır.
+UPPER = BÜYÜKHARF ## Metni büyük harfe çevirir.
+VALUE = SAYIYAÇEVİR ## Bir metin bağımsız değişkenini sayıya dönüştürür.
diff --git a/Documentation/Examples/Calculations/Database/DAVERAGE.php b/Documentation/Examples/Calculations/Database/DAVERAGE.php
new file mode 100644
index 0000000..adf4636
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DAVERAGE.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DAVERAGE
+Returns the average of selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height');
+$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
+
+$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard');
+$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DAVERAGE() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DAVERAGE() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DCOUNT.php b/Documentation/Examples/Calculations/Database/DCOUNT.php
new file mode 100644
index 0000000..ece2b1f
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DCOUNT.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DCOUNT
+Counts the cells that contain numbers in a database.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height');
+$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)');
+
+$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard');
+$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:B2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DCOUNT() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DCOUNT() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DGET.php b/Documentation/Examples/Calculations/Database/DGET.php
new file mode 100644
index 0000000..51d7dd6
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DGET.php
@@ -0,0 +1,86 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DGET
+Extracts a single value from a column of a list or database that matches conditions that you specify.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall');
+$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+echo 'ALL' . '
';
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DMAX.php b/Documentation/Examples/Calculations/Database/DMAX.php
new file mode 100644
index 0000000..1a2d22a
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DMAX.php
@@ -0,0 +1,89 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DMAX
+Returns the maximum value from selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The tallest tree in the orchard');
+$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)');
+
+$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
+$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+echo 'ALL' . '
';
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DMIN.php b/Documentation/Examples/Calculations/Database/DMIN.php
new file mode 100644
index 0000000..d6f23a6
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DMIN.php
@@ -0,0 +1,89 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DMIN
+Returns the minimum value from selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The shortest tree in the orchard');
+$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)');
+
+$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard');
+$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+echo 'ALL' . '
';
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DMIN() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DMIN() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DPRODUCT.php b/Documentation/Examples/Calculations/Database/DPRODUCT.php
new file mode 100644
index 0000000..e5e629e
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DPRODUCT.php
@@ -0,0 +1,87 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DPRODUCT
+Multiplies the values in a column of a list or database that match conditions that you specify.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard');
+$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
+
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+echo 'ALL' . '
';
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A2',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DMAX() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DSTDEV.php b/Documentation/Examples/Calculations/Database/DSTDEV.php
new file mode 100644
index 0000000..c26df0e
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DSTDEV.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DSTDEV
+Estimates the standard deviation based on a sample of selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees');
+$worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
+
+$worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees');
+$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DSTDEV() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DSTDEV() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DSTDEVP.php b/Documentation/Examples/Calculations/Database/DSTDEVP.php
new file mode 100644
index 0000000..9b35345
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DSTDEVP.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DSTDEVP
+Calculates the standard deviation based on the entire population of selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees');
+$worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
+
+$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees');
+$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DSTDEVP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DSTDEVP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DVAR.php b/Documentation/Examples/Calculations/Database/DVAR.php
new file mode 100644
index 0000000..e425f77
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DVAR.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DVAR
+Estimates variance based on a sample from selected database entries.
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees');
+$worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)');
+
+$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees');
+$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DVAR() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DVAR() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/Database/DVARP.php b/Documentation/Examples/Calculations/Database/DVARP.php
new file mode 100644
index 0000000..e1cfc8e
--- /dev/null
+++ b/Documentation/Examples/Calculations/Database/DVARP.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DVARP
+Calculates variance based on the entire population of selected database entries,
+getActiveSheet();
+
+// Add some data
+$database = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+ );
+$criteria = array( array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL )
+ );
+
+$worksheet->fromArray( $criteria, NULL, 'A1' );
+$worksheet->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees');
+$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)');
+
+$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees');
+$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)');
+
+
+echo '
';
+
+
+echo 'Database
';
+
+$databaseData = $worksheet->rangeToArray('A4:E10',null,true,true,true);
+var_dump($databaseData);
+
+
+echo '
';
+
+
+// Test the formulae
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A12")->getValue() .'
';
+echo 'DVARP() Result is ' . $worksheet->getCell("B12")->getCalculatedValue() .'
';
+
+echo 'Criteria
';
+
+$criteriaData = $worksheet->rangeToArray('A1:A3',null,true,true,true);
+var_dump($criteriaData);
+
+echo $worksheet->getCell("A13")->getValue() .'
';
+echo 'DVARP() Result is ' . $worksheet->getCell("B13")->getCalculatedValue();
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/DateTime/DATE.php b/Documentation/Examples/Calculations/DateTime/DATE.php
new file mode 100644
index 0000000..979d1f5
--- /dev/null
+++ b/Documentation/Examples/Calculations/DateTime/DATE.php
@@ -0,0 +1,83 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DATE
+Returns the serial number of a particular date.
+getActiveSheet();
+
+// Add some data
+$testDates = array( array(2012,3,26), array(2012,2,29), array(2012,4,1), array(2012,12,25),
+ array(2012,10,31), array(2012,11,5), array(2012,1,1), array(2012,3,17),
+ array(2011,2,29), array(7,5,3), array(2012,13,1), array(2012,11,45),
+ array(2012,0,0), array(2012,1,0), array(2012,0,1),
+ array(2012,-2,2), array(2012,2,-2), array(2012,-2,-2),
+ );
+$testDateCount = count($testDates);
+
+$worksheet->fromArray($testDates,NULL,'A1',true);
+
+for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('D'.$row, '=DATE(A'.$row.',B'.$row.',C'.$row.')');
+ $worksheet->setCellValue('E'.$row, '=D'.$row);
+}
+$worksheet->getStyle('E1:E'.$testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('yyyy-mmm-dd');
+
+
+echo '
';
+
+
+// Test the formulae
+?>
+
+
+ Date Value |
+ Formula |
+ Excel DateStamp |
+ Formatted DateStamp |
+
+
+ Year |
+ Month |
+ Day |
+
+ ';
+ echo '' , $worksheet->getCell('A'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('C'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('D'.$row)->getValue() , ' | ';
+ echo '' , $worksheet->getCell('D'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('E'.$row)->getFormattedValue() , ' | ';
+ echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/DateTime/DATEVALUE.php b/Documentation/Examples/Calculations/DateTime/DATEVALUE.php
new file mode 100644
index 0000000..4d5d8c2
--- /dev/null
+++ b/Documentation/Examples/Calculations/DateTime/DATEVALUE.php
@@ -0,0 +1,76 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+DATEVALUE
+Converts a date in the form of text to a serial number.
+getActiveSheet();
+
+// Add some data
+$testDates = array( '26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012',
+ '2012-Oct-31', '5th November', 'January 1st', 'April 2012',
+ '17-03', '03-2012', '29 Feb 2011', '03-05-07',
+ '03-MAY-07', '03-13-07',
+ );
+$testDateCount = count($testDates);
+
+for($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('A'.$row, $testDates[$row-1]);
+ $worksheet->setCellValue('B'.$row, '=DATEVALUE(A'.$row.')');
+ $worksheet->setCellValue('C'.$row, '=B'.$row);
+}
+
+$worksheet->getStyle('C1:C'.$testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('yyyy-mmm-dd');
+
+
+echo '
';
+
+
+// Test the formulae
+?>
+Warning: The PHPExcel DATEVALUE() function accepts a wider range of date formats than MS Excel's DATEFORMAT() function.
+
+
+ Date String |
+ Formula |
+ Excel DateStamp |
+ Formatted DateStamp |
+
+ ';
+ echo '' , $worksheet->getCell('A'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('C'.$row)->getFormattedValue() , ' | ';
+ echo '';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/DateTime/TIME.php b/Documentation/Examples/Calculations/DateTime/TIME.php
new file mode 100644
index 0000000..f452276
--- /dev/null
+++ b/Documentation/Examples/Calculations/DateTime/TIME.php
@@ -0,0 +1,81 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+TIME
+Returns the serial number of a particular time.
+getActiveSheet();
+
+// Add some data
+$testDates = array( array(3,15), array(13,15), array(15,15,15), array(3,15,30),
+ array(15,15,15), array(5), array(9,15,0), array(9,15,-1),
+ array(13,-14,-15), array(0,0,-1)
+ );
+$testDateCount = count($testDates);
+
+$worksheet->fromArray($testDates,NULL,'A1',true);
+
+for ($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('D'.$row, '=TIME(A'.$row.',B'.$row.',C'.$row.')');
+ $worksheet->setCellValue('E'.$row, '=D'.$row);
+}
+$worksheet->getStyle('E1:E'.$testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('hh:mm:ss');
+
+
+echo '
';
+
+
+// Test the formulae
+?>
+
+
+ Date Value |
+ Formula |
+ Excel TimeStamp |
+ Formatted TimeStamp |
+
+
+ Hour |
+ Minute |
+ Second |
+
+ ';
+ echo '' , $worksheet->getCell('A'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('C'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('D'.$row)->getValue() , ' | ';
+ echo '' , $worksheet->getCell('D'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('E'.$row)->getFormattedValue() , ' | ';
+ echo '
';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/DateTime/TIMEVALUE.php b/Documentation/Examples/Calculations/DateTime/TIMEVALUE.php
new file mode 100644
index 0000000..89e0ba4
--- /dev/null
+++ b/Documentation/Examples/Calculations/DateTime/TIMEVALUE.php
@@ -0,0 +1,72 @@
+
+
+
+
+
+PHPExcel Calculation Examples
+
+
+
+
+TIMEVALUE
+Converts a time in the form of text to a serial number.
+getActiveSheet();
+
+// Add some data
+$testDates = array( '3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM'
+ );
+$testDateCount = count($testDates);
+
+for($row = 1; $row <= $testDateCount; ++$row) {
+ $worksheet->setCellValue('A'.$row, $testDates[$row-1]);
+ $worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')');
+ $worksheet->setCellValue('C'.$row, '=B'.$row);
+}
+
+$worksheet->getStyle('C1:C'.$testDateCount)
+ ->getNumberFormat()
+ ->setFormatCode('hh:mm:ss');
+
+
+echo '
';
+
+
+// Test the formulae
+?>
+
+
+ Time String |
+ Formula |
+ Excel TimeStamp |
+ Formatted TimeStamp |
+
+ ';
+ echo '' , $worksheet->getCell('A'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getValue() , ' | ';
+ echo '' , $worksheet->getCell('B'.$row)->getFormattedValue() , ' | ';
+ echo '' , $worksheet->getCell('C'.$row)->getFormattedValue() , ' | ';
+ echo '';
+ }
+ ?>
+
\ No newline at end of file
diff --git a/Documentation/Examples/Calculations/index.php b/Documentation/Examples/Calculations/index.php
new file mode 100644
index 0000000..f090553
--- /dev/null
+++ b/Documentation/Examples/Calculations/index.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+PHPExcel Calculation Function Examples
+
+
+
+
+PHPExcel Calculation Function Examples';
+
+$exampleTypeList = glob('./*',GLOB_ONLYDIR);
+
+foreach($exampleTypeList as $exampleType) {
+
+ echo '' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples
';
+
+ $exampleList = glob('./'.$exampleType.'/*.php');
+
+ foreach($exampleList as $exampleFile) {
+ $fileData = file_get_contents($exampleFile);
+
+ $h1Pattern = '#(.*?)
#';
+ $h2Pattern = '#(.*?)
#';
+
+ if (preg_match($h1Pattern, $fileData, $out)) {
+ $h1Text = $out[1];
+ $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
+
+ echo '',$h1Text,'
';
+ if ($h2Text > '') {
+ echo $h2Text,'
';
+ }
+ }
+
+ }
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader01.php b/Documentation/Examples/Reader/exampleReader01.php
new file mode 100644
index 0000000..f881af0
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader01.php
@@ -0,0 +1,42 @@
+
+
+
+
+
+PHPExcel Reader Example #01
+
+
+
+
+PHPExcel Reader Example #01
+Simple File Reader using PHPExcel_IOFactory::load()
+';
+$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader02.php b/Documentation/Examples/Reader/exampleReader02.php
new file mode 100644
index 0000000..51b36e5
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader02.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+PHPExcel Reader Example #02
+
+
+
+
+PHPExcel Reader Example #02
+Simple File Reader using a Specified Reader
+';
+$objReader = new PHPExcel_Reader_Excel5();
+// $objReader = new PHPExcel_Reader_Excel2007();
+// $objReader = new PHPExcel_Reader_Excel2003XML();
+// $objReader = new PHPExcel_Reader_OOCalc();
+// $objReader = new PHPExcel_Reader_SYLK();
+// $objReader = new PHPExcel_Reader_Gnumeric();
+// $objReader = new PHPExcel_Reader_CSV();
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader03.php b/Documentation/Examples/Reader/exampleReader03.php
new file mode 100644
index 0000000..1c571d3
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader03.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+PHPExcel Reader Example #03
+
+
+
+
+PHPExcel Reader Example #03
+Simple File Reader using the PHPExcel_IOFactory to Return a Reader
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader04.php b/Documentation/Examples/Reader/exampleReader04.php
new file mode 100644
index 0000000..a18c711
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader04.php
@@ -0,0 +1,47 @@
+
+
+
+
+
+PHPExcel Reader Example #04
+
+
+
+
+PHPExcel Reader Example #04
+Simple File Reader using the PHPExcel_IOFactory to Identify a Reader to Use
+';
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with the identified reader type
';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader05.php b/Documentation/Examples/Reader/exampleReader05.php
new file mode 100644
index 0000000..9bee5b4
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader05.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+PHPExcel Reader Example #05
+
+
+
+
+PHPExcel Reader Example #05
+Simple File Reader using the "Read Data Only" Option
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Turning Formatting off for Load
';
+$objReader->setReadDataOnly(true);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader06.php b/Documentation/Examples/Reader/exampleReader06.php
new file mode 100644
index 0000000..6997a38
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader06.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+PHPExcel Reader Example #06
+
+
+
+
+PHPExcel Reader Example #06
+Simple File Reader Loading All WorkSheets
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Loading all WorkSheets
';
+$objReader->setLoadAllSheets();
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex,' -> ',$loadedSheetName,'
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader07.php b/Documentation/Examples/Reader/exampleReader07.php
new file mode 100644
index 0000000..0d86ea7
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader07.php
@@ -0,0 +1,55 @@
+
+
+
+
+
+PHPExcel Reader Example #07
+
+
+
+
+PHPExcel Reader Example #07
+Simple File Reader Loading a Single Named WorkSheet
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Loading Sheet "',$sheetname,'" only
';
+$objReader->setLoadSheetsOnly($sheetname);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex,' -> ',$loadedSheetName,'
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader08.php b/Documentation/Examples/Reader/exampleReader08.php
new file mode 100644
index 0000000..c6a4460
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader08.php
@@ -0,0 +1,55 @@
+
+
+
+
+
+PHPExcel Reader Example #08
+
+
+
+
+PHPExcel Reader Example #08
+Simple File Reader Loading Several Named WorkSheets
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "',$sheetnames),'" only
';
+$objReader->setLoadSheetsOnly($sheetnames);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo $sheetIndex,' -> ',$loadedSheetName,'
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader09.php b/Documentation/Examples/Reader/exampleReader09.php
new file mode 100644
index 0000000..a6cd144
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader09.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+PHPExcel Reader Example #09
+
+
+
+
+PHPExcel Reader Example #09
+Simple File Reader Using a Read Filter
+= 1 && $row <= 7) {
+ if (in_array($column,range('A','E'))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+$filterSubset = new MyReadFilter();
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Loading Sheet "',$sheetname,'" only
';
+$objReader->setLoadSheetsOnly($sheetname);
+echo 'Loading Sheet using filter
';
+$objReader->setReadFilter($filterSubset);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader10.php b/Documentation/Examples/Reader/exampleReader10.php
new file mode 100644
index 0000000..d608c64
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader10.php
@@ -0,0 +1,82 @@
+
+
+
+
+
+PHPExcel Reader Example #10
+
+
+
+
+PHPExcel Reader Example #10
+Simple File Reader Using a Configurable Read Filter
+_startRow = $startRow;
+ $this->_endRow = $endRow;
+ $this->_columns = $columns;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ if ($row >= $this->_startRow && $row <= $this->_endRow) {
+ if (in_array($column,$this->_columns)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+$filterSubset = new MyReadFilter(9,15,range('G','K'));
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+echo 'Loading Sheet "',$sheetname,'" only
';
+$objReader->setLoadSheetsOnly($sheetname);
+echo 'Loading Sheet using configurable filter
';
+$objReader->setReadFilter($filterSubset);
+$objPHPExcel = $objReader->load($inputFileName);
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader11.php b/Documentation/Examples/Reader/exampleReader11.php
new file mode 100644
index 0000000..becdb63
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader11.php
@@ -0,0 +1,91 @@
+
+
+
+
+
+PHPExcel Reader Example #11
+
+
+
+
+PHPExcel Reader Example #11
+Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 1)
+_startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the heading row, and the rows that were configured in the constructor
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+echo '
';
+
+
+/** Define how many rows we want for each "chunk" **/
+$chunkSize = 20;
+
+/** Loop to read our worksheet in "chunk size" blocks **/
+for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'
';
+ /** Create a new Instance of our Read Filter, passing in the limits on which rows we want to read **/
+ $chunkFilter = new chunkReadFilter($startRow,$chunkSize);
+ /** Tell the Reader that we want to use the new Read Filter that we've just Instantiated **/
+ $objReader->setReadFilter($chunkFilter);
+ /** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
+ $objPHPExcel = $objReader->load($inputFileName);
+
+ // Do some processing here
+
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader12.php b/Documentation/Examples/Reader/exampleReader12.php
new file mode 100644
index 0000000..1df90cd
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader12.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+PHPExcel Reader Example #12
+
+
+
+
+PHPExcel Reader Example #12
+Reading a Workbook in "Chunks" Using a Configurable Read Filter (Version 2)
+_startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+echo '
';
+
+
+/** Define how many rows we want to read for each "chunk" **/
+$chunkSize = 20;
+/** Create a new Instance of our Read Filter **/
+$chunkFilter = new chunkReadFilter();
+
+/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
+$objReader->setReadFilter($chunkFilter);
+
+/** Loop to read our worksheet in "chunk size" blocks **/
+for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'
';
+ /** Tell the Read Filter, the limits on which rows we want to read this iteration **/
+ $chunkFilter->setRows($startRow,$chunkSize);
+ /** Load only the rows that match our filter from $inputFileName to a PHPExcel Object **/
+ $objPHPExcel = $objReader->load($inputFileName);
+
+ // Do some processing here
+
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader13.php b/Documentation/Examples/Reader/exampleReader13.php
new file mode 100644
index 0000000..255501f
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader13.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+PHPExcel Reader Example #13
+
+
+
+
+PHPExcel Reader Example #13
+Simple File Reader for Multiple CSV Files
+';
+$objPHPExcel = $objReader->load($inputFileName);
+$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+foreach($inputFileNames as $sheet => $inputFileName) {
+ echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' into WorkSheet #',($sheet+2),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+ $objReader->setSheetIndex($sheet+1);
+ $objReader->loadIntoExisting($inputFileName,$objPHPExcel);
+ $objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+}
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'
';
+ $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader14.php b/Documentation/Examples/Reader/exampleReader14.php
new file mode 100644
index 0000000..bef1916
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader14.php
@@ -0,0 +1,105 @@
+
+
+
+
+
+PHPExcel Reader Example #15
+
+
+
+
+PHPExcel Reader Example #14
+Reading a Large CSV file in "Chunks" to split across multiple Worksheets
+_startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+echo '
';
+
+
+/** Define how many rows we want to read for each "chunk" **/
+$chunkSize = 100;
+/** Create a new Instance of our Read Filter **/
+$chunkFilter = new chunkReadFilter();
+
+/** Tell the Reader that we want to use the Read Filter that we've Instantiated **/
+/** and that we want to store it in contiguous rows/columns **/
+$objReader->setReadFilter($chunkFilter)
+ ->setContiguous(true);
+
+
+/** Instantiate a new PHPExcel object manually **/
+$objPHPExcel = new PHPExcel();
+
+/** Set a sheet index **/
+$sheet = 0;
+/** Loop to read our worksheet in "chunk size" blocks **/
+/** $startRow is set to 2 initially because we always read the headings in row #1 **/
+for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) {
+ echo 'Loading WorkSheet #',($sheet+1),' using configurable filter for headings row 1 and for rows ',$startRow,' to ',($startRow+$chunkSize-1),'
';
+ /** Tell the Read Filter, the limits on which rows we want to read this iteration **/
+ $chunkFilter->setRows($startRow,$chunkSize);
+
+ /** Increment the worksheet index pointer for the Reader **/
+ $objReader->setSheetIndex($sheet);
+ /** Load only the rows that match our filter into a new worksheet in the PHPExcel Object **/
+ $objReader->loadIntoExisting($inputFileName,$objPHPExcel);
+ /** Set the worksheet title (to reference the "sheet" of data that we've loaded) **/
+ /** and increment the sheet index as well **/
+ $objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet));
+}
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,'
';
+ $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader15.php b/Documentation/Examples/Reader/exampleReader15.php
new file mode 100644
index 0000000..bb68e90
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader15.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+PHPExcel Reader Example #15
+
+
+
+
+PHPExcel Reader Example #15
+Simple File Reader for Tab-Separated Value File using the Advanced Value Binder
+';
+$objReader->setDelimiter("\t");
+$objPHPExcel = $objReader->load($inputFileName);
+$objPHPExcel->getActiveSheet()->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+
+
+echo '
';
+
+echo $objPHPExcel->getSheetCount(),' worksheet',(($objPHPExcel->getSheetCount() == 1) ? '' : 's'),' loaded
';
+$loadedSheetNames = $objPHPExcel->getSheetNames();
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Formatted)
';
+ $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+echo '
';
+
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Unformatted)
';
+ $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,false,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+echo '
';
+
+foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
+ echo 'Worksheet #',$sheetIndex,' -> ',$loadedSheetName,' (Raw)
';
+ $objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
+ $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,false,false,true);
+ var_dump($sheetData);
+ echo '
';
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader16.php b/Documentation/Examples/Reader/exampleReader16.php
new file mode 100644
index 0000000..62d82ea
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader16.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+PHPExcel Reader Example #16
+
+
+
+
+PHPExcel Reader Example #16
+Handling Loader Exceptions using Try/Catch
+';
+try {
+ $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
+} catch(PHPExcel_Reader_Exception $e) {
+ die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
+}
+
+
+echo '
';
+
+$sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+var_dump($sheetData);
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader17.php b/Documentation/Examples/Reader/exampleReader17.php
new file mode 100644
index 0000000..1f77c56
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader17.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+PHPExcel Reader Example #17
+
+
+
+
+PHPExcel Reader Example #17
+Simple File Reader Loading Several Named WorkSheets
+';
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+/** Read the list of Worksheet Names from the Workbook file **/
+echo 'Read the list of Worksheets in the WorkBook
';
+$worksheetNames = $objReader->listWorksheetNames($inputFileName);
+
+echo 'There are ',count($worksheetNames),' worksheet',((count($worksheetNames) == 1) ? '' : 's'),' in the workbook
';
+foreach($worksheetNames as $worksheetName) {
+ echo $worksheetName,'
';
+}
+
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader18.php b/Documentation/Examples/Reader/exampleReader18.php
new file mode 100644
index 0000000..438d886
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader18.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+PHPExcel Reader Example #18
+
+
+
+
+PHPExcel Reader Example #18
+Reading list of WorkSheets without loading entire file
+';
+
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$worksheetNames = $objReader->listWorksheetNames($inputFileName);
+
+echo 'Worksheet Names
';
+echo '';
+foreach ($worksheetNames as $worksheetName) {
+ echo '- ', $worksheetName, '
';
+}
+echo '
';
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/exampleReader19.php b/Documentation/Examples/Reader/exampleReader19.php
new file mode 100644
index 0000000..2f3eaaf
--- /dev/null
+++ b/Documentation/Examples/Reader/exampleReader19.php
@@ -0,0 +1,53 @@
+
+
+
+
+
+PHPExcel Reader Example #19
+
+
+
+
+PHPExcel Reader Example #19
+Reading WorkSheet information without loading entire file
+';
+
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$worksheetData = $objReader->listWorksheetInfo($inputFileName);
+
+echo 'Worksheet Information
';
+echo '';
+foreach ($worksheetData as $worksheet) {
+ echo '- ', $worksheet['worksheetName'], '
';
+ echo 'Rows: ', $worksheet['totalRows'], ' Columns: ', $worksheet['totalColumns'], '
';
+ echo 'Cell Range: A1:', $worksheet['lastColumnLetter'], $worksheet['totalRows'];
+ echo ' ';
+}
+echo '
';
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/sampleData/example1.csv b/Documentation/Examples/Reader/sampleData/example1.csv
new file mode 100644
index 0000000..6344d9f
--- /dev/null
+++ b/Documentation/Examples/Reader/sampleData/example1.csv
@@ -0,0 +1,4 @@
+First Name,Last Name,Nationality,Gender,Date of Birth,Time of Birth,Date/Time,PHP Coder,Sanity %Age
+Mark,Baker,British,M,19-Dec-1960,01:30,=E2+F2,TRUE,32%
+Toni,Baker,British,F,24-Nov-1950,20:00,=E3+F3,FALSE,95%
+Rachel,Baker,British,F,7-Dec-1982,00:15,=E4+F4,FALSE,100%
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/sampleData/example1.tsv b/Documentation/Examples/Reader/sampleData/example1.tsv
new file mode 100644
index 0000000..35de476
--- /dev/null
+++ b/Documentation/Examples/Reader/sampleData/example1.tsv
@@ -0,0 +1,4 @@
+First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age
+Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32%
+Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95%
+Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100%
\ No newline at end of file
diff --git a/Documentation/Examples/Reader/sampleData/example1.xls b/Documentation/Examples/Reader/sampleData/example1.xls
new file mode 100644
index 0000000..bd9bb11
Binary files /dev/null and b/Documentation/Examples/Reader/sampleData/example1.xls differ
diff --git a/Documentation/Examples/Reader/sampleData/example2.csv b/Documentation/Examples/Reader/sampleData/example2.csv
new file mode 100644
index 0000000..3f5e998
--- /dev/null
+++ b/Documentation/Examples/Reader/sampleData/example2.csv
@@ -0,0 +1,223 @@
+"City","Country","Latitude","Longitude"
+"Kabul","Afghanistan",34.528455,69.171703
+"Tirane","Albania",41.33,19.82
+"Algiers","Algeria",36.752887,3.042048
+"Pago Pago","American Samoa",-14.27933,-170.700897
+"Andorra la Vella","Andorra",42.507531,1.521816
+"Luanda","Angola",-8.838333,13.234444
+"Buenos Aires","Argentina",-34.608417,-58.373161
+"Yerevan","Armenia",40.183333,44.516667
+"Oranjestad","Aruba",12.52458,-70.026459
+"Canberra","Australia",-35.3075,149.124417
+"Vienna","Austria",48.208333,16.373056
+"Baku","Azerbaijan",40.379571,49.891233
+"Nassau","Bahamas",25.06,-77.345
+"Manama","Bahrain",26.216667,50.583333
+"Dhaka","Bangladesh",23.709921,90.407143
+"Bridgetown","Barbados",13.096111,-59.608333
+"Minsk","Belarus",53.9,27.566667
+"Brussels","Belgium",50.846281,4.354727
+"Belmopan","Belize",17.251389,-88.766944
+"Thimphu","Bhutan",27.466667,89.641667
+"La Paz","Bolivia",-16.49901,-68.146248
+"Sarajevo","Bosnia and Herzegovina",43.8476,18.3564
+"Gaborone","Botswana",-24.65411,25.908739
+"Brasilia","Brazil",-15.780148,-47.92917
+"Road Town","British Virgin Islands",18.433333,-64.616667
+"Bandar Seri Begawan","Brunei Darussalam",4.9431,114.9425
+"Sofia","Bulgaria",42.697626,23.322284
+"Ouagadougou","Burkina Faso",12.364637,-1.533864
+"Bujumbura","Burundi",-3.361378,29.359878
+"Phnom Penh","Cambodia",11.55,104.916667
+"Yaounde","Cameroon",3.866667,11.516667
+"Ottawa","Canada",45.423494,-75.697933
+"Praia","Cape Verde",14.920833,-23.508333
+"George Town","Cayman Islands",19.286932,-81.367439
+"Bangui","Central African Republic",4.361698,18.555975
+"N'Djamena","Chad",12.104797,15.044506
+"Santiago","Chile",-33.42536,-70.566466
+"Beijing","China",39.904667,116.408198
+"Bogota","Colombia",4.647302,-74.096268
+"Moroni","Comoros",-11.717216,43.247315
+"Brazzaville","Congo",-4.266667,15.283333
+"San Jose","Costa Rica",9.933333,-84.083333
+"Yamoussoukro","Cote d'Ivoire",6.816667,-5.283333
+"Zagreb","Croatia",45.814912,15.978515
+"Havana","Cuba",23.133333,-82.366667
+"Nicosia","Cyprus",35.166667,33.366667
+"Prague","Czech Republic",50.087811,14.42046
+"Kinshasa","Congo",-4.325,15.322222
+"Copenhagen","Denmark",55.676294,12.568116
+"Djibouti","Djibouti",11.588,43.145
+"Roseau","Dominica",15.301389,-61.388333
+"Santo Domingo","Dominican Republic",18.5,-69.983333
+"Dili","East Timor",-8.566667,125.566667
+"Quito","Ecuador",-0.229498,-78.524277
+"Cairo","Egypt",30.064742,31.249509
+"San Salvador","El Salvador",13.69,-89.190003
+"Malabo","Equatorial Guinea",3.75,8.783333
+"Asmara","Eritrea",15.33236,38.92617
+"Tallinn","Estonia",59.438862,24.754472
+"Addis Ababa","Ethiopia",9.022736,38.746799
+"Stanley","Falkland Islands",-51.700981,-57.84919
+"Torshavn","Faroe Islands",62.017707,-6.771879
+"Suva","Fiji",-18.1416,178.4419
+"Helsinki","Finland",60.169813,24.93824
+"Paris","France",48.856667,2.350987
+"Cayenne","French Guiana",4.9227,-52.3269
+"Papeete","French Polynesia",-17.535021,-149.569595
+"Libreville","Gabon",0.390841,9.453644
+"Banjul","Gambia",13.453056,-16.5775
+"T'bilisi","Georgia",41.716667,44.783333
+"Berlin","Germany",52.523405,13.4114
+"Accra","Ghana",5.555717,-0.196306
+"Athens","Greece",37.97918,23.716647
+"Nuuk","Greenland",64.18362,-51.721407
+"Basse-Terre","Guadeloupe",15.998503,-61.72202
+"Guatemala","Guatemala",14.641389,-90.513056
+"St. Peter Port","Guernsey",49.458858,-2.534752
+"Conakry","Guinea",9.537029,-13.67847
+"Bissau","Guinea-Bissau",11.866667,-15.6
+"Georgetown","Guyana",6.804611,-58.154831
+"Port-au-Prince","Haiti",18.539269,-72.336408
+"Tegucigalpa","Honduras",14.082054,-87.206285
+"Budapest","Hungary",47.498406,19.040758
+"Reykjavik","Iceland",64.135338,-21.89521
+"New Delhi","India",28.635308,77.22496
+"Jakarta","Indonesia",-6.211544,106.845172
+"Tehran","Iran",35.696216,51.422945
+"Baghdad","Iraq",33.3157,44.3922
+"Dublin","Ireland",53.344104,-6.267494
+"Jerusalem","Israel",31.7857,35.2007
+"Rome","Italy",41.895466,12.482324
+"Kingston","Jamaica",17.992731,-76.792009
+"St. Helier","Jersey",49.190278,-2.108611
+"Amman","Jordan",31.956578,35.945695
+"Astana","Kazakhstan",51.10,71.30
+"Nairobi","Kenya",-01.17,36.48
+"Tarawa","Kiribati",01.30,173.00
+"Seoul","South Korea",37.31,126.58
+"Kuwait City","Kuwait",29.30,48.00
+"Bishkek","Kyrgyzstan",42.54,74.46
+"Riga","Latvia",56.53,24.08
+"Beirut","Lebanon",33.53,35.31
+"Maseru","Lesotho",-29.18,27.30
+"Monrovia","Liberia",06.18,-10.47
+"Vaduz","Liechtenstein",47.08,09.31
+"Vilnius","Lithuania",54.38,25.19
+"Luxembourg","Luxembourg",49.37,06.09
+"Antananarivo","Madagascar",-18.55,47.31
+"Lilongwe","Malawi",-14.00,33.48
+"Kuala Lumpur","Malaysia",03.09,101.41
+"Male","Maldives",04.00,73.28
+"Bamako","Mali",12.34,-07.55
+"Valletta","Malta",35.54,14.31
+"Fort-de-France","Martinique",14.36,-61.02
+"Nouakchott","Mauritania",-20.10,57.30
+"Mamoudzou","Mayotte",-12.48,45.14
+"Mexico City","Mexico",19.20,-99.10
+"Palikir","Micronesia",06.55,158.09
+"Chisinau","Moldova",47.02,28.50
+"Maputo","Mozambique",-25.58,32.32
+"Yangon","Myanmar",16.45,96.20
+"Windhoek","Namibia",-22.35,17.04
+"Kathmandu","Nepal",27.45,85.20
+"Amsterdam","Netherlands",52.23,04.54
+"Willemstad","Netherlands Antilles",12.05,-69.00
+"Noumea","New Caledonia",-22.17,166.30
+"Wellington","New Zealand",-41.19,174.46
+"Managua","Nicaragua",12.06,-86.20
+"Niamey","Niger",13.27,02.06
+"Abuja","Nigeria",09.05,07.32
+"Kingston","Norfolk Island",-45.20,168.43
+"Saipan","Northern Mariana Islands",15.12,145.45
+"Oslo","Norway",59.55,10.45
+"Masqat","Oman",23.37,58.36
+"Islamabad","Pakistan",33.40,73.10
+"Koror","Palau",07.20,134.28
+"Panama City","Panama",09.00,-79.25
+"Port Moresby","Papua New Guinea",-09.24,147.08
+"Asuncion","Paraguay",-25.10,-57.30
+"Lima","Peru",-12.00,-77.00
+"Manila","Philippines",14.40,121.03
+"Warsaw","Poland",52.13,21.00
+"Lisbon","Portugal",38.42,-09.10
+"San Juan","Puerto Rico",18.28,-66.07
+"Doha","Qatar",25.15,51.35
+"Bucuresti","Romania",44.27,26.10
+"Moskva","Russian Federation",55.45,37.35
+"Kigali","Rawanda",-01.59,30.04
+"Basseterre","Saint Kitts and Nevis",17.17,-62.43
+"Castries","Saint Lucia",14.02,-60.58
+"Saint-Pierre","Saint Pierre and Miquelon",46.46,-56.12
+"Apia","Samoa",-13.50,-171.50
+"San Marino","San Marino",43.55,12.30
+"Sao Tome","Sao Tome and Principe",00.10,06.39
+"Riyadh","Saudi Arabia",24.41,46.42
+"Dakar","Senegal",14.34,-17.29
+"Freetown","Sierra Leone",08.30,-13.17
+"Bratislava","Slovakia",48.10,17.07
+"Ljubljana","Slovenia",46.04,14.33
+"Honiara","Solomon Islands",-09.27,159.57
+"Mogadishu","Somalia",02.02,45.25
+"Pretoria","South Africa",-25.44,28.12
+"Madrid","Spain",40.25,-03.45
+"Khartoum","Sudan",15.31,32.35
+"Paramaribo","Suriname",05.50,-55.10
+"Mbabane","Swaziland",-26.18,31.06
+"Stockholm","Sweden",59.20,18.03
+"Bern","Switzerland",46.57,07.28
+"Damascus","Syrian Arab Republic",33.30,36.18
+"Dushanbe","Tajikistan",38.33,68.48
+"Bangkok","Thailand",13.45,100.35
+"Lome","Togo",06.09,01.20
+"Nuku'alofa","Tonga",-21.10,-174.00
+"Tunis","Tunisia",36.50,10.11
+"Ankara","Turkey",39.57,32.54
+"Ashgabat","Turkmenistan",38.00,57.50
+"Funafuti","Tuvalu",-08.31,179.13
+"Kampala","Uganda",00.20,32.30
+"Kiev","Ukraine",50.30,30.28
+"Abu Dhabi","United Arab Emirates",24.28,54.22
+"London","United Kingdom",51.36,-00.05
+"Dodoma","Tanzania",-06.08,35.45
+"Washington DC","United States of America",39.91,-77.02
+"Montevideo","Uruguay",-34.50,-56.11
+"Tashkent","Uzbekistan",41.20,69.10
+"Port-Vila","Vanuatu",-17.45,168.18
+"Caracas","Venezuela",10.30,-66.55
+"Hanoi","Viet Nam",21.05,105.55
+"Belgrade","Yugoslavia",44.50,20.37
+"Lusaka","Zambia",-15.28,28.16
+"Harare","Zimbabwe",-17.43,31.02
+"St. John's","Antigua and Barbuda",17.08,-61.50
+"Porto Novo","Benin",06.30,02.47
+"Hamilton","Bermuda"","32.18,-64.48
+"Avarua","Cook Islands",-21.12,-159.46
+"St. George's","Grenada",12.04,-61.44
+"Agaña","Guam",13.28,144.45
+"Victoria","Hong Kong",22.16,114.13
+"Tokyo","Japan",35.40,139.45
+"Pyongyang","North Korea",39.00,125.47
+"Vientiane","Laos",17.59,102.38
+"Tripoli","Libya",32.54,013.11
+"Skopje","Macedonia",42.00,021.28
+"Majuro","Marshall Islands",07.05,171.08
+"Port Louis","Mauritius",-20.10,57.30
+"Monaco","Monaco",43.44,007.25
+"Ulan Bator","Mongolia",47.54,106.52
+"Plymouth","Montserrat",16.44,-62.14
+"Rabat","Morocco",34.02,-06.51
+"Alofi","Niue",-14.27,-178.05
+"Saint-Denis","Réunion",-20.52,55.27
+"Victoria","Seychelles",-04.38,55.28
+"Singapore","Singapore",01.18,103.50
+"Colombo","Sri Lanka",06.55,79.52
+"Kingstown","St Vincent and the Grenadines",13.12,-61.14
+"Taipei","Taiwan",25.50,121.32
+"Port-of-Spain","Trinidad and Tobago",10.38,-61.31
+"Cockburn Harbour","Turks and Caicos Islands",21.30,-71.30
+"Charlotte Amalie","US Virgin Islands",18.22,-64.56
+"Vatican City","Vatican State",41.54,12.27
+"Laàyoune","Western Sahara",27.10,-13.11
+"San'a","Yemen",15.24,44.14
diff --git a/Documentation/Examples/Reader/sampleData/example2.xls b/Documentation/Examples/Reader/sampleData/example2.xls
new file mode 100644
index 0000000..dd213ab
Binary files /dev/null and b/Documentation/Examples/Reader/sampleData/example2.xls differ
diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
new file mode 100644
index 0000000..4f8dfdf
--- /dev/null
+++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader01.php
@@ -0,0 +1,93 @@
+
+
+
+
+
+PHPExcel Reading WorkBook Data Example #01
+
+
+
+
+PHPExcel Reading WorkBook Data Example #01
+Read the WorkBook Properties
+load($inputFileName);
+
+
+echo '
';
+
+/** Read the document's creator property **/
+$creator = $objPHPExcel->getProperties()->getCreator();
+echo 'Document Creator: ',$creator,'
';
+
+/** Read the Date when the workbook was created (as a PHP timestamp value) **/
+$creationDatestamp = $objPHPExcel->getProperties()->getCreated();
+/** Format the date and time using the standard PHP date() function **/
+$creationDate = date('l, d<\s\up>S\s\up> F Y',$creationDatestamp);
+$creationTime = date('g:i A',$creationDatestamp);
+echo 'Created On: ',$creationDate,' at ',$creationTime,'
';
+
+/** Read the name of the last person to modify this workbook **/
+$modifiedBy = $objPHPExcel->getProperties()->getLastModifiedBy();
+echo 'Last Modified By: ',$modifiedBy,'
';
+
+/** Read the Date when the workbook was last modified (as a PHP timestamp value) **/
+$modifiedDatestamp = $objPHPExcel->getProperties()->getModified();
+/** Format the date and time using the standard PHP date() function **/
+$modifiedDate = date('l, d<\s\up>S\s\up> F Y',$modifiedDatestamp);
+$modifiedTime = date('g:i A',$modifiedDatestamp);
+echo 'Last Modified On: ',$modifiedDate,' at ',$modifiedTime,'
';
+
+/** Read the workbook title property **/
+$workbookTitle = $objPHPExcel->getProperties()->getTitle();
+echo 'Title: ',$workbookTitle,'
';
+
+/** Read the workbook description property **/
+$description = $objPHPExcel->getProperties()->getDescription();
+echo 'Description: ',$description,'
';
+
+/** Read the workbook subject property **/
+$subject = $objPHPExcel->getProperties()->getSubject();
+echo 'Subject: ',$subject,'
';
+
+/** Read the workbook keywords property **/
+$keywords = $objPHPExcel->getProperties()->getKeywords();
+echo 'Keywords: ',$keywords,'
';
+
+/** Read the workbook category property **/
+$category = $objPHPExcel->getProperties()->getCategory();
+echo 'Category: ',$category,'
';
+
+/** Read the workbook company property **/
+$company = $objPHPExcel->getProperties()->getCompany();
+echo 'Company: ',$company,'
';
+
+/** Read the workbook manager property **/
+$manager = $objPHPExcel->getProperties()->getManager();
+echo 'Manager: ',$manager,'
';
+
+
+?>
+
+
diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
new file mode 100644
index 0000000..b8c359d
--- /dev/null
+++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader02.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+PHPExcel Reading WorkBook Data Example #02
+
+
+
+
+PHPExcel Reading WorkBook Data Example #02
+Read a list of Custom Properties for a WorkBook
+load($inputFileName);
+
+
+echo '
';
+
+/** Read an array list of any custom properties for this document **/
+$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties();
+
+echo 'Custom Property names:
';
+foreach($customPropertyList as $customPropertyName) {
+ echo $customPropertyName,'
';
+}
+
+
+
+?>
+
+
diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
new file mode 100644
index 0000000..8fb350d
--- /dev/null
+++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader03.php
@@ -0,0 +1,80 @@
+
+
+
+
+
+PHPExcel Reading WorkBook Data Example #03
+
+
+
+
+PHPExcel Reading WorkBook Data Example #03
+Read Custom Property Values for a WorkBook
+load($inputFileName);
+
+
+echo '
';
+
+/** Read an array list of any custom properties for this document **/
+$customPropertyList = $objPHPExcel->getProperties()->getCustomProperties();
+
+echo 'Custom Properties:
';
+/** Loop through the list of custom properties **/
+foreach($customPropertyList as $customPropertyName) {
+ echo '',$customPropertyName,': ';
+ /** Retrieve the property value **/
+ $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customPropertyName);
+ /** Retrieve the property type **/
+ $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customPropertyName);
+
+ /** Manipulate properties as appropriate for display purposes **/
+ switch($propertyType) {
+ case 'i' : // integer
+ $propertyType = 'integer number';
+ break;
+ case 'f' : // float
+ $propertyType = 'floating point number';
+ break;
+ case 's' : // string
+ $propertyType = 'string';
+ break;
+ case 'd' : // date
+ $propertyValue = date('l, d<\s\up>S\s\up> F Y g:i A',$propertyValue);
+ $propertyType = 'date';
+ break;
+ case 'b' : // boolean
+ $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE';
+ $propertyType = 'boolean';
+ break;
+ }
+
+ echo $propertyValue,' (',$propertyType,')
';
+}
+
+
+
+?>
+
+
diff --git a/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
new file mode 100644
index 0000000..05ff637
--- /dev/null
+++ b/Documentation/Examples/Reading WorkBook Data/exampleWorkBookReader04.php
@@ -0,0 +1,55 @@
+
+
+
+
+
+PHPExcel Reading WorkBook Data Example #04
+
+
+
+
+PHPExcel Reading WorkBook Data Example #04
+Get a List of the Worksheets in a WorkBook
+load($inputFileName);
+
+
+echo '
';
+
+echo 'Reading the number of Worksheets in the WorkBook
';
+/** Use the PHPExcel object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook */
+$sheetCount = $objPHPExcel->getSheetCount();
+echo 'There ',(($sheetCount == 1) ? 'is' : 'are'),' ',$sheetCount,' WorkSheet',(($sheetCount == 1) ? '' : 's'),' in the WorkBook
';
+
+echo 'Reading the names of Worksheets in the WorkBook
';
+/** Use the PHPExcel object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook */
+$sheetNames = $objPHPExcel->getSheetNames();
+foreach($sheetNames as $sheetIndex => $sheetName) {
+ echo 'WorkSheet #',$sheetIndex,' is named "',$sheetName,'"
';
+}
+
+
+?>
+
+
diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls
new file mode 100644
index 0000000..0db0efd
Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xls differ
diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx
new file mode 100644
index 0000000..2224dd4
Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example1.xlsx differ
diff --git a/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls b/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls
new file mode 100644
index 0000000..18bfcf4
Binary files /dev/null and b/Documentation/Examples/Reading WorkBook Data/sampleData/example2.xls differ
diff --git a/Documentation/Examples/index.php b/Documentation/Examples/index.php
new file mode 100644
index 0000000..f657a7a
--- /dev/null
+++ b/Documentation/Examples/index.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+PHPExcel Examples
+
+
+
+
+PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples';
+
+ $exampleList = glob('./'.$exampleType.'/*.php');
+
+ foreach($exampleList as $exampleFile) {
+ $fileData = file_get_contents($exampleFile);
+
+ $h1Pattern = '#(.*?)
#';
+ $h2Pattern = '#(.*?)
#';
+
+ if (preg_match($h1Pattern, $fileData, $out)) {
+ $h1Text = $out[1];
+ $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
+
+ echo '',$h1Text,'
';
+ if (($h2Text > '') &&
+ (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) {
+ echo $h2Text,'
';
+ }
+ }
+
+ }
+}
+
+?>
+
+
\ No newline at end of file
diff --git a/Documentation/FunctionListByCategory.txt b/Documentation/FunctionListByCategory.txt
new file mode 100644
index 0000000..b23d9a1
--- /dev/null
+++ b/Documentation/FunctionListByCategory.txt
@@ -0,0 +1,377 @@
+CATEGORY_CUBE
+ CUBEKPIMEMBER *** Not yet Implemented
+ CUBEMEMBER *** Not yet Implemented
+ CUBEMEMBERPROPERTY *** Not yet Implemented
+ CUBERANKEDMEMBER *** Not yet Implemented
+ CUBESET *** Not yet Implemented
+ CUBESETCOUNT *** Not yet Implemented
+ CUBEVALUE *** Not yet Implemented
+
+CATEGORY_DATABASE
+ DAVERAGE PHPExcel_Calculation_Database::DAVERAGE
+ DCOUNT PHPExcel_Calculation_Database::DCOUNT
+ DCOUNTA PHPExcel_Calculation_Database::DCOUNTA
+ DGET PHPExcel_Calculation_Database::DGET
+ DMAX PHPExcel_Calculation_Database::DMAX
+ DMIN PHPExcel_Calculation_Database::DMIN
+ DPRODUCT PHPExcel_Calculation_Database::DPRODUCT
+ DSTDEV PHPExcel_Calculation_Database::DSTDEV
+ DSTDEVP PHPExcel_Calculation_Database::DSTDEVP
+ DSUM PHPExcel_Calculation_Database::DSUM
+ DVAR PHPExcel_Calculation_Database::DVAR
+ DVARP PHPExcel_Calculation_Database::DVARP
+
+CATEGORY_DATE_AND_TIME
+ DATE PHPExcel_Calculation_DateTime::DATE
+ DATEDIF PHPExcel_Calculation_DateTime::DATEDIF
+ DATEVALUE PHPExcel_Calculation_DateTime::DATEVALUE
+ DAY PHPExcel_Calculation_DateTime::DAYOFMONTH
+ DAYS360 PHPExcel_Calculation_DateTime::DAYS360
+ EDATE PHPExcel_Calculation_DateTime::EDATE
+ EOMONTH PHPExcel_Calculation_DateTime::EOMONTH
+ HOUR PHPExcel_Calculation_DateTime::HOUROFDAY
+ MINUTE PHPExcel_Calculation_DateTime::MINUTEOFHOUR
+ MONTH PHPExcel_Calculation_DateTime::MONTHOFYEAR
+ NETWORKDAYS PHPExcel_Calculation_DateTime::NETWORKDAYS
+ NOW PHPExcel_Calculation_DateTime::DATETIMENOW
+ SECOND PHPExcel_Calculation_DateTime::SECONDOFMINUTE
+ TIME PHPExcel_Calculation_DateTime::TIME
+ TIMEVALUE PHPExcel_Calculation_DateTime::TIMEVALUE
+ TODAY PHPExcel_Calculation_DateTime::DATENOW
+ WEEKDAY PHPExcel_Calculation_DateTime::DAYOFWEEK
+ WEEKNUM PHPExcel_Calculation_DateTime::WEEKOFYEAR
+ WORKDAY PHPExcel_Calculation_DateTime::WORKDAY
+ YEAR PHPExcel_Calculation_DateTime::YEAR
+ YEARFRAC PHPExcel_Calculation_DateTime::YEARFRAC
+
+CATEGORY_ENGINEERING
+ BESSELI PHPExcel_Calculation_Engineering::BESSELI
+ BESSELJ PHPExcel_Calculation_Engineering::BESSELJ
+ BESSELK PHPExcel_Calculation_Engineering::BESSELK
+ BESSELY PHPExcel_Calculation_Engineering::BESSELY
+ BIN2DEC PHPExcel_Calculation_Engineering::BINTODEC
+ BIN2HEX PHPExcel_Calculation_Engineering::BINTOHEX
+ BIN2OCT PHPExcel_Calculation_Engineering::BINTOOCT
+ COMPLEX PHPExcel_Calculation_Engineering::COMPLEX
+ CONVERT PHPExcel_Calculation_Engineering::CONVERTUOM
+ DEC2BIN PHPExcel_Calculation_Engineering::DECTOBIN
+ DEC2HEX PHPExcel_Calculation_Engineering::DECTOHEX
+ DEC2OCT PHPExcel_Calculation_Engineering::DECTOOCT
+ DELTA PHPExcel_Calculation_Engineering::DELTA
+ ERF PHPExcel_Calculation_Engineering::ERF
+ ERFC PHPExcel_Calculation_Engineering::ERFC
+ GESTEP PHPExcel_Calculation_Engineering::GESTEP
+ HEX2BIN PHPExcel_Calculation_Engineering::HEXTOBIN
+ HEX2DEC PHPExcel_Calculation_Engineering::HEXTODEC
+ HEX2OCT PHPExcel_Calculation_Engineering::HEXTOOCT
+ IMABS PHPExcel_Calculation_Engineering::IMABS
+ IMAGINARY PHPExcel_Calculation_Engineering::IMAGINARY
+ IMARGUMENT PHPExcel_Calculation_Engineering::IMARGUMENT
+ IMCONJUGATE PHPExcel_Calculation_Engineering::IMCONJUGATE
+ IMCOS PHPExcel_Calculation_Engineering::IMCOS
+ IMDIV PHPExcel_Calculation_Engineering::IMDIV
+ IMEXP PHPExcel_Calculation_Engineering::IMEXP
+ IMLN PHPExcel_Calculation_Engineering::IMLN
+ IMLOG10 PHPExcel_Calculation_Engineering::IMLOG10
+ IMLOG2 PHPExcel_Calculation_Engineering::IMLOG2
+ IMPOWER PHPExcel_Calculation_Engineering::IMPOWER
+ IMPRODUCT PHPExcel_Calculation_Engineering::IMPRODUCT
+ IMREAL PHPExcel_Calculation_Engineering::IMREAL
+ IMSIN PHPExcel_Calculation_Engineering::IMSIN
+ IMSQRT PHPExcel_Calculation_Engineering::IMSQRT
+ IMSUB PHPExcel_Calculation_Engineering::IMSUB
+ IMSUM PHPExcel_Calculation_Engineering::IMSUM
+ OCT2BIN PHPExcel_Calculation_Engineering::OCTTOBIN
+ OCT2DEC PHPExcel_Calculation_Engineering::OCTTODEC
+ OCT2HEX PHPExcel_Calculation_Engineering::OCTTOHEX
+
+CATEGORY_FINANCIAL
+ ACCRINT PHPExcel_Calculation_Financial::ACCRINT
+ ACCRINTM PHPExcel_Calculation_Financial::ACCRINTM
+ AMORDEGRC PHPExcel_Calculation_Financial::AMORDEGRC
+ AMORLINC PHPExcel_Calculation_Financial::AMORLINC
+ COUPDAYBS PHPExcel_Calculation_Financial::COUPDAYBS
+ COUPDAYS PHPExcel_Calculation_Financial::COUPDAYS
+ COUPDAYSNC PHPExcel_Calculation_Financial::COUPDAYSNC
+ COUPNCD PHPExcel_Calculation_Financial::COUPNCD
+ COUPNUM PHPExcel_Calculation_Financial::COUPNUM
+ COUPPCD PHPExcel_Calculation_Financial::COUPPCD
+ CUMIPMT PHPExcel_Calculation_Financial::CUMIPMT
+ CUMPRINC PHPExcel_Calculation_Financial::CUMPRINC
+ DB PHPExcel_Calculation_Financial::DB
+ DDB PHPExcel_Calculation_Financial::DDB
+ DISC PHPExcel_Calculation_Financial::DISC
+ DOLLARDE PHPExcel_Calculation_Financial::DOLLARDE
+ DOLLARFR PHPExcel_Calculation_Financial::DOLLARFR
+ DURATION *** Not yet Implemented
+ EFFECT PHPExcel_Calculation_Financial::EFFECT
+ FV PHPExcel_Calculation_Financial::FV
+ FVSCHEDULE PHPExcel_Calculation_Financial::FVSCHEDULE
+ INTRATE PHPExcel_Calculation_Financial::INTRATE
+ IPMT PHPExcel_Calculation_Financial::IPMT
+ IRR PHPExcel_Calculation_Financial::IRR
+ ISPMT PHPExcel_Calculation_Financial::ISPMT
+ MDURATION *** Not yet Implemented
+ MIRR PHPExcel_Calculation_Financial::MIRR
+ NOMINAL PHPExcel_Calculation_Financial::NOMINAL
+ NPER PHPExcel_Calculation_Financial::NPER
+ NPV PHPExcel_Calculation_Financial::NPV
+ ODDFPRICE *** Not yet Implemented
+ ODDFYIELD *** Not yet Implemented
+ ODDLPRICE *** Not yet Implemented
+ ODDLYIELD *** Not yet Implemented
+ PMT PHPExcel_Calculation_Financial::PMT
+ PPMT PHPExcel_Calculation_Financial::PPMT
+ PRICE PHPExcel_Calculation_Financial::PRICE
+ PRICEDISC PHPExcel_Calculation_Financial::PRICEDISC
+ PRICEMAT PHPExcel_Calculation_Financial::PRICEMAT
+ PV PHPExcel_Calculation_Financial::PV
+ RATE PHPExcel_Calculation_Financial::RATE
+ RECEIVED PHPExcel_Calculation_Financial::RECEIVED
+ SLN PHPExcel_Calculation_Financial::SLN
+ SYD PHPExcel_Calculation_Financial::SYD
+ TBILLEQ PHPExcel_Calculation_Financial::TBILLEQ
+ TBILLPRICE PHPExcel_Calculation_Financial::TBILLPRICE
+ TBILLYIELD PHPExcel_Calculation_Financial::TBILLYIELD
+ USDOLLAR *** Not yet Implemented
+ VDB *** Not yet Implemented
+ XIRR PHPExcel_Calculation_Financial::XIRR
+ XNPV PHPExcel_Calculation_Financial::XNPV
+ YIELD *** Not yet Implemented
+ YIELDDISC PHPExcel_Calculation_Financial::YIELDDISC
+ YIELDMAT PHPExcel_Calculation_Financial::YIELDMAT
+
+CATEGORY_INFORMATION
+ CELL *** Not yet Implemented
+ ERROR.TYPE PHPExcel_Calculation_Functions::ERROR_TYPE
+ INFO *** Not yet Implemented
+ ISBLANK PHPExcel_Calculation_Functions::IS_BLANK
+ ISERR PHPExcel_Calculation_Functions::IS_ERR
+ ISERROR PHPExcel_Calculation_Functions::IS_ERROR
+ ISEVEN PHPExcel_Calculation_Functions::IS_EVEN
+ ISLOGICAL PHPExcel_Calculation_Functions::IS_LOGICAL
+ ISNA PHPExcel_Calculation_Functions::IS_NA
+ ISNONTEXT PHPExcel_Calculation_Functions::IS_NONTEXT
+ ISNUMBER PHPExcel_Calculation_Functions::IS_NUMBER
+ ISODD PHPExcel_Calculation_Functions::IS_ODD
+ ISREF *** Not yet Implemented
+ ISTEXT PHPExcel_Calculation_Functions::IS_TEXT
+ N PHPExcel_Calculation_Functions::N
+ NA PHPExcel_Calculation_Functions::NA
+ TYPE PHPExcel_Calculation_Functions::TYPE
+ VERSION PHPExcel_Calculation_Functions::VERSION
+
+CATEGORY_LOGICAL
+ AND PHPExcel_Calculation_Logical::LOGICAL_AND
+ FALSE PHPExcel_Calculation_Logical::FALSE
+ IF PHPExcel_Calculation_Logical::STATEMENT_IF
+ IFERROR PHPExcel_Calculation_Logical::IFERROR
+ NOT PHPExcel_Calculation_Logical::NOT
+ OR PHPExcel_Calculation_Logical::LOGICAL_OR
+ TRUE PHPExcel_Calculation_Logical::TRUE
+
+CATEGORY_LOOKUP_AND_REFERENCE
+ ADDRESS PHPExcel_Calculation_LookupRef::CELL_ADDRESS
+ AREAS *** Not yet Implemented
+ CHOOSE PHPExcel_Calculation_LookupRef::CHOOSE
+ COLUMN PHPExcel_Calculation_LookupRef::COLUMN
+ COLUMNS PHPExcel_Calculation_LookupRef::COLUMNS
+ GETPIVOTDATA *** Not yet Implemented
+ HLOOKUP PHPExcel_Calculation_LookupRef::HLOOKUP
+ HYPERLINK PHPExcel_Calculation_LookupRef::HYPERLINK
+ INDEX PHPExcel_Calculation_LookupRef::INDEX
+ INDIRECT PHPExcel_Calculation_LookupRef::INDIRECT
+ LOOKUP PHPExcel_Calculation_LookupRef::LOOKUP
+ MATCH PHPExcel_Calculation_LookupRef::MATCH
+ OFFSET PHPExcel_Calculation_LookupRef::OFFSET
+ ROW PHPExcel_Calculation_LookupRef::ROW
+ ROWS PHPExcel_Calculation_LookupRef::ROWS
+ RTD *** Not yet Implemented
+ TRANSPOSE PHPExcel_Calculation_LookupRef::TRANSPOSE
+ VLOOKUP PHPExcel_Calculation_LookupRef::VLOOKUP
+
+CATEGORY_MATH_AND_TRIG
+ ABS abs
+ ACOS acos
+ ACOSH acosh
+ ASIN asin
+ ASINH asinh
+ ATAN atan
+ ATAN2 PHPExcel_Calculation_MathTrig::REVERSE_ATAN2
+ ATANH atanh
+ CEILING PHPExcel_Calculation_MathTrig::CEILING
+ COMBIN PHPExcel_Calculation_MathTrig::COMBIN
+ COS cos
+ COSH cosh
+ DEGREES rad2deg
+ EVEN PHPExcel_Calculation_MathTrig::EVEN
+ EXP exp
+ FACT PHPExcel_Calculation_MathTrig::FACT
+ FACTDOUBLE PHPExcel_Calculation_MathTrig::FACTDOUBLE
+ FLOOR PHPExcel_Calculation_MathTrig::FLOOR
+ GCD PHPExcel_Calculation_MathTrig::GCD
+ INT PHPExcel_Calculation_MathTrig::INT
+ LCM PHPExcel_Calculation_MathTrig::LCM
+ LN log
+ LOG PHPExcel_Calculation_MathTrig::LOG_BASE
+ LOG10 log10
+ MDETERM PHPExcel_Calculation_MathTrig::MDETERM
+ MINVERSE PHPExcel_Calculation_MathTrig::MINVERSE
+ MMULT PHPExcel_Calculation_MathTrig::MMULT
+ MOD PHPExcel_Calculation_MathTrig::MOD
+ MROUND PHPExcel_Calculation_MathTrig::MROUND
+ MULTINOMIAL PHPExcel_Calculation_MathTrig::MULTINOMIAL
+ ODD PHPExcel_Calculation_MathTrig::ODD
+ PI pi
+ POWER PHPExcel_Calculation_MathTrig::POWER
+ PRODUCT PHPExcel_Calculation_MathTrig::PRODUCT
+ QUOTIENT PHPExcel_Calculation_MathTrig::QUOTIENT
+ RADIANS deg2rad
+ RAND PHPExcel_Calculation_MathTrig::RAND
+ RANDBETWEEN PHPExcel_Calculation_MathTrig::RAND
+ ROMAN PHPExcel_Calculation_MathTrig::ROMAN
+ ROUND round
+ ROUNDDOWN PHPExcel_Calculation_MathTrig::ROUNDDOWN
+ ROUNDUP PHPExcel_Calculation_MathTrig::ROUNDUP
+ SERIESSUM PHPExcel_Calculation_MathTrig::SERIESSUM
+ SIGN PHPExcel_Calculation_MathTrig::SIGN
+ SIN sin
+ SINH sinh
+ SQRT sqrt
+ SQRTPI PHPExcel_Calculation_MathTrig::SQRTPI
+ SUBTOTAL PHPExcel_Calculation_MathTrig::SUBTOTAL
+ SUM PHPExcel_Calculation_MathTrig::SUM
+ SUMIF PHPExcel_Calculation_MathTrig::SUMIF
+ SUMIFS *** Not yet Implemented
+ SUMPRODUCT PHPExcel_Calculation_MathTrig::SUMPRODUCT
+ SUMSQ PHPExcel_Calculation_MathTrig::SUMSQ
+ SUMX2MY2 PHPExcel_Calculation_MathTrig::SUMX2MY2
+ SUMX2PY2 PHPExcel_Calculation_MathTrig::SUMX2PY2
+ SUMXMY2 PHPExcel_Calculation_MathTrig::SUMXMY2
+ TAN tan
+ TANH tanh
+ TRUNC PHPExcel_Calculation_MathTrig::TRUNC
+
+CATEGORY_STATISTICAL
+ AVEDEV PHPExcel_Calculation_Statistical::AVEDEV
+ AVERAGE PHPExcel_Calculation_Statistical::AVERAGE
+ AVERAGEA PHPExcel_Calculation_Statistical::AVERAGEA
+ AVERAGEIF PHPExcel_Calculation_Statistical::AVERAGEIF
+ AVERAGEIFS *** Not yet Implemented
+ BETADIST PHPExcel_Calculation_Statistical::BETADIST
+ BETAINV PHPExcel_Calculation_Statistical::BETAINV
+ BINOMDIST PHPExcel_Calculation_Statistical::BINOMDIST
+ CHIDIST PHPExcel_Calculation_Statistical::CHIDIST
+ CHIINV PHPExcel_Calculation_Statistical::CHIINV
+ CHITEST *** Not yet Implemented
+ CONFIDENCE PHPExcel_Calculation_Statistical::CONFIDENCE
+ CORREL PHPExcel_Calculation_Statistical::CORREL
+ COUNT PHPExcel_Calculation_Statistical::COUNT
+ COUNTA PHPExcel_Calculation_Statistical::COUNTA
+ COUNTBLANK PHPExcel_Calculation_Statistical::COUNTBLANK
+ COUNTIF PHPExcel_Calculation_Statistical::COUNTIF
+ COUNTIFS *** Not yet Implemented
+ COVAR PHPExcel_Calculation_Statistical::COVAR
+ CRITBINOM PHPExcel_Calculation_Statistical::CRITBINOM
+ DEVSQ PHPExcel_Calculation_Statistical::DEVSQ
+ EXPONDIST PHPExcel_Calculation_Statistical::EXPONDIST
+ FDIST *** Not yet Implemented
+ FINV *** Not yet Implemented
+ FISHER PHPExcel_Calculation_Statistical::FISHER
+ FISHERINV PHPExcel_Calculation_Statistical::FISHERINV
+ FORECAST PHPExcel_Calculation_Statistical::FORECAST
+ FREQUENCY *** Not yet Implemented
+ FTEST *** Not yet Implemented
+ GAMMADIST PHPExcel_Calculation_Statistical::GAMMADIST
+ GAMMAINV PHPExcel_Calculation_Statistical::GAMMAINV
+ GAMMALN PHPExcel_Calculation_Statistical::GAMMALN
+ GEOMEAN PHPExcel_Calculation_Statistical::GEOMEAN
+ GROWTH PHPExcel_Calculation_Statistical::GROWTH
+ HARMEAN PHPExcel_Calculation_Statistical::HARMEAN
+ HYPGEOMDIST PHPExcel_Calculation_Statistical::HYPGEOMDIST
+ INTERCEPT PHPExcel_Calculation_Statistical::INTERCEPT
+ KURT PHPExcel_Calculation_Statistical::KURT
+ LARGE PHPExcel_Calculation_Statistical::LARGE
+ LINEST PHPExcel_Calculation_Statistical::LINEST
+ LOGEST PHPExcel_Calculation_Statistical::LOGEST
+ LOGINV PHPExcel_Calculation_Statistical::LOGINV
+ LOGNORMDIST PHPExcel_Calculation_Statistical::LOGNORMDIST
+ MAX PHPExcel_Calculation_Statistical::MAX
+ MAXA PHPExcel_Calculation_Statistical::MAXA
+ MAXIF PHPExcel_Calculation_Statistical::MAXIF
+ MEDIAN PHPExcel_Calculation_Statistical::MEDIAN
+ MEDIANIF *** Not yet Implemented
+ MIN PHPExcel_Calculation_Statistical::MIN
+ MINA PHPExcel_Calculation_Statistical::MINA
+ MINIF PHPExcel_Calculation_Statistical::MINIF
+ MODE PHPExcel_Calculation_Statistical::MODE
+ NEGBINOMDIST PHPExcel_Calculation_Statistical::NEGBINOMDIST
+ NORMDIST PHPExcel_Calculation_Statistical::NORMDIST
+ NORMINV PHPExcel_Calculation_Statistical::NORMINV
+ NORMSDIST PHPExcel_Calculation_Statistical::NORMSDIST
+ NORMSINV PHPExcel_Calculation_Statistical::NORMSINV
+ PEARSON PHPExcel_Calculation_Statistical::CORREL
+ PERCENTILE PHPExcel_Calculation_Statistical::PERCENTILE
+ PERCENTRANK PHPExcel_Calculation_Statistical::PERCENTRANK
+ PERMUT PHPExcel_Calculation_Statistical::PERMUT
+ POISSON PHPExcel_Calculation_Statistical::POISSON
+ PROB *** Not yet Implemented
+ QUARTILE PHPExcel_Calculation_Statistical::QUARTILE
+ RANK PHPExcel_Calculation_Statistical::RANK
+ RSQ PHPExcel_Calculation_Statistical::RSQ
+ SKEW PHPExcel_Calculation_Statistical::SKEW
+ SLOPE PHPExcel_Calculation_Statistical::SLOPE
+ SMALL PHPExcel_Calculation_Statistical::SMALL
+ STANDARDIZE PHPExcel_Calculation_Statistical::STANDARDIZE
+ STDEV PHPExcel_Calculation_Statistical::STDEV
+ STDEVA PHPExcel_Calculation_Statistical::STDEVA
+ STDEVP PHPExcel_Calculation_Statistical::STDEVP
+ STDEVPA PHPExcel_Calculation_Statistical::STDEVPA
+ STEYX PHPExcel_Calculation_Statistical::STEYX
+ TDIST PHPExcel_Calculation_Statistical::TDIST
+ TINV PHPExcel_Calculation_Statistical::TINV
+ TREND PHPExcel_Calculation_Statistical::TREND
+ TRIMMEAN PHPExcel_Calculation_Statistical::TRIMMEAN
+ TTEST *** Not yet Implemented
+ VAR PHPExcel_Calculation_Statistical::VARFunc
+ VARA PHPExcel_Calculation_Statistical::VARA
+ VARP PHPExcel_Calculation_Statistical::VARP
+ VARPA PHPExcel_Calculation_Statistical::VARPA
+ WEIBULL PHPExcel_Calculation_Statistical::WEIBULL
+ ZTEST PHPExcel_Calculation_Statistical::ZTEST
+
+CATEGORY_TEXT_AND_DATA
+ ASC *** Not yet Implemented
+ BAHTTEXT *** Not yet Implemented
+ CHAR PHPExcel_Calculation_TextData::CHARACTER
+ CLEAN PHPExcel_Calculation_TextData::TRIMNONPRINTABLE
+ CODE PHPExcel_Calculation_TextData::ASCIICODE
+ CONCATENATE PHPExcel_Calculation_TextData::CONCATENATE
+ DOLLAR PHPExcel_Calculation_TextData::DOLLAR
+ EXACT *** Not yet Implemented
+ FIND PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FINDB PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FIXED PHPExcel_Calculation_TextData::FIXEDFORMAT
+ JIS *** Not yet Implemented
+ LEFT PHPExcel_Calculation_TextData::LEFT
+ LEFTB PHPExcel_Calculation_TextData::LEFT
+ LEN PHPExcel_Calculation_TextData::STRINGLENGTH
+ LENB PHPExcel_Calculation_TextData::STRINGLENGTH
+ LOWER PHPExcel_Calculation_TextData::LOWERCASE
+ MID PHPExcel_Calculation_TextData::MID
+ MIDB PHPExcel_Calculation_TextData::MID
+ PHONETIC *** Not yet Implemented
+ PROPER PHPExcel_Calculation_TextData::PROPERCASE
+ REPLACE PHPExcel_Calculation_TextData::REPLACE
+ REPLACEB PHPExcel_Calculation_TextData::REPLACE
+ REPT str_repeat
+ RIGHT PHPExcel_Calculation_TextData::RIGHT
+ RIGHTB PHPExcel_Calculation_TextData::RIGHT
+ SEARCH PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SEARCHB PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SUBSTITUTE PHPExcel_Calculation_TextData::SUBSTITUTE
+ T PHPExcel_Calculation_TextData::RETURNSTRING
+ TEXT PHPExcel_Calculation_TextData::TEXTFORMAT
+ TRIM PHPExcel_Calculation_TextData::TRIMSPACES
+ UPPER PHPExcel_Calculation_TextData::UPPERCASE
+ VALUE PHPExcel_Calculation_TextData::VALUE
diff --git a/Documentation/FunctionListByName.txt b/Documentation/FunctionListByName.txt
new file mode 100644
index 0000000..45a9daf
--- /dev/null
+++ b/Documentation/FunctionListByName.txt
@@ -0,0 +1,381 @@
+ABS CATEGORY_MATH_AND_TRIG abs
+ACCRINT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::ACCRINT
+ACCRINTM CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::ACCRINTM
+ACOS CATEGORY_MATH_AND_TRIG acos
+ACOSH CATEGORY_MATH_AND_TRIG acosh
+ADDRESS CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::CELL_ADDRESS
+AMORDEGRC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::AMORDEGRC
+AMORLINC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::AMORLINC
+AND CATEGORY_LOGICAL PHPExcel_Calculation_Logical::LOGICAL_AND
+AREAS CATEGORY_LOOKUP_AND_REFERENCE *** Not yet Implemented
+ASC CATEGORY_TEXT_AND_DATA *** Not yet Implemented
+ASIN CATEGORY_MATH_AND_TRIG asin
+ASINH CATEGORY_MATH_AND_TRIG asinh
+ATAN CATEGORY_MATH_AND_TRIG atan
+ATAN2 CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::REVERSE_ATAN2
+ATANH CATEGORY_MATH_AND_TRIG atanh
+AVEDEV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::AVEDEV
+AVERAGE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::AVERAGE
+AVERAGEA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::AVERAGEA
+AVERAGEIF CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::AVERAGEIF
+AVERAGEIFS CATEGORY_STATISTICAL *** Not yet Implemented
+
+BAHTTEXT CATEGORY_TEXT_AND_DATA *** Not yet Implemented
+BESSELI CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BESSELI
+BESSELJ CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BESSELJ
+BESSELK CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BESSELK
+BESSELY CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BESSELY
+BETADIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::BETADIST
+BETAINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::BETAINV
+BIN2DEC CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BINTODEC
+BIN2HEX CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BINTOHEX
+BIN2OCT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::BINTOOCT
+BINOMDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::BINOMDIST
+
+CEILING CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::CEILING
+CELL CATEGORY_INFORMATION *** Not yet Implemented
+CHAR CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::CHARACTER
+CHIDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CHIDIST
+CHIINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CHIINV
+CHITEST CATEGORY_STATISTICAL *** Not yet Implemented
+CHOOSE CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::CHOOSE
+CLEAN CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::TRIMNONPRINTABLE
+CODE CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::ASCIICODE
+COLUMN CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::COLUMN
+COLUMNS CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::COLUMNS
+COMBIN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::COMBIN
+COMPLEX CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::COMPLEX
+CONCATENATE CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::CONCATENATE
+CONFIDENCE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CONFIDENCE
+CONVERT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::CONVERTUOM
+CORREL CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CORREL
+COS CATEGORY_MATH_AND_TRIG cos
+COSH CATEGORY_MATH_AND_TRIG cosh
+COUNT CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::COUNT
+COUNTA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::COUNTA
+COUNTBLANK CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::COUNTBLANK
+COUNTIF CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::COUNTIF
+COUNTIFS CATEGORY_STATISTICAL *** Not yet Implemented
+COUPDAYBS CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPDAYBS
+COUPDAYS CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPDAYS
+COUPDAYSNC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPDAYSNC
+COUPNCD CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPNCD
+COUPNUM CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPNUM
+COUPPCD CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::COUPPCD
+COVAR CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::COVAR
+CRITBINOM CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CRITBINOM
+CUBEKPIMEMBER CATEGORY_CUBE *** Not yet Implemented
+CUBEMEMBER CATEGORY_CUBE *** Not yet Implemented
+CUBEMEMBERPROPERTY CATEGORY_CUBE *** Not yet Implemented
+CUBERANKEDMEMBER CATEGORY_CUBE *** Not yet Implemented
+CUBESET CATEGORY_CUBE *** Not yet Implemented
+CUBESETCOUNT CATEGORY_CUBE *** Not yet Implemented
+CUBEVALUE CATEGORY_CUBE *** Not yet Implemented
+CUMIPMT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::CUMIPMT
+CUMPRINC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::CUMPRINC
+
+DATE CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DATE
+DATEDIF CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DATEDIF
+DATEVALUE CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DATEVALUE
+DAVERAGE CATEGORY_DATABASE PHPExcel_Calculation_Database::DAVERAGE
+DAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DAYOFMONTH
+DAYS360 CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DAYS360
+DB CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::DB
+DCOUNT CATEGORY_DATABASE PHPExcel_Calculation_Database::DCOUNT
+DCOUNTA CATEGORY_DATABASE PHPExcel_Calculation_Database::DCOUNTA
+DDB CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::DDB
+DEC2BIN CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::DECTOBIN
+DEC2HEX CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::DECTOHEX
+DEC2OCT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::DECTOOCT
+DEGREES CATEGORY_MATH_AND_TRIG rad2deg
+DELTA CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::DELTA
+DEVSQ CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::DEVSQ
+DGET CATEGORY_DATABASE PHPExcel_Calculation_Database::DGET
+DISC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::DISC
+DMAX CATEGORY_DATABASE PHPExcel_Calculation_Database::DMAX
+DMIN CATEGORY_DATABASE PHPExcel_Calculation_Database::DMIN
+DOLLAR CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::DOLLAR
+DOLLARDE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::DOLLARDE
+DOLLARFR CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::DOLLARFR
+DPRODUCT CATEGORY_DATABASE PHPExcel_Calculation_Database::DPRODUCT
+DSTDEV CATEGORY_DATABASE PHPExcel_Calculation_Database::DSTDEV
+DSTDEVP CATEGORY_DATABASE PHPExcel_Calculation_Database::DSTDEVP
+DSUM CATEGORY_DATABASE PHPExcel_Calculation_Database::DSUM
+DURATION CATEGORY_FINANCIAL *** Not yet Implemented
+DVAR CATEGORY_DATABASE PHPExcel_Calculation_Database::DVAR
+DVARP CATEGORY_DATABASE PHPExcel_Calculation_Database::DVARP
+
+EDATE CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::EDATE
+EFFECT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::EFFECT
+EOMONTH CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::EOMONTH
+ERF CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::ERF
+ERFC CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::ERFC
+ERROR.TYPE CATEGORY_INFORMATION PHPExcel_Calculation_Functions::ERROR_TYPE
+EVEN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::EVEN
+EXACT CATEGORY_TEXT_AND_DATA *** Not yet Implemented
+EXP CATEGORY_MATH_AND_TRIG exp
+EXPONDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::EXPONDIST
+
+FACT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::FACT
+FACTDOUBLE CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::FACTDOUBLE
+FALSE CATEGORY_LOGICAL PHPExcel_Calculation_Logical::FALSE
+FDIST CATEGORY_STATISTICAL *** Not yet Implemented
+FIND CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+FINDB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+FINV CATEGORY_STATISTICAL *** Not yet Implemented
+FISHER CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::FISHER
+FISHERINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::FISHERINV
+FIXED CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::FIXEDFORMAT
+FLOOR CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::FLOOR
+FORECAST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::FORECAST
+FREQUENCY CATEGORY_STATISTICAL *** Not yet Implemented
+FTEST CATEGORY_STATISTICAL *** Not yet Implemented
+FV CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::FV
+FVSCHEDULE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::FVSCHEDULE
+
+GAMMADIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::GAMMADIST
+GAMMAINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::GAMMAINV
+GAMMALN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::GAMMALN
+GCD CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::GCD
+GEOMEAN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::GEOMEAN
+GESTEP CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::GESTEP
+GETPIVOTDATA CATEGORY_LOOKUP_AND_REFERENCE *** Not yet Implemented
+GROWTH CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::GROWTH
+
+HARMEAN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::HARMEAN
+HEX2BIN CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::HEXTOBIN
+HEX2DEC CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::HEXTODEC
+HEX2OCT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::HEXTOOCT
+HLOOKUP CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::HLOOKUP
+HOUR CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::HOUROFDAY
+HYPERLINK CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::HYPERLINK
+HYPGEOMDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::HYPGEOMDIST
+
+IF CATEGORY_LOGICAL PHPExcel_Calculation_Logical::STATEMENT_IF
+IFERROR CATEGORY_LOGICAL PHPExcel_Calculation_Logical::IFERROR
+IMABS CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMABS
+IMAGINARY CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMAGINARY
+IMARGUMENT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMARGUMENT
+IMCONJUGATE CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMCONJUGATE
+IMCOS CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMCOS
+IMDIV CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMDIV
+IMEXP CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMEXP
+IMLN CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMLN
+IMLOG10 CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMLOG10
+IMLOG2 CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMLOG2
+IMPOWER CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMPOWER
+IMPRODUCT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMPRODUCT
+IMREAL CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMREAL
+IMSIN CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMSIN
+IMSQRT CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMSQRT
+IMSUB CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMSUB
+IMSUM CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::IMSUM
+INDEX CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::INDEX
+INDIRECT CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::INDIRECT
+INFO CATEGORY_INFORMATION *** Not yet Implemented
+INT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::INT
+INTERCEPT CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::INTERCEPT
+INTRATE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::INTRATE
+IPMT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::IPMT
+IRR CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::IRR
+ISBLANK CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_BLANK
+ISERR CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_ERR
+ISERROR CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_ERROR
+ISEVEN CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_EVEN
+ISLOGICAL CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_LOGICAL
+ISNA CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_NA
+ISNONTEXT CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_NONTEXT
+ISNUMBER CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_NUMBER
+ISODD CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_ODD
+ISPMT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::ISPMT
+ISREF CATEGORY_INFORMATION *** Not yet Implemented
+ISTEXT CATEGORY_INFORMATION PHPExcel_Calculation_Functions::IS_TEXT
+
+JIS CATEGORY_TEXT_AND_DATA *** Not yet Implemented
+
+KURT CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::KURT
+
+LARGE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::LARGE
+LCM CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::LCM
+LEFT CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::LEFT
+LEFTB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::LEFT
+LEN CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::STRINGLENGTH
+LENB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::STRINGLENGTH
+LINEST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::LINEST
+LN CATEGORY_MATH_AND_TRIG log
+LOG CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::LOG_BASE
+LOG10 CATEGORY_MATH_AND_TRIG log10
+LOGEST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::LOGEST
+LOGINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::LOGINV
+LOGNORMDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::LOGNORMDIST
+LOOKUP CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::LOOKUP
+LOWER CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::LOWERCASE
+
+MATCH CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::MATCH
+MAX CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MAX
+MAXA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MAXA
+MAXIF CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MAXIF
+MDETERM CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MDETERM
+MDURATION CATEGORY_FINANCIAL *** Not yet Implemented
+MEDIAN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MEDIAN
+MEDIANIF CATEGORY_STATISTICAL *** Not yet Implemented
+MID CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::MID
+MIDB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::MID
+MIN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MIN
+MINA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MINA
+MINIF CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MINIF
+MINUTE CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::MINUTEOFHOUR
+MINVERSE CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MINVERSE
+MIRR CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::MIRR
+MMULT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MMULT
+MOD CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MOD
+MODE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::MODE
+MONTH CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::MONTHOFYEAR
+MROUND CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MROUND
+MULTINOMIAL CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::MULTINOMIAL
+
+N CATEGORY_INFORMATION PHPExcel_Calculation_Functions::N
+NA CATEGORY_INFORMATION PHPExcel_Calculation_Functions::NA
+NEGBINOMDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::NEGBINOMDIST
+NETWORKDAYS CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::NETWORKDAYS
+NOMINAL CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::NOMINAL
+NORMDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::NORMDIST
+NORMINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::NORMINV
+NORMSDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::NORMSDIST
+NORMSINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::NORMSINV
+NOT CATEGORY_LOGICAL PHPExcel_Calculation_Logical::NOT
+NOW CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DATETIMENOW
+NPER CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::NPER
+NPV CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::NPV
+
+OCT2BIN CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::OCTTOBIN
+OCT2DEC CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::OCTTODEC
+OCT2HEX CATEGORY_ENGINEERING PHPExcel_Calculation_Engineering::OCTTOHEX
+ODD CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::ODD
+ODDFPRICE CATEGORY_FINANCIAL *** Not yet Implemented
+ODDFYIELD CATEGORY_FINANCIAL *** Not yet Implemented
+ODDLPRICE CATEGORY_FINANCIAL *** Not yet Implemented
+ODDLYIELD CATEGORY_FINANCIAL *** Not yet Implemented
+OFFSET CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::OFFSET
+OR CATEGORY_LOGICAL PHPExcel_Calculation_Logical::LOGICAL_OR
+
+PEARSON CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::CORREL
+PERCENTILE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::PERCENTILE
+PERCENTRANK CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::PERCENTRANK
+PERMUT CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::PERMUT
+PHONETIC CATEGORY_TEXT_AND_DATA *** Not yet Implemented
+PI CATEGORY_MATH_AND_TRIG pi
+PMT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PMT
+POISSON CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::POISSON
+POWER CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::POWER
+PPMT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PPMT
+PRICE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PRICE
+PRICEDISC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PRICEDISC
+PRICEMAT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PRICEMAT
+PROB CATEGORY_STATISTICAL *** Not yet Implemented
+PRODUCT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::PRODUCT
+PROPER CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::PROPERCASE
+PV CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::PV
+
+QUARTILE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::QUARTILE
+QUOTIENT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::QUOTIENT
+
+RADIANS CATEGORY_MATH_AND_TRIG deg2rad
+RAND CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::RAND
+RANDBETWEEN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::RAND
+RANK CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::RANK
+RATE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::RATE
+RECEIVED CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::RECEIVED
+REPLACE CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::REPLACE
+REPLACEB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::REPLACE
+REPT CATEGORY_TEXT_AND_DATA str_repeat
+RIGHT CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::RIGHT
+RIGHTB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::RIGHT
+ROMAN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::ROMAN
+ROUND CATEGORY_MATH_AND_TRIG round
+ROUNDDOWN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::ROUNDDOWN
+ROUNDUP CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::ROUNDUP
+ROW CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::ROW
+ROWS CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::ROWS
+RSQ CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::RSQ
+RTD CATEGORY_LOOKUP_AND_REFERENCE *** Not yet Implemented
+
+SEARCH CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+SEARCHB CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+SECOND CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::SECONDOFMINUTE
+SERIESSUM CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SERIESSUM
+SIGN CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SIGN
+SIN CATEGORY_MATH_AND_TRIG sin
+SINH CATEGORY_MATH_AND_TRIG sinh
+SKEW CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::SKEW
+SLN CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::SLN
+SLOPE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::SLOPE
+SMALL CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::SMALL
+SQRT CATEGORY_MATH_AND_TRIG sqrt
+SQRTPI CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SQRTPI
+STANDARDIZE CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STANDARDIZE
+STDEV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STDEV
+STDEVA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STDEVA
+STDEVP CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STDEVP
+STDEVPA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STDEVPA
+STEYX CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::STEYX
+SUBSTITUTE CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::SUBSTITUTE
+SUBTOTAL CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUBTOTAL
+SUM CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUM
+SUMIF CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMIF
+SUMIFS CATEGORY_MATH_AND_TRIG *** Not yet Implemented
+SUMPRODUCT CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMPRODUCT
+SUMSQ CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMSQ
+SUMX2MY2 CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMX2MY2
+SUMX2PY2 CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMX2PY2
+SUMXMY2 CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::SUMXMY2
+SYD CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::SYD
+
+T CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::RETURNSTRING
+TAN CATEGORY_MATH_AND_TRIG tan
+TANH CATEGORY_MATH_AND_TRIG tanh
+TBILLEQ CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::TBILLEQ
+TBILLPRICE CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::TBILLPRICE
+TBILLYIELD CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::TBILLYIELD
+TDIST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::TDIST
+TEXT CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::TEXTFORMAT
+TIME CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::TIME
+TIMEVALUE CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::TIMEVALUE
+TINV CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::TINV
+TODAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DATENOW
+TRANSPOSE CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::TRANSPOSE
+TREND CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::TREND
+TRIM CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::TRIMSPACES
+TRIMMEAN CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::TRIMMEAN
+TRUE CATEGORY_LOGICAL PHPExcel_Calculation_Logical::TRUE
+TRUNC CATEGORY_MATH_AND_TRIG PHPExcel_Calculation_MathTrig::TRUNC
+TTEST CATEGORY_STATISTICAL *** Not yet Implemented
+TYPE CATEGORY_INFORMATION PHPExcel_Calculation_Functions::TYPE
+
+UPPER CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::UPPERCASE
+USDOLLAR CATEGORY_FINANCIAL *** Not yet Implemented
+
+VALUE CATEGORY_TEXT_AND_DATA PHPExcel_Calculation_TextData::VALUE
+VAR CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::VARFunc
+VARA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::VARA
+VARP CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::VARP
+VARPA CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::VARPA
+VDB CATEGORY_FINANCIAL *** Not yet Implemented
+VERSION CATEGORY_INFORMATION PHPExcel_Calculation_Functions::VERSION
+VLOOKUP CATEGORY_LOOKUP_AND_REFERENCE PHPExcel_Calculation_LookupRef::VLOOKUP
+
+WEEKDAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::DAYOFWEEK
+WEEKNUM CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::WEEKOFYEAR
+WEIBULL CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::WEIBULL
+WORKDAY CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::WORKDAY
+
+XIRR CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::XIRR
+XNPV CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::XNPV
+
+YEAR CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::YEAR
+YEARFRAC CATEGORY_DATE_AND_TIME PHPExcel_Calculation_DateTime::YEARFRAC
+YIELD CATEGORY_FINANCIAL *** Not yet Implemented
+YIELDDISC CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::YIELDDISC
+YIELDMAT CATEGORY_FINANCIAL PHPExcel_Calculation_Financial::YIELDMAT
+
+ZTEST CATEGORY_STATISTICAL PHPExcel_Calculation_Statistical::ZTEST
diff --git a/Documentation/Functionality Cross-Reference.xls b/Documentation/Functionality Cross-Reference.xls
new file mode 100644
index 0000000..227fd61
Binary files /dev/null and b/Documentation/Functionality Cross-Reference.xls differ
diff --git a/Documentation/PHPExcel AutoFilter Reference developer documentation.doc b/Documentation/PHPExcel AutoFilter Reference developer documentation.doc
new file mode 100644
index 0000000..208b202
Binary files /dev/null and b/Documentation/PHPExcel AutoFilter Reference developer documentation.doc differ
diff --git a/Documentation/PHPExcel Function Reference developer documentation.doc b/Documentation/PHPExcel Function Reference developer documentation.doc
new file mode 100644
index 0000000..57d218c
Binary files /dev/null and b/Documentation/PHPExcel Function Reference developer documentation.doc differ
diff --git a/Documentation/PHPExcel User Documentation - Reading Spreadsheet Files.doc b/Documentation/PHPExcel User Documentation - Reading Spreadsheet Files.doc
new file mode 100644
index 0000000..ef3954d
Binary files /dev/null and b/Documentation/PHPExcel User Documentation - Reading Spreadsheet Files.doc differ
diff --git a/Documentation/PHPExcel developer documentation.doc b/Documentation/PHPExcel developer documentation.doc
new file mode 100644
index 0000000..52cc964
Binary files /dev/null and b/Documentation/PHPExcel developer documentation.doc differ
diff --git a/Documentation/assets/ClassDiagrams/Architecture.cd b/Documentation/assets/ClassDiagrams/Architecture.cd
new file mode 100644
index 0000000..f36715f
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Architecture.cd
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ Classes\PHPExcel.cs
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=
+
+
+
+
+
+
+
+
+ Classes\Worksheet.cs
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
+
+
+
+
+
+ Classes\IReader.cs
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Classes\IWriter.cs
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/assets/ClassDiagrams/Architecture.png b/Documentation/assets/ClassDiagrams/Architecture.png
new file mode 100644
index 0000000..3fc7655
Binary files /dev/null and b/Documentation/assets/ClassDiagrams/Architecture.png differ
diff --git a/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj b/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj
new file mode 100644
index 0000000..cae9d4e
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj
@@ -0,0 +1,64 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}
+ Exe
+ Properties
+ ClassDiagrams
+ ClassDiagrams
+
+
+ 2.0
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj.user b/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj.user
new file mode 100644
index 0000000..5c2d6e6
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/ClassDiagrams.csproj.user
@@ -0,0 +1,5 @@
+
+
+ ShowAllFiles
+
+
\ No newline at end of file
diff --git a/Documentation/assets/ClassDiagrams/ClassDiagrams.sln b/Documentation/assets/ClassDiagrams/ClassDiagrams.sln
new file mode 100644
index 0000000..b565408
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/ClassDiagrams.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagrams", "ClassDiagrams.csproj", "{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Documentation/assets/ClassDiagrams/Classes/IReader.cs b/Documentation/assets/ClassDiagrams/Classes/IReader.cs
new file mode 100644
index 0000000..33cb05a
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/IReader.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public interface PHPExcel_Reader_IReader
+ {
+ PHPExcel reads
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/IWriter.cs b/Documentation/assets/ClassDiagrams/Classes/IWriter.cs
new file mode 100644
index 0000000..6783f3a
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/IWriter.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public interface PHPExcel_Writer_IWriter
+ {
+ PHPExcel writes
+ {
+ get;
+ set;
+ }
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel.cs
new file mode 100644
index 0000000..825139b
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel
+ {
+ ///
+ public Worksheet Worksheets
+ {
+ get
+ {
+ throw new System.NotImplementedException();
+ }
+ set
+ {
+ }
+ }
+ }
+
+ public class PHPExcel_Writer_PDF : PHPExcel_Writer_IWriter
+ {
+ #region PHPExcel_Writer_IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs
new file mode 100644
index 0000000..695a455
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_IOFactory
+ {
+ public PHPExcel_Reader_IReader createsReader
+ {
+ get
+ {
+ throw new System.NotImplementedException();
+ }
+ set
+ {
+ }
+ }
+
+ public PHPExcel_Writer_IWriter createsWriter
+ {
+ get
+ {
+ throw new System.NotImplementedException();
+ }
+ set
+ {
+ }
+ }
+
+ public PHPExcel_Writer_IWriter createWriter()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public PHPExcel_Reader_IReader createReader()
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs
new file mode 100644
index 0000000..fc38fac
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_Reader_Excel2007 : PHPExcel_Reader_IReader
+ {
+ #region IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs
new file mode 100644
index 0000000..673df56
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_Reader_Excel5 : PHPExcel_Reader_IReader
+ {
+ #region PHPExcel_Writer_IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Reader_Excel2003XML : PHPExcel_Reader_IReader
+ {
+ #region PHPExcel_Writer_IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Reader_SYLK : PHPExcel_Reader_IReader
+ {
+ #region PHPExcel_Writer_IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs
new file mode 100644
index 0000000..3718dd2
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_Reader_Serialized : PHPExcel_Reader_IReader
+ {
+ #region IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Reader_CSV : PHPExcel_Reader_IReader
+ {
+ #region IReader Members
+
+ public PHPExcel reads
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs
new file mode 100644
index 0000000..5f4b565
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_Writer_Excel2007 : PHPExcel_Writer_IWriter
+ {
+ #region IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs
new file mode 100644
index 0000000..58f4bbe
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs
@@ -0,0 +1,82 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class PHPExcel_Writer_Serialized : PHPExcel_Writer_IWriter
+ {
+ #region IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Writer_CSV : PHPExcel_Writer_IWriter
+ {
+ #region IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Writer_Excel5 : PHPExcel_Writer_IWriter
+ {
+ #region IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+
+ public class PHPExcel_Writer_HTML : PHPExcel_Writer_IWriter
+ {
+ #region IWriter Members
+
+ public PHPExcel writes
+ {
+ get
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Classes/Worksheet.cs b/Documentation/assets/ClassDiagrams/Classes/Worksheet.cs
new file mode 100644
index 0000000..aa977b8
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/Classes/Worksheet.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ClassDiagrams
+{
+ public class Worksheet
+ {
+ }
+
+ public class CopyOfWorksheet
+ {
+ }
+}
diff --git a/Documentation/assets/ClassDiagrams/Exports/Architecture.png b/Documentation/assets/ClassDiagrams/Exports/Architecture.png
new file mode 100644
index 0000000..1324818
Binary files /dev/null and b/Documentation/assets/ClassDiagrams/Exports/Architecture.png differ
diff --git a/Documentation/assets/ClassDiagrams/Exports/ReaderWriter.png b/Documentation/assets/ClassDiagrams/Exports/ReaderWriter.png
new file mode 100644
index 0000000..b915faa
Binary files /dev/null and b/Documentation/assets/ClassDiagrams/Exports/ReaderWriter.png differ
diff --git a/Documentation/assets/ClassDiagrams/ReaderWriter.cd b/Documentation/assets/ClassDiagrams/ReaderWriter.cd
new file mode 100644
index 0000000..7764e09
--- /dev/null
+++ b/Documentation/assets/ClassDiagrams/ReaderWriter.cd
@@ -0,0 +1,135 @@
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Excel2007.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel_Writer_Excel2007.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel_Writer_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel_Writer_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel_Writer_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel_Writer_Serialized.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Excel5.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\PHPExcel.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AIAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAA=
+ Classes\PHPExcel_IOFactory.cs
+
+
+
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Excel5.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\PHPExcel_Reader_Excel5.cs
+
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA=
+ Classes\IWriter.cs
+
+
+
+
+
+ AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA=
+ Classes\IReader.cs
+
+
+
+
\ No newline at end of file
diff --git a/Documentation/assets/ClassDiagrams/ReaderWriter.png b/Documentation/assets/ClassDiagrams/ReaderWriter.png
new file mode 100644
index 0000000..d76c98d
Binary files /dev/null and b/Documentation/assets/ClassDiagrams/ReaderWriter.png differ
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/01-Introduction.md b/Documentation/markdown/CalculationEngine/FunctionReference/01-Introduction.md
new file mode 100644
index 0000000..2ea3a50
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/01-Introduction.md
@@ -0,0 +1,11 @@
+# Calculation Engine - Formula Function Reference
+
+## Frequently asked questions
+
+The up-to-date F.A.Q. page for PHPExcel can be found on [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements][1].
+
+### Formulas don’t seem to be calculated in Excel2003 using compatibility pack?
+
+This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
+
+ [1]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/02-01-Date-and-Time-Handling.md b/Documentation/markdown/CalculationEngine/FunctionReference/02-01-Date-and-Time-Handling.md
new file mode 100644
index 0000000..82993bb
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/02-01-Date-and-Time-Handling.md
@@ -0,0 +1,123 @@
+# Calculation Engine - Formula Function Reference
+
+## Function Reference
+
+### Handling Date and Time Values
+
+#### Excel functions that return a Date and Time value
+
+Any of the Date and Time functions that return a date value in Excel can return either an Excel timestamp or a PHP timestamp or date object.
+
+It is possible for scripts to change the data type used for returning date values by calling the PHPExcel_Calculation_Functions::setReturnDateType() method:
+
+```php
+PHPExcel_Calculation_Functions::setReturnDateType($returnDateType);
+```
+
+where the following constants can be used for $returnDateType
+
+ - PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC
+ - PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT
+ - PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+
+The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in for the return date type).
+
+The PHPExcel_Calculation_Functions::getReturnDateType() method can be used to determine the current value of this setting:
+
+```php
+$returnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
+```
+
+The default is RETURNDATE_PHP_NUMERIC.
+
+##### PHP Timestamps
+
+If RETURNDATE_PHP_NUMERIC is set for the Return Date Type, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be an integer value that represents the number of seconds from the PHP/Unix base date. The PHP/Unix base date (0) is 00:00 UST on 1st January 1970. This value can be positive or negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; while a value of +3600 would be 01:00 hrs on 1st January 1970. This gives PHP a date range of between 14th December 1901 and 19th January 2038.
+
+##### PHP DateTime Objects
+
+If the Return Date Type is set for RETURNDATE_PHP_NUMERIC, then any date value returned to the calling script by any access to the Date and Time functions in Excel will be a PHP date/time object.
+
+##### Excel Timestamps
+
+If RETURNDATE_EXCEL is set for the Return Date Type, then the returned date value by any access to the Date and Time functions in Excel will be a floating point value that represents a number of days from the Excel base date. The Excel base date is determined by which calendar Excel uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the base date for the Windows 1900 calendar while 1st January 1904 is the base date for the Mac 1904 calendar.
+
+It is possible for scripts to change the calendar used for calculating Excel date values by calling the PHPExcel_Shared_Date::setExcelCalendar() method:
+
+```php
+PHPExcel_Shared_Date::setExcelCalendar($baseDate);
+```
+
+where the following constants can be used for $baseDate
+
+ - PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900
+ - PHPExcel_Shared_Date::CALENDAR_MAC_1904
+
+The method will return a Boolean True on success, False on failure (e.g. if an invalid value is passed in).
+
+The PHPExcel_Shared_Date::getExcelCalendar() method can be used to determine the current value of this setting:
+
+```php
+$baseDate = PHPExcel_Shared_Date::getExcelCalendar();
+```
+The default is CALENDAR_WINDOWS_1900.
+
+##### Functions that return a Date/Time Value
+
+ - DATE
+ - DATEVALUE
+ - EDATE
+ - EOMONTH
+ - NOW
+ - TIME
+ - TIMEVALUE
+ - TODAY
+
+#### Excel functions that accept Date and Time values as parameters
+
+Date values passed in as parameters to a function can be an Excel timestamp or a PHP timestamp; or date object; or a string containing a date value (e.g. '1-Jan-2009'). PHPExcel will attempt to identify their type based on the PHP datatype:
+
+An integer numeric value will be treated as a PHP/Unix timestamp. A real (floating point) numeric value will be treated as an Excel date/timestamp. Any PHP DateTime object will be treated as a DateTime object. Any string value (even one containing straight numeric data) will be converted to a date/time object for validation as a date value based on the server locale settings, so passing through an ambiguous value of '07/08/2008' will be treated as 7th August 2008 if your server settings are UK, but as 8th July 2008 if your server settings are US. However, if you pass through a value such as '31/12/2008' that would be considered an error by a US-based server, but which is not ambiguous, then PHPExcel will attempt to correct this to 31st December 2008. If the content of the string doesn’t match any of the formats recognised by the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), then the function will return a '#VALUE' error. However, Excel recommends that you should always use date/timestamps for your date functions, and the recommendation for PHPExcel is the same: avoid strings because the result is not predictable.
+
+The same principle applies when data is being written to Excel. Cells containing date actual values (rather than Excel functions that return a date value) are always written as Excel dates, converting where necessary. If a cell formatted as a date contains an integer or date/time object value, then it is converted to an Excel value for writing: if a cell formatted as a date contains a real value, then no conversion is required. Note that string values are written as strings rather than converted to Excel date timestamp values.
+
+##### Functions that expect a Date/Time Value
+
+ - DATEDIF
+ - DAY
+ - DAYS360
+ - EDATE
+ - EOMONTH
+ - HOUR
+ - MINUTE
+ - MONTH
+ - NETWORKDAYS
+ - SECOND
+ - WEEKDAY
+ - WEEKNUM
+ - WORKDAY
+ - YEAR
+ - YEARFRAC
+
+#### Helper Methods
+
+In addition to the setExcelCalendar() and getExcelCalendar() methods, a number of other methods are available in the PHPExcel_Shared_Date class that can help when working with dates:
+
+##### PHPExcel_Shared_Date::ExcelToPHP($excelDate)
+
+Converts a date/time from an Excel date timestamp to return a PHP serialized date/timestamp.
+
+Note that this method does not trap for Excel dates that fall outside of the valid range for a PHP date timestamp.
+
+##### PHPExcel_Shared_Date::ExcelToPHPObject($excelDate)
+
+Converts a date from an Excel date/timestamp to return a PHP DateTime object.
+
+##### PHPExcel_Shared_Date::PHPToExcel($PHPDate)
+
+Converts a PHP serialized date/timestamp or a PHP DateTime object to return an Excel date timestamp.
+
+##### PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0)
+
+Takes year, month and day values (and optional hour, minute and second values) and returns an Excel date timestamp value.
+
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md b/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md
new file mode 100644
index 0000000..b714d51
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/02-General-Introduction.md
@@ -0,0 +1,36 @@
+# Calculation Engine - Formula Function Reference
+
+## General Introduction
+
+### Function that are not Supported in Excel5
+
+Not all functions are supported by the Excel 5 Writer. Use of these functions within your workbooks will result in an error when trying to write to Excel5.
+
+The following is the list of those functions that are implemented within PHPExcel, but that cannot currently be written to Excel 5.
+
+#### Cube Functions
+
+ Excel Function | Notes
+ --------------------|---------
+ CUBEKPIMEMBER | Not yet Implemented
+ CUBEMEMBER | Not yet Implemented
+ CUBEMEMBERPROPERTY | Not yet Implemented
+ CUBERANKEDMEMBER | Not yet Implemented
+ CUBESET | Not yet Implemented
+ CUBESETCOUNT | Not yet Implemented
+ CUBEVALUE | Not yet Implemented
+
+
+#### Database Functions
+
+ Excel Function | Notes
+ ---------------|---------
+
+
+#### Date and Time Functions
+
+ Excel Function | Notes
+ ---------------|---------
+ EDATE | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+ EOMONTH | Not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/03-01-Cube-Functions.md b/Documentation/markdown/CalculationEngine/FunctionReference/03-01-Cube-Functions.md
new file mode 100644
index 0000000..8c94632
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/03-01-Cube-Functions.md
@@ -0,0 +1,34 @@
+# Calculation Engine - Formula Function Reference
+
+## Function Reference
+
+### Cube Functions
+
+#### CUBEKPIMEMBER
+
+Not yet implemented.
+
+#### CUBEMEMBER
+
+Not yet implemented.
+
+#### CUBEMEMBERPROPERTY
+
+Not yet implemented.
+
+#### CUBERANKEDMEMBER
+
+Not yet implemented.
+
+#### CUBESET
+
+Not yet implemented.
+
+#### CUBESETCOUNT
+
+Not yet implemented.
+
+#### CUBEVALUE
+
+Not yet implemented.
+
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/03-02-Database-Functions.md b/Documentation/markdown/CalculationEngine/FunctionReference/03-02-Database-Functions.md
new file mode 100644
index 0000000..a50e1c8
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/03-02-Database-Functions.md
@@ -0,0 +1,618 @@
+# Calculation Engine - Formula Function Reference
+
+## Function Reference
+
+### Database Functions
+
+#### DAVERAGE
+
+The DAVERAGE function returns the average value of the cells in a column of a list or database that match conditions you specify.
+
+##### Syntax
+
+```
+DAVERAGE (database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The average value of the matching cells.
+
+This is the statistical mean.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 12
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DCOUNT
+
+The DCOUNT function returns the count of cells that contain a number in a column of a list or database matching conditions that you specify.
+
+##### Syntax
+
+```
+DCOUNT(database, [field], criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The count of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+
+// $retVal = 3
+```
+
+##### Notes
+
+In MS Excel, The field argument is optional. If field is omitted, DCOUNT counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
+
+#### DCOUNTA
+
+The DCOUNT function returns the count of cells that aren’t blank in a column of a list or database and that match conditions that you specify.
+
+##### Syntax
+
+```
+DCOUNTA(database, [field], criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The count of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+
+// $retVal = 5
+```
+
+##### Notes
+
+In MS Excel, The field argument is optional. If field is omitted, DCOUNTA counts all records in the database that match the criteria. This logic has not yet been implemented in PHPExcel.
+
+#### DGET
+
+The DGET function extracts a single value from a column of a list or database that matches conditions that you specify.
+
+##### Syntax
+
+```
+DGET(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**mixed** The value from the selected column of the matching row.
+
+#### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 14
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DMAX
+
+The DMAX function returns the largest number in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DMAX(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The maximum value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 105
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DMIN
+
+The DMIN function returns the smallest number in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DMIN(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The minimum value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 6
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DPRODUCT
+
+The DPRODUCT function multiplies the values in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DPRODUCT(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The product of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 140
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSTDEV
+
+The DSTDEV function estimates the standard deviation of a population based on a sample by using the numbers in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DSTDEV(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The estimated standard deviation of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 2.97
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSTDEVP
+
+The DSTDEVP function calculates the standard deviation of a population based on the entire population by using the numbers in a column of a list or database that match conditions that you specify.
+
+##### Syntax
+
+```
+DSTDEVP(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The estimated standard deviation of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 2.65
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DSUM
+
+The DSUM function adds the numbers in a column of a list or database that matches conditions you specify.
+
+##### Syntax
+
+```
+DSUM(database, field, criteria)
+```
+
+##### Parameters
+
+**database** The range of cells that makes up the list or database.
+
+A database is a list of related data in which rows of related information are records, and columns of data are fields. The first row of the list contains labels for each column.
+
+**field** Indicates which column of the database is used in the function.
+
+Enter the column label as a string (enclosed between double quotation marks), such as "Age" or "Yield," or as a number (without quotation marks) that represents the position of the column within the list: 1 for the first column, 2 for the second column, and so on.
+
+**criteria** The range of cells that contains the conditions you specify.
+
+You can use any range for the criteria argument, as long as it includes at least one column label and at least one cell below the column label in which you specify a condition for the column.
+
+##### Return Value
+
+**float** The total value of the matching cells.
+
+##### Examples
+
+```php
+$database = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit' ),
+ array( 'Apple', 18, 20, 14, 105.00 ),
+ array( 'Pear', 12, 12, 10, 96.00 ),
+ array( 'Cherry', 13, 14, 9, 105.00 ),
+ array( 'Apple', 14, 15, 10, 75.00 ),
+ array( 'Pear', 9, 8, 8, 76.80 ),
+ array( 'Apple', 8, 9, 6, 45.00 ),
+);
+
+$criteria = array(
+ array( 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ),
+ array( '="=Apple"', '>10', NULL, NULL, NULL, '<16' ),
+ array( '="=Pear"', NULL, NULL, NULL, NULL, NULL ),
+);
+
+$worksheet->fromArray( $criteria, NULL, 'A1' )
+ ->fromArray( $database, NULL, 'A4' );
+
+$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)');
+
+$retVal = $worksheet->getCell('A12')->getCalculatedValue();
+// $retVal = 225
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DVAR
+
+Not yet documented.
+
+#### DVARP
+
+Not yet documented.
+
diff --git a/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md b/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md
new file mode 100644
index 0000000..d0cc568
--- /dev/null
+++ b/Documentation/markdown/CalculationEngine/FunctionReference/03-03-Date-and-Time-Functions.md
@@ -0,0 +1,1000 @@
+# Calculation Engine - Formula Function Reference
+
+## Function Reference
+
+### Date and Time Functions
+
+Excel provides a number of functions for the manipulation of dates and times, and calculations based on date/time values. it is worth spending some time reading the section titled "Date and Time Values" on passing date parameters and returning date values to understand how PHPExcel reconciles the differences between dates and times in Excel and in PHP.
+
+#### DATE
+
+The DATE function returns an Excel timestamp or a PHP timestamp or date object representing the date that is referenced by the parameters.
+
+##### Syntax
+
+```
+DATE(year, month, day)
+```
+
+##### Parameters
+
+**year** The year number.
+
+If this value is between 0 (zero) and 1899 inclusive (for the Windows 1900 calendar), or between 4 and 1903 inclusive (for the Mac 1904), then PHPExcel adds it to the Calendar base year, so a value of 108 will interpret the year as 2008 when using the Windows 1900 calendar, or 2012 when using the Mac 1904 calendar.
+
+**month** The month number.
+
+If this value is greater than 12, the DATE function adds that number of months to the first month in the year specified. For example, DATE(2008,14,2) returns a value representing February 2, 2009.
+
+If the value of __month__ is less than 1, then that value will be adjusted by -1, and that will then be subtracted from the first month of the year specified. For example, DATE(2008,0,2) returns a value representing December 2, 2007; while DATE(2008,-1,2) returns a value representing November 2, 2007.
+
+**day** The day number.
+
+If this value is greater than the number of days in the month (and year) specified, the DATE function adds that number of days to the first day in the month. For example, DATE(2008,1,35) returns a value representing February 4, 2008.
+
+If the value of __day__ is less than 1, then that value will be adjusted by -1, and that will then be subtracted from the first month of the year specified. For example, DATE(2008,3,0) returns a value representing February 29, 2008; while DATE(2008,3,-2) returns a value representing February 27, 2008.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the given date.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of PHPExcel_Calculation_Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Year')
+ ->setCellValue('A2', 'Month')
+ ->setCellValue('A3', 'Day');
+
+$worksheet->setCellValue('B1', 2008)
+ ->setCellValue('B2', 12)
+ ->setCellValue('B3', 31);
+
+$worksheet->setCellValue('D1', '=DATE(B1,B2,B3)');
+
+$retVal = $worksheet->getCell('D1')->getCalculatedValue();
+// $retVal = 1230681600
+```
+
+```php
+// We're going to be calling the same cell calculation multiple times,
+// and expecting different return values, so disable calculation cacheing
+PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
+
+$saveFormat = PHPExcel_Calculation_Functions::getReturnDateType();
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATE'),
+ array(2008, 12, 31)
+);
+// $retVal = 39813.0
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATE'),
+ array(2008, 12, 31)
+);
+// $retVal = 1230681600
+
+PHPExcel_Calculation_Functions::setReturnDateType($saveFormat);
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### DATEDIF
+
+The DATEDIF function computes the difference between two dates in a variety of different intervals, such number of years, months, or days.
+
+##### Syntax
+
+```
+DATEDIF(date1, date2 [, unit])
+```
+
+##### Parameters
+
+**date1** First Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**date2** Second Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**unit** The interval type to use for the calculation
+
+This is a string, comprising one of the values listed below:
+
+Unit | Meaning | Description
+-----|---------------------------------|--------------------------------
+m | Months | Complete calendar months between the dates.
+d | Days | Number of days between the dates.
+y | Years | Complete calendar years between the dates.
+ym | Months Excluding Years | Complete calendar months between the dates as if they were of the same year.
+yd | Days Excluding Years | Complete calendar days between the dates as if they were of the same year.
+md | Days Excluding Years And Months | Complete calendar days between the dates as if they were of the same month and same year.
+
+The unit value is not case sensitive, and defaults to "d".
+
+##### Return Value
+
+**integer** An integer value that reflects the difference between the two dates.
+
+This could be the number of full days, months or years between the two dates, depending on the interval unit value passed into the function as the third parameter.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Year')
+ ->setCellValue('A2', 'Month')
+ ->setCellValue('A3', 'Day');
+
+$worksheet->setCellValue('B1', 2001)
+ ->setCellValue('C1', 2009)
+ ->setCellValue('B2', 7)
+ ->setCellValue('C2', 12)
+ ->setCellValue('B3', 1)
+ ->setCellValue('C3', 31);
+
+$worksheet->setCellValue('D1', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"d")')
+ ->setCellValue('D2', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"m")')
+ ->setCellValue('D3', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"y")')
+ ->setCellValue('D4', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"ym")')
+ ->setCellValue('D5', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"yd")')
+ ->setCellValue('D6', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"md")');
+
+$retVal = $worksheet->getCell('D1')->getCalculatedValue();
+// $retVal = 3105
+
+$retVal = $worksheet->getCell('D2')->getCalculatedValue();
+// $retVal = 101
+
+$retVal = $worksheet->getCell('D3')->getCalculatedValue();
+// $retVal = 8
+
+$retVal = $worksheet->getCell('D4')->getCalculatedValue();
+// $retVal = 5
+
+$retVal = $worksheet->getCell('D5')->getCalculatedValue();
+// $retVal = 183
+
+$retVal = $worksheet->getCell('D6')->getCalculatedValue();
+// $retVal = 30
+```
+
+```php
+$date1 = 1193317015; // PHP timestamp for 25-Oct-2007
+$date2 = 1449579415; // PHP timestamp for 8-Dec-2015
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'd')
+);
+// $retVal = 2966
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'm')
+);
+// $retVal = 97
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'y')
+);
+// $retVal = 8
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'ym')
+);
+// $retVal = 1
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'yd')
+);
+// $retVal = 44
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEDIF'),
+ array($date1, $date2, 'md')
+);
+// $retVal = 13
+```
+
+##### Notes
+
+If Date1 is later than Date2, DATEDIF will return a #NUM! error.
+
+#### DATEVALUE
+
+The DATEVALUE function returns the date represented by a date formatted as a text string. Use DATEVALUE to convert a date represented by text to a serial number.
+
+##### Syntax
+
+```
+DATEVALUE(dateString)
+```
+
+##### Parameters
+
+**date** Date String.
+
+A string, representing a date value.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the given date.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of PHPExcel_Calculation_Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String');
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '31/12/2008')
+ ->setCellValue('A4', '12-31-2008');
+
+$worksheet->setCellValue('B2', '=DATEVALUE(A2)')
+ ->setCellValue('B3', '=DATEVALUE(A3)')
+ ->setCellValue('B4', '=DATEVALUE(A4)');
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 39813.0 for all cases
+```
+
+```php
+// We're going to be calling the same cell calculation multiple times,
+// and expecting different return values, so disable calculation cacheing
+PHPExcel_Calculation::getInstance()->setCalculationCacheEnabled(FALSE);
+
+$saveFormat = PHPExcel_Calculation_Functions::getReturnDateType();
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEVALUE'),
+ array('31-Dec-2008')
+);
+// $retVal = 39813.0
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DATEVALUE'),
+ array('31-Dec-2008')
+);
+// $retVal = 1230681600
+
+PHPExcel_Calculation_Functions::setReturnDateType($saveFormat);
+```
+
+##### Notes
+
+DATEVALUE uses the php date/time object implementation of strtotime() (which can handle a wider range of formats than the normal strtotime() function), and it is also called for any date parameter passed to other date functions (such as DATEDIF) when the parameter value is a string.
+
+__WARNING:-__ PHPExcel accepts a wider range of date formats than MS Excel, so it is entirely possible that Excel will return a #VALUE! error when passed a date string that it can’t interpret, while PHPExcel is able to translate that same string into a correct date value.
+
+Care should be taken in workbooks that use string formatted dates in calculations when writing to Excel5 or Excel2007.
+
+#### DAY
+
+The DAY function returns the day of a date. The day is given as an integer ranging from 1 to 31.
+
+##### Syntax
+
+```
+DAY(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the day of the month.
+
+This is an integer ranging from 1 to 31.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=DAY(A2)')
+ ->setCellValue('B3', '=DAY(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 31
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 14
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DAYOFMONTH'),
+ array('25-Dec-2008')
+);
+// $retVal = 25
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::DAYOFMONTH() when the method is called statically.
+
+#### DAYS360
+
+The DAYS360 function computes the difference between two dates based on a 360 day year (12 equal periods of 30 days each) used by some accounting systems.
+
+##### Syntax
+
+```
+DAYS360(date1, date2 [, method])
+```
+
+#### Parameters
+
+**date1** First Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**date2** Second Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**method** A boolean flag (TRUE or FALSE)
+
+This is a flag that determines which method to use in the calculation, based on the values listed below:
+
+ method | Description
+ -------|------------
+ FALSE | U.S. (NASD) method. If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month.
+ TRUE | European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month.
+
+The method value defaults to FALSE.
+
+##### Return Value
+
+**integer** An integer value that reflects the difference between the two dates.
+
+This is the number of full days between the two dates, based on a 360 day year.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('B1', 'Start Date')
+ ->setCellValue('C1', 'End Date')
+ ->setCellValue('A2', 'Year')
+ ->setCellValue('A3', 'Month')
+ ->setCellValue('A4', 'Day');
+
+$worksheet->setCellValue('B2', 2003)
+ ->setCellValue('B3', 2)
+ ->setCellValue('B4', 3);
+
+$worksheet->setCellValue('C2', 2007)
+ ->setCellValue('C3', 5)
+ ->setCellValue('C4', 31);
+
+$worksheet->setCellValue('E2', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4))')
+ ->setCellValue('E4', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4),FALSE)');
+
+$retVal = $worksheet->getCell('E2')->getCalculatedValue();
+// $retVal = 1558
+
+$retVal = $worksheet->getCell('E4')->getCalculatedValue();
+// $retVal = 1557
+```
+
+```php
+$date1 = 37655.0; // Excel timestamp for 25-Oct-2007
+$date2 = 39233.0; // Excel timestamp for 8-Dec-2015
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DAYS360'),
+ array($date1, $date2)
+);
+// $retVal = 1558
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DAYS360'),
+ array($date1, $date2, TRUE)
+);
+// $retVal = 1557
+```
+
+##### Notes
+
+__WARNING:-__ This function does not currently work with the Excel5 Writer when a PHP Boolean is used for the third (optional) parameter (as shown in the example above), and the writer will generate and error. It will work if a numeric 0 or 1 is used for the method parameter; or if the Excel TRUE() and FALSE() functions are used instead.
+
+#### EDATE
+
+The EDATE function returns an Excel timestamp or a PHP timestamp or date object representing the date that is the indicated number of months before or after a specified date (the start_date). Use EDATE to calculate maturity dates or due dates that fall on the same day of the month as the date of issue.
+
+##### Syntax
+
+```
+EDATE(baseDate, months)
+```
+
+##### Parameters
+
+**baseDate** Start Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**months** Number of months to add.
+
+An integer value indicating the number of months before or after baseDate. A positive value for months yields a future date; a negative value yields a past date.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the basedate + months.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of PHPExcel_Calculation_Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '1-Jan-2008')
+ ->setCellValue('A3', '29-Feb-2008');
+
+$worksheet->setCellValue('B2', '=EDATE(A2,5)')
+ ->setCellValue('B3', '=EDATE(A3,-12)');
+
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 39600.0 (1-Jun-2008)
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 39141.0 (28-Feb-2007)
+```
+
+```php
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'EDATE'),
+ array('31-Oct-2008',25)
+);
+// $retVal = 40512.0 (30-Nov-2010)
+```
+
+###### Notes
+
+__WARNING:-__ This function is currently not supported by the Excel5 Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+
+#### EOMONTH
+
+The EOMONTH function returns an Excel timestamp or a PHP timestamp or date object representing the date of the last day of the month that is the indicated number of months before or after a specified date (the start_date). Use EOMONTH to calculate maturity dates or due dates that fall on the last day of the month.
+
+##### Syntax
+
+```
+EOMONTH(baseDate, months)
+```
+
+##### Parameters
+
+**baseDate** Start Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**months** Number of months to add.
+
+An integer value indicating the number of months before or after baseDate. A positive value for months yields a future date; a negative value yields a past date.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the last day of basedate + months.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of PHPExcel_Calculation_Functions::getReturnDateType().
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '1-Jan-2000')
+ ->setCellValue('A3', '14-Feb-2009');
+
+$worksheet->setCellValue('B2', '=EOMONTH(A2,5)')
+ ->setCellValue('B3', '=EOMONTH(A3,-12)');
+
+PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 39629.0 (30-Jun-2008)
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 39507.0 (29-Feb-2008)
+```
+
+```php
+PHPExcel_Calculation_Functions::setReturnDateType(
+ PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+);
+
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'EOMONTH'),
+ array('31-Oct-2008',13)
+);
+// $retVal = 40147.0 (30-Nov-2010)
+```
+
+##### Notes
+
+__WARNING:-__ This function is currently not supported by the Excel5 Writer because it is not a standard function within Excel 5, but an add-in from the Analysis ToolPak.
+
+#### HOUR
+
+The HOUR function returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).
+
+##### Syntax
+
+```
+HOUR(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the hour of the day.
+
+This is an integer ranging from 0 to 23.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:20 PM');
+
+$worksheet->setCellValue('B2', '=HOUR(A2)')
+ ->setCellValue('B3', '=HOUR(A3)')
+ ->setCellValue('B4', '=HOUR(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 17
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 4
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 16
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'HOUROFDAY'),
+ array('09:30')
+);
+// $retVal = 9
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::HOUROFDAY() when the method is called statically.
+
+#### MINUTE
+
+The MINUTE function returns the minutes of a time value. The minute is given as an integer, ranging from 0 to 59.
+
+##### Syntax
+
+```
+MINUTE(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the minutes within the hour.
+
+This is an integer ranging from 0 to 59.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:45 PM');
+
+$worksheet->setCellValue('B2', '=MINUTE(A2)')
+ ->setCellValue('B3', '=MINUTE(A3)')
+ ->setCellValue('B4', '=MINUTE(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 30
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 20
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 45
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'MINUTEOFHOUR'),
+ array('09:30')
+);
+// $retVal = 30
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::MINUTEOFHOUR() when the method is called statically.
+
+#### MONTH
+
+The MONTH function returns the month of a date. The month is given as an integer ranging from 1 to 12.
+
+##### Syntax
+
+```
+MONTH(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the month of the year.
+
+This is an integer ranging from 1 to 12.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String');
+$worksheet->setCellValue('A2', '31-Dec-2008');
+$worksheet->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=MONTH(A2)');
+$worksheet->setCellValue('B3', '=MONTH(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 12
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'MONTHOFYEAR'),
+ array('14-July-2008')
+);
+// $retVal = 7
+```
+
+#### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::MONTHOFYEAR() when the method is called statically.
+
+#### NETWORKDAYS
+
+The NETWORKDAYS function returns the number of whole working days between a *start date* and an *end date*. Working days exclude weekends and any dates identified in *holidays*. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.
+
+##### Syntax
+
+```
+NETWORKDAYS(startDate, endDate [, holidays])
+```
+
+##### Parameters
+
+**startDate** Start Date of the period.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**endDate** End Date of the period.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**holidays** Optional array of Holiday dates.
+
+An optional range of one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays.
+
+The list can be either a range of cells that contains the dates or an array constant of Excel date values, PHP date timestamps, PHP date objects, or dates represented as strings.
+
+##### Return Value
+
+**integer** Number of working days.
+
+The number of working days between startDate and endDate.
+
+##### Examples
+
+```php
+```
+
+```php
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+#### NOW
+
+The NOW function returns the current date and time.
+
+##### Syntax
+
+```
+NOW()
+```
+
+##### Parameters
+
+There are now parameters for the NOW() function.
+
+##### Return Value
+
+**mixed** A date/time stamp that corresponds to the current date and time.
+
+This could be a PHP timestamp value (integer), a PHP date/time object, or an Excel timestamp value (real), depending on the value of PHPExcel_Calculation_Functions::getReturnDateType().
+
+##### Examples
+
+```php
+```
+
+```php
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::DATETIMENOW() when the method is called statically.
+
+#### SECOND
+
+The SECOND function returns the seconds of a time value. The second is given as an integer, ranging from 0 to 59.
+
+##### Syntax
+
+```
+SECOND(datetime)
+```
+
+##### Parameters
+
+**datetime** Time.
+
+An Excel date/time value, PHP date timestamp, PHP date object, or a date/time represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the seconds within the minute.
+
+This is an integer ranging from 0 to 59.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Time String')
+ ->setCellValue('A2', '31-Dec-2008 17:30:20')
+ ->setCellValue('A3', '14-Feb-2008 4:20 AM')
+ ->setCellValue('A4', '14-Feb-2008 4:45:59 PM');
+
+$worksheet->setCellValue('B2', '=SECOND(A2)')
+ ->setCellValue('B3', '=SECOND(A3)');
+ ->setCellValue('B4', '=SECOND(A4)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 20
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 0
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 59
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'SECONDOFMINUTE'),
+ array('09:30:17')
+);
+// $retVal = 17
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::SECONDOFMINUTE() when the method is called statically.
+
+#### TIME
+
+Not yet documented.
+
+#### TIMEVALUE
+
+Not yet documented.
+
+#### TODAY
+
+Not yet documented.
+
+#### WEEKDAY
+
+The WEEKDAY function returns the day of the week for a given date. The day is given as an integer ranging from 1 to 7, although this can be modified to return a value between 0 and 6.
+
+##### Syntax
+
+```
+WEEKDAY(datetime [, method])
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+**method** An integer flag (values 0, 1 or 2)
+
+This is a flag that determines which method to use in the calculation, based on the values listed below:
+
+ method | Description
+ :-----:|------------------------------------------
+ 0 | Returns 1 (Sunday) through 7 (Saturday).
+ 1 | Returns 1 (Monday) through 7 (Sunday).
+ 2 | Returns 0 (Monday) through 6 (Sunday).
+
+The method value defaults to 1.
+
+##### Return Value
+
+**integer** An integer value that reflects the day of the week.
+
+This is an integer ranging from 1 to 7, or 0 to 6, depending on the value of method.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '31-Dec-2008')
+ ->setCellValue('A3', '14-Feb-2008');
+
+$worksheet->setCellValue('B2', '=WEEKDAY(A2)')
+ ->setCellValue('B3', '=WEEKDAY(A3,0)')
+ ->setCellValue('B4', '=WEEKDAY(A3,2)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 12
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2
+
+$retVal = $worksheet->getCell('B4')->getCalculatedValue();
+// $retVal = 2
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'DAYOFWEEK'),
+ array('14-July-2008')
+);
+// $retVal = 7
+```
+
+##### Notes
+
+Note that the PHPExcel function is PHPExcel_Calculation_Functions::DAYOFWEEK() when the method is called statically.
+
+#### WEEKNUM
+
+Not yet documented.
+
+#### WORKDAY
+
+Not yet documented.
+
+#### YEAR
+
+The YEAR function returns the year of a date.
+
+##### Syntax
+
+```
+YEAR(datetime)
+```
+
+##### Parameters
+
+**datetime** Date.
+
+An Excel date value, PHP date timestamp, PHP date object, or a date represented as a string.
+
+##### Return Value
+
+**integer** An integer value that reflects the month of the year.
+
+This is an integer year value.
+
+##### Examples
+
+```php
+$worksheet->setCellValue('A1', 'Date String')
+ ->setCellValue('A2', '17-Jul-1982')
+ ->setCellValue('A3', '16-Apr-2009');
+
+$worksheet->setCellValue('B2', '=YEAR(A2)')
+ ->setCellValue('B3', '=YEAR(A3)');
+
+$retVal = $worksheet->getCell('B2')->getCalculatedValue();
+// $retVal = 1982
+
+$retVal = $worksheet->getCell('B3')->getCalculatedValue();
+// $retVal = 2009
+```
+
+```php
+$retVal = call_user_func_array(
+ array('PHPExcel_Calculation_Functions', 'YEAR'),
+ array('14-July-2001')
+);
+// $retVal = 2001
+```
+
+##### Notes
+
+There are no additional notes on this function
+
+### YEARFRAC
+
+Not yet documented.
+
diff --git a/Documentation/markdown/Features/Autofilters/01-Autofilters.md b/Documentation/markdown/Features/Autofilters/01-Autofilters.md
new file mode 100644
index 0000000..c2fbd2f
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/01-Autofilters.md
@@ -0,0 +1,19 @@
+# PHPExcel AutoFilter Reference
+
+
+## AutoFilters
+
+Each worksheet in an Excel Workbook can contain a single autoFilter range. Filtered data displays only the rows that meet criteria that you specify and hides rows that you do not want displayed. You can filter by more than one column: filters are additive, which means that each additional filter is based on the current filter and further reduces the subset of data.
+
+![01-01-autofilter.png](./images/01-01-autofilter.png "")
+
+When an AutoFilter is applied to a range of cells, the first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless), but PHPExcel won't actually stop you specifying a meaningless range: it's up to you as the developer to avoid such errors.
+
+To determine if a filter is applied, note the icon in the column heading. A drop-down arrow (![01-03-filter-icon-1.png](./images/01-03-filter-icon-1.png "")) means that filtering is enabled but not applied. In MS Excel, when you hover over the heading of a column with filtering enabled but not applied, a screen tip displays the cell text for the first row in that column, and the message "(Showing All)".
+
+![01-02-autofilter.png](./images/01-02-autofilter.png "")
+
+
+A Filter button (![01-03-filter-icon-2.png](./images/01-03-filter-icon-2.png "")) means that a filter is applied. When you hover over the heading of a filtered column, a screen tip displays the filter that has been applied to that column, such as "Equals a red cell color" or "Larger than 150".
+
+![01-04-autofilter.png](./images/01-04-autofilter.png "")
diff --git a/Documentation/markdown/Features/Autofilters/02-Setting-an-Autofilter.md b/Documentation/markdown/Features/Autofilters/02-Setting-an-Autofilter.md
new file mode 100644
index 0000000..49c8fa4
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/02-Setting-an-Autofilter.md
@@ -0,0 +1,24 @@
+# PHPExcel AutoFilter Reference
+
+
+## Setting an AutoFilter area on a worksheet
+
+To set an autoFilter on a range of cells.
+
+```php
+$objPHPExcel->getActiveSheet()->setAutoFilter('A1:E20');
+```
+
+The first row in an autofilter range will be the heading row, which displays the autoFilter dropdown icons. It is not part of the actual autoFiltered data. All subsequent rows are the autoFiltered data. So an AutoFilter range should always contain the heading row and one or more data rows (one data row is pretty meaningless, but PHPExcel won't actually stop you specifying a meaningless range: it's up to you as the developer to avoid such errors.
+
+If you want to set the whole worksheet as an autofilter region
+
+```php
+$objPHPExcel->getActiveSheet()->setAutoFilter(
+ $objPHPExcel->getActiveSheet()
+ ->calculateWorksheetDimension()
+);
+```
+
+This enables filtering, but does not actually apply any filters.
+
diff --git a/Documentation/markdown/Features/Autofilters/03-Autofilter-Expressions.md b/Documentation/markdown/Features/Autofilters/03-Autofilter-Expressions.md
new file mode 100644
index 0000000..fd65901
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/03-Autofilter-Expressions.md
@@ -0,0 +1,27 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+PHPEXcel 1.7.8 introduced the ability to actually create, read and write filter expressions; initially only for Excel2007 files, but later releases will extend this to other formats.
+
+To apply a filter expression to an autoFilter range, you first need to identify which column you're going to be applying this filter to.
+
+```php
+$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
+$columnFilter = $autoFilter->getColumn('C');
+```
+
+This returns an autoFilter column object, and you can then apply filter expressions to that column.
+
+There are a number of different types of autofilter expressions. The most commonly used are:
+
+ - Simple Filters
+ - DateGroup Filters
+ - Custom filters
+ - Dynamic Filters
+ - Top Ten Filters
+
+These different types are mutually exclusive within any single column. You should not mix the different types of filter in the same column. PHPExcel will not actively prevent you from doing this, but the results are unpredictable.
+
+Other filter expression types (such as cell colour filters) are not yet supported.
diff --git a/Documentation/markdown/Features/Autofilters/04-01-Autofilter-Expressions-Simple.md b/Documentation/markdown/Features/Autofilters/04-01-Autofilter-Expressions-Simple.md
new file mode 100644
index 0000000..ca229b8
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/04-01-Autofilter-Expressions-Simple.md
@@ -0,0 +1,52 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+### Simple filters
+
+In MS Excel, Simple Filters are a dropdown list of all values used in that column, and the user can select which ones they want to display and which ones they want to hide by ticking and unticking the checkboxes alongside each option. When the filter is applied, rows containing the checked entries will be displayed, rows that don't contain those values will be hidden.
+
+![04-01-simple-autofilter.png](./images/04-01-simple-autofilter.png "")
+
+To create a filter expression, we need to start by identifying the filter type. In this case, we're just going to specify that this filter is a standard filter.
+
+```php
+$columnFilter->setFilterType(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER
+);
+```
+
+Now we've identified the filter type, we can create a filter rule and set the filter values:
+
+When creating a simple filter in PHPExcel, you only need to specify the values for "checked" columns: you do this by creating a filter rule for each value.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'France'
+ );
+
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'Germany'
+ );
+```
+
+This creates two filter rules: the column will be filtered by values that match “France†OR “Germanyâ€. For Simple Filters, you can create as many rules as you want
+
+Simple filters are always a comparison match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
+
+#### Matching Blanks
+
+If you want to create a filter to select blank cells, you would use:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ ''
+ );
+```
diff --git a/Documentation/markdown/Features/Autofilters/04-02-Autofilter-Expressions-Dategroup.md b/Documentation/markdown/Features/Autofilters/04-02-Autofilter-Expressions-Dategroup.md
new file mode 100644
index 0000000..2b9015f
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/04-02-Autofilter-Expressions-Dategroup.md
@@ -0,0 +1,48 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+### DateGroup Filters
+
+In MS Excel, DateGroup filters provide a series of dropdown filter selectors for date values, so you can specify entire years, or months within a year, or individual days within each month.
+
+![04-02-dategroup-autofilter.png](./images/04-02-dategroup-autofilter.png "")
+
+DateGroup filters are still applied as a Standard Filter type.
+
+```php
+$columnFilter->setFilterType(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER
+);
+```
+
+Creating a dateGroup filter in PHPExcel, you specify the values for "checked" columns as an associative array of year. month, day, hour minute and second. To select a year and month, you need to create a DateGroup rule identifying the selected year and month:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ array(
+ 'year' => 2012,
+ 'month' => 1
+ )
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP
+ );
+```
+
+The key values for the associative array are:
+
+ - year
+ - month
+ - day
+ - hour
+ - minute
+ - second
+
+Like Standard filters, DateGroup filters are always a match of EQUALS, and multiple standard filters are always treated as being joined by an OR condition.
+
+Note that we alse specify a ruleType: to differentiate this from a standard filter, we explicitly set the Rule's Type to AUTOFILTER_RULETYPE_DATEGROUP. As with standard filters, we can create any number of DateGroup Filters.
+
diff --git a/Documentation/markdown/Features/Autofilters/04-03-Autofilter-Expressions-Custom.md b/Documentation/markdown/Features/Autofilters/04-03-Autofilter-Expressions-Custom.md
new file mode 100644
index 0000000..9ca3bd4
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/04-03-Autofilter-Expressions-Custom.md
@@ -0,0 +1,84 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+### Custom filters
+
+In MS Excel, Custom filters allow us to select more complex conditions using an operator as well as a value. Typical examples might be values that fall within a range (e.g. between -20 and +20), or text values with wildcards (e.g. beginning with the letter U). To handle this, they
+
+![04-03-custom-autofilter-1.png](./images/04-03-custom-autofilter-1.png "")
+
+![04-03-custom-autofilter-2.png](./images/04-03-custom-autofilter-2.png "")
+
+Custom filters are limited to 2 rules, and these can be joined using either an AND or an OR.
+
+We start by specifying a Filter type, this time a CUSTOMFILTER.
+
+```php
+$columnFilter->setFilterType(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER
+);
+```
+
+And then define our rules.
+
+The following shows a simple wildcard filter to show all column entries beginning with the letter 'U'.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'U*'
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+```
+
+MS Excel uses \* as a wildcard to match any number of characters, and ? as a wildcard to match a single character. 'U\*' equates to "begins with a 'U'"; '\*U' equates to "ends with a 'U'"; and '\*U\*' equates to "contains a 'U'"
+
+If you want to match explicitly against a \* or a ? character, you can escape it with a tilde (~), so ?~\*\* would explicitly match for a \* character as the second character in the cell value, followed by any number of other characters. The only other character that needs escaping is the ~ itself.
+
+To create a "between" condition, we need to define two rules:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ -20
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ 20
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER
+ );
+```
+
+We also set the rule type to CUSTOMFILTER.
+
+This defined two rules, filtering numbers that are >= -20 OR <= 20, so we also need to modify the join condition to reflect AND rather than OR.
+
+```php
+$columnFilter->setAndOr(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_ANDOR_AND
+);
+```
+
+The valid set of operators for Custom Filters are defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprise:
+
+ Operator Constant | Value |
+ ------------------------------------------|----------------------|
+ AUTOFILTER_COLUMN_RULE_EQUAL | 'equal' |
+ AUTOFILTER_COLUMN_RULE_NOTEQUAL | 'notEqual' |
+ AUTOFILTER_COLUMN_RULE_GREATERTHAN | 'greaterThan' |
+ AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL | 'greaterThanOrEqual' |
+ AUTOFILTER_COLUMN_RULE_LESSTHAN | 'lessThan' |
+ AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL | 'lessThanOrEqual' |
+
diff --git a/Documentation/markdown/Features/Autofilters/04-04-Autofilter-Expressions-Dynamic.md b/Documentation/markdown/Features/Autofilters/04-04-Autofilter-Expressions-Dynamic.md
new file mode 100644
index 0000000..f285e57
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/04-04-Autofilter-Expressions-Dynamic.md
@@ -0,0 +1,88 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+### Dynamic Filters
+
+Dynamic Filters are based on a dynamic comparison condition, where the value we're comparing against the cell values is variable, such as 'today'; or when we're testing against an aggregate of the cell data (e.g. 'aboveAverage'). Only a single dynamic filter can be applied to a column at a time.
+
+![04-04-dynamic-autofilter.png](./images/04-04-dynamic-autofilter.png "")
+
+Again, we start by specifying a Filter type, this time a DYNAMICFILTER.
+
+```php
+$columnFilter->setFilterType(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER
+);
+```
+
+When defining the rule for a dynamic filter, we don't define a value (we can simply set that to NULL) but we do specify the dynamic filter category.
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ NULL,
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER
+ );
+```
+
+We also set the rule type to DYNAMICFILTER.
+
+The valid set of dynamic filter categories is defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprises:
+
+ Operator Constant | Value |
+ -----------------------------------------|----------------|
+ AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY | 'yesterday' |
+ AUTOFILTER_RULETYPE_DYNAMIC_TODAY | 'today' |
+ AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW | 'tomorrow' |
+ AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE | 'yearToDate' |
+ AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR | 'thisYear' |
+ AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER | 'thisQuarter' |
+ AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH | 'thisMonth' |
+ AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK | 'thisWeek' |
+ AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR | 'lastYear' |
+ AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER | 'lastQuarter' |
+ AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH | 'lastMonth' |
+ AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK | 'lastWeek' |
+ AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR | 'nextYear' |
+ AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER | 'nextQuarter' |
+ AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH | 'nextMonth' |
+ AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK | 'nextWeek' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 | 'M1' |
+ AUTOFILTER_RULETYPE_DYNAMIC_JANUARY | 'M1' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 | 'M2' |
+ AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY | 'M2' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 | 'M3' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MARCH | 'M3' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 | 'M4' |
+ AUTOFILTER_RULETYPE_DYNAMIC_APRIL | 'M4' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 | 'M5' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MAY | 'M5' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 | 'M6' |
+ AUTOFILTER_RULETYPE_DYNAMIC_JUNE | 'M6' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 | 'M7' |
+ AUTOFILTER_RULETYPE_DYNAMIC_JULY | 'M7' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 | 'M8' |
+ AUTOFILTER_RULETYPE_DYNAMIC_AUGUST | 'M8' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 | 'M9' |
+ AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER | 'M9' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 | 'M10' |
+ AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER | 'M10' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 | 'M11' |
+ AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER | 'M11' |
+ AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 | 'M12' |
+ AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER | 'M12' |
+ AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 | 'Q1' |
+ AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 | 'Q2' |
+ AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 | 'Q3' |
+ AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 | 'Q4' |
+ AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE | 'aboveAverage' |
+ AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE | 'belowAverage' |
+
+We can only apply a single Dynamic Filter rule to a column at a time.
+
diff --git a/Documentation/markdown/Features/Autofilters/04-05-Autofilter-Expressions-Topten.md b/Documentation/markdown/Features/Autofilters/04-05-Autofilter-Expressions-Topten.md
new file mode 100644
index 0000000..ff36b0a
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/04-05-Autofilter-Expressions-Topten.md
@@ -0,0 +1,69 @@
+# PHPExcel AutoFilter Reference
+
+
+## Autofilter Expressions
+
+### Top Ten Filters
+
+Top Ten Filters are similar to Dynamic Filters in that they are based on a summarisation of the actual data values in the cells. However, unlike Dynamic Filters where you can only select a single option, Top Ten Filters allow you to select based on a number of criteria:
+
+![04-05-custom-topten-1.png](./images/04-05-topten-autofilter-1.png "")
+
+![04-05-custom-topten-2.png](./images/04-05-topten-autofilter-2.png "")
+
+You can identify whether you want the top (highest) or bottom (lowest) values.You can identify how many values you wish to select in the filterYou can identify whether this should be a percentage or a number of items.
+
+Like Dynamic Filters, only a single Top Ten filter can be applied to a column at a time.
+
+We start by specifying a Filter type, this time a DYNAMICFILTER.
+
+```php
+$columnFilter->setFilterType(
+ PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER
+);
+```
+
+Then we create the rule:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT,
+ 5,
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
+ );
+```
+
+This will filter the Top 5 percent of values in the column.
+
+To specify the lowest (bottom 2 values), we would specify a rule of:
+
+```php
+$columnFilter->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE,
+ 5,
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
+ )
+ ->setRuleType(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER
+ );
+```
+
+The option values for TopTen Filters top/bottom value/percent are all defined in the PHPExcel_Worksheet_AutoFilter_Column_Rule class, and comprise:
+
+ Operator Constant | Value |
+ ---------------------------------------|-------------|
+ AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE | 'byValue' |
+ AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT | 'byPercent' |
+
+and
+
+ Operator Constant | Value |
+ -------------------------------------|----------|
+ AUTOFILTER_COLUMN_RULE_TOPTEN_TOP | 'top' |
+ AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM | 'bottom' |
+
diff --git a/Documentation/markdown/Features/Autofilters/05-Executing-Autofilters.md b/Documentation/markdown/Features/Autofilters/05-Executing-Autofilters.md
new file mode 100644
index 0000000..852e1f4
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/05-Executing-Autofilters.md
@@ -0,0 +1,42 @@
+# PHPExcel AutoFilter Reference
+
+
+## Executing an AutoFilter
+
+When an autofilter is applied in MS Excel, it sets the row hidden/visible flags for each row of the autofilter area based on the selected criteria, so that only those rows that match the filter criteria are displayed.
+
+PHPExcel will not execute the equivalent function automatically when you set or change a filter expression, but only when the file is saved.
+
+### Applying the Filter
+
+If you wish to execute your filter from within a script, you need to do this manually. You can do this using the autofilters showHideRows() method.
+
+```php
+$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
+$autoFilter->showHideRows();
+```
+
+This will set all rows that match the filter criteria to visible, while hiding all other rows within the autofilter area.
+
+### Displaying Filtered Rows
+
+Simply looping through the rows in an autofilter area will still access ever row, whether it matches the filter criteria or not. To selectively access only the filtered rows, you need to test each row’s visibility settings.
+
+```php
+foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) {
+ if ($objPHPExcel->getActiveSheet()
+ ->getRowDimension($row->getRowIndex())->getVisible()) {
+ echo ' Row number - ' , $row->getRowIndex() , ' ';
+ echo $objPHPExcel->getActiveSheet()
+ ->getCell(
+ 'C'.$row->getRowIndex()
+ )
+ ->getValue(), ' ';
+ echo $objPHPExcel->getActiveSheet()
+ ->getCell(
+ 'D'.$row->getRowIndex()
+ )->getFormattedValue(), ' ';
+ echo EOL;
+ }
+}
+```
diff --git a/Documentation/markdown/Features/Autofilters/06-Autofilter-Sorting.md b/Documentation/markdown/Features/Autofilters/06-Autofilter-Sorting.md
new file mode 100644
index 0000000..23133b8
--- /dev/null
+++ b/Documentation/markdown/Features/Autofilters/06-Autofilter-Sorting.md
@@ -0,0 +1,7 @@
+# PHPExcel AutoFilter Reference
+
+
+## AutoFilter Sorting
+
+In MS Excel, Autofiltering also allows the rows to be sorted. This feature is ***not*** supported by PHPExcel.
+
diff --git a/Documentation/markdown/Features/Autofilters/images/01-01-autofilter.png b/Documentation/markdown/Features/Autofilters/images/01-01-autofilter.png
new file mode 100644
index 0000000..8b5c4fa
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/01-01-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/01-02-autofilter.png b/Documentation/markdown/Features/Autofilters/images/01-02-autofilter.png
new file mode 100644
index 0000000..a2d6c9b
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/01-02-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-1.png b/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-1.png
new file mode 100644
index 0000000..e5a7e7d
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-1.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-2.png b/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-2.png
new file mode 100644
index 0000000..1567245
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/01-03-filter-icon-2.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/01-04-autofilter.png b/Documentation/markdown/Features/Autofilters/images/01-04-autofilter.png
new file mode 100644
index 0000000..b88f4c4
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/01-04-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-01-simple-autofilter.png b/Documentation/markdown/Features/Autofilters/images/04-01-simple-autofilter.png
new file mode 100644
index 0000000..5dcc6a4
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-01-simple-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-02-dategroup-autofilter.png b/Documentation/markdown/Features/Autofilters/images/04-02-dategroup-autofilter.png
new file mode 100644
index 0000000..da1f089
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-02-dategroup-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-1.png b/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-1.png
new file mode 100644
index 0000000..0098d98
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-1.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-2.png b/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-2.png
new file mode 100644
index 0000000..96ff2cf
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-03-custom-autofilter-2.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-04-dynamic-autofilter.png b/Documentation/markdown/Features/Autofilters/images/04-04-dynamic-autofilter.png
new file mode 100644
index 0000000..6cb905d
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-04-dynamic-autofilter.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-1.png b/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-1.png
new file mode 100644
index 0000000..207e645
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-1.png differ
diff --git a/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-2.png b/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-2.png
new file mode 100644
index 0000000..4db5125
Binary files /dev/null and b/Documentation/markdown/Features/Autofilters/images/04-05-topten-autofilter-2.png differ
diff --git a/Documentation/markdown/Functions/FunctionListByCategory.md b/Documentation/markdown/Functions/FunctionListByCategory.md
new file mode 100644
index 0000000..4ceb1e4
--- /dev/null
+++ b/Documentation/markdown/Functions/FunctionListByCategory.md
@@ -0,0 +1,411 @@
+## CATEGORY_CUBE
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ CUBEKPIMEMBER | **\*\*\* Not yet Implemented**
+ CUBEMEMBER | **\*\*\* Not yet Implemented**
+ CUBEMEMBERPROPERTY | **\*\*\* Not yet Implemented**
+ CUBERANKEDMEMBER | **\*\*\* Not yet Implemented**
+ CUBESET | **\*\*\* Not yet Implemented**
+ CUBESETCOUNT | **\*\*\* Not yet Implemented**
+ CUBEVALUE | **\*\*\* Not yet Implemented**
+
+## CATEGORY_DATABASE
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ DAVERAGE | PHPExcel_Calculation_Database::DAVERAGE
+ DCOUNT | PHPExcel_Calculation_Database::DCOUNT
+ DCOUNTA | PHPExcel_Calculation_Database::DCOUNTA
+ DGET | PHPExcel_Calculation_Database::DGET
+ DMAX | PHPExcel_Calculation_Database::DMAX
+ DMIN | PHPExcel_Calculation_Database::DMIN
+ DPRODUCT | PHPExcel_Calculation_Database::DPRODUCT
+ DSTDEV | PHPExcel_Calculation_Database::DSTDEV
+ DSTDEVP | PHPExcel_Calculation_Database::DSTDEVP
+ DSUM | PHPExcel_Calculation_Database::DSUM
+ DVAR | PHPExcel_Calculation_Database::DVAR
+ DVARP | PHPExcel_Calculation_Database::DVARP
+
+## CATEGORY_DATE_AND_TIME
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ DATE | PHPExcel_Calculation_DateTime::DATE
+ DATEDIF | PHPExcel_Calculation_DateTime::DATEDIF
+ DATEVALUE | PHPExcel_Calculation_DateTime::DATEVALUE
+ DAY | PHPExcel_Calculation_DateTime::DAYOFMONTH
+ DAYS360 | PHPExcel_Calculation_DateTime::DAYS360
+ EDATE | PHPExcel_Calculation_DateTime::EDATE
+ EOMONTH | PHPExcel_Calculation_DateTime::EOMONTH
+ HOUR | PHPExcel_Calculation_DateTime::HOUROFDAY
+ MINUTE | PHPExcel_Calculation_DateTime::MINUTEOFHOUR
+ MONTH | PHPExcel_Calculation_DateTime::MONTHOFYEAR
+ NETWORKDAYS | PHPExcel_Calculation_DateTime::NETWORKDAYS
+ NOW | PHPExcel_Calculation_DateTime::DATETIMENOW
+ SECOND | PHPExcel_Calculation_DateTime::SECONDOFMINUTE
+ TIME | PHPExcel_Calculation_DateTime::TIME
+ TIMEVALUE | PHPExcel_Calculation_DateTime::TIMEVALUE
+ TODAY | PHPExcel_Calculation_DateTime::DATENOW
+ WEEKDAY | PHPExcel_Calculation_DateTime::DAYOFWEEK
+ WEEKNUM | PHPExcel_Calculation_DateTime::WEEKOFYEAR
+ WORKDAY | PHPExcel_Calculation_DateTime::WORKDAY
+ YEAR | PHPExcel_Calculation_DateTime::YEAR
+ YEARFRAC | PHPExcel_Calculation_DateTime::YEARFRAC
+
+## CATEGORY_ENGINEERING
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ BESSELI | PHPExcel_Calculation_Engineering::BESSELI
+ BESSELJ | PHPExcel_Calculation_Engineering::BESSELJ
+ BESSELK | PHPExcel_Calculation_Engineering::BESSELK
+ BESSELY | PHPExcel_Calculation_Engineering::BESSELY
+ BIN2DEC | PHPExcel_Calculation_Engineering::BINTODEC
+ BIN2HEX | PHPExcel_Calculation_Engineering::BINTOHEX
+ BIN2OCT | PHPExcel_Calculation_Engineering::BINTOOCT
+ COMPLEX | PHPExcel_Calculation_Engineering::COMPLEX
+ CONVERT | PHPExcel_Calculation_Engineering::CONVERTUOM
+ DEC2BIN | PHPExcel_Calculation_Engineering::DECTOBIN
+ DEC2HEX | PHPExcel_Calculation_Engineering::DECTOHEX
+ DEC2OCT | PHPExcel_Calculation_Engineering::DECTOOCT
+ DELTA | PHPExcel_Calculation_Engineering::DELTA
+ ERF | PHPExcel_Calculation_Engineering::ERF
+ ERFC | PHPExcel_Calculation_Engineering::ERFC
+ GESTEP | PHPExcel_Calculation_Engineering::GESTEP
+ HEX2BIN | PHPExcel_Calculation_Engineering::HEXTOBIN
+ HEX2DEC | PHPExcel_Calculation_Engineering::HEXTODEC
+ HEX2OCT | PHPExcel_Calculation_Engineering::HEXTOOCT
+ IMABS | PHPExcel_Calculation_Engineering::IMABS
+ IMAGINARY | PHPExcel_Calculation_Engineering::IMAGINARY
+ IMARGUMENT | PHPExcel_Calculation_Engineering::IMARGUMENT
+ IMCONJUGATE | PHPExcel_Calculation_Engineering::IMCONJUGATE
+ IMCOS | PHPExcel_Calculation_Engineering::IMCOS
+ IMDIV | PHPExcel_Calculation_Engineering::IMDIV
+ IMEXP | PHPExcel_Calculation_Engineering::IMEXP
+ IMLN | PHPExcel_Calculation_Engineering::IMLN
+ IMLOG10 | PHPExcel_Calculation_Engineering::IMLOG10
+ IMLOG2 | PHPExcel_Calculation_Engineering::IMLOG2
+ IMPOWER | PHPExcel_Calculation_Engineering::IMPOWER
+ IMPRODUCT | PHPExcel_Calculation_Engineering::IMPRODUCT
+ IMREAL | PHPExcel_Calculation_Engineering::IMREAL
+ IMSIN | PHPExcel_Calculation_Engineering::IMSIN
+ IMSQRT | PHPExcel_Calculation_Engineering::IMSQRT
+ IMSUB | PHPExcel_Calculation_Engineering::IMSUB
+ IMSUM | PHPExcel_Calculation_Engineering::IMSUM
+ OCT2BIN | PHPExcel_Calculation_Engineering::OCTTOBIN
+ OCT2DEC | PHPExcel_Calculation_Engineering::OCTTODEC
+ OCT2HEX | PHPExcel_Calculation_Engineering::OCTTOHEX
+
+## CATEGORY_FINANCIAL
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ ACCRINT | PHPExcel_Calculation_Financial::ACCRINT
+ ACCRINTM | PHPExcel_Calculation_Financial::ACCRINTM
+ AMORDEGRC | PHPExcel_Calculation_Financial::AMORDEGRC
+ AMORLINC | PHPExcel_Calculation_Financial::AMORLINC
+ COUPDAYBS | PHPExcel_Calculation_Financial::COUPDAYBS
+ COUPDAYS | PHPExcel_Calculation_Financial::COUPDAYS
+ COUPDAYSNC | PHPExcel_Calculation_Financial::COUPDAYSNC
+ COUPNCD | PHPExcel_Calculation_Financial::COUPNCD
+ COUPNUM | PHPExcel_Calculation_Financial::COUPNUM
+ COUPPCD | PHPExcel_Calculation_Financial::COUPPCD
+ CUMIPMT | PHPExcel_Calculation_Financial::CUMIPMT
+ CUMPRINC | PHPExcel_Calculation_Financial::CUMPRINC
+ DB | PHPExcel_Calculation_Financial::DB
+ DDB | PHPExcel_Calculation_Financial::DDB
+ DISC | PHPExcel_Calculation_Financial::DISC
+ DOLLARDE | PHPExcel_Calculation_Financial::DOLLARDE
+ DOLLARFR | PHPExcel_Calculation_Financial::DOLLARFR
+ DURATION | **\*\*\* Not yet Implemented**
+ EFFECT | PHPExcel_Calculation_Financial::EFFECT
+ FV | PHPExcel_Calculation_Financial::FV
+ FVSCHEDULE | PHPExcel_Calculation_Financial::FVSCHEDULE
+ INTRATE | PHPExcel_Calculation_Financial::INTRATE
+ IPMT | PHPExcel_Calculation_Financial::IPMT
+ IRR | PHPExcel_Calculation_Financial::IRR
+ ISPMT | PHPExcel_Calculation_Financial::ISPMT
+ MDURATION | **\*\*\* Not yet Implemented**
+ MIRR | PHPExcel_Calculation_Financial::MIRR
+ NOMINAL | PHPExcel_Calculation_Financial::NOMINAL
+ NPER | PHPExcel_Calculation_Financial::NPER
+ NPV | PHPExcel_Calculation_Financial::NPV
+ ODDFPRICE | **\*\*\* Not yet Implemented**
+ ODDFYIELD | **\*\*\* Not yet Implemented**
+ ODDLPRICE | **\*\*\* Not yet Implemented**
+ ODDLYIELD | **\*\*\* Not yet Implemented**
+ PMT | PHPExcel_Calculation_Financial::PMT
+ PPMT | PHPExcel_Calculation_Financial::PPMT
+ PRICE | PHPExcel_Calculation_Financial::PRICE
+ PRICEDISC | PHPExcel_Calculation_Financial::PRICEDISC
+ PRICEMAT | PHPExcel_Calculation_Financial::PRICEMAT
+ PV | PHPExcel_Calculation_Financial::PV
+ RATE | PHPExcel_Calculation_Financial::RATE
+ RECEIVED | PHPExcel_Calculation_Financial::RECEIVED
+ SLN | PHPExcel_Calculation_Financial::SLN
+ SYD | PHPExcel_Calculation_Financial::SYD
+ TBILLEQ | PHPExcel_Calculation_Financial::TBILLEQ
+ TBILLPRICE | PHPExcel_Calculation_Financial::TBILLPRICE
+ TBILLYIELD | PHPExcel_Calculation_Financial::TBILLYIELD
+ USDOLLAR | **\*\*\* Not yet Implemented**
+ VDB | **\*\*\* Not yet Implemented**
+ XIRR | PHPExcel_Calculation_Financial::XIRR
+ XNPV | PHPExcel_Calculation_Financial::XNPV
+ YIELD | **\*\*\* Not yet Implemented**
+ YIELDDISC | PHPExcel_Calculation_Financial::YIELDDISC
+ YIELDMAT | PHPExcel_Calculation_Financial::YIELDMAT
+
+## CATEGORY_INFORMATION
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ CELL | **\*\*\* Not yet Implemented**
+ ERROR.TYPE | PHPExcel_Calculation_Functions::ERROR_TYPE
+ INFO | **\*\*\* Not yet Implemented**
+ ISBLANK | PHPExcel_Calculation_Functions::IS_BLANK
+ ISERR | PHPExcel_Calculation_Functions::IS_ERR
+ ISERROR | PHPExcel_Calculation_Functions::IS_ERROR
+ ISEVEN | PHPExcel_Calculation_Functions::IS_EVEN
+ ISLOGICAL | PHPExcel_Calculation_Functions::IS_LOGICAL
+ ISNA | PHPExcel_Calculation_Functions::IS_NA
+ ISNONTEXT | PHPExcel_Calculation_Functions::IS_NONTEXT
+ ISNUMBER | PHPExcel_Calculation_Functions::IS_NUMBER
+ ISODD | PHPExcel_Calculation_Functions::IS_ODD
+ ISREF | **\*\*\* Not yet Implemented**
+ ISTEXT | PHPExcel_Calculation_Functions::IS_TEXT
+ N | PHPExcel_Calculation_Functions::N
+ NA | PHPExcel_Calculation_Functions::NA
+ TYPE | PHPExcel_Calculation_Functions::TYPE
+ VERSION | PHPExcel_Calculation_Functions::VERSION
+
+## CATEGORY_LOGICAL
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ AND | PHPExcel_Calculation_Logical::LOGICAL_AND
+ FALSE | PHPExcel_Calculation_Logical::FALSE
+ IF | PHPExcel_Calculation_Logical::STATEMENT_IF
+ IFERROR | PHPExcel_Calculation_Logical::IFERROR
+ NOT | PHPExcel_Calculation_Logical::NOT
+ OR | PHPExcel_Calculation_Logical::LOGICAL_OR
+ TRUE | PHPExcel_Calculation_Logical::TRUE
+
+## CATEGORY_LOOKUP_AND_REFERENCE
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ ADDRESS | PHPExcel_Calculation_LookupRef::CELL_ADDRESS
+ AREAS | **\*\*\* Not yet Implemented**
+ CHOOSE | PHPExcel_Calculation_LookupRef::CHOOSE
+ COLUMN | PHPExcel_Calculation_LookupRef::COLUMN
+ COLUMNS | PHPExcel_Calculation_LookupRef::COLUMNS
+ GETPIVOTDATA | **\*\*\* Not yet Implemented**
+ HLOOKUP | **\*\*\* Not yet Implemented**
+ HYPERLINK | PHPExcel_Calculation_LookupRef::HYPERLINK
+ INDEX | PHPExcel_Calculation_LookupRef::INDEX
+ INDIRECT | PHPExcel_Calculation_LookupRef::INDIRECT
+ LOOKUP | PHPExcel_Calculation_LookupRef::LOOKUP
+ MATCH | PHPExcel_Calculation_LookupRef::MATCH
+ OFFSET | PHPExcel_Calculation_LookupRef::OFFSET
+ ROW | PHPExcel_Calculation_LookupRef::ROW
+ ROWS | PHPExcel_Calculation_LookupRef::ROWS
+ RTD | **\*\*\* Not yet Implemented**
+ TRANSPOSE | PHPExcel_Calculation_LookupRef::TRANSPOSE
+ VLOOKUP | PHPExcel_Calculation_LookupRef::VLOOKUP
+
+## CATEGORY_MATH_AND_TRIG
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ ABS | abs
+ ACOS | acos
+ ACOSH | acosh
+ ASIN | asin
+ ASINH | asinh
+ ATAN | atan
+ ATAN2 | PHPExcel_Calculation_MathTrig::REVERSE_ATAN2
+ ATANH | atanh
+ CEILING | PHPExcel_Calculation_MathTrig::CEILING
+ COMBIN | PHPExcel_Calculation_MathTrig::COMBIN
+ COS | cos
+ COSH | cosh
+ DEGREES | rad2deg
+ EVEN | PHPExcel_Calculation_MathTrig::EVEN
+ EXP | exp
+ FACT | PHPExcel_Calculation_MathTrig::FACT
+ FACTDOUBLE | PHPExcel_Calculation_MathTrig::FACTDOUBLE
+ FLOOR | PHPExcel_Calculation_MathTrig::FLOOR
+ GCD | PHPExcel_Calculation_MathTrig::GCD
+ INT | PHPExcel_Calculation_MathTrig::INT
+ LCM | PHPExcel_Calculation_MathTrig::LCM
+ LN | log
+ LOG | PHPExcel_Calculation_MathTrig::LOG_BASE
+ LOG10 | log10
+ MDETERM | PHPExcel_Calculation_MathTrig::MDETERM
+ MINVERSE | PHPExcel_Calculation_MathTrig::MINVERSE
+ MMULT | PHPExcel_Calculation_MathTrig::MMULT
+ MOD | PHPExcel_Calculation_MathTrig::MOD
+ MROUND | PHPExcel_Calculation_MathTrig::MROUND
+ MULTINOMIAL | PHPExcel_Calculation_MathTrig::MULTINOMIAL
+ ODD | PHPExcel_Calculation_MathTrig::ODD
+ PI | pi
+ POWER | PHPExcel_Calculation_MathTrig::POWER
+ PRODUCT | PHPExcel_Calculation_MathTrig::PRODUCT
+ QUOTIENT | PHPExcel_Calculation_MathTrig::QUOTIENT
+ RADIANS | deg2rad
+ RAND | PHPExcel_Calculation_MathTrig::RAND
+ RANDBETWEEN | PHPExcel_Calculation_MathTrig::RAND
+ ROMAN | PHPExcel_Calculation_MathTrig::ROMAN
+ ROUND | round
+ ROUNDDOWN | PHPExcel_Calculation_MathTrig::ROUNDDOWN
+ ROUNDUP | PHPExcel_Calculation_MathTrig::ROUNDUP
+ SERIESSUM | PHPExcel_Calculation_MathTrig::SERIESSUM
+ SIGN | PHPExcel_Calculation_MathTrig::SIGN
+ SIN | sin
+ SINH | sinh
+ SQRT | sqrt
+ SQRTPI | PHPExcel_Calculation_MathTrig::SQRTPI
+ SUBTOTAL | PHPExcel_Calculation_MathTrig::SUBTOTAL
+ SUM | PHPExcel_Calculation_MathTrig::SUM
+ SUMIF | PHPExcel_Calculation_MathTrig::SUMIF
+ SUMIFS | **\*\*\* Not yet Implemented**
+ SUMPRODUCT | PHPExcel_Calculation_MathTrig::SUMPRODUCT
+ SUMSQ | PHPExcel_Calculation_MathTrig::SUMSQ
+ SUMX2MY2 | PHPExcel_Calculation_MathTrig::SUMX2MY2
+ SUMX2PY2 | PHPExcel_Calculation_MathTrig::SUMX2PY2
+ SUMXMY2 | PHPExcel_Calculation_MathTrig::SUMXMY2
+ TAN | tan
+ TANH | tanh
+ TRUNC | PHPExcel_Calculation_MathTrig::TRUNC
+
+## CATEGORY_STATISTICAL
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ AVEDEV | PHPExcel_Calculation_Statistical::AVEDEV
+ AVERAGE | PHPExcel_Calculation_Statistical::AVERAGE
+ AVERAGEA | PHPExcel_Calculation_Statistical::AVERAGEA
+ AVERAGEIF | PHPExcel_Calculation_Statistical::AVERAGEIF
+ AVERAGEIFS | **\*\*\* Not yet Implemented**
+ BETADIST | PHPExcel_Calculation_Statistical::BETADIST
+ BETAINV | PHPExcel_Calculation_Statistical::BETAINV
+ BINOMDIST | PHPExcel_Calculation_Statistical::BINOMDIST
+ CHIDIST | PHPExcel_Calculation_Statistical::CHIDIST
+ CHIINV | PHPExcel_Calculation_Statistical::CHIINV
+ CHITEST | **\*\*\* Not yet Implemented**
+ CONFIDENCE | PHPExcel_Calculation_Statistical::CONFIDENCE
+ CORREL | PHPExcel_Calculation_Statistical::CORREL
+ COUNT | PHPExcel_Calculation_Statistical::COUNT
+ COUNTA | PHPExcel_Calculation_Statistical::COUNTA
+ COUNTBLANK | PHPExcel_Calculation_Statistical::COUNTBLANK
+ COUNTIF | PHPExcel_Calculation_Statistical::COUNTIF
+ COUNTIFS | **\*\*\* Not yet Implemented**
+ COVAR | PHPExcel_Calculation_Statistical::COVAR
+ CRITBINOM | PHPExcel_Calculation_Statistical::CRITBINOM
+ DEVSQ | PHPExcel_Calculation_Statistical::DEVSQ
+ EXPONDIST | PHPExcel_Calculation_Statistical::EXPONDIST
+ FDIST | **\*\*\* Not yet Implemented**
+ FINV | **\*\*\* Not yet Implemented**
+ FISHER | PHPExcel_Calculation_Statistical::FISHER
+ FISHERINV | PHPExcel_Calculation_Statistical::FISHERINV
+ FORECAST | PHPExcel_Calculation_Statistical::FORECAST
+ FREQUENCY | **\*\*\* Not yet Implemented**
+ FTEST | **\*\*\* Not yet Implemented**
+ GAMMADIST | PHPExcel_Calculation_Statistical::GAMMADIST
+ GAMMAINV | PHPExcel_Calculation_Statistical::GAMMAINV
+ GAMMALN | PHPExcel_Calculation_Statistical::GAMMALN
+ GEOMEAN | PHPExcel_Calculation_Statistical::GEOMEAN
+ GROWTH | PHPExcel_Calculation_Statistical::GROWTH
+ HARMEAN | PHPExcel_Calculation_Statistical::HARMEAN
+ HYPGEOMDIST | PHPExcel_Calculation_Statistical::HYPGEOMDIST
+ INTERCEPT | PHPExcel_Calculation_Statistical::INTERCEPT
+ KURT | PHPExcel_Calculation_Statistical::KURT
+ LARGE | PHPExcel_Calculation_Statistical::LARGE
+ LINEST | PHPExcel_Calculation_Statistical::LINEST
+ LOGEST | PHPExcel_Calculation_Statistical::LOGEST
+ LOGINV | PHPExcel_Calculation_Statistical::LOGINV
+ LOGNORMDIST | PHPExcel_Calculation_Statistical::LOGNORMDIST
+ MAX | PHPExcel_Calculation_Statistical::MAX
+ MAXA | PHPExcel_Calculation_Statistical::MAXA
+ MAXIF | PHPExcel_Calculation_Statistical::MAXIF
+ MEDIAN | PHPExcel_Calculation_Statistical::MEDIAN
+ MEDIANIF | **\*\*\* Not yet Implemented**
+ MIN | PHPExcel_Calculation_Statistical::MIN
+ MINA | PHPExcel_Calculation_Statistical::MINA
+ MINIF | PHPExcel_Calculation_Statistical::MINIF
+ MODE | PHPExcel_Calculation_Statistical::MODE
+ NEGBINOMDIST | PHPExcel_Calculation_Statistical::NEGBINOMDIST
+ NORMDIST | PHPExcel_Calculation_Statistical::NORMDIST
+ NORMINV | PHPExcel_Calculation_Statistical::NORMINV
+ NORMSDIST | PHPExcel_Calculation_Statistical::NORMSDIST
+ NORMSINV | PHPExcel_Calculation_Statistical::NORMSINV
+ PEARSON | PHPExcel_Calculation_Statistical::CORREL
+ PERCENTILE | PHPExcel_Calculation_Statistical::PERCENTILE
+ PERCENTRANK | PHPExcel_Calculation_Statistical::PERCENTRANK
+ PERMUT | PHPExcel_Calculation_Statistical::PERMUT
+ POISSON | PHPExcel_Calculation_Statistical::POISSON
+ PROB | **\*\*\* Not yet Implemented**
+ QUARTILE | PHPExcel_Calculation_Statistical::QUARTILE
+ RANK | PHPExcel_Calculation_Statistical::RANK
+ RSQ | PHPExcel_Calculation_Statistical::RSQ
+ SKEW | PHPExcel_Calculation_Statistical::SKEW
+ SLOPE | PHPExcel_Calculation_Statistical::SLOPE
+ SMALL | PHPExcel_Calculation_Statistical::SMALL
+ STANDARDIZE | PHPExcel_Calculation_Statistical::STANDARDIZE
+ STDEV | PHPExcel_Calculation_Statistical::STDEV
+ STDEVA | PHPExcel_Calculation_Statistical::STDEVA
+ STDEVP | PHPExcel_Calculation_Statistical::STDEVP
+ STDEVPA | PHPExcel_Calculation_Statistical::STDEVPA
+ STEYX | PHPExcel_Calculation_Statistical::STEYX
+ TDIST | PHPExcel_Calculation_Statistical::TDIST
+ TINV | PHPExcel_Calculation_Statistical::TINV
+ TREND | PHPExcel_Calculation_Statistical::TREND
+ TRIMMEAN | PHPExcel_Calculation_Statistical::TRIMMEAN
+ TTEST | **\*\*\* Not yet Implemented**
+ VAR | PHPExcel_Calculation_Statistical::VARFunc
+ VARA | PHPExcel_Calculation_Statistical::VARA
+ VARP | PHPExcel_Calculation_Statistical::VARP
+ VARPA | PHPExcel_Calculation_Statistical::VARPA
+ WEIBULL | PHPExcel_Calculation_Statistical::WEIBULL
+ ZTEST | PHPExcel_Calculation_Statistical::ZTEST
+
+## CATEGORY_TEXT_AND_DATA
+
+ Excel Function | PHPExcel Function
+ --------------------|-------------------------------------------
+ ASC | **\*\*\* Not yet Implemented**
+ BAHTTEXT | **\*\*\* Not yet Implemented**
+ CHAR | PHPExcel_Calculation_TextData::CHARACTER
+ CLEAN | PHPExcel_Calculation_TextData::TRIMNONPRINTABLE
+ CODE | PHPExcel_Calculation_TextData::ASCIICODE
+ CONCATENATE | PHPExcel_Calculation_TextData::CONCATENATE
+ DOLLAR | PHPExcel_Calculation_TextData::DOLLAR
+ EXACT | **\*\*\* Not yet Implemented**
+ FIND | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FINDB | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FIXED | PHPExcel_Calculation_TextData::FIXEDFORMAT
+ JIS | **\*\*\* Not yet Implemented**
+ LEFT | PHPExcel_Calculation_TextData::LEFT
+ LEFTB | PHPExcel_Calculation_TextData::LEFT
+ LEN | PHPExcel_Calculation_TextData::STRINGLENGTH
+ LENB | PHPExcel_Calculation_TextData::STRINGLENGTH
+ LOWER | PHPExcel_Calculation_TextData::LOWERCASE
+ MID | PHPExcel_Calculation_TextData::MID
+ MIDB | PHPExcel_Calculation_TextData::MID
+ PHONETIC | **\*\*\* Not yet Implemented**
+ PROPER | PHPExcel_Calculation_TextData::PROPERCASE
+ REPLACE | PHPExcel_Calculation_TextData::REPLACE
+ REPLACEB | PHPExcel_Calculation_TextData::REPLACE
+ REPT | str_repeat
+ RIGHT | PHPExcel_Calculation_TextData::RIGHT
+ RIGHTB | PHPExcel_Calculation_TextData::RIGHT
+ SEARCH | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SEARCHB | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SUBSTITUTE | PHPExcel_Calculation_TextData::SUBSTITUTE
+ T | PHPExcel_Calculation_TextData::RETURNSTRING
+ TEXT | PHPExcel_Calculation_TextData::TEXTFORMAT
+ TRIM | PHPExcel_Calculation_TextData::TRIMSPACES
+ UPPER | PHPExcel_Calculation_TextData::UPPERCASE
+ VALUE | **\*\*\* Not yet Implemented**
+
diff --git a/Documentation/markdown/Functions/FunctionListByName.md b/Documentation/markdown/Functions/FunctionListByName.md
new file mode 100644
index 0000000..b69e454
--- /dev/null
+++ b/Documentation/markdown/Functions/FunctionListByName.md
@@ -0,0 +1,485 @@
+#A
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ ABS | CATEGORY_MATH_AND_TRIG | abs
+ ACCRINT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::ACCRINT
+ ACCRINTM | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::ACCRINTM
+ ACOS | CATEGORY_MATH_AND_TRIG | acos
+ ACOSH | CATEGORY_MATH_AND_TRIG | acosh
+ ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::CELL_ADDRESS
+ AMORDEGRC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::AMORDEGRC
+ AMORLINC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::AMORLINC
+ AND | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::LOGICAL_AND
+ AREAS | CATEGORY_LOOKUP_AND_REFERENCE | **\*\*\* Not yet Implemented**
+ ASC | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+ ASIN | CATEGORY_MATH_AND_TRIG | asin
+ ASINH | CATEGORY_MATH_AND_TRIG | asinh
+ ATAN | CATEGORY_MATH_AND_TRIG | atan
+ ATAN2 | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::REVERSE_ATAN2
+ ATANH | CATEGORY_MATH_AND_TRIG | atanh
+ AVEDEV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::AVEDEV
+ AVERAGE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::AVERAGE
+ AVERAGEA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::AVERAGEA
+ AVERAGEIF | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::AVERAGEIF
+ AVERAGEIFS | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+
+#B
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ BAHTTEXT | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+ BESSELI | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BESSELI
+ BESSELJ | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BESSELJ
+ BESSELK | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BESSELK
+ BESSELY | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BESSELY
+ BETADIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::BETADIST
+ BETAINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::BETAINV
+ BIN2DEC | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BINTODEC
+ BIN2HEX | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BINTOHEX
+ BIN2OCT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::BINTOOCT
+ BINOMDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::BINOMDIST
+
+#C
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ CEILING | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::CEILING
+ CELL | CATEGORY_INFORMATION | **\*\*\* Not yet Implemented**
+ CHAR | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::CHARACTER
+ CHIDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CHIDIST
+ CHIINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CHIINV
+ CHITEST | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ CHOOSE | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::CHOOSE
+ CLEAN | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::TRIMNONPRINTABLE
+ CODE | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::ASCIICODE
+ COLUMN | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::COLUMN
+ COLUMNS | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::COLUMNS
+ COMBIN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::COMBIN
+ COMPLEX | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::COMPLEX
+ CONCATENATE | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::CONCATENATE
+ CONFIDENCE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CONFIDENCE
+ CONVERT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::CONVERTUOM
+ CORREL | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CORREL
+ COS | CATEGORY_MATH_AND_TRIG | cos
+ COSH | CATEGORY_MATH_AND_TRIG | cosh
+ COUNT | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::COUNT
+ COUNTA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::COUNTA
+ COUNTBLANK | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::COUNTBLANK
+ COUNTIF | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::COUNTIF
+ COUNTIFS | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ COUPDAYBS | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPDAYBS
+ COUPDAYS | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPDAYS
+ COUPDAYSNC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPDAYSNC
+ COUPNCD | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPNCD
+ COUPNUM | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPNUM
+ COUPPCD | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::COUPPCD
+ COVAR | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::COVAR
+ CRITBINOM | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CRITBINOM
+ CUBEKPIMEMBER | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBEMEMBER | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBEMEMBERPROPERTY | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBERANKEDMEMBER | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBESET | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBESETCOUNT | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUBEVALUE | CATEGORY_CUBE | **\*\*\* Not yet Implemented**
+ CUMIPMT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::CUMIPMT
+ CUMPRINC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::CUMPRINC
+
+#D
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ DATE | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DATE
+ DATEDIF | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DATEDIF
+ DATEVALUE | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DATEVALUE
+ DAVERAGE | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DAVERAGE
+ DAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DAYOFMONTH
+ DAYS360 | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DAYS360
+ DB | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::DB
+ DCOUNT | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DCOUNT
+ DCOUNTA | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DCOUNTA
+ DDB | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::DDB
+ DEC2BIN | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::DECTOBIN
+ DEC2HEX | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::DECTOHEX
+ DEC2OCT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::DECTOOCT
+ DEGREES | CATEGORY_MATH_AND_TRIG | rad2deg
+ DELTA | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::DELTA
+ DEVSQ | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::DEVSQ
+ DGET | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DGET
+ DISC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::DISC
+ DMAX | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DMAX
+ DMIN | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DMIN
+ DOLLAR | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::DOLLAR
+ DOLLARDE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::DOLLARDE
+ DOLLARFR | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::DOLLARFR
+ DPRODUCT | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DPRODUCT
+ DSTDEV | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DSTDEV
+ DSTDEVP | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DSTDEVP
+ DSUM | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DSUM
+ DURATION | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ DVAR | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DVAR
+ DVARP | CATEGORY_DATABASE | PHPExcel_Calculation_Database::DVARP
+
+#E
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ EDATE | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::EDATE
+ EFFECT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::EFFECT
+ EOMONTH | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::EOMONTH
+ ERF | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::ERF
+ ERFC | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::ERFC
+ ERROR.TYPE | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::ERROR_TYPE
+ EVEN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::EVEN
+ EXACT | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+ EXP | CATEGORY_MATH_AND_TRIG | exp
+ EXPONDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::EXPONDIST
+
+#F
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ FACT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::FACT
+ FACTDOUBLE | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::FACTDOUBLE
+ FALSE | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::FALSE
+ FDIST | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ FIND | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FINDB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::SEARCHSENSITIVE
+ FINV | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ FISHER | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::FISHER
+ FISHERINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::FISHERINV
+ FIXED | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::FIXEDFORMAT
+ FLOOR | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::FLOOR
+ FORECAST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::FORECAST
+ FREQUENCY | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ FTEST | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ FV | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::FV
+ FVSCHEDULE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::FVSCHEDULE
+
+#G
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ GAMMADIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::GAMMADIST
+ GAMMAINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::GAMMAINV
+ GAMMALN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::GAMMALN
+ GCD | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::GCD
+ GEOMEAN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::GEOMEAN
+ GESTEP | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::GESTEP
+ GETPIVOTDATA | CATEGORY_LOOKUP_AND_REFERENCE | **\*\*\* Not yet Implemented**
+ GROWTH | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::GROWTH
+
+#H
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ HARMEAN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::HARMEAN
+ HEX2BIN | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::HEXTOBIN
+ HEX2DEC | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::HEXTODEC
+ HEX2OCT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::HEXTOOCT
+ HLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | **\*\*\* Not yet Implemented**
+ HOUR | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::HOUROFDAY
+ HYPERLINK | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::HYPERLINK
+ HYPGEOMDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::HYPGEOMDIST
+
+#I
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ IF | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::STATEMENT_IF
+ IFERROR | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::IFERROR
+ IMABS | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMABS
+ IMAGINARY | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMAGINARY
+ IMARGUMENT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMARGUMENT
+ IMCONJUGATE | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMCONJUGATE
+ IMCOS | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMCOS
+ IMDIV | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMDIV
+ IMEXP | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMEXP
+ IMLN | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMLN
+ IMLOG10 | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMLOG10
+ IMLOG2 | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMLOG2
+ IMPOWER | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMPOWER
+ IMPRODUCT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMPRODUCT
+ IMREAL | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMREAL
+ IMSIN | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMSIN
+ IMSQRT | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMSQRT
+ IMSUB | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMSUB
+ IMSUM | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::IMSUM
+ INDEX | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::INDEX
+ INDIRECT | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::INDIRECT
+ INFO | CATEGORY_INFORMATION | **\*\*\* Not yet Implemented**
+ INT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::INT
+ INTERCEPT | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::INTERCEPT
+ INTRATE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::INTRATE
+ IPMT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::IPMT
+ IRR | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::IRR
+ ISBLANK | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_BLANK
+ ISERR | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_ERR
+ ISERROR | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_ERROR
+ ISEVEN | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_EVEN
+ ISLOGICAL | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_LOGICAL
+ ISNA | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_NA
+ ISNONTEXT | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_NONTEXT
+ ISNUMBER | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_NUMBER
+ ISODD | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_ODD
+ ISPMT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::ISPMT
+ ISREF | CATEGORY_INFORMATION | **\*\*\* Not yet Implemented**
+ ISTEXT | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::IS_TEXT
+
+#J
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ JIS | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+
+#K
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ KURT | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::KURT
+
+#L
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ LARGE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::LARGE
+ LCM | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::LCM
+ LEFT | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::LEFT
+ LEFTB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::LEFT
+ LEN | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::STRINGLENGTH
+ LENB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::STRINGLENGTH
+ LINEST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::LINEST
+ LN | CATEGORY_MATH_AND_TRIG | log
+ LOG | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::LOG_BASE
+ LOG10 | CATEGORY_MATH_AND_TRIG | log10
+ LOGEST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::LOGEST
+ LOGINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::LOGINV
+ LOGNORMDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::LOGNORMDIST
+ LOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::LOOKUP
+ LOWER | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::LOWERCASE
+
+#M
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ MATCH | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::MATCH
+ MAX | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MAX
+ MAXA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MAXA
+ MAXIF | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MAXIF
+ MDETERM | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MDETERM
+ MDURATION | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ MEDIAN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MEDIAN
+ MEDIANIF | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ MID | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::MID
+ MIDB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::MID
+ MIN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MIN
+ MINA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MINA
+ MINIF | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MINIF
+ MINUTE | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::MINUTEOFHOUR
+ MINVERSE | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MINVERSE
+ MIRR | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::MIRR
+ MMULT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MMULT
+ MOD | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MOD
+ MODE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::MODE
+ MONTH | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::MONTHOFYEAR
+ MROUND | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MROUND
+ MULTINOMIAL | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::MULTINOMIAL
+
+#N
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ N | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::N
+ NA | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::NA
+ NEGBINOMDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::NEGBINOMDIST
+ NETWORKDAYS | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::NETWORKDAYS
+ NOMINAL | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::NOMINAL
+ NORMDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::NORMDIST
+ NORMINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::NORMINV
+ NORMSDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::NORMSDIST
+ NORMSINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::NORMSINV
+ NOT | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::NOT
+ NOW | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DATETIMENOW
+ NPER | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::NPER
+ NPV | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::NPV
+
+#O
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ OCT2BIN | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::OCTTOBIN
+ OCT2DEC | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::OCTTODEC
+ OCT2HEX | CATEGORY_ENGINEERING | PHPExcel_Calculation_Engineering::OCTTOHEX
+ ODD | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::ODD
+ ODDFPRICE | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ ODDFYIELD | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ ODDLPRICE | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ ODDLYIELD | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ OFFSET | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::OFFSET
+ OR | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::LOGICAL_OR
+
+#P
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ PEARSON | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::CORREL
+ PERCENTILE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::PERCENTILE
+ PERCENTRANK | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::PERCENTRANK
+ PERMUT | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::PERMUT
+ PHONETIC | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+ PI | CATEGORY_MATH_AND_TRIG | pi
+ PMT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PMT
+ POISSON | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::POISSON
+ POWER | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::POWER
+ PPMT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PPMT
+ PRICE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PRICE
+ PRICEDISC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PRICEDISC
+ PRICEMAT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PRICEMAT
+ PROB | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ PRODUCT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::PRODUCT
+ PROPER | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::PROPERCASE
+ PV | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::PV
+
+#Q
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ QUARTILE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::QUARTILE
+ QUOTIENT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::QUOTIENT
+
+#R
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ RADIANS | CATEGORY_MATH_AND_TRIG | deg2rad
+ RAND | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::RAND
+ RANDBETWEEN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::RAND
+ RANK | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::RANK
+ RATE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::RATE
+ RECEIVED | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::RECEIVED
+ REPLACE | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::REPLACE
+ REPLACEB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::REPLACE
+ REPT | CATEGORY_TEXT_AND_DATA | str_repeat
+ RIGHT | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::RIGHT
+ RIGHTB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::RIGHT
+ ROMAN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::ROMAN
+ ROUND | CATEGORY_MATH_AND_TRIG | round
+ ROUNDDOWN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::ROUNDDOWN
+ ROUNDUP | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::ROUNDUP
+ ROW | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::ROW
+ ROWS | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::ROWS
+ RSQ | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::RSQ
+ RTD | CATEGORY_LOOKUP_AND_REFERENCE | **\*\*\* Not yet Implemented**
+
+#S
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ SEARCH | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SEARCHB | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::SEARCHINSENSITIVE
+ SECOND | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::SECONDOFMINUTE
+ SERIESSUM | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SERIESSUM
+ SIGN | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SIGN
+ SIN | CATEGORY_MATH_AND_TRIG | sin
+ SINH | CATEGORY_MATH_AND_TRIG | sinh
+ SKEW | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::SKEW
+ SLN | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::SLN
+ SLOPE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::SLOPE
+ SMALL | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::SMALL
+ SQRT | CATEGORY_MATH_AND_TRIG | sqrt
+ SQRTPI | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SQRTPI
+ STANDARDIZE | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STANDARDIZE
+ STDEV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STDEV
+ STDEVA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STDEVA
+ STDEVP | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STDEVP
+ STDEVPA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STDEVPA
+ STEYX | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::STEYX
+ SUBSTITUTE | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::SUBSTITUTE
+ SUBTOTAL | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUBTOTAL
+ SUM | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUM
+ SUMIF | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMIF
+ SUMIFS | CATEGORY_MATH_AND_TRIG | **\*\*\* Not yet Implemented**
+ SUMPRODUCT | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMPRODUCT
+ SUMSQ | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMSQ
+ SUMX2MY2 | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMX2MY2
+ SUMX2PY2 | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMX2PY2
+ SUMXMY2 | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::SUMXMY2
+ SYD | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::SYD
+
+#T
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ T | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::RETURNSTRING
+ TAN | CATEGORY_MATH_AND_TRIG | tan
+ TANH | CATEGORY_MATH_AND_TRIG | tanh
+ TBILLEQ | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::TBILLEQ
+ TBILLPRICE | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::TBILLPRICE
+ TBILLYIELD | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::TBILLYIELD
+ TDIST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::TDIST
+ TEXT | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::TEXTFORMAT
+ TIME | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::TIME
+ TIMEVALUE | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::TIMEVALUE
+ TINV | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::TINV
+ TODAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DATENOW
+ TRANSPOSE | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::TRANSPOSE
+ TREND | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::TREND
+ TRIM | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::TRIMSPACES
+ TRIMMEAN | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::TRIMMEAN
+ TRUE | CATEGORY_LOGICAL | PHPExcel_Calculation_Logical::TRUE
+ TRUNC | CATEGORY_MATH_AND_TRIG | PHPExcel_Calculation_MathTrig::TRUNC
+ TTEST | CATEGORY_STATISTICAL | **\*\*\* Not yet Implemented**
+ TYPE | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::TYPE
+
+#U
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ UPPER | CATEGORY_TEXT_AND_DATA | PHPExcel_Calculation_TextData::UPPERCASE
+ USDOLLAR | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+
+#V
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ VALUE | CATEGORY_TEXT_AND_DATA | **\*\*\* Not yet Implemented**
+ VAR | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::VARFunc
+ VARA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::VARA
+ VARP | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::VARP
+ VARPA | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::VARPA
+ VDB | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ VERSION | CATEGORY_INFORMATION | PHPExcel_Calculation_Functions::VERSION
+ VLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | PHPExcel_Calculation_LookupRef::VLOOKUP
+
+#W
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ WEEKDAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::DAYOFWEEK
+ WEEKNUM | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::WEEKOFYEAR
+ WEIBULL | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::WEIBULL
+ WORKDAY | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::WORKDAY
+
+#X
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ XIRR | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::XIRR
+ XNPV | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::XNPV
+
+#Y
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ YEAR | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::YEAR
+ YEARFRAC | CATEGORY_DATE_AND_TIME | PHPExcel_Calculation_DateTime::YEARFRAC
+ YIELD | CATEGORY_FINANCIAL | **\*\*\* Not yet Implemented**
+ YIELDDISC | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::YIELDDISC
+ YIELDMAT | CATEGORY_FINANCIAL | PHPExcel_Calculation_Financial::YIELDMAT
+
+#Z
+
+ Excel Function | Category | PHPExcel Function
+ --------------------|--------------------------------|-------------------------------------------
+ ZTEST | CATEGORY_STATISTICAL | PHPExcel_Calculation_Statistical::ZTEST
diff --git a/Documentation/markdown/Overview/01-Getting-Started.md b/Documentation/markdown/Overview/01-Getting-Started.md
new file mode 100644
index 0000000..262f1ea
--- /dev/null
+++ b/Documentation/markdown/Overview/01-Getting-Started.md
@@ -0,0 +1,179 @@
+# PHPExcel Developer Documentation
+
+
+## Prerequisites, Installation, FAQ and Links
+
+### Software requirements
+
+The following software is required to develop using PHPExcel:
+
+ - PHP version 5.2.0 or newer
+ - PHP extension php_zip enabled [^phpzip_footnote]
+ - PHP extension php_xml enabled
+ - PHP extension php_gd2 enabled (if not compiled in)
+
+
+### Installation instructions
+
+Installation is quite easy: copy the contents of the Classes folder to any location within your application source directories.
+
+*Example:*
+
+If your web root folder is /var/www/ you may want to create a subfolder called /var/www/Classes/ and copy the files into that folder so you end up with files:
+
+ /var/www/Classes/PHPExcel.php
+ /var/www/Classes/PHPExcel/Calculation.php
+ /var/www/Classes/PHPExcel/Cell.php
+ ...
+
+
+### Getting started
+
+A good way to get started is to run some of the tests included in the download.
+Copy the "Examples" folder next to your "Classes" folder from above so you end up with:
+
+ /var/www/Examples/01simple.php
+ /var/www/Examples/02types.php
+ ...
+
+Start running the tests by pointing your browser to the test scripts:
+
+http://example.com/Tests/01simple.php
+http://example.com/Tests/02types.php
+...
+
+**Note:** It may be necessary to modify the include/require statements at the beginning of each of the test scripts if your "Classes" folder from above is named differently.
+
+
+### Useful links and tools
+
+There are some links and tools which are very useful when developing using PHPExcel. Please refer to the [PHPExcel CodePlex pages][2] for an update version of the list below.
+
+#### OpenXML / SpreadsheetML
+
+ - __File format documentation__
+[http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm][3]
+ - __OpenXML Explained e-book__
+[http://openxmldeveloper.org/articles/1970.aspx][4]
+ - __Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats__
+[http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en][5]
+ - __OpenXML Package Explorer__
+[http://www.codeplex.com/PackageExplorer/][6]
+
+
+### Frequently asked questions
+
+The up-to-date F.A.Q. page for PHPExcel can be found on [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements][7].
+
+##### There seems to be a problem with character encoding...
+
+It is necessary to use UTF-8 encoding for all texts in PHPExcel. If the script uses different encoding then you can convert those texts with PHP's iconv() or mb_convert_encoding() functions.
+
+##### PHP complains about ZipArchive not being found
+
+Make sure you meet all requirements, especially php_zip extension should be enabled.
+
+The ZipArchive class is only required when reading or writing formats that use Zip compression (Excel2007 and OOCalc). Since version 1.7.6 the PCLZip library has been bundled with PHPExcel as an alternative to the ZipArchive class.
+
+This can be enabled by calling:
+```php
+PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
+```
+*before* calling the save method of the Excel2007 Writer.
+
+You can revert to using ZipArchive by calling:
+```php
+PHPExcel_Settings::setZipClass(PHPExcel_Settings::ZIPARCHIVE);
+```
+At present, this only allows you to write Excel2007 files without the need for ZipArchive (not to read Excel2007 or OOCalc)
+
+##### Excel 2007 cannot open the file generated by PHPExcel_Writer_2007 on Windows
+
+"Excel found unreadable content in '*.xlsx'. Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes."
+
+Some older versions of the 5.2.x php_zip extension on Windows contain an error when creating ZIP files. The version that can be found on [http://snaps.php.net/win32/php5.2-win32-latest.zip][8] should work at all times.
+
+Alternatively, upgrading to at least PHP 5.2.9 should solve the problem.
+
+If you can't locate a clean copy of ZipArchive, then you can use the PCLZip library as an alternative when writing Excel2007 files, as described above.
+
+##### Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate yyy bytes) in zzz on line aaa
+
+PHPExcel holds an "in memory" representation of a spreadsheet, so it is susceptible to PHP's memory limitations. The memory made available to PHP can be increased by editing the value of the memory_limit directive in your php.ini file, or by using ini_set('memory_limit', '128M') within your code (ISP permitting).
+
+Some Readers and Writers are faster than others, and they also use differing amounts of memory. You can find some indication of the relative performance and memory usage for the different Readers and Writers, over the different versions of PHPExcel, on the [discussion board][9].
+
+If you've already increased memory to a maximum, or can't change your memory limit, then [this discussion][10] on the board describes some of the methods that can be applied to reduce the memory usage of your scripts using PHPExcel.
+
+##### Protection on my worksheet is not working?
+
+When you make use of any of the worksheet protection features (e.g. cell range protection, prohibiting deleting rows, ...), make sure you enable worksheet security. This can for example be done like this:
+```php
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
+```
+
+##### Feature X is not working with PHPExcel_Reader_Y / PHPExcel_Writer_Z
+
+Not all features of PHPExcel are implemented in all of the Reader / Writer classes. This is mostly due to underlying libraries not supporting a specific feature or not having implemented a specific feature.
+
+For example autofilter is not implemented in PEAR Spreadsheet_Excel_writer, which is the base of our Excel5 writer.
+
+We are slowly building up a list of features, together with the different readers and writers that support them, in the "Functionality Cross-Reference.xls" file in the /Documentation folder.
+
+##### Formulas don't seem to be calculated in Excel2003 using compatibility pack?
+
+This is normal behaviour of the compatibility pack, Excel2007 displays this correctly. Use PHPExcel_Writer_Excel5 if you really need calculated values, or force recalculation in Excel2003.
+
+##### Setting column width is not 100% accurate
+
+Trying to set column width, I experience one problem. When I open the file in Excel, the actual width is 0.71 less than it should be.
+
+The short answer is that PHPExcel uses a measure where padding is included. See section: "Setting a column's width" for more details.
+
+##### How do I use PHPExcel with my framework
+
+ - There are some instructions for using PHPExcel with Joomla on the [Joomla message board][11]
+ - A page of advice on using [PHPExcel in the Yii framework][12]
+ - [The Bakery][13] has some helper classes for reading and writing with PHPExcel within CakePHP
+ - Integrating [PHPExcel into Kohana 3][14] and [?????????? PHPExcel ? Kohana Framework][15]
+ - Using [PHPExcel with Typo3][16]
+
+##### Joomla Autoloader interferes with PHPExcel Autoloader
+
+Thanks to peterrlynch for the following advice on resolving issues between the [PHPExcel autoloader and Joomla Autoloader][17]
+
+
+#### Tutorials
+
+ - __English PHPExcel tutorial__
+ [http://openxmldeveloper.org][18]
+ - __French PHPExcel tutorial__
+ [http://g-ernaelsten.developpez.com/tutoriels/excel2007/][19]
+ - __A Japanese-language introduction to PHPExcel__
+ [http://journal.mycom.co.jp/articles/2009/03/06/phpexcel/index.html][21]
+
+
+ [2]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Documents&referringTitle=Home
+ [3]: http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm
+ [4]: http://openxmldeveloper.org/articles/1970.aspx
+ [5]: http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang=en
+ [6]: http://www.codeplex.com/PackageExplorer/
+ [7]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle=Requirements
+ [8]: http://snaps.php.net/win32/php5.2-win32-latest.zip
+ [9]: http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=234150
+ [10]: http://phpexcel.codeplex.com/Thread/View.aspx?ThreadId=242712
+ [11]: http://http:/forum.joomla.org/viewtopic.php?f=304&t=433060
+ [12]: http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii/
+ [13]: http://bakery.cakephp.org/articles/melgior/2010/01/26/simple-excel-spreadsheet-helper
+ [14]: http://www.flynsarmy.com/2010/07/phpexcel-module-for-kohana-3/
+ [15]: http://szpargalki.blogspot.com/2011/02/phpexcel-kohana-framework.html
+ [16]: http://typo3.org/documentation/document-library/extension-manuals/phpexcel_library/1.1.1/view/toc/0/
+ [17]: http://phpexcel.codeplex.com/discussions/211925
+ [18]: http://openxmldeveloper.org
+ [19]: http://g-ernaelsten.developpez.com/tutoriels/excel2007/
+ [20]: http://www.web-junior.net/sozdanie-excel-fajjlov-s-pomoshhyu-phpexcel/
+ [21]: http://journal.mycom.co.jp/articles/2009/03/06/phpexcel/index.html
+
+
+[^phpzip_footnote]: __php_zip__ is only needed by __PHPExcel_Reader_Excel2007__, __PHPExcel_Writer_Excel2007__ and __PHPExcel_Reader_OOCalc__. In other words, if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension, but otherwise not.
You can remove this dependency for writing Excel2007 files (though not yet for reading) by using the PCLZip library that is bundled with PHPExcel. See the FAQ section of this document for details about this. PCLZip does have a dependency on PHP's zlib extension being enabled.
+
diff --git a/Documentation/markdown/Overview/02-Architecture.md b/Documentation/markdown/Overview/02-Architecture.md
new file mode 100644
index 0000000..8ddb43e
--- /dev/null
+++ b/Documentation/markdown/Overview/02-Architecture.md
@@ -0,0 +1,76 @@
+# PHPExcel Developer Documentation
+
+
+## Architecture
+
+### Schematical
+
+![01-schematic.png](./images/01-schematic.png "Basic Architecture Schematic")
+
+
+### Lazy Loader
+
+PHPExcel implements an autoloader or "lazy loader", which means that it is not necessary to include every file within PHPExcel. It is only necessary to include the initial PHPExcel class file, then the autoloader will include other class files as and when required, so only those files that are actually required by your script will be loaded into PHP memory. The main benefit of this is that it reduces the memory footprint of PHPExcel itself, so that it uses less PHP memory.
+
+If your own scripts already define an autoload function, then this may be overwritten by the PHPExcel autoload function. For example, if you have:
+```php
+function __autoload($class) {
+ ...
+}
+```
+Do this instead:
+```php
+function myAutoload($class) {
+ ...
+}
+
+spl_autoload_register('myAutoload');
+```
+Your autoloader will then co-exist with the autoloader of PHPExcel.
+
+
+### Spreadsheet in memory
+
+PHPExcel's architecture is built in a way that it can serve as an in-memory spreadsheet. This means that, if one would want to create a web based view of a spreadsheet which communicates with PHPExcel's object model, he would only have to write the front-end code.
+
+Just like desktop spreadsheet software, PHPExcel represents a spreadsheet containing one or more worksheets, which contain cells with data, formulas, images, ...
+
+
+### Readers and writers
+
+On its own, PHPExcel does not provide the functionality to read from or write to a persisted spreadsheet (on disk or in a database). To provide that functionality, readers and writers can be used.
+
+By default, the PHPExcel package provides some readers and writers, including one for the Open XML spreadsheet format (a.k.a. Excel 2007 file format). You are not limited to the default readers and writers, as you are free to implement the PHPExcel_Reader_IReader and PHPExcel_Writer_IWriter interface in a custom class.
+
+![02-readers-writers.png](./images/02-readers-writers.png "Readers/Writers")
+
+### Fluent interfaces
+
+PHPExcel supports fluent interfaces in most locations. This means that you can easily "chain" calls to specific methods without requiring a new PHP statement. For example, take the following code:
+
+```php
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
+$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
+$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");
+$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
+$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
+$objPHPExcel->getProperties()->setKeywords("office 2007 openxml php");
+$objPHPExcel->getProperties()->setCategory("Test result file");
+```
+
+This can be rewritten as:
+
+```php
+$objPHPExcel->getProperties()
+ ->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+```
+
+ > __Using fluent interfaces is not required__
+ > Fluent interfaces have been implemented to provide a convenient programming API. Use of them is not required, but can make your code easier to read and maintain.
+ > It can also improve performance, as you are reducing the overall number of calls to PHPExcel methods: in the above example, the `getProperties()` method is being called only once rather than 7 times in the non-fluent version.
diff --git a/Documentation/markdown/Overview/03-Creating-a-Spreadsheet.md b/Documentation/markdown/Overview/03-Creating-a-Spreadsheet.md
new file mode 100644
index 0000000..b65000b
--- /dev/null
+++ b/Documentation/markdown/Overview/03-Creating-a-Spreadsheet.md
@@ -0,0 +1,34 @@
+# PHPExcel Developer Documentation
+
+
+## Creating a spreadsheet
+
+### The PHPExcel class
+
+The PHPExcel class is the core of PHPExcel. It contains references to the contained worksheets, document security settings and document meta data.
+
+To simplify the PHPExcel concept: the PHPExcel class represents your workbook.
+
+Typically, you will create a workbook in one of two ways, either by loading it from a spreadsheet file, or creating it manually. A third option, though less commonly used, is cloning an existing workbook that has been created using one of the previous two methods.
+
+#### Loading a Workbook from a file
+
+Details of the different spreadsheet formats supported, and the options available to read them into a PHPExcel object are described fully in the PHPExcel User Documentation - Reading Spreadsheet Files document.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
+```
+
+#### Creating a new workbook
+
+If you want to create a new workbook, rather than load one from file, then you simply need to instantiate it as a new PHPExcel object.
+
+```php
+/** Create a new PHPExcel Object **/
+$objPHPExcel = new PHPExcel();
+```
+
+A new workbook will always be created with a single worksheet.
diff --git a/Documentation/markdown/Overview/04-Configuration-Settings.md b/Documentation/markdown/Overview/04-Configuration-Settings.md
new file mode 100644
index 0000000..2024e80
--- /dev/null
+++ b/Documentation/markdown/Overview/04-Configuration-Settings.md
@@ -0,0 +1,140 @@
+# PHPExcel Developer Documentation
+
+
+## Configuration Settings
+
+Once you have included the PHPExcel files in your script, but before instantiating a PHPExcel object or loading a workbook file, there are a number of configuration options that can be set which will affect the subsequent behaviour of the script.
+
+### Cell Caching
+
+PHPExcel uses an average of about 1k/cell in your worksheets, so large workbooks can quickly use up available memory. Cell caching provides a mechanism that allows PHPExcel to maintain the cell objects in a smaller size of memory, on disk, or in APC, memcache or Wincache, rather than in PHP memory. This allows you to reduce the memory usage for large workbooks, although at a cost of speed to access cell data.
+
+By default, PHPExcel still holds all cell objects in memory, but you can specify alternatives. To enable cell caching, you must call the PHPExcel_Settings::setCacheStorageMethod() method, passing in the caching method that you wish to use.
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory;
+
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
+```
+
+setCacheStorageMethod() will return a boolean true on success, false on failure (for example if trying to cache to APC when APC is not enabled).
+
+A separate cache is maintained for each individual worksheet, and is automatically created when the worksheet is instantiated based on the caching method and settings that you have configured. You cannot change the configuration settings once you have started to read a workbook, or have created your first worksheet.
+
+Currently, the following caching methods are available.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_in_memory
+
+The default. If you don't initialise any caching method, then this is the method that PHPExcel will use. Cell objects are maintained in PHP memory as at present.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized
+
+Using this caching method, cells are held in PHP memory as an array of serialized objects, which reduces the memory footprint with minimal performance overhead.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip
+
+Like cache_in_memory_serialized, this method holds cells in PHP memory as an array of serialized objects, but gzipped to reduce the memory usage still further, although access to read or write a cell is slightly slower.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_igbinary
+
+Uses PHPs igbinary extension (if its available) to serialize cell objects in memory. This is normally faster and uses less memory than standard PHP serialization, but isnt available in most hosting environments.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_discISAM
+
+When using cache_to_discISAM all cells are held in a temporary disk file, with only an index to their location in that file maintained in PHP memory. This is slower than any of the cache_in_memory methods, but significantly reduces the memory footprint. By default, PHPExcel will use PHP's temp directory for the cache file, but you can specify a different directory when initialising cache_to_discISAM.
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_discISAM;
+$cacheSettings = array(
+ 'dir' => '/usr/local/tmp'
+);
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+```
+
+The temporary disk file is automatically deleted when your script terminates.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp
+
+Like cache_to_discISAM, when using cache_to_phpTemp all cells are held in the php://temp I/O stream, with only an index to their location maintained in PHP memory. In PHP, the php://memory wrapper stores data in the memory: php://temp behaves similarly, but uses a temporary file for storing the data when a certain memory limit is reached. The default is 1 MB, but you can change this when initialising cache_to_phpTemp.
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory:: cache_to_phpTemp;
+$cacheSettings = array(
+ 'memoryCacheSize' => '8MB'
+);
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+```
+
+The php://temp file is automatically deleted when your script terminates.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_apc
+
+When using cache_to_apc, cell objects are maintained in APC with only an index maintained in PHP memory to identify that the cell exists. By default, an APC cache timeout of 600 seconds is used, which should be enough for most applications: although it is possible to change this when initialising cache_to_APC.
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_APC;
+$cacheSettings = array(
+ 'cacheTime' => 600
+);
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+```
+
+When your script terminates all entries will be cleared from APC, regardless of the cacheTime value, so it cannot be used for persistent storage using this mechanism.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_memcache
+
+When using cache_to_memcache, cell objects are maintained in memcache with only an index maintained in PHP memory to identify that the cell exists.
+
+By default, PHPExcel looks for a memcache server on localhost at port 11211. It also sets a memcache timeout limit of 600 seconds. If you are running memcache on a different server or port, then you can change these defaults when you initialise cache_to_memcache:
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_memcache;
+$cacheSettings = array(
+ 'memcacheServer' => 'localhost',
+ 'memcachePort' => 11211,
+ 'cacheTime' => 600
+);
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+```
+
+When your script terminates all entries will be cleared from memcache, regardless of the cacheTime value, so it cannot be used for persistent storage using this mechanism.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_wincache
+
+When using cache_to_wincache, cell objects are maintained in Wincache with only an index maintained in PHP memory to identify that the cell exists. By default, a Wincache cache timeout of 600 seconds is used, which should be enough for most applications: although it is possible to change this when initialising cache_to_wincache.
+
+```php
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_wincache;
+$cacheSettings = array(
+ 'cacheTime' => 600
+);
+PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
+```
+
+When your script terminates all entries will be cleared from Wincache, regardless of the cacheTime value, so it cannot be used for persistent storage using this mechanism.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_sqlite
+
+Uses an SQLite 2 "in-memory" database for caching cell data. Unlike other caching methods, neither cells nor an index are held in PHP memory - an indexed database table makes it unnecessary to hold any index in PHP memory, which makes this the most memory-efficient of the cell caching methods.
+
+#### PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
+
+Uses an SQLite 3 "in-memory" database for caching cell data. Unlike other caching methods, neither cells nor an index are held in PHP memory - an indexed database table makes it unnecessary to hold any index in PHP memory, which makes this the most memory-efficient of the cell caching methods.
+
+
+### Language/Locale
+
+Some localisation elements have been included in PHPExcel. You can set a locale by changing the settings. To set the locale to Brazilian Portuguese you would use:
+
+```php
+$locale = 'pt_br';
+$validLocale = PHPExcel_Settings::setLocale($locale);
+if (!$validLocale) {
+ echo 'Unable to set locale to ' . $locale . " - reverting to en_us" . PHP_EOL;
+}
+```
+
+If Brazilian Portuguese language files aren't available, then Portuguese will be enabled instead: if Portuguese language files aren't available, then the setLocale() method will return an error, and American English (en_us) settings will be used throughout.
+
+More details of the features available once a locale has been set, including a list of the languages and locales currently supported, can be found in the section of this document entitled "Locale Settings for Formulae".
+
diff --git a/Documentation/markdown/Overview/05-Deleting-a-Workbook.md b/Documentation/markdown/Overview/05-Deleting-a-Workbook.md
new file mode 100644
index 0000000..0ea9171
--- /dev/null
+++ b/Documentation/markdown/Overview/05-Deleting-a-Workbook.md
@@ -0,0 +1,13 @@
+# PHPExcel Developer Documentation
+
+## Clearing a Workbook from memory
+
+The PHPExcel object contains cyclic references (e.g. the workbook is linked to the worksheets, and the worksheets are linked to their parent workbook) which cause problems when PHP tries to clear the objects from memory when they are unset(), or at the end of a function when they are in local scope. The result of this is "memory leaks", which can easily use a large amount of PHP's limited memory.
+
+This can only be resolved manually: if you need to unset a workbook, then you also need to "break" these cyclic references before doing so. PHPExcel provides the disconnectWorksheets() method for this purpose.
+
+```php
+$objPHPExcel->disconnectWorksheets();
+
+unset($objPHPExcel);
+```
diff --git a/Documentation/markdown/Overview/06-Worksheets.md b/Documentation/markdown/Overview/06-Worksheets.md
new file mode 100644
index 0000000..a6a231c
--- /dev/null
+++ b/Documentation/markdown/Overview/06-Worksheets.md
@@ -0,0 +1,94 @@
+# PHPExcel Developer Documentation
+
+## Worksheets
+
+A worksheet is a collection of cells, formulae, images, graphs, etc. It holds all data necessary to represent a spreadsheet worksheet.
+
+When you load a workbook from a spreadsheet file, it will be loaded with all its existing worksheets (unless you specified that only certain sheets should be loaded). When you load from non-spreadsheet files (such as a CSV or HTML file) or from spreadsheet formats that don't identify worksheets by name (such as SYLK), then a single worksheet called "WorkSheet1" will be created containing the data from that file.
+
+When you instantiate a new workbook, PHPExcel will create it with a single worksheet called "WorkSheet1".
+
+The `getSheetCount()` method will tell you the number of worksheets in the workbook; while the `getSheetNames()` method will return a list of all worksheets in the workbook, indexed by the order in which their "tabs" would appear when opened in MS Excel (or other appropriate Spreadsheet program).
+
+Individual worksheets can be accessed by name, or by their index position in the workbook. The index position represents the order that each worksheet "tab" is shown when the workbook is opened in MS Excel (or other appropriate Spreadsheet program). To access a sheet by its index, use the `getSheet()` method.
+
+```php
+// Get the second sheet in the workbook
+// Note that sheets are indexed from 0
+$objPHPExcel->getSheet(1);
+```
+
+If you don't specify a sheet index, then the first worksheet will be returned.
+
+Methods also exist allowing you to reorder the worksheets in the workbook.
+
+To access a sheet by name, use the `getSheetByName()` method, specifying the name of the worksheet that you want to access.
+
+```php
+// Retrieve the worksheet called 'Worksheet 1'
+$objPHPExcel->getSheetByName('Worksheet 1');
+```
+
+Alternatively, one worksheet is always the currently active worksheet, and you can access that directly. The currently active worksheet is the one that will be active when the workbook is opened in MS Excel (or other appropriate Spreadsheet program).
+
+```php
+// Retrieve the current active worksheet
+$objPHPExcel->getActiveSheet();
+```
+
+You can change the currently active sheet by index or by name using the `setActiveSheetIndex()` and `setActiveSheetIndexByName()` methods.
+
+### Adding a new Worksheet
+
+You can add a new worksheet to the workbook using the `createSheet()` method of the PHPExcel object. By default, this will be created as a new "last" sheet; but you can also specify an index position as an argument, and the worksheet will be inserted at that position, shuffling all subsequent worksheets in the collection down a place.
+
+```php
+$objPHPExcel->createSheet();
+```
+
+A new worksheet created using this method will be called "Worksheet\" where "\" is the lowest number possible to guarantee that the title is unique.
+
+Alternatively, you can instantiate a new worksheet (setting the title to whatever you choose) and then insert it into your workbook using the addSheet() method.
+
+```php
+// Create a new worksheet called "My Data"
+$myWorkSheet = new PHPExcel_Worksheet($objPHPExcel, 'My Data');
+
+// Attach the "My Data" worksheet as the first worksheet in the PHPExcel object
+$objPHPExcel->addSheet($myWorkSheet, 0);
+```
+
+If you don't specify an index position as the second argument, then the new worksheet will be added after the last existing worksheet.
+
+### Copying Worksheets
+
+Sheets within the same workbook can be copied by creating a clone of the worksheet you wish to copy, and then using the addSheet() method to insert the clone into the workbook.
+
+```php
+$objClonedWorksheet = clone $objPHPExcel->getSheetByName('Worksheet 1');
+$objClonedWorksheet->setTitle('Copy of Worksheet 1')
+$objPHPExcel->addSheet($objClonedWorksheet);
+```
+
+You can also copy worksheets from one workbook to another, though this is more complex as PHPExcel also has to replicate the styling between the two workbooks. The addExternalSheet() method is provided for this purpose.
+
+```
+$objClonedWorksheet = clone $objPHPExcel1->getSheetByName('Worksheet 1');
+$objPHPExcel->addExternalSheet($objClonedWorksheet);
+```
+
+In both cases, it is the developer's responsibility to ensure that worksheet names are not duplicated. PHPExcel will throw an exception if you attempt to copy worksheets that will result in a duplicate name.
+
+### Removing a Worksheet
+
+You can delete a worksheet from a workbook, identified by its index position, using the removeSheetByIndex() method
+
+```php
+$sheetIndex = $objPHPExcel->getIndex(
+ $objPHPExcel->getSheetByName('Worksheet 1')
+);
+$objPHPExcel->removeSheetByIndex($sheetIndex);
+```
+
+If the currently active worksheet is deleted, then the sheet at the previous index position will become the currently active sheet.
+
diff --git a/Documentation/markdown/Overview/07-Accessing-Cells.md b/Documentation/markdown/Overview/07-Accessing-Cells.md
new file mode 100644
index 0000000..e63b45b
--- /dev/null
+++ b/Documentation/markdown/Overview/07-Accessing-Cells.md
@@ -0,0 +1,390 @@
+# PHPExcel Developer Documentation
+
+## Accessing cells
+
+Accessing cells in a PHPExcel worksheet should be pretty straightforward. This topic lists some of the options to access a cell.
+
+### Setting a cell value by coordinate
+
+Setting a cell value by coordinate can be done using the worksheet's `setCellValue()` method.
+
+```php
+// Set cell A1 with a string value
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'PHPExcel');
+
+// Set cell A2 with a numeric value
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 12345.6789);
+
+// Set cell A3 with a boolean value
+$objPHPExcel->getActiveSheet()->setCellValue('A3', TRUE);
+
+// Set cell A4 with a formula
+$objPHPExcel->getActiveSheet()->setCellValue(
+ 'A4',
+ '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))'
+);
+```
+
+Alternatively, you can retrieve the cell object, and then call the cell’s setValue() method:
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->getCell('B8')
+ ->setValue('Some value');
+```
+
+**Excel DataTypes**
+
+MS Excel supports 7 basic datatypes
+ - string
+ - number
+ - boolean
+ - null
+ - formula
+ - error
+ - Inline (or rich text) string
+
+By default, when you call the worksheet's `setCellValue()` method or the cell's `setValue()` method, PHPExcel will use the appropriate datatype for PHP nulls, booleans, floats or integers; or cast any string data value that you pass to the method into the most appropriate datatype, so numeric strings will be cast to numbers, while string values beginning with “=†will be converted to a formula. Strings that aren't numeric, or that don't begin with a leading "=" will be treated as genuine string values.
+
+This "conversion" is handled by a cell "value binder", and you can write custom "value binders" to change the behaviour of these "conversions". The standard PHPExcel package also provides an "advanced value binder" that handles a number of more complex conversions, such as converting strings with a fractional format like "3/4" to a number value (0.75 in this case) and setting an appropriate "fraction" number format mask. Similarly, strings like "5%" will be converted to a value of 0.05, and a percentage number format mask applied, and strings containing values that look like dates will be converted to Excel serialized datetimestamp values, and a corresponding mask applied. This is particularly useful when loading data from csv files, or setting cell values from a database.
+
+Formats handled by the advanced value binder include
+ - TRUE or FALSE (dependent on locale settings) are converted to booleans.
+ - Numeric strings identified as scientific (exponential) format are converted to numbers.
+ - Fractions and vulgar fractions are converted to numbers, and an appropriate number format mask applied.
+ - Percentages are converted to numbers, divided by 100, and an appropriate number format mask applied.
+ - Dates and times are converted to Excel timestamp values (numbers), and an appropriate number format mask applied.
+ - When strings contain a newline character ("\n"), then the cell styling is set to wrap.
+
+You can read more about value binders later in this section of the documentation.
+
+#### Setting a date and/or time value in a cell
+
+Date or time values are held as timestamp in Excel (a simple floating point value), and a number format mask is used to show how that value should be formatted; so if we want to store a date in a cell, we need to calculate the correct Excel timestamp, and set a number format mask.
+
+```php
+// Get the current date/time and convert to an Excel date/time
+$dateTimeNow = time();
+$excelDateValue = PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow );
+// Set cell A6 with the Excel date/time value
+$objPHPExcel->getActiveSheet()->setCellValue(
+ 'A6',
+ $excelDateValue
+);
+// Set the number format mask so that the excel timestamp will be displayed as a human-readable date/time
+$objPHPExcel->getActiveSheet()->getStyle('A6')
+ ->getNumberFormat()
+ ->setFormatCode(
+ PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME
+ );
+```
+
+#### Setting a number with leading zeroes
+
+By default, PHPExcel will automatically detect the value type and set it to the appropriate Excel numeric datatype. This type conversion is handled by a value binder, as described in the section of this document entitled "Using value binders to facilitate data entry".
+
+Numbers don't have leading zeroes, so if you try to set a numeric value that does have leading zeroes (such as a telephone number) then these will be normally be lost as the value is cast to a number, so "01513789642" will be displayed as 1513789642.
+
+There are two ways you can force PHPExcel to override this behaviour.
+
+Firstly, you can set the datatype explicitly as a string so that it is not converted to a number.
+
+```php
+// Set cell A8 with a numeric value, but tell PHPExcel it should be treated as a string
+$objPHPExcel->getActiveSheet()->setCellValueExplicit(
+ 'A8',
+ "01513789642",
+ PHPExcel_Cell_DataType::TYPE_STRING
+);
+```
+
+Alternatively, you can use a number format mask to display the value with leading zeroes.
+
+```php
+// Set cell A9 with a numeric value
+$objPHPExcel->getActiveSheet()->setCellValue('A9', 1513789642);
+// Set a number format mask to display the value as 11 digits with leading zeroes
+$objPHPExcel->getActiveSheet()->getStyle('A9')
+ ->getNumberFormat()
+ ->setFormatCode(
+ '00000000000'
+ );
+```
+
+With number format masking, you can even break up the digits into groups to make the value more easily readable.
+
+```php
+// Set cell A10 with a numeric value
+$objPHPExcel->getActiveSheet()->setCellValue('A10', 1513789642);
+// Set a number format mask to display the value as 11 digits with leading zeroes
+$objPHPExcel->getActiveSheet()->getStyle('A10')
+ ->getNumberFormat()
+ ->setFormatCode(
+ '0000-000-0000'
+ );
+```
+
+![07-simple-example-1.png](./images/07-simple-example-1.png "")
+
+
+**Note** that not all complex format masks such as this one will work when retrieving a formatted value to display "on screen", or for certain writers such as HTML or PDF, but it will work with the true spreadsheet writers (Excel2007 and Excel5).
+
+### Setting a range of cells from an array
+
+It is also possible to set a range of cell values in a single call by passing an array of values to the `fromArray()` method.
+
+```php
+$arrayData = array(
+ array(NULL, 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+);
+$objPHPExcel->getActiveSheet()
+ ->fromArray(
+ $arrayData, // The data to set
+ NULL, // Array values with this value will not be set
+ 'C3' // Top left coordinate of the worksheet range where
+ // we want to set these values (default is A1)
+ );
+```
+
+![07-simple-example-2.png](./images/07-simple-example-2.png "")
+
+If you pass a 2-d array, then this will be treated as a series of rows and columns. A 1-d array will be treated as a single row, which is particularly useful if you're fetching an array of data from a database.
+
+```php
+$rowArray = array('Value1', 'Value2', 'Value3', 'Value4');
+$objPHPExcel->getActiveSheet()
+ ->fromArray(
+ $rowArray, // The data to set
+ NULL, // Array values with this value will not be set
+ 'C3' // Top left coordinate of the worksheet range where
+ // we want to set these values (default is A1)
+ );
+```
+
+![07-simple-example-3.png](./images/07-simple-example-3.png "")
+
+If you have a simple 1-d array, and want to write it as a column, then the following will convert it into an appropriately structured 2-d array that can be fed to the `fromArray()` method:
+
+```php
+$rowArray = array('Value1', 'Value2', 'Value3', 'Value4');
+$columnArray = array_chunk($rowArray, 1);
+$objPHPExcel->getActiveSheet()
+ ->fromArray(
+ $columnArray, // The data to set
+ NULL, // Array values with this value will not be set
+ 'C3' // Top left coordinate of the worksheet range where
+ // we want to set these values (default is A1)
+ );
+```
+
+![07-simple-example-4.png](./images/07-simple-example-4.png "")
+
+### Retrieving a cell value by coordinate
+
+To retrieve the value of a cell, the cell should first be retrieved from the worksheet using the `getCell()` method. A cell's value can be read using the `getValue()` method.
+
+```php
+// Get the value fom cell A1
+$cellValue = $objPHPExcel->getActiveSheet()->getCell('A1')
+ ->getValue();
+```
+
+This will retrieve the raw, unformatted value contained in the cell.
+
+If a cell contains a formula, and you need to retrieve the calculated value rather than the formula itself, then use the cell's `getCalculatedValue()` method. This is further explained in .
+
+```php
+// Get the value fom cell A4
+$cellValue = $objPHPExcel->getActiveSheet()->getCell('A4')
+ ->getCalculatedValue();
+```
+
+Alternatively, if you want to see the value with any cell formatting applied (e.g. for a human-readable date or time value), then you can use the cell's `getFormattedValue()` method.
+
+```php
+// Get the value fom cell A6
+$cellValue = $objPHPExcel->getActiveSheet()->getCell('A6')
+ ->getFormattedValue();
+```
+
+
+### Setting a cell value by column and row
+
+Setting a cell value by coordinate can be done using the worksheet's `setCellValueByColumnAndRow()` method.
+
+```php
+// Set cell B5 with a string value
+$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, 5, 'PHPExcel');
+```
+
+**Note** that column references start with '0' for column 'A', rather than from '1'.
+
+### Retrieving a cell value by column and row
+
+To retrieve the value of a cell, the cell should first be retrieved from the worksheet using the getCellByColumnAndRow method. A cell’s value can be read again using the following line of code:
+
+```php
+// Get the value fom cell B5
+$cellValue = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(1, 5)
+ ->getValue();
+```
+If you need the calculated value of a cell, use the following code. This is further explained in .
+
+```php
+// Get the value fom cell A4
+$cellValue = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(0, 4)
+ ->getCalculatedValue();
+```
+
+### Retrieving a range of cell values to an array
+
+It is also possible to retrieve a range of cell values to an array in a single call using the `toArray()`, `rangeToArray()` or `namedRangeToArray()` methods.
+
+```php
+$dataArray = $objPHPExcel->getActiveSheet()
+ ->rangeToArray(
+ 'C3:E5', // The worksheet range that we want to retrieve
+ NULL, // Value that should be returned for empty cells
+ TRUE, // Should formulas be calculated (the equivalent of getCalculatedValue() for each cell)
+ TRUE, // Should values be formatted (the equivalent of getFormattedValue() for each cell)
+ TRUE // Should the array be indexed by cell row and cell column
+ );
+```
+
+These methods will all return a 2-d array of rows and columns. The `toArray()` method will return the whole worksheet; `rangeToArray()` will return a specified range or cells; while `namedRangeToArray()` will return the cells within a defined `named range`.
+
+### Looping through cells
+
+#### Looping through cells using iterators
+
+The easiest way to loop cells is by using iterators. Using iterators, one can use foreach to loop worksheets, rows within a worksheet, and cells within a row.
+
+Below is an example where we read all the values in a worksheet and display them in a table.
+
+```php
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objReader->setReadDataOnly(TRUE);
+$objPHPExcel = $objReader->load("test.xlsx");
+
+$objWorksheet = $objPHPExcel->getActiveSheet();
+
+echo '' . PHP_EOL;
+foreach ($objWorksheet->getRowIterator() as $row) {
+ echo '' . PHP_EOL;
+ $cellIterator = $row->getCellIterator();
+ $cellIterator->setIterateOnlyExistingCells(FALSE); // This loops through all cells,
+ // even if a cell value is not set.
+ // By default, only cells that have a value
+ // set will be iterated.
+ foreach ($cellIterator as $cell) {
+ echo '' .
+ $cell->getValue() .
+ ' | ' . PHP_EOL;
+ }
+ echo '
' . PHP_EOL;
+}
+echo '
' . PHP_EOL;
+```
+
+Note that we have set the cell iterator's `setIterateOnlyExistingCells()` to FALSE. This makes the iterator loop all cells within the worksheet range, even if they have not been set.
+
+The cell iterator will return a __NULL__ as the cell value if it is not set in the worksheet.
+Setting the cell iterator's setIterateOnlyExistingCells() to FALSE will loop all cells in the worksheet that can be available at that moment. This will create new cells if required and increase memory usage! Only use it if it is intended to loop all cells that are possibly available.
+
+#### Looping through cells using indexes
+
+One can use the possibility to access cell values by column and row index like (0,1) instead of 'A1' for reading and writing cell values in loops.
+
+Note: In PHPExcel column index is 0-based while row index is 1-based. That means 'A1' ~ (0,1)
+
+Below is an example where we read all the values in a worksheet and display them in a table.
+
+```php
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objReader->setReadDataOnly(TRUE);
+$objPHPExcel = $objReader->load("test.xlsx");
+
+$objWorksheet = $objPHPExcel->getActiveSheet();
+// Get the highest row and column numbers referenced in the worksheet
+$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
+$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
+$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
+
+echo '' . "\n";
+for ($row = 1; $row <= $highestRow; ++$row) {
+ echo '' . PHP_EOL;
+ for ($col = 0; $col <= $highestColumnIndex; ++$col) {
+ echo '' .
+ $objWorksheet->getCellByColumnAndRow($col, $row)
+ ->getValue() .
+ ' | ' . PHP_EOL;
+ }
+ echo '
' . PHP_EOL;
+}
+echo '
' . PHP_EOL;
+```
+
+Alternatively, you can take advantage of PHP's "Perl-style" character incrementors to loop through the cells by coordinate:
+
+```php
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objReader->setReadDataOnly(TRUE);
+$objPHPExcel = $objReader->load("test.xlsx");
+
+$objWorksheet = $objPHPExcel->getActiveSheet();
+// Get the highest row number and column letter referenced in the worksheet
+$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
+$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
+// Increment the highest column letter
+$highestColumn++;
+
+echo '' . "\n";
+for ($row = 1; $row <= $highestRow; ++$row) {
+ echo '' . PHP_EOL;
+ for ($col = 'A'; $col != $highestColumn; ++$col) {
+ echo '' .
+ $objWorksheet->getCell($col . $row)
+ ->getValue() .
+ ' | ' . PHP_EOL;
+ }
+ echo '
' . PHP_EOL;
+}
+echo '
' . PHP_EOL;
+```
+
+Note that we can't use a <= comparison here, because 'AA' would match as <= 'B', so we increment the highest column letter and then loop while $col != the incremented highest column.
+
+### Using value binders to facilitate data entry
+
+Internally, PHPExcel uses a default PHPExcel_Cell_IValueBinder implementation (PHPExcel_Cell_DefaultValueBinder) to determine data types of entered data using a cell's `setValue()` method (the `setValueExplicit()` method bypasses this check).
+
+Optionally, the default behaviour of PHPExcel can be modified, allowing easier data entry. For example, a PHPExcel_Cell_AdvancedValueBinder class is available. It automatically converts percentages, number in scientific format, and dates entered as strings to the correct format, also setting the cell's style information. The following example demonstrates how to set the value binder in PHPExcel:
+
+```php
+/** PHPExcel */
+require_once 'PHPExcel.php';
+
+// Set value binder
+PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
+
+// Create new PHPExcel object
+$objPHPExcel = new PHPExcel();
+
+// ...
+// Add some data, resembling some different data types
+$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Percentage value:');
+// Converts the string value to 0.1 and sets percentage cell style
+$objPHPExcel->getActiveSheet()->setCellValue('B4', '10%');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Date/time value:');
+// Converts the string value to an Excel datestamp and sets the date format cell style
+$objPHPExcel->getActiveSheet()->setCellValue('B5', '21 December 1983');
+```
+
+__Creating your own value binder is easy.__
+When advanced value binding is required, you can implement the PHPExcel_Cell_IValueBinder interface or extend the PHPExcel_Cell_DefaultValueBinder or PHPExcel_Cell_AdvancedValueBinder classes.
+
diff --git a/Documentation/markdown/Overview/08-Recipes.md b/Documentation/markdown/Overview/08-Recipes.md
new file mode 100644
index 0000000..b8930a4
--- /dev/null
+++ b/Documentation/markdown/Overview/08-Recipes.md
@@ -0,0 +1,1214 @@
+# PHPExcel Developer Documentation
+
+## PHPExcel recipes
+
+The following pages offer you some widely-used PHPExcel recipes. Please note that these do NOT offer complete documentation on specific PHPExcel API functions, but just a bump to get you started. If you need specific API functions, please refer to the API documentation.
+
+For example, REF _Ref191885321 \w \h 4.4.7 REF _Ref191885321 \h Setting a worksheet's page orientation and size covers setting a page orientation to A4. Other paper formats, like US Letter, are not covered in this document, but in the PHPExcel API documentation.
+
+### Setting a spreadsheet's metadata
+
+PHPExcel allows an easy way to set a spreadsheet's metadata, using document property accessors. Spreadsheet metadata can be useful for finding a specific document in a file repository or a document management system. For example Microsoft Sharepoint uses document metadata to search for a specific document in its document lists.
+
+Setting spreadsheet metadata is done as follows:
+
+```php
+$objPHPExcel->getProperties()
+ ->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw");
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription(
+ "Test document for Office 2007 XLSX, generated using PHP classes."
+ )
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+```
+
+### Setting a spreadsheet's active sheet
+
+The following line of code sets the active sheet index to the first sheet:
+
+```php
+$objPHPExcel->setActiveSheetIndex(0);
+```
+
+You can also set the active sheet by its name/title
+
+```php
+$objPHPExcel->setActiveSheetIndexByName('DataSheet')
+```
+
+will change the currently active sheet to the worksheet called "DataSheet".
+
+### Write a date or time into a cell
+
+In Excel, dates and Times are stored as numeric values counting the number of days elapsed since 1900-01-01. For example, the date '2008-12-31' is represented as 39813. You can verify this in Microsoft Office Excel by entering that date in a cell and afterwards changing the number format to 'General' so the true numeric value is revealed. Likewise, '3:15 AM' is represented as 0.135417.
+
+PHPExcel works with UST (Universal Standard Time) date and Time values, but does no internal conversions; so it is up to the developer to ensure that values passed to the date/time conversion functions are UST.
+
+Writing a date value in a cell consists of 2 lines of code. Select the method that suits you the best. Here are some examples:
+
+```php
+/* PHPExcel_Cell_AdvanceValueBinder required for this sample */
+require_once 'PHPExcel/Cell/AdvancedValueBinder.php';
+
+// MySQL-like timestamp '2008-12-31' or date string
+PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('D1', '2008-12-31');
+
+$objPHPExcel->getActiveSheet()->getStyle('D1')
+ ->getNumberFormat()
+ ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);
+
+// PHP-time (Unix time)
+$time = gmmktime(0,0,0,12,31,2008); // int(1230681600)
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('D1', PHPExcel_Shared_Date::PHPToExcel($time));
+$objPHPExcel->getActiveSheet()->getStyle('D1')
+ ->getNumberFormat()
+ ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);
+
+// Excel-date/time
+$objPHPExcel->getActiveSheet()->setCellValue('D1', 39813)
+$objPHPExcel->getActiveSheet()->getStyle('D1')
+ ->getNumberFormat()
+ ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDDSLASH);
+```
+
+The above methods for entering a date all yield the same result. PHPExcel_Style_NumberFormat provides a lot of pre-defined date formats.
+
+The PHPExcel_Shared_Date::PHPToExcel() method will also work with a PHP DateTime object.
+
+Similarly, times (or date and time values) can be entered in the same fashion: just remember to use an appropriate format code.
+
+__Notes:__
+
+See section "Using value binders to facilitate data entry" to learn more about the AdvancedValueBinder used in the first example.
+In previous versions of PHPExcel up to and including 1.6.6, when a cell had a date-like number format code, it was possible to enter a date directly using an integer PHP-time without converting to Excel date format. Starting with PHPExcel 1.6.7 this is no longer supported.
+Excel can also operate in a 1904-based calendar (default for workbooks saved on Mac). Normally, you do not have to worry about this when using PHPExcel.
+
+### Write a formula into a cell
+
+Inside the Excel file, formulas are always stored as they would appear in an English version of Microsoft Office Excel, and PHPExcel handles all formulae internally in this format. This means that the following rules hold:
+
+ - Decimal separator is '.' (period)
+ - Function argument separator is ',' (comma)
+ - Matrix row separator is ';' (semicolon)
+ - English function names must be used
+
+This is regardless of which language version of Microsoft Office Excel may have been used to create the Excel file.
+
+When the final workbook is opened by the user, Microsoft Office Excel will take care of displaying the formula according the applications language. Translation is taken care of by the application!
+
+The following line of code writes the formula '=IF(C4>500,"profit","loss")'Â into the cell B8. Note that the formula must start with "=" to make PHPExcel recognise this as a formula.
+
+```php
+$objPHPExcel->getActiveSheet()->setCellValue('B8','=IF(C4>500,"profit","loss")');
+```
+
+If you want to write a string beginning with an "="Â character to a cell, then you should use the setCellValueExplicit() method.
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->setCellValueExplicit(
+ 'B8',
+ '=IF(C4>500,"profit","loss")',
+ PHPExcel_Cell_DataType::TYPE_STRING
+ );
+```
+
+A cell's formula can be read again using the following line of code:
+
+```php
+$formula = $objPHPExcel->getActiveSheet()->getCell('B8')->getValue();
+```
+
+If you need the calculated value of a cell, use the following code. This is further explained in REF _Ref191885372 \w \h \* MERGEFORMAT 4.4.35.
+
+```php
+$value = $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue();
+```
+
+### Locale Settings for Formulae
+
+Some localisation elements have been included in PHPExcel. You can set a locale by changing the settings. To set the locale to Russian you would use:
+
+```php
+$locale = 'ru';
+$validLocale = PHPExcel_Settings::setLocale($locale);
+if (!$validLocale) {
+ echo 'Unable to set locale to '.$locale." - reverting to en_us
\n";
+}
+```
+
+If Russian language files aren't available, the `setLocale()` method will return an error, and English settings will be used throughout.
+
+Once you have set a locale, you can translate a formula from its internal English coding.
+
+```php
+$formula = $objPHPExcel->getActiveSheet()->getCell('B8')->getValue();
+$translatedFormula = PHPExcel_Calculation::getInstance()->_translateFormulaToLocale($formula);
+```
+
+You can also create a formula using the function names and argument separators appropriate to the defined locale; then translate it to English before setting the cell value:
+
+```php
+$formula = '=????360(????(2010;2;5);????(2010;12;31);??????)';
+$internalFormula = PHPExcel_Calculation::getInstance()->translateFormulaToEnglish($formula);
+$objPHPExcel->getActiveSheet()->setCellValue('B8',$internalFormula);
+```
+
+Currently, formula translation only translates the function names, the constants TRUE and FALSE, and the function argument separators.
+
+At present, the following locale settings are supported:
+
+ Language | | Locale Code
+ ---------------------|----------------------|-------------
+ Czech | Ceština | cs
+ Danish | Dansk | da
+ German | Deutsch | de
+ Spanish | Español | es
+ Finnish | Suomi | fi
+ French | Français | fr
+ Hungarian | Magyar | hu
+ Italian | Italiano | it
+ Dutch | Nederlands | nl
+ Norwegian | Norsk | no
+ Polish | Jezyk polski | pl
+ Portuguese | Português | pt
+ Brazilian Portuguese | Português Brasileiro | pt_br
+ Russian | ??????? ???? | ru
+ Swedish | Svenska | sv
+ Turkish | Türkçe | tr
+
+### Write a newline character "\n" in a cell (ALT+"Enter")
+
+In Microsoft Office Excel you get a line break in a cell by hitting ALT+"Enter". When you do that, it automatically turns on "wrap text" for the cell.
+
+Here is how to achieve this in PHPExcel:
+
+```php
+$objPHPExcel->getActiveSheet()->getCell('A1')->setValue("hello\nworld");
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
+```
+
+__Tip__
+
+Read more about formatting cells using getStyle() elsewhere.
+
+__Tip__
+
+AdvancedValuebinder.php automatically turns on "wrap text" for the cell when it sees a newline character in a string that you are inserting in a cell. Just like Microsoft Office Excel. Try this:
+
+```php
+require_once 'PHPExcel/Cell/AdvancedValueBinder.php';
+PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
+
+$objPHPExcel->getActiveSheet()->getCell('A1')->setValue("hello\nworld");
+```
+
+Read more about AdvancedValueBinder.php elsewhere.
+
+### Explicitly set a cell's datatype
+
+You can set a cell's datatype explicitly by using the cell's setValueExplicit method, or the setCellValueExplicit method of a worksheet. Here's an example:
+
+```php
+$objPHPExcel->getActiveSheet()->getCell('A1')
+ ->setValueExplicit(
+ '25',
+ PHPExcel_Cell_DataType::TYPE_NUMERIC
+ );
+```
+
+### Change a cell into a clickable URL
+
+You can make a cell a clickable URL by setting its hyperlink property:
+
+```php
+$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
+```
+
+If you want to make a hyperlink to another worksheet/cell, use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl("sheet://'Sheetname'!A1");
+```
+
+### Setting Printer Options for Excel files
+
+#### Setting a worksheet's page orientation and size
+
+Setting a worksheet's page orientation and size can be done using the following lines of code:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()
+ ->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
+$objPHPExcel->getActiveSheet()->getPageSetup()
+ ->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
+```
+
+Note that there are additional page settings available. Please refer to the API documentation for all possible options.
+
+#### Page Setup: Scaling options
+
+The page setup scaling options in PHPExcel relate directly to the scaling options in the "Page Setup" dialog as shown in the illustration.
+
+Default values in PHPExcel correspond to default values in MS Office Excel as shown in illustration
+
+![08-page-setup-scaling-options.png](./images/08-page-setup-scaling-options.png "")
+
+ method | initial value | calling method will trigger | Note
+ --------------------|:-------------:|-----------------------------|------
+ setFitToPage(...) | FALSE | - |
+ setScale(...) | 100 | setFitToPage(FALSE) |
+ setFitToWidth(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-width
+ setFitToHeight(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-height
+
+##### Example
+
+Here is how to fit to 1 page wide by infinite pages tall:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
+```
+
+As you can see, it is not necessary to call setFitToPage(TRUE) since setFitToWidth(...) and setFitToHeight(...) triggers this.
+
+If you use setFitToWidth() you should in general also specify setFitToHeight() explicitly like in the example. Be careful relying on the initial values. This is especially true if you are upgrading from PHPExcel 1.7.0 to 1.7.1 where the default values for fit-to-height and fit-to-width changed from 0 to 1.
+
+#### Page margins
+
+To set page margins for a worksheet, use this code:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageMargins()->setTop(1);
+$objPHPExcel->getActiveSheet()->getPageMargins()->setRight(0.75);
+$objPHPExcel->getActiveSheet()->getPageMargins()->setLeft(0.75);
+$objPHPExcel->getActiveSheet()->getPageMargins()->setBottom(1);
+```
+
+Note that the margin values are specified in inches.
+
+![08-page-setup-margins.png](./images/08-page-setup-margins.png "")
+
+#### Center a page horizontally/vertically
+
+To center a page horizontally/vertically, you can use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()->setHorizontalCentered(true);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setVerticalCentered(false);
+```
+
+#### Setting the print header and footer of a worksheet
+
+Setting a worksheet's print header and footer can be done using the following lines of code:
+
+```php
+$objPHPExcel->getActiveSheet()->getHeaderFooter()
+ ->setOddHeader('&C&HPlease treat this document as confidential!');
+$objPHPExcel->getActiveSheet()->getHeaderFooter()
+ ->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
+```
+
+Substitution and formatting codes (starting with &) can be used inside headers and footers. There is no required order in which these codes must appear.
+
+The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again:
+
+ - Strikethrough
+ - Superscript
+ - Subscript
+
+Superscript and subscript cannot both be ON at same time. Whichever comes first wins and the other is ignored, while the first is ON.
+
+The following codes are supported by Excel2007:
+
+Code | Meaning
+-----------------------|-----------
+&L | Code for "left section" (there are three header / footer locations, "left", "center", and "right"). When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the left section.
+&P | Code for "current page #"
+&N | Code for "total pages"
+&font size | Code for "text font size", where font size is a font size in points.
+&K | Code for "text font color" - RGB Color is specified as RRGGBB Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value.
+&S | Code for "text strikethrough" on / off
+&X | Code for "text super script" on / off
+&Y | Code for "text subscript" on / off
+&C | Code for "center section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the center section.
+&D | Code for "date"
+&T | Code for "time"
+&G | Code for "picture as background" - Please make sure to add the image to the header/footer[^print-footer-image-footnote]
+&U | Code for "text single underline"
+&E | Code for "double underline"
+&R | Code for "right section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the right section.
+&Z | Code for "this workbook's file path"
+&F | Code for "this workbook's file name"
+&A | Code for "sheet tab name"
+&+ | Code for add to page #
+&- | Code for subtract from page #
+&"font name,font type" | Code for "text font name" and "text font type", where font name and font type are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font name, it means "none specified". Both of font name and font type can be localized values.
+&"-,Bold" | Code for "bold font style"
+&B | Code for "bold font style"
+&"-,Regular" | Code for "regular font style"
+&"-,Italic" | Code for "italic font style"
+&I | Code for "italic font style"
+&"-,Bold Italic" | Code for "bold italic font style"
+&O | Code for "outline style"
+&H | Code for "shadow style"
+
+ [^print-footer-image-footnote]: z
+```php
+$objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing();
+$objDrawing->setName('PHPExcel logo');
+$objDrawing->setPath('./images/phpexcel_logo.gif');
+$objDrawing->setHeight(36);
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
+```
+
+__Tip__
+
+The above table of codes may seem overwhelming first time you are trying to figure out how to write some header or footer. Luckily, there is an easier way. Let Microsoft Office Excel do the work for you.For example, create in Microsoft Office Excel an xlsx file where you insert the header and footer as desired using the programs own interface. Save file as test.xlsx. Now, take that file and read off the values using PHPExcel as follows:
+
+```php
+$objPHPexcel = PHPExcel_IOFactory::load('test.xlsx');
+$objWorksheet = $objPHPexcel->getActiveSheet();
+
+var_dump($objWorksheet->getHeaderFooter()->getOddFooter());
+var_dump($objWorksheet->getHeaderFooter()->getEvenFooter());
+var_dump($objWorksheet->getHeaderFooter()->getOddHeader());
+var_dump($objWorksheet->getHeaderFooter()->getEvenHeader());
+```
+
+That reveals the codes for the even/odd header and footer. Experienced users may find it easier to rename test.xlsx to test.zip, unzip it, and inspect directly the contents of the relevant xl/worksheets/sheetX.xml to find the codes for header/footer.
+
+#### Setting printing breaks on a row or column
+
+To set a print break, use the following code, which sets a row break on row 10.
+
+```php
+$objPHPExcel->getActiveSheet()->setBreak( 'A10' , PHPExcel_Worksheet::BREAK_ROW );
+```
+
+The following line of code sets a print break on column D:
+
+```php
+$objPHPExcel->getActiveSheet()->setBreak( 'D10' , PHPExcel_Worksheet::BREAK_COLUMN );
+```
+
+#### Show/hide gridlines when printing
+
+To show/hide gridlines when printing, use the following code:
+
+$objPHPExcel->getActiveSheet()->setShowGridlines(true);
+
+#### Setting rows/columns to repeat at top/left
+
+PHPExcel can repeat specific rows/cells at top/left of a page. The following code is an example of how to repeat row 1 to 5 on each printed page of a specific worksheet:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 5);
+```
+
+#### Specify printing area
+
+To specify a worksheet's printing area, use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5');
+```
+
+There can also be multiple printing areas in a single worksheet:
+
+```php
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5,G4:M20');
+```
+
+### Styles
+
+#### Formatting cells
+
+A cell can be formatted with font, border, fill, ... style information. For example, one can set the foreground colour of a cell to red, aligned to the right, and the border to black and thick border style. Let's do that on cell B2:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THICK);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THICK);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THICK);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THICK);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
+$objPHPExcel->getActiveSheet()->getStyle('B2')
+ ->getFill()->getStartColor()->setARGB('FFFF0000');
+```
+
+Starting with PHPExcel 1.7.0 getStyle() also accepts a cell range as a parameter. For example, you can set a red background color on a range of cells:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('B3:B7')->getFill()
+ ->setFillType(PHPExcel_Style_Fill::FILL_SOLID)
+ ->getStartColor()->setARGB('FFFF0000');
+```
+
+__Tip__
+It is recommended to style many cells at once, using e.g. getStyle('A1:M500'), rather than styling the cells individually in a loop. This is much faster compared to looping through cells and styling them individually.
+
+There is also an alternative manner to set styles. The following code sets a cell's style to font bold, alignment right, top border thin and a gradient fill:
+
+```php
+$styleArray = array(
+ 'font' => array(
+ 'bold' => true,
+ ),
+ 'alignment' => array(
+ 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
+ ),
+ 'borders' => array(
+ 'top' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THIN,
+ ),
+ ),
+ 'fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
+ 'rotation' => 90,
+ 'startcolor' => array(
+ 'argb' => 'FFA0A0A0',
+ ),
+ 'endcolor' => array(
+ 'argb' => 'FFFFFFFF',
+ ),
+ ),
+);
+
+$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray);
+```
+
+Or with a range of cells:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('B3:B7')->applyFromArray($styleArray);
+```
+
+This alternative method using arrays should be faster in terms of execution whenever you are setting more than one style property. But the difference may barely be measurable unless you have many different styles in your workbook.
+
+Prior to PHPExcel 1.7.0 duplicateStyleArray() was the recommended method for styling a cell range, but this method has now been deprecated since getStyle() has started to accept a cell range.
+
+#### Number formats
+
+You often want to format numbers in Excel. For example you may want a thousands separator plus a fixed number of decimals after the decimal separator. Or perhaps you want some numbers to be zero-padded.
+
+In Microsoft Office Excel you may be familiar with selecting a number format from the "Format Cells" dialog. Here there are some predefined number formats available including some for dates. The dialog is designed in a way so you don't have to interact with the underlying raw number format code unless you need a custom number format.
+
+In PHPExcel, you can also apply various predefined number formats. Example:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()
+ ->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1);
+```
+
+This will format a number e.g. 1587.2 so it shows up as 1,587.20 when you open the workbook in MS Office Excel. (Depending on settings for decimal and thousands separators in Microsoft Office Excel it may show up as 1.587,20)
+
+You can achieve exactly the same as the above by using this:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()
+ ->setFormatCode('#,##0.00');
+```
+
+In Microsoft Office Excel, as well as in PHPExcel, you will have to interact with raw number format codes whenever you need some special custom number format. Example:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()
+ ->setFormatCode('[Blue][>=3000]$#,##0;[Red][<0]$#,##0;$#,##0');
+```
+
+Another example is when you want numbers zero-padded with leading zeros to a fixed length:
+
+```php
+$objPHPExcel->getActiveSheet()->getCell('A1')->setValue(19);
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()
+ ->setFormatCode('0000'); // will show as 0019 in Excel
+```
+
+__Tip__
+The rules for composing a number format code in Excel can be rather complicated. Sometimes you know how to create some number format in Microsoft Office Excel, but don't know what the underlying number format code looks like. How do you find it?
+
+The readers shipped with PHPExcel come to the rescue. Load your template workbook using e.g. Excel2007 reader to reveal the number format code. Example how read a number format code for cell A1:
+
+```php
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objPHPExcel = $objReader->load('template.xlsx');
+var_dump($objPHPExcel->getActiveSheet()->getStyle('A1')->getNumberFormat()->getFormatCode());
+```
+
+Advanced users may find it faster to inspect the number format code directly by renaming template.xlsx to template.zip, unzipping, and looking for the relevant piece of XML code holding the number format code in *xl/styles.xml*.
+
+#### Alignment and wrap text
+
+Let's set vertical alignment to the top for cells A1:D4
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('A1:D4')
+ ->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
+```
+
+Here is how to achieve wrap text:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('A1:D4')
+ ->getAlignment()->setWrapText(true);
+```
+
+#### Setting the default style of a workbook
+
+It is possible to set the default style of a workbook. Let's set the default font to Arial size 8:
+
+```php
+$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial');
+$objPHPExcel->getDefaultStyle()->getFont()->setSize(8);
+```
+
+#### Styling cell borders
+
+In PHPExcel it is easy to apply various borders on a rectangular selection. Here is how to apply a thick red border outline around cells B2:G8.
+
+```php
+$styleArray = array(
+ 'borders' => array(
+ 'outline' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THICK,
+ 'color' => array('argb' => 'FFFF0000'),
+ ),
+ ),
+);
+
+$objWorksheet->getStyle('B2:G8')->applyFromArray($styleArray);
+```
+
+In Microsoft Office Excel, the above operation would correspond to selecting the cells B2:G8, launching the style dialog, choosing a thick red border, and clicking on the "Outline" border component.
+
+Note that the border outline is applied to the rectangular selection B2:G8 as a whole, not on each cell individually.
+
+You can achieve any border effect by using just the 5 basic borders and operating on a single cell at a time:
+
+ Array key | Maps to property
+ ----------|------------------
+ left | getLeft()
+ right | getRight()
+ top | getTop()
+ bottom | getBottom()
+ diagonal | getDiagonal()
+
+Additional shortcut borders come in handy like in the example above. These are the shortcut borders available:
+
+ Array key | Maps to property
+ -----------|------------------
+ allborders | getAllBorders()
+ outline | getOutline()
+ inside | getInside()
+ vertical | getVertical()
+ horizontal | getHorizontal()
+
+
+
+An overview of all border shortcuts can be seen in the following image:
+
+![08-styling-border-options.png](./images/08-styling-border-options.png "")
+
+If you simultaneously set e.g. allborders and vertical, then we have "overlapping" borders, and one of the components has to win over the other where there is border overlap. In PHPExcel, from weakest to strongest borders, the list is as follows: allborders, outline/inside, vertical/horizontal, left/right/top/bottom/diagonal.
+
+This border hierarchy can be utilized to achieve various effects in an easy manner.
+
+### Conditional formatting a cell
+
+A cell can be formatted conditionally, based on a specific rule. For example, one can set the foreground colour of a cell to red if its value is below zero, and to green if its value is zero or more.
+
+One can set a conditional style ruleset to a cell using the following code:
+
+```php
+$objConditional1 = new PHPExcel_Style_Conditional();
+$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS);
+$objConditional1->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN);
+$objConditional1->addCondition('0');
+$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
+$objConditional1->getStyle()->getFont()->setBold(true);
+
+$objConditional2 = new PHPExcel_Style_Conditional();
+$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS);
+$objConditional2->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL);
+$objConditional2->addCondition('0');
+$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
+$objConditional2->getStyle()->getFont()->setBold(true);
+
+$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
+array_push($conditionalStyles, $objConditional1);
+array_push($conditionalStyles, $objConditional2);
+
+$objPHPExcel->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles);
+```
+
+If you want to copy the ruleset to other cells, you can duplicate the style object:
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->duplicateStyle(
+ $objPHPExcel->getActiveSheet()->getStyle('B2'),
+ 'B3:B7'
+ );
+```
+
+### Add a comment to a cell
+
+To add a comment to a cell, use the following code. The example below adds a comment to cell E11:
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->getComment('E11')
+ ->setAuthor('Mark Baker');
+$objCommentRichText = $objPHPExcel->getActiveSheet()
+ ->getComment('E11')
+ ->getText()->createTextRun('PHPExcel:');
+$objCommentRichText->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()
+ ->getComment('E11')
+ ->getText()->createTextRun("\r\n");
+$objPHPExcel->getActiveSheet()
+ ->getComment('E11')
+ ->getText()->createTextRun('Total amount on the current invoice, excluding VAT.');
+```
+
+![08-cell-comment.png](./images/08-cell-comment.png "")
+
+### Apply autofilter to a range of cells
+
+To apply an autofilter to a range of cells, use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->setAutoFilter('A1:C9');
+```
+
+__Make sure that you always include the complete filter range!__
+Excel does support setting only the captionrow, but that's __not__ a best practice...
+
+### Setting security on a spreadsheet
+
+Excel offers 3 levels of "protection": document security, sheet security and cell security.
+
+Document security allows you to set a password on a complete spreadsheet, allowing changes to be made only when that password is entered.Worksheet security offers other security options: you can disallow inserting rows on a specific sheet, disallow sorting, ... Cell security offers the option to lock/unlock a cell as well as show/hide the internal formulaAn example on setting document security:
+
+```php
+$objPHPExcel->getSecurity()->setLockWindows(true);
+$objPHPExcel->getSecurity()->setLockStructure(true);
+$objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel");
+```
+
+An example on setting worksheet security:
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->getProtection()->setPassword('PHPExcel');
+$objPHPExcel->getActiveSheet()
+ ->getProtection()->setSheet(true);
+$objPHPExcel->getActiveSheet()
+ ->getProtection()->setSort(true);
+$objPHPExcel->getActiveSheet()
+ ->getProtection()->setInsertRows(true);
+$objPHPExcel->getActiveSheet()
+ ->getProtection()->setFormatCells(true);
+```
+
+An example on setting cell security:
+
+```php
+$objPHPExcel->getActiveSheet()->getStyle('B1')
+ ->getProtection()
+ ->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
+```
+
+__Make sure you enable worksheet protection if you need any of the worksheet protection features!__ This can be done using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
+```
+
+### Setting data validation on a cell
+
+Data validation is a powerful feature of Excel2007. It allows to specify an input filter on the data that can be inserted in a specific cell. This filter can be a range (i.e. value must be between 0 and 10), a list (i.e. value must be picked from a list), ...
+
+The following piece of code only allows numbers between 10 and 20 to be entered in cell B3:
+
+```php
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')
+ ->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Number is not allowed!');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Only numbers between 10 and 20 are allowed.');
+$objValidation->setFormula1(10);
+$objValidation->setFormula2(20);
+```
+
+This validation will limit the length of text that can be entered in a cell to 6 characters.
+
+```
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B9')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Text exceeds maximum length');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Maximum text length is 6 characters.');
+$objValidation->setFormula1(6);
+```
+
+The following piece of code only allows an item picked from a list of data to be entered in cell B3:
+
+```php
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')
+ ->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
+$objValidation->setAllowBlank(false);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setShowDropDown(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Value is not in list.');
+$objValidation->setPromptTitle('Pick from list');
+$objValidation->setPrompt('Please pick a value from the drop-down list.');
+$objValidation->setFormula1('"Item A,Item B,Item C"');
+```
+
+When using a data validation list like above, make sure you put the list between " and " and that you split the items with a comma (,).
+
+It is important to remember that any string participating in an Excel formula is allowed to be maximum 255 characters (not bytes). This sets a limit on how many items you can have in the string "Item A,Item B,Item C". Therefore it is normally a better idea to type the item values directly in some cell range, say A1:A3, and instead use, say, $objValidation->setFormula1('Sheet!$A$1:$A$3');. Another benefit is that the item values themselves can contain the comma "," character itself.
+
+If you need data validation on multiple cells, one can clone the ruleset:
+
+```php
+$objPHPExcel->getActiveSheet()->getCell('B8')->setDataValidation(clone $objValidation);
+```
+
+### Setting a column's width
+
+A column's width can be set using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);
+```
+
+If you want PHPExcel to perform an automatic width calculation, use the following code. PHPExcel will approximate the column with to the width of the widest column value.
+
+```php
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
+```
+
+![08-column-width.png](./images/08-column-width.png "")
+
+The measure for column width in PHPExcel does __not__ correspond exactly to the measure you may be used to in Microsoft Office Excel. Column widths are difficult to deal with in Excel, and there are several measures for the column width.1) __Inner width in character units__ (e.g. 8.43 this is probably what you are familiar with in Excel)2) __Full width in pixels__ (e.g. 64 pixels)3) __Full width in character units__ (e.g. 9.140625, value -1 indicates unset width)__PHPExcel always operates with 3) "Full width in character units"__ which is in fact the only value that is stored in any Excel file, hence the most reliable measure. Unfortunately, __Microsoft ____Office ____Excel does not present you with this ____measure__. Instead measures 1) and 2) are computed by the application when the file is opened and these values are presented in various dialogues and tool tips.The character width unit is the width of a '0' (zero) glyph in the workbooks default font. Therefore column widths measured in character units in two different workbooks can only be compared if they have the same default workbook font.If you have some Excel file and need to know the column widths in measure 3), you can read the Excel file with PHPExcel and echo the retrieved values.
+
+### Show/hide a column
+
+To set a worksheet's column visibility, you can use the following code. The first line explicitly shows the column C, the second line hides column D.
+
+```php
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+```
+
+### Group/outline a column
+
+To group/outline a column, you can use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1);
+```
+
+You can also collapse the column. Note that you should also set the column invisible, otherwise the collapse will not be visible in Excel 2007.
+
+```php
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setCollapsed(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setVisible(false);
+```
+
+Please refer to the section "group/outline a row" for a complete example on collapsing.
+
+You can instruct PHPExcel to add a summary to the right (default), or to the left. The following code adds the summary to the left:
+
+```php
+$objPHPExcel->getActiveSheet()->setShowSummaryRight(false);
+```
+
+### Setting a row's height
+
+A row's height can be set using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getRowDimension('10')->setRowHeight(100);
+```
+
+Excel measures row height in points, where 1 pt is 1/72 of an inch (or about 0.35mm). The default value is 12.75 pts; and the permitted range of values is between 0 and 409 pts, where 0 pts is a hidden row.
+
+### Show/hide a row
+
+To set a worksheet''s row visibility, you can use the following code. The following example hides row number 10.
+
+```php
+$objPHPExcel->getActiveSheet()->getRowDimension('10')->setVisible(false);
+```
+
+Note that if you apply active filters using an AutoFilter, then this will override any rows that you hide or unhide manually within that AutoFilter range if you save the file.
+
+### Group/outline a row
+
+To group/outline a row, you can use the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getRowDimension('5')->setOutlineLevel(1);
+```
+
+You can also collapse the row. Note that you should also set the row invisible, otherwise the collapse will not be visible in Excel 2007.
+
+```php
+$objPHPExcel->getActiveSheet()->getRowDimension('5')->setCollapsed(true);
+$objPHPExcel->getActiveSheet()->getRowDimension('5')->setVisible(false);
+```
+
+Here's an example which collapses rows 50 to 80:
+
+```php
+for ($i = 51; $i <= 80; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, "LName $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('E' . $i, true);
+ $objPHPExcel->getActiveSheet()->getRowDimension($i)->setOutlineLevel(1);
+ $objPHPExcel->getActiveSheet()->getRowDimension($i)->setVisible(false);
+}
+
+$objPHPExcel->getActiveSheet()->getRowDimension(81)->setCollapsed(true);
+```
+
+You can instruct PHPExcel to add a summary below the collapsible rows (default), or above. The following code adds the summary above:
+
+```php
+$objPHPExcel->getActiveSheet()->setShowSummaryBelow(false);
+```
+
+### Merge/unmerge cells
+
+If you have a big piece of data you want to display in a worksheet, you can merge two or more cells together, to become one cell. This can be done using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->mergeCells('A18:E22');
+```
+
+Removing a merge can be done using the unmergeCells method:
+
+```php
+$objPHPExcel->getActiveSheet()->unmergeCells('A18:E22');
+```
+
+### Inserting rows/columns
+
+You can insert/remove rows/columns at a specific position. The following code inserts 2 new rows, right before row 7:
+
+```php
+$objPHPExcel->getActiveSheet()->insertNewRowBefore(7, 2);
+```
+
+### Add a drawing to a worksheet
+
+A drawing is always represented as a separate object, which can be added to a worksheet. Therefore, you must first instantiate a new PHPExcel_Worksheet_Drawing, and assign its properties a meaningful value:
+
+```php
+$objDrawing = new PHPExcel_Worksheet_Drawing();
+$objDrawing->setName('Logo');
+$objDrawing->setDescription('Logo');
+$objDrawing->setPath('./images/officelogo.jpg');
+$objDrawing->setHeight(36);
+```
+
+To add the above drawing to the worksheet, use the following snippet of code. PHPExcel creates the link between the drawing and the worksheet:
+
+```php
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+```
+
+You can set numerous properties on a drawing, here are some examples:
+
+```php
+$objDrawing->setName('Paid');
+$objDrawing->setDescription('Paid');
+$objDrawing->setPath('./images/paid.png');
+$objDrawing->setCoordinates('B15');
+$objDrawing->setOffsetX(110);
+$objDrawing->setRotation(25);
+$objDrawing->getShadow()->setVisible(true);
+$objDrawing->getShadow()->setDirection(45);
+```
+
+You can also add images created using GD functions without needing to save them to disk first as In-Memory drawings.
+
+```php
+// Use GD to create an in-memory image
+$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream');
+$textColor = imagecolorallocate($gdImage, 255, 255, 255);
+imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor);
+
+// Add the In-Memory image to a worksheet
+$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
+$objDrawing->setName('In-Memory image 1');
+$objDrawing->setDescription('In-Memory image 1');
+$objDrawing->setCoordinates('A1');
+$objDrawing->setImageResource($gdImage);
+$objDrawing->setRenderingFunction(
+ PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG
+);
+$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
+$objDrawing->setHeight(36);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+```
+
+### Reading Images from a worksheet
+
+A commonly asked question is how to retrieve the images from a workbook that has been loaded, and save them as individual image files to disk.
+
+The following code extracts images from the current active worksheet, and writes each as a separate file.
+
+```php
+$i = 0;
+foreach ($objPHPExcel->getActiveSheet()->getDrawingCollection() as $drawing) {
+ if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
+ ob_start();
+ call_user_func(
+ $drawing->getRenderingFunction(),
+ $drawing->getImageResource()
+ );
+ $imageContents = ob_get_contents();
+ ob_end_clean();
+ switch ($drawing->getMimeType()) {
+ case PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_PNG :
+ $extension = 'png';
+ break;
+ case PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_GIF:
+ $extension = 'gif';
+ break;
+ case PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_JPEG :
+ $extension = 'jpg';
+ break;
+ }
+ } else {
+ $zipReader = fopen($drawing->getPath(),'r');
+ $imageContents = '';
+ while (!feof($zipReader)) {
+ $imageContents .= fread($zipReader,1024);
+ }
+ fclose($zipReader);
+ $extension = $drawing->getExtension();
+ }
+ $myFileName = '00_Image_'.++$i.'.'.$extension;
+ file_put_contents($myFileName,$imageContents);
+}
+```
+
+### Add rich text to a cell
+
+Adding rich text to a cell can be done using PHPExcel_RichText instances. Here''s an example, which creates the following rich text string:
+
+ > This invoice is *__payable within thirty days after the end of the month__* unless specified otherwise on the invoice.
+
+```php
+$objRichText = new PHPExcel_RichText();
+$objRichText->createText('This invoice is ');
+$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
+$objPayable->getFont()->setBold(true);
+$objPayable->getFont()->setItalic(true);
+$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
+$objRichText->createText(', unless specified otherwise on the invoice.');
+$objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText);
+```
+
+### Define a named range
+
+PHPExcel supports the definition of named ranges. These can be defined using the following code:
+
+```php
+// Add some data
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:');
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Lastname:');
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Maarten');
+$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Balliauw');
+
+// Define named ranges
+$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonFN', $objPHPExcel->getActiveSheet(), 'B1') );
+$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
+```
+
+Optionally, a fourth parameter can be passed defining the named range local (i.e. only usable on the current worksheet). Named ranges are global by default.
+
+### Redirect output to a client's web browser
+
+Sometimes, one really wants to output a file to a client''s browser, especially when creating spreadsheets on-the-fly. There are some easy steps that can be followed to do this:
+
+ 1. Create your PHPExcel spreadsheet
+ 2. Output HTTP headers for the type of document you wish to output
+ 3. Use the PHPExcel_Writer_* of your choice, and save to "php://output"
+
+ÂPHPExcel_Writer_Excel2007 uses temporary storage when writing to php://output. By default, temporary files are stored in the script's working directory. When there is no access, it falls back to the operating system's temporary files location.
+
+__This may not be safe for unauthorized viewing!__
+Depending on the configuration of your operating system, temporary storage can be read by anyone using the same temporary storage folder. When confidentiality of your document is needed, it is recommended not to use php://output.
+
+#### HTTP headers
+
+Example of a script redirecting an Excel 2007 file to the client's browser:
+
+```php
+/* Here there will be some code where you create $objPHPExcel */
+
+// redirect output to client browser
+header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+header('Content-Disposition: attachment;filename="myfile.xlsx"');
+header('Cache-Control: max-age=0');
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save('php://output');
+```
+
+Example of a script redirecting an Excel5 file to the client's browser:
+
+```php
+/* Here there will be some code where you create $objPHPExcel */
+
+// redirect output to client browser
+header('Content-Type: application/vnd.ms-excel');
+header('Content-Disposition: attachment;filename="myfile.xls"');
+header('Cache-Control: max-age=0');
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save('php://output');
+```
+
+**Caution:**
+
+Make sure not to include any echo statements or output any other contents than the Excel file. There should be no whitespace before the opening tag (which can also be omitted to avoid problems). Make sure that your script is saved without a BOM (Byte-order mark) because this counts as echoing output. The same things apply to all included files.
+Failing to follow the above guidelines may result in corrupt Excel files arriving at the client browser, and/or that headers cannot be set by PHP (resulting in warning messages).
+
+### Setting the default column width
+
+Default column width can be set using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(12);
+```
+
+### Setting the default row height
+
+Default row height can be set using the following code:
+
+```php
+$objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15);
+```
+
+### Add a GD drawing to a worksheet
+
+There might be a situation where you want to generate an in-memory image using GD and add it to a PHPExcel worksheet without first having to save this file to a temporary location.
+
+Here''s an example which generates an image in memory and adds it to the active worksheet:
+
+```php
+// Generate an image
+$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream');
+$textColor = imagecolorallocate($gdImage, 255, 255, 255);
+imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor);
+
+// Add a drawing to the worksheet
+$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
+$objDrawing->setName('Sample image');
+$objDrawing->setDescription('Sample image');
+$objDrawing->setImageResource($gdImage);
+$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
+$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
+$objDrawing->setHeight(36);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+```
+
+### Setting worksheet zoom level
+
+To set a worksheet's zoom level, the following code can be used:
+
+```php
+$objPHPExcel->getActiveSheet()->getSheetView()->setZoomScale(75);
+```
+
+Note that zoom level should be in range 10 – 400.
+
+### Sheet tab color
+
+Sometimes you want to set a color for sheet tab. For example you can have a red sheet tab:
+
+```php
+$objWorksheet->getTabColor()->setRGB('FF0000');
+```
+
+### Creating worksheets in a workbook
+
+If you need to create more worksheets in the workbook, here is how:
+
+```php
+$objWorksheet1 = $objPHPExcel->createSheet();
+$objWorksheet1->setTitle('Another sheet');
+```
+
+Think of createSheet() as the "Insert sheet" button in Excel. When you hit that button a new sheet is appended to the existing collection of worksheets in the workbook.
+
+### Hidden worksheets (Sheet states)
+
+Set a worksheet to be __hidden__ using this code:
+
+```php
+$objPHPExcel->getActiveSheet()
+ ->setSheetState(PHPExcel_Worksheet::SHEETSTATE_HIDDEN);
+```
+
+Sometimes you may even want the worksheet to be __"very hidden"__. The available sheet states are :
+
+ - PHPExcel_Worksheet::SHEETSTATE_VISIBLE
+ - PHPExcel_Worksheet::SHEETSTATE_HIDDEN
+ - PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN
+
+In Excel the sheet state "very hidden" can only be set programmatically, e.g. with Visual Basic Macro. It is not possible to make such a sheet visible via the user interface.
+
+### Right-to-left worksheet
+
+Worksheets can be set individually whether column "A" should start at left or right side. Default is left. Here is how to set columns from right-to-left.
+
+```php
+// right-to-left worksheet
+$objPHPExcel->getActiveSheet()
+ ->setRightToLeft(true);
+```
+
diff --git a/Documentation/markdown/Overview/09-Calculation-Engine.md b/Documentation/markdown/Overview/09-Calculation-Engine.md
new file mode 100644
index 0000000..c13a18c
--- /dev/null
+++ b/Documentation/markdown/Overview/09-Calculation-Engine.md
@@ -0,0 +1,52 @@
+# PHPExcel Developer Documentation
+
+## Using the PHPExcel calculation engine
+
+### Performing formula calculations
+
+As PHPExcel represents an in-memory spreadsheet, it also offers formula calculation capabilities. A cell can be of a value type (containing a number or text), or a formula type (containing a formula which can be evaluated). For example, the formula "=SUM(A1:A10)" evaluates to the sum of values in A1, A2, ..., A10.
+
+To calculate a formula, you can call the cell containing the formula’s method getCalculatedValue(), for example:
+
+```php
+$objPHPExcel->getActiveSheet()->getCell('E11')->getCalculatedValue();
+```
+If you write the following line of code in the invoice demo included with PHPExcel, it evaluates to the value "64":
+
+![09-command-line-calculation.png](./images/09-command-line-calculation.png "")
+
+Another nice feature of PHPExcel's formula parser, is that it can automatically adjust a formula when inserting/removing rows/columns. Here's an example:
+
+![09-formula-in-cell-1.png](./images/09-formula-in-cell-1.png "")
+
+You see that the formula contained in cell E11 is "SUM(E4:E9)". Now, when I write the following line of code, two new product lines are added:
+
+```php
+$objPHPExcel->getActiveSheet()->insertNewRowBefore(7, 2);
+```
+
+![09-formula-in-cell-2.png](./images/09-formula-in-cell-2.png "")
+
+Did you notice? The formula in the former cell E11 (now E13, as I inserted 2 new rows), changed to "SUM(E4:E11)". Also, the inserted cells duplicate style information of the previous cell, just like Excel's behaviour. Note that you can both insert rows and columns.
+
+### Known limitations
+
+There are some known limitations to the PHPExcel calculation engine. Most of them are due to the fact that an Excel formula is converted into PHP code before being executed. This means that Excel formula calculation is subject to PHP's language characteristics.
+
+#### Operator precedence
+
+In Excel '+' wins over '&', just like '*' wins over '+' in ordinary algebra. The former rule is not what one finds using the calculation engine shipped with PHPExcel.
+
+Reference for operator precedence in Excel: [http://support.microsoft.com/kb/25189][18]
+
+Reference for operator precedence in PHP: [http://www.php.net/operators][19]
+
+#### Formulas involving numbers and text
+
+Formulas involving numbers and text may produce unexpected results or even unreadable file contents. For example, the formula '=3+"Hello "' is expected to produce an error in Excel (#VALUE!). Due to the fact that PHP converts “Hello†to a numeric value (zero), the result of this formula is evaluated as 3 instead of evaluating as an error. This also causes the Excel document being generated as containing unreadable content.
+
+Reference for this behaviour in PHP: [http://be.php.net/manual/en/language.types.string.php#language.types.string.conversion][20]
+
+ [18]: http://support.microsoft.com/kb/25189
+ [19]: http://www.php.net/operators
+ [20]: http://be.php.net/manual/en/language.types.string.php#language.types.string.conversion
diff --git a/Documentation/markdown/Overview/10-Reading-and-Writing.md b/Documentation/markdown/Overview/10-Reading-and-Writing.md
new file mode 100644
index 0000000..1468abc
--- /dev/null
+++ b/Documentation/markdown/Overview/10-Reading-and-Writing.md
@@ -0,0 +1,714 @@
+# PHPExcel Developer Documentation
+
+## Reading and writing to file
+
+As you already know from part REF _Ref191885438 \w \h 3.3 REF _Ref191885438 \h Readers and writers, reading and writing to a persisted storage is not possible using the base PHPExcel classes. For this purpose, PHPExcel provides readers and writers, which are implementations of PHPExcel_Writer_IReader and PHPExcel_Writer_IWriter.
+
+### PHPExcel_IOFactory
+
+The PHPExcel API offers multiple methods to create a PHPExcel_Writer_IReader or PHPExcel_Writer_IWriter instance:
+
+Direct creation via PHPExcel_IOFactory. All examples underneath demonstrate the direct creation method. Note that you can also use the PHPExcel_IOFactory class to do this.
+
+#### Creating PHPExcel_Reader_IReader using PHPExcel_IOFactory
+
+There are 2 methods for reading in a file into PHPExcel: using automatic file type resolving or explicitly.
+
+Automatic file type resolving checks the different PHPExcel_Reader_IReader distributed with PHPExcel. If one of them can load the specified file name, the file is loaded using that PHPExcel_Reader_IReader. Explicit mode requires you to specify which PHPExcel_Reader_IReader should be used.
+
+You can create a PHPExcel_Reader_IReader instance using PHPExcel_IOFactory in automatic file type resolving mode using the following code sample:
+
+```php
+$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
+```
+
+A typical use of this feature is when you need to read files uploaded by your users, and you don’t know whether they are uploading xls or xlsx files.
+
+If you need to set some properties on the reader, (e.g. to only read data, see more about this later), then you may instead want to use this variant:
+
+```php
+$objReader = PHPExcel_IOFactory::createReaderForFile("05featuredemo.xlsx");
+$objReader->setReadDataOnly(true);
+$objReader->load("05featuredemo.xlsx");
+```
+
+You can create a PHPExcel_Reader_IReader instance using PHPExcel_IOFactory in explicit mode using the following code sample:
+
+```php
+$objReader = PHPExcel_IOFactory::createReader("Excel2007");
+$objPHPExcel = $objReader->load("05featuredemo.xlsx");
+```
+
+Note that automatic type resolving mode is slightly slower than explicit mode.
+
+#### Creating PHPExcel_Writer_IWriter using PHPExcel_IOFactory
+
+You can create a PHPExcel_Writer_Iwriter instance using PHPExcel_IOFactory:
+
+```php
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
+$objWriter->save("05featuredemo.xlsx");
+```
+
+### Excel 2007 (SpreadsheetML) file format
+
+Excel2007 file format is the main file format of PHPExcel. It allows outputting the in-memory spreadsheet to a .xlsx file.
+
+#### PHPExcel_Reader_Excel2007
+
+##### Reading a spreadsheet
+
+You can read an .xlsx file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_Excel2007();
+$objPHPExcel = $objReader->load("05featuredemo.xlsx");
+```
+
+##### Read data only
+
+You can set the option setReadDataOnly on the reader, to instruct the reader to ignore styling, data validation, … and just read cell data:
+
+```php
+$objReader = new PHPExcel_Reader_Excel2007();
+$objReader->setReadDataOnly(true);
+$objPHPExcel = $objReader->load("05featuredemo.xlsx");
+```
+
+##### Read specific sheets only
+
+You can set the option setLoadSheetsOnly on the reader, to instruct the reader to only load the sheets with a given name:
+
+```php
+$objReader = new PHPExcel_Reader_Excel2007();
+$objReader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") );
+$objPHPExcel = $objReader->load("05featuredemo.xlsx");
+```
+
+##### Read specific cells only
+
+You can set the option setReadFilter on the reader, to instruct the reader to only load the cells which match a given rule. A read filter can be any class which implements PHPExcel_Reader_IReadFilter. By default, all cells are read using the PHPExcel_Reader_DefaultReadFilter.
+
+The following code will only read row 1 and rows 20 – 30 of any sheet in the Excel file:
+
+```php
+class MyReadFilter implements PHPExcel_Reader_IReadFilter {
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+$objReader = new PHPExcel_Reader_Excel2007();
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.xlsx");
+```
+
+#### PHPExcel_Writer_Excel2007
+
+##### Writing a spreadsheet
+
+You can write an .xlsx file using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
+$objWriter->save("05featuredemo.xlsx");
+```
+
+##### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
+$objWriter->setPreCalculateFormulas(false);
+$objWriter->save("05featuredemo.xlsx");
+```
+
+##### Office 2003 compatibility pack
+
+Because of a bug in the Office2003 compatibility pack, there can be some small issues when opening Excel2007 spreadsheets (mostly related to formula calculation). You can enable Office2003 compatibility with the following code:
+
+```
+$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
+$objWriter->setOffice2003Compatibility(true);
+$objWriter->save("05featuredemo.xlsx");
+```
+
+__Office2003 compatibility should only be used when needed__
+Office2003 compatibility option should only be used when needed. This option disables several Office2007 file format options, resulting in a lower-featured Office2007 spreadsheet when this option is used.
+
+### Excel 5 (BIFF) file format
+
+Excel5 file format is the old Excel file format, implemented in PHPExcel to provide a uniform manner to create both .xlsx and .xls files. It is basically a modified version of [PEAR Spreadsheet_Excel_Writer][21], although it has been extended and has fewer limitations and more features than the old PEAR library. This can read all BIFF versions that use OLE2: BIFF5 (introduced with office 95) through BIFF8, but cannot read earlier versions.
+
+Excel5 file format will not be developed any further, it just provides an additional file format for PHPExcel.
+
+__Excel5 (BIFF) limitations__
+Please note that BIFF file format has some limits regarding to styling cells and handling large spreadsheets via PHP.
+
+#### PHPExcel_Reader_Excel5
+
+##### Reading a spreadsheet
+
+You can read an .xls file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_Excel5();
+$objPHPExcel = $objReader->load("05featuredemo.xls");
+```
+
+##### Read data only
+
+You can set the option setReadDataOnly on the reader, to instruct the reader to ignore styling, data validation, … and just read cell data:
+
+```php
+$objReader = new PHPExcel_Reader_Excel5();
+$objReader->setReadDataOnly(true);
+$objPHPExcel = $objReader->load("05featuredemo.xls");
+```
+
+##### Read specific sheets only
+
+You can set the option setLoadSheetsOnly on the reader, to instruct the reader to only load the sheets with a given name:
+
+```php
+$objReader = new PHPExcel_Reader_Excel5();
+$objReader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") );
+$objPHPExcel = $objReader->load("05featuredemo.xls");
+```
+
+##### Read specific cells only
+
+You can set the option setReadFilter on the reader, to instruct the reader to only load the cells which match a given rule. A read filter can be any class which implements PHPExcel_Reader_IReadFilter. By default, all cells are read using the PHPExcel_Reader_DefaultReadFilter.
+
+The following code will only read row 1 and rows 20 to 30 of any sheet in the Excel file:
+
+```php
+class MyReadFilter implements PHPExcel_Reader_IReadFilter {
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+$objReader = new PHPExcel_Reader_Excel5();
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.xls");
+```
+
+#### PHPExcel_Writer_Excel5
+
+##### Writing a spreadsheet
+
+You can write an .xls file using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
+$objWriter->save("05featuredemo.xls");
+```
+
+### Excel 2003 XML file format
+
+Excel 2003 XML file format is a file format which can be used in older versions of Microsoft Excel.
+
+__Excel 2003 XML limitations__
+Please note that Excel 2003 XML format has some limits regarding to styling cells and handling large spreadsheets via PHP.
+
+#### PHPExcel_Reader_Excel2003XML
+
+##### Reading a spreadsheet
+
+You can read an Excel 2003 .xml file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_Excel2003XML();
+$objPHPExcel = $objReader->load("05featuredemo.xml");
+```
+
+##### Read specific cells only
+
+You can set the option setReadFilter on the reader, to instruct the reader to only load the cells which match a given rule. A read filter can be any class which implements PHPExcel_Reader_IReadFilter. By default, all cells are read using the PHPExcel_Reader_DefaultReadFilter.
+
+The following code will only read row 1 and rows 20 to 30 of any sheet in the Excel file:
+
+```php
+class MyReadFilter implements PHPExcel_Reader_IReadFilter {
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
+$objReader = new PHPExcel_Reader_Excel2003XML();
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.xml");
+```
+
+### Symbolic LinK (SYLK)
+
+Symbolic Link (SYLK) is a Microsoft file format typically used to exchange data between applications, specifically spreadsheets. SYLK files conventionally have a .slk suffix. Composed of only displayable ANSI characters, it can be easily created and processed by other applications, such as databases.
+
+__SYLK limitations__
+Please note that SYLK file format has some limits regarding to styling cells and handling large spreadsheets via PHP.
+
+#### PHPExcel_Reader_SYLK
+
+##### Reading a spreadsheet
+
+You can read an .slk file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_SYLK();
+$objPHPExcel = $objReader->load("05featuredemo.slk");
+```
+
+##### Read specific cells only
+
+You can set the option setReadFilter on the reader, to instruct the reader to only load the cells which match a given rule. A read filter can be any class which implements PHPExcel_Reader_IReadFilter. By default, all cells are read using the PHPExcel_Reader_DefaultReadFilter.
+
+The following code will only read row 1 and rows 20 to 30 of any sheet in the SYLK file:
+
+```php
+class MyReadFilter implements PHPExcel_Reader_IReadFilter {
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
+$objReader = new PHPExcel_Reader_SYLK();
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.slk");
+```
+
+### Open/Libre Office (.ods)
+
+Open Office or Libre Office .ods files are the standard file format for Open Office or Libre Office Calc files.
+
+#### PHPExcel_Reader_OOCalc
+
+##### Reading a spreadsheet
+
+You can read an .ods file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_OOCalc();
+$objPHPExcel = $objReader->load("05featuredemo.ods");
+```
+
+##### Read specific cells only
+
+You can set the option setReadFilter on the reader, to instruct the reader to only load the cells which match a given rule. A read filter can be any class which implements PHPExcel_Reader_IReadFilter. By default, all cells are read using the PHPExcel_Reader_DefaultReadFilter.
+
+The following code will only read row 1 and rows 20 to 30 of any sheet in the Calc file:
+
+```php
+class MyReadFilter implements PHPExcel_Reader_IReadFilter {
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+ return false;
+ }
+
+}
+
+$objReader = new PHPExcel_Reader_OOcalc();
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.ods");
+```
+
+### CSV (Comma Separated Values)
+
+CSV (Comma Separated Values) are often used as an import/export file format with other systems. PHPExcel allows reading and writing to CSV files.
+
+__CSV limitations__
+Please note that CSV file format has some limits regarding to styling cells, number formatting, ...
+
+#### PHPExcel_Reader_CSV
+
+##### Reading a CSV file
+
+You can read a .csv file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_CSV();
+$objPHPExcel = $objReader->load("sample.csv");
+```
+
+##### Setting CSV options
+
+Often, CSV files are not really “comma separatedâ€, or use semicolon (;) as a separator. You can instruct PHPExcel_Reader_CSV some options before reading a CSV file.
+
+Note that PHPExcel_Reader_CSV by default assumes that the loaded CSV file is UTF-8 encoded. If you are reading CSV files that were created in Microsoft Office Excel the correct input encoding may rather be Windows-1252 (CP1252). Always make sure that the input encoding is set appropriately.
+
+```php
+$objReader = new PHPExcel_Reader_CSV();
+$objReader->setInputEncoding('CP1252');
+$objReader->setDelimiter(';');
+$objReader->setEnclosure('');
+$objReader->setLineEnding("\r\n");
+$objReader->setSheetIndex(0);
+
+$objPHPExcel = $objReader->load("sample.csv");
+```
+
+##### Read a specific worksheet
+
+CSV files can only contain one worksheet. Therefore, you can specify which sheet to read from CSV:
+
+```php
+$objReader->setSheetIndex(0);
+```
+
+##### Read into existing spreadsheet
+
+When working with CSV files, it might occur that you want to import CSV data into an existing PHPExcel object. The following code loads a CSV file into an existing $objPHPExcel containing some sheets, and imports onto the 6th sheet:
+
+```php
+$objReader = new PHPExcel_Reader_CSV();
+$objReader->setDelimiter(';');
+$objReader->setEnclosure('');
+$objReader->setLineEnding("\r\n");
+$objReader->setSheetIndex(5);
+
+$objReader->loadIntoExisting("05featuredemo.csv", $objPHPExcel);
+```
+
+#### PHPExcel_Writer_CSV
+
+##### Writing a CSV file
+
+You can write a .csv file using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_CSV($objPHPExcel);
+$objWriter->save("05featuredemo.csv");
+```
+
+##### Setting CSV options
+
+Often, CSV files are not really “comma separatedâ€, or use semicolon (;) as a separator. You can instruct PHPExcel_Writer_CSV some options before writing a CSV file:
+
+```php
+$objWriter = new PHPExcel_Writer_CSV($objPHPExcel);
+$objWriter->setDelimiter(';');
+$objWriter->setEnclosure('');
+$objWriter->setLineEnding("\r\n");
+$objWriter->setSheetIndex(0);
+
+$objWriter->save("05featuredemo.csv");
+```
+
+##### Write a specific worksheet
+
+CSV files can only contain one worksheet. Therefore, you can specify which sheet to write to CSV:
+
+```php
+$objWriter->setSheetIndex(0);
+```
+
+##### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new PHPExcel_Writer_CSV($objPHPExcel);
+$objWriter->setPreCalculateFormulas(false);
+$objWriter->save("05featuredemo.csv");
+```
+
+##### Writing UTF-8 CSV files
+
+A CSV file can be marked as UTF-8 by writing a BOM file header. This can be enabled by using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_CSV($objPHPExcel);
+$objWriter->setUseBOM(true);
+$objWriter->save("05featuredemo.csv");
+```
+
+##### Decimal and thousands separators
+
+If the worksheet you are exporting contains numbers with decimal or thousands separators then you should think about what characters you want to use for those before doing the export.
+
+By default PHPExcel looks up in the server's locale settings to decide what characters to use. But to avoid problems it is recommended to set the characters explicitly as shown below.
+
+English users will want to use this before doing the export:
+
+```php
+PHPExcel_Shared_String::setDecimalSeparator('.');
+PHPExcel_Shared_String::setThousandsSeparator(',');
+```
+
+German users will want to use the opposite values.
+
+```php
+PHPExcel_Shared_String::setDecimalSeparator(',');
+PHPExcel_Shared_String::setThousandsSeparator('.');
+```
+
+Note that the above code sets decimal and thousand separators as global options. This also affects how HTML and PDF is exported.
+
+### HTML
+
+PHPExcel allows you to read or write a spreadsheet as HTML format, for quick representation of the data in it to anyone who does not have a spreadsheet application on their PC, or loading files saved by other scripts that simply create HTML markup and give it a .xls file extension.
+
+__HTML limitations__
+Please note that HTML file format has some limits regarding to styling cells, number formatting, ...
+
+#### PHPExcel_Reader_HTML
+
+##### Reading a spreadsheet
+
+You can read an .html or .htm file using the following code:
+
+```php
+$objReader = new PHPExcel_Reader_HTML();
+
+$objPHPExcel = $objReader->load("05featuredemo.html");
+```
+
+__HTML limitations__
+Please note that HTML reader is still experimental and does not yet support merged cells or nested tables cleanly
+
+#### PHPExcel_Writer_HTML
+
+Please note that PHPExcel_Writer_HTML only outputs the first worksheet by default.
+
+##### Writing a spreadsheet
+
+You can write a .htm file using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
+
+$objWriter->save("05featuredemo.htm");
+```
+
+##### Write all worksheets
+
+HTML files can contain one or more worksheets. If you want to write all sheets into a single HTML file, use the following code:
+
+```php
+$objWriter->writeAllSheets();
+```
+
+##### Write a specific worksheet
+
+HTML files can contain one or more worksheets. Therefore, you can specify which sheet to write to HTML:
+
+```php
+$objWriter->setSheetIndex(0);
+```
+
+##### Setting the images root of the HTML file
+
+There might be situations where you want to explicitly set the included images root. For example, one might want to see
+```html
+
+```
+
+instead of
+
+```html
+.
+```
+
+You can use the following code to achieve this result:
+
+```php
+$objWriter->setImagesRoot('http://www.example.com');
+```
+
+##### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
+$objWriter->setPreCalculateFormulas(false);
+
+$objWriter->save("05featuredemo.htm");
+```
+
+##### Embedding generated HTML in a web page
+
+There might be a situation where you want to embed the generated HTML in an existing website. PHPExcel_Writer_HTML provides support to generate only specific parts of the HTML code, which allows you to use these parts in your website.
+
+Supported methods:
+
+ - generateHTMLHeader()
+ - generateStyles()
+ - generateSheetData()
+ - generateHTMLFooter()
+
+Here's an example which retrieves all parts independently and merges them into a resulting HTML page:
+
+```php
+generateHTMLHeader();
+?>
+
+
+?>
+
+-->
+
+
+generateSheetData();
+echo $objWriter->generateHTMLFooter();
+?>
+```
+
+##### Writing UTF-8 HTML files
+
+A HTML file can be marked as UTF-8 by writing a BOM file header. This can be enabled by using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_HTML($objPHPExcel);
+$objWriter->setUseBOM(true);
+
+$objWriter->save("05featuredemo.htm");
+```
+
+##### Decimal and thousands separators
+
+See section PHPExcel_Writer_CSV how to control the appearance of these.
+
+### PDF
+
+PHPExcel allows you to write a spreadsheet into PDF format, for fast distribution of represented data.
+
+__PDF limitations__
+Please note that PDF file format has some limits regarding to styling cells, number formatting, ...
+
+#### PHPExcel_Writer_PDF
+
+PHPExcel’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering library such as tcPDF, mPDF or DomPDF. Prior to version 1.7.8 of PHPExcel, the tcPDF library was bundled with PHPExcel; but from version 1.7.8 this was removed. Instead, you must now install a PDF Rendering library yourself; but PHPExcel will work with a number of different libraries.
+
+Currently, the following libraries are supported:
+
+Library | Version used for testing | Downloadable from | PHPExcel Internal Constant
+--------|--------------------------|----------------------------------|----------------------------
+tcPDF | 5.9 | http://www.tcpdf.org/ | PDF_RENDERER_TCPDF
+mPDF | 5.4 | http://www.mpdf1.com/mpdf/ | PDF_RENDERER_MPDF
+domPDF | 0.6.0 beta 3 | http://code.google.com/p/dompdf/ | PDF_RENDERER_DOMPDF
+
+The different libraries have different strengths and weaknesses. Some generate better formatted output than others, some are faster or use less memory than others, while some generate smaller .pdf files. It is the developers choice which one they wish to use, appropriate to their own circumstances.
+
+Before instantiating a Writer to generate PDF output, you will need to indicate which Rendering library you are using, and where it is located.
+
+```php
+$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
+$rendererLibrary = 'mPDF5.4';
+$rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererLibrary;
+
+if (!PHPExcel_Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'Please set the $rendererName and $rendererLibraryPath values' .
+ PHP_EOL .
+ ' as appropriate for your directory structure'
+ );
+}
+```
+
+##### Writing a spreadsheet
+
+Once you have identified the Renderer that you wish to use for PDF generation, you can write a .pdf file using the following code:
+
+```php
+$objWriter = new PHPExcel_Writer_PDF($objPHPExcel);
+$objWriter->save("05featuredemo.pdf");
+```
+
+Please note that PHPExcel_Writer_PDF only outputs the first worksheet by default.
+
+##### Write all worksheets
+
+PDF files can contain one or more worksheets. If you want to write all sheets into a single PDF file, use the following code:
+
+```php
+$objWriter->writeAllSheets();
+```
+
+##### Write a specific worksheet
+
+PDF files can contain one or more worksheets. Therefore, you can specify which sheet to write to PDF:
+
+```php
+$objWriter->setSheetIndex(0);
+```
+
+##### Formula pre-calculation
+
+By default, this writer pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. You can however disable formula pre-calculation:
+
+```php
+$objWriter = new PHPExcel_Writer_PDF($objPHPExcel);
+$objWriter->setPreCalculateFormulas(false);
+
+$objWriter->save("05featuredemo.pdf");
+```
+
+##### Decimal and thousands separators
+
+See section PHPExcel_Writer_CSV how to control the appearance of these.
+
+### Generating Excel files from templates (read, modify, write)
+
+Readers and writers are the tools that allow you to generate Excel files from templates. This requires less coding effort than generating the Excel file from scratch, especially if your template has many styles, page setup properties, headers etc.
+
+Here is an example how to open a template file, fill in a couple of fields and save it again:
+
+```php
+$objPHPexcel = PHPExcel_IOFactory::load('template.xlsx');
+
+$objWorksheet = $objPHPexcel->getActiveSheet();
+
+$objWorksheet->getCell('A1')->setValue('John');
+$objWorksheet->getCell('A2')->setValue('Smith');
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel5');
+$objWriter->save('write.xls');
+```
+
+Notice that it is ok to load an xlsx file and generate an xls file.
+
+ [21]: http://pear.php.net/package/Spreadsheet_Excel_Writer
+ [22]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home
diff --git a/Documentation/markdown/Overview/11-Appendices.md b/Documentation/markdown/Overview/11-Appendices.md
new file mode 100644
index 0000000..1302feb
--- /dev/null
+++ b/Documentation/markdown/Overview/11-Appendices.md
@@ -0,0 +1,100 @@
+# PHPExcel Developer Documentation
+
+## Credits
+
+Please refer to the internet page [http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home][22] for up-to-date credits.
+
+## Valid array keys for style applyFromArray()
+
+The following table lists the valid array keys for PHPExcel_Style applyFromArray() classes. If the "Maps to property" column maps a key to a setter, the value provided for that key will be applied directly. If the "Maps to property" column maps a key to a getter, the value provided for that key will be applied as another style array.
+
+__PHPExcel_Style__
+
+ Array key | Maps to property
+ -------------|-------------------
+ fill | getFill()
+ font | getFont()
+ borders | getBorders()
+ alignment | getAlignment()
+ numberformat | getNumberFormat()
+ protection | getProtection()
+
+
+__PHPExcel_Style_Fill__
+
+ Array key | Maps to property
+ -----------|-------------------
+ type | setFillType()
+ rotation | setRotation()
+ startcolor | getStartColor()
+ endcolor | getEndColor()
+ color | getStartColor()
+
+
+__PHPExcel_Style_Font__
+
+ Array key | Maps to property
+ ------------|-------------------
+ name | setName()
+ bold | setBold()
+ italic | setItalic()
+ underline | setUnderline()
+ strike | setStrikethrough()
+ color | getColor()
+ size | setSize()
+ superScript | setSuperScript()
+ subScript | setSubScript()
+
+
+__PHPExcel_Style_Borders__
+
+ Array key | Maps to property
+ ------------------|-------------------
+ allborders | getLeft(); getRight(); getTop(); getBottom()
+ left | getLeft()
+ right | getRight()
+ top | getTop()
+ bottom | getBottom()
+ diagonal | getDiagonal()
+ vertical | getVertical()
+ horizontal | getHorizontal()
+ diagonaldirection | setDiagonalDirection()
+ outline | setOutline()
+
+
+__PHPExcel_Style_Border__
+
+ Array key | Maps to property
+ ----------|-------------------
+ style | setBorderStyle()
+ color | getColor()
+
+
+__PHPExcel_Style_Alignment__
+
+ Array key | Maps to property
+ ------------|-------------------
+ horizontal | setHorizontal()
+ vertical | setVertical()
+ rotation | setTextRotation()
+ wrap | setWrapText()
+ shrinkToFit | setShrinkToFit()
+ indent | setIndent()
+
+
+__PHPExcel_Style_NumberFormat__
+
+ Array key | Maps to property
+ ----------|-------------------
+ code | setFormatCode()
+
+
+__PHPExcel_Style_Protection__
+
+ Array key | Maps to property
+ ----------|-------------------
+ locked | setLocked()
+ hidden | setHidden()
+
+
+ [22]: http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=Credits&referringTitle=Home
diff --git a/Documentation/markdown/Overview/images/01-schematic.png b/Documentation/markdown/Overview/images/01-schematic.png
new file mode 100644
index 0000000..8b67792
Binary files /dev/null and b/Documentation/markdown/Overview/images/01-schematic.png differ
diff --git a/Documentation/markdown/Overview/images/02-readers-writers.png b/Documentation/markdown/Overview/images/02-readers-writers.png
new file mode 100644
index 0000000..0600788
Binary files /dev/null and b/Documentation/markdown/Overview/images/02-readers-writers.png differ
diff --git a/Documentation/markdown/Overview/images/07-simple-example-1.png b/Documentation/markdown/Overview/images/07-simple-example-1.png
new file mode 100644
index 0000000..30d1936
Binary files /dev/null and b/Documentation/markdown/Overview/images/07-simple-example-1.png differ
diff --git a/Documentation/markdown/Overview/images/07-simple-example-2.png b/Documentation/markdown/Overview/images/07-simple-example-2.png
new file mode 100644
index 0000000..e2b6850
Binary files /dev/null and b/Documentation/markdown/Overview/images/07-simple-example-2.png differ
diff --git a/Documentation/markdown/Overview/images/07-simple-example-3.png b/Documentation/markdown/Overview/images/07-simple-example-3.png
new file mode 100644
index 0000000..459261f
Binary files /dev/null and b/Documentation/markdown/Overview/images/07-simple-example-3.png differ
diff --git a/Documentation/markdown/Overview/images/07-simple-example-4.png b/Documentation/markdown/Overview/images/07-simple-example-4.png
new file mode 100644
index 0000000..7072545
Binary files /dev/null and b/Documentation/markdown/Overview/images/07-simple-example-4.png differ
diff --git a/Documentation/markdown/Overview/images/08-cell-comment.png b/Documentation/markdown/Overview/images/08-cell-comment.png
new file mode 100644
index 0000000..bd8f8e6
Binary files /dev/null and b/Documentation/markdown/Overview/images/08-cell-comment.png differ
diff --git a/Documentation/markdown/Overview/images/08-column-width.png b/Documentation/markdown/Overview/images/08-column-width.png
new file mode 100644
index 0000000..1419943
Binary files /dev/null and b/Documentation/markdown/Overview/images/08-column-width.png differ
diff --git a/Documentation/markdown/Overview/images/08-page-setup-margins.png b/Documentation/markdown/Overview/images/08-page-setup-margins.png
new file mode 100644
index 0000000..36e07a9
Binary files /dev/null and b/Documentation/markdown/Overview/images/08-page-setup-margins.png differ
diff --git a/Documentation/markdown/Overview/images/08-page-setup-scaling-options.png b/Documentation/markdown/Overview/images/08-page-setup-scaling-options.png
new file mode 100644
index 0000000..80fb5f0
Binary files /dev/null and b/Documentation/markdown/Overview/images/08-page-setup-scaling-options.png differ
diff --git a/Documentation/markdown/Overview/images/08-styling-border-options.png b/Documentation/markdown/Overview/images/08-styling-border-options.png
new file mode 100644
index 0000000..4ef5970
Binary files /dev/null and b/Documentation/markdown/Overview/images/08-styling-border-options.png differ
diff --git a/Documentation/markdown/Overview/images/09-command-line-calculation.png b/Documentation/markdown/Overview/images/09-command-line-calculation.png
new file mode 100644
index 0000000..ceb2b30
Binary files /dev/null and b/Documentation/markdown/Overview/images/09-command-line-calculation.png differ
diff --git a/Documentation/markdown/Overview/images/09-formula-in-cell-1.png b/Documentation/markdown/Overview/images/09-formula-in-cell-1.png
new file mode 100644
index 0000000..e50c6cc
Binary files /dev/null and b/Documentation/markdown/Overview/images/09-formula-in-cell-1.png differ
diff --git a/Documentation/markdown/Overview/images/09-formula-in-cell-2.png b/Documentation/markdown/Overview/images/09-formula-in-cell-2.png
new file mode 100644
index 0000000..46daf09
Binary files /dev/null and b/Documentation/markdown/Overview/images/09-formula-in-cell-2.png differ
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md b/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md
new file mode 100644
index 0000000..d891664
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/01-File-Formats.md
@@ -0,0 +1,60 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+
+## Spreadsheet File Formats
+
+PHPExcel can read a number of different spreadsheet and file formats, although not all features are supported by all of the readers. Check the Functionality Cross-Reference document (Functionality Cross-Reference.xls) for a list that identifies which features are supported by which readers.
+
+Currently, PHPExcel supports the following File Types for Reading:
+
+### Excel5
+
+The Microsoft Excelâ„¢ Binary file format (BIFF5 and BIFF8) is a binary file format that was used by Microsoft Excelâ„¢ between versions 95 and 2003. The format is supported (to various extents) by most spreadsheet programs. BIFF files normally have an extension of .xls. Documentation describing the format can be found online at [http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx][1] or from [http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/[MS-XLS].pdf][2] (as a downloadable PDF).
+
+### Excel2003XML
+
+Microsoft Excel™ 2003 included options for a file format called SpreadsheetML. This file is a zipped XML document. It is not very common, but its core features are supported. Documentation for the format can be found at [http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx][3] though it’s sadly rather sparse in its detail.
+
+### Excel2007
+
+Microsoft Excelâ„¢ 2007 shipped with a new file format, namely Microsoft Office Open XML SpreadsheetML, and Excel 2010 extended this still further with its new features such as sparklines. These files typically have an extension of .xlsx. This format is based around a zipped collection of eXtensible Markup Language (XML) files. Microsoft Office Open XML SpreadsheetML is mostly standardized in ECMA 376 ([http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm][4]) and ISO 29500.
+
+### OOCalc
+
+aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML File Format for spreadsheets. It comprises a zip archive including several components all of which are text files, most of these with markup in the eXtensible Markup Language (XML). It is the standard file format for OpenOffice.org Calc and StarCalc, and files typically have an extension of .ods. The published specification for the file format is available from the OASIS Open Office XML Format Technical Committee web page ([http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office#technical][5]). Other information is available from the OpenOffice.org XML File Format web page ([http://xml.openoffice.org/general.html][6]), part of the OpenOffice.org project.
+
+### SYLK
+
+This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file format. Multiplan was a predecessor to Microsoft Excelâ„¢. Files normally have an extension of .slk. While not common, there are still a few applications that generate SYLK files as a cross-platform option, because (despite being limited to a single worksheet) it is a simple format to implement, and supports some basic data and cell formatting options (unlike CSV files).
+
+### Gnumeric
+
+The Gnumeric file format is used by the Gnome Gnumeric spreadsheet application, and typically files have an extension of .gnumeric. The file contents are stored using eXtensible Markup Language (XML) markup, and the file is then compressed using the GNU project's gzip compression library. [http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml][7]
+
+### CSV
+
+Comma Separated Value (CSV) file format is a common structuring strategy for text format files. In CSV flies, each line in the file represents a row of data and (within each line of the file) the different data fields (or columns) are separated from one another using a comma (","). If a data field contains a comma, then it should be enclosed (typically in quotation marks ("). Sometimes tabs "\t", or the pipe symbol ("|"), or a semi-colon (";") are used as separators instead of a comma, although other symbols can be used. Because CSV is a text-only format, it doesn't support any data formatting options.
+
+"CSV" is not a single, well-defined format (although see RFC 4180 for one definition that is commonly used). Rather, in practice the term "CSV" refers to any file that:
+ - is plain text using a character set such as ASCII, Unicode, EBCDIC, or Shift JIS,
+ - consists of records (typically one record per line),
+ - with the records divided into fields separated by delimiters (typically a single reserved character such as comma, semicolon, or tab,
+ - where every record has the same sequence of fields.
+
+Within these general constraints, many variations are in use. Therefore "CSV" files are not entirely portable. Nevertheless, the variations are fairly small, and many implementations allow users to glance at the file (which is feasible because it is plain text), and then specify the delimiter character(s), quoting rules, etc.
+
+**Warning:** Microsoft Excelâ„¢ will open .csv files, but depending on the system's regional settings, it may expect a semicolon as a separator instead of a comma, since in some languages the comma is used as the decimal separator. Also, many regional versions of Excel will not be able to deal with Unicode characters in a CSV file.
+
+### HTML
+
+HyperText Markup Language (HTML) is the main markup language for creating web pages and other information that can be displayed in a web browser. Files typically have an extension of .html or .htm. HTML markup provides a means to create structured documents by denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. Since 1996, the HTML specifications have been maintained, with input from commercial software vendors, by the World Wide Web Consortium (W3C). However, in 2000, HTML also became an international standard (ISO/IEC 15445:2000). HTML 4.01 was published in late 1999, with further errata published through 2001. In 2004 development began on HTML5 in the Web Hypertext Application Technology Working Group (WHATWG), which became a joint deliverable with the W3C in 2008.
+
+
+
+ [1]: http://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx
+ [2]: http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5bMS-XLS%5d.pdf
+ [3]: http://msdn.microsoft.com/en-us/library/aa140066%28office.10%29.aspx
+ [4]: http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm
+ [5]: http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office
+ [6]: http://xml.openoffice.org/general.html
+ [7]: http://projects.gnome.org/gnumeric/doc/file-format-gnumeric.shtml
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/02-Security.md b/Documentation/markdown/ReadingSpreadsheetFiles/02-Security.md
new file mode 100644
index 0000000..12da958
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/02-Security.md
@@ -0,0 +1,13 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+
+## Security
+
+XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and Gnumeric are susceptible to XML External Entity Processing (XXE) injection attacks (for an explanation of XXE injection see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html) when reading spreadsheet files. This can lead to:
+
+ - Disclosure whether a file is existent
+ - Server Side Request Forgery
+ - Command Execution (depending on the installed PHP wrappers)
+
+
+To prevent this, PHPExcel sets `libxml_disable_entity_loader` to `true` for the XML-based Readers by default.
\ No newline at end of file
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md b/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md
new file mode 100644
index 0000000..afa674d
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/03-Loading-a-Spreadsheet.md
@@ -0,0 +1,21 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+
+## Loading a Spreadsheet File
+
+The simplest way to load a workbook file is to let PHPExcel's IO Factory identify the file type and load it, calling the static load() method of the PHPExcel_IOFactory class.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
+```
+ > See Examples/Reader/exampleReader01.php for a working example of this code.
+
+The load() method will attempt to identify the file type, and instantiate a loader for that file type; using it to load the file and store the data and any formatting in a PHPExcel object.
+
+The method makes an initial guess at the loader to instantiate based on the file extension; but will test the file before actually executing the load: so if (for example) the file is actually a CSV file or contains HTML markup, but that has been given a .xls extension (quite a common practise), it will reject the Excel5 loader that it would normally use for a .xls file; and test the file using the other loaders until it finds the appropriate loader, and then use that to read the file.
+
+While easy to implement in your code, and you don't need to worry about the file type; this isn't the most efficient method to load a file; and it lacks the flexibility to configure the loader in any way before actually reading the file into a PHPExcel object.
+
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md b/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md
new file mode 100644
index 0000000..94d07aa
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/04-Loading-with-a-Reader.md
@@ -0,0 +1,56 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+
+## Creating a Reader and Loading a Spreadsheet File
+
+If you know the file type of the spreadsheet file that you need to load, you can instantiate a new reader object for that file type, then use the reader's load() method to read the file to a PHPExcel object. It is possible to instantiate the reader objects for each of the different supported filetype by name. However, you may get unpredictable results if the file isn't of the right type (e.g. it is a CSV with an extension of .xls), although this type of exception should normally be trapped.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Excel5 Reader **/
+$objReader = new PHPExcel_Reader_Excel5();
+// $objReader = new PHPExcel_Reader_Excel2007();
+// $objReader = new PHPExcel_Reader_Excel2003XML();
+// $objReader = new PHPExcel_Reader_OOCalc();
+// $objReader = new PHPExcel_Reader_SYLK();
+// $objReader = new PHPExcel_Reader_Gnumeric();
+// $objReader = new PHPExcel_Reader_CSV();
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader02.php for a working example of this code.
+
+Alternatively, you can use the IO Factory's createReader() method to instantiate the reader object for you, simply telling it the file type of the reader that you want instantiating.
+
+```php
+$inputFileType = 'Excel5';
+// $inputFileType = 'Excel2007';
+// $inputFileType = 'Excel2003XML';
+// $inputFileType = 'OOCalc';
+// $inputFileType = 'SYLK';
+// $inputFileType = 'Gnumeric';
+// $inputFileType = 'CSV';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader03.php for a working example of this code.
+
+If you're uncertain of the filetype, you can use the IO Factory's identify() method to identify the reader that you need, before using the createReader() method to instantiate the reader object.
+
+```php
+$inputFileName = './sampleData/example1.xls';
+
+/** Identify the type of $inputFileName **/
+$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
+/** Create a new Reader of the type that has been identified **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader04.php for a working example of this code.
+
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md b/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md
new file mode 100644
index 0000000..137fd1e
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/05-Reader-Options.md
@@ -0,0 +1,392 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+## Spreadsheet Reader Options
+
+Once you have created a reader object for the workbook that you want to load, you have the opportunity to set additional options before executing the load() method.
+
+### Reading Only Data from a Spreadsheet File
+
+If you're only interested in the cell values in a workbook, but don't need any of the cell formatting information, then you can set the reader to read only the data values and any formulae from each cell using the setReadDataOnly() method.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Advise the Reader that we only want to load cell data **/
+$objReader->setReadDataOnly(true);
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader05.php for a working example of this code.
+
+It is important to note that Workbooks (and PHPExcel) store dates and times as simple numeric values: they can only be distinguished from other numeric values by the format mask that is applied to that cell. When setting read data only to true, PHPExcel doesn't read the cell format masks, so it is not possible to differentiate between dates/times and numbers.
+
+The Gnumeric loader has been written to read the format masks for date values even when read data only has been set to true, so it can differentiate between dates/times and numbers; but this change hasn't yet been implemented for the other readers.
+
+Reading Only Data from a Spreadsheet File applies to Readers:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
+OOCalc | YES | SYLK | NO | Gnumeric | YES |
+CSV | NO | HTML | NO
+
+### Reading Only Named WorkSheets from a File
+
+If your workbook contains a number of worksheets, but you are only interested in reading some of those, then you can use the setLoadSheetsOnly() method to identify those sheets you are interested in reading.
+
+To read a single sheet, you can pass that sheet name as a parameter to the setLoadSheetsOnly() method.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example1.xls';
+$sheetname = 'Data Sheet #2';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Advise the Reader of which WorkSheets we want to load **/
+$objReader->setLoadSheetsOnly($sheetname);
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader07.php for a working example of this code.
+
+If you want to read more than just a single sheet, you can pass a list of sheet names as an array parameter to the setLoadSheetsOnly() method.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example1.xls';
+$sheetnames = array('Data Sheet #1','Data Sheet #3');
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Advise the Reader of which WorkSheets we want to load **/
+$objReader->setLoadSheetsOnly($sheetnames);
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader08.php for a working example of this code.
+
+To reset this option to the default, you can call the setLoadAllSheets() method.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example1.xls';
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Advise the Reader to load all Worksheets **/
+$objReader->setLoadAllSheets();
+/** Load $inputFileName to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader06.php for a working example of this code.
+
+Reading Only Named WorkSheets from a File applies to Readers:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
+OOCalc | YES | SYLK | NO | Gnumeric | YES |
+CSV | NO | HTML | NO
+
+### Reading Only Specific Columns and Rows from a File (Read Filters)
+
+If you are only interested in reading part of a worksheet, then you can write a filter class that identifies whether or not individual cells should be read by the loader. A read filter must implement the PHPExcel_Reader_IReadFilter interface, and contain a readCell() method that accepts arguments of $column, $row and $worksheetName, and return a boolean true or false that indicates whether a workbook cell identified by those arguments should be read or not.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example1.xls';
+$sheetname = 'Data Sheet #3';
+
+
+/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
+class MyReadFilter implements PHPExcel_Reader_IReadFilter
+{
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read rows 1 to 7 and columns A to E only
+ if ($row >= 1 && $row <= 7) {
+ if (in_array($column,range('A','E'))) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+/** Create an Instance of our Read Filter **/
+$filterSubset = new MyReadFilter();
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Tell the Reader that we want to use the Read Filter **/
+$objReader->setReadFilter($filterSubset);
+/** Load only the rows and columns that match our filter to PHPExcel **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader09.php for a working example of this code.
+
+This example is not particularly useful, because it can only be used in a very specific circumstance (when you only want cells in the range A1:E7 from your worksheet. A generic Read Filter would probably be more useful:
+
+```php
+/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
+class MyReadFilter implements PHPExcel_Reader_IReadFilter
+{
+ private $_startRow = 0;
+ private $_endRow = 0;
+ private $_columns = array();
+
+ /** Get the list of rows and columns to read */
+ public function __construct($startRow, $endRow, $columns) {
+ $this->_startRow = $startRow;
+ $this->_endRow = $endRow;
+ $this->_columns = $columns;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the rows and columns that were configured
+ if ($row >= $this->_startRow && $row <= $this->_endRow) {
+ if (in_array($column,$this->_columns)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+/** Create an Instance of our Read Filter, passing in the cell range **/
+$filterSubset = new MyReadFilter(9,15,range('G','K'));
+```
+ > See Examples/Reader/exampleReader10.php for a working example of this code.
+
+This can be particularly useful for conserving memory, by allowing you to read and process a large workbook in “chunksâ€: an example of this usage might be when transferring data from an Excel worksheet to a database.
+
+```php
+$inputFileType = 'Excel5';
+$inputFileName = './sampleData/example2.xls';
+
+
+/** Define a Read Filter class implementing PHPExcel_Reader_IReadFilter */
+class chunkReadFilter implements PHPExcel_Reader_IReadFilter
+{
+ private $_startRow = 0;
+ private $_endRow = 0;
+
+ /** Set the list of rows that we want to read */
+ public function setRows($startRow, $chunkSize) {
+ $this->_startRow = $startRow;
+ $this->_endRow = $startRow + $chunkSize;
+ }
+
+ public function readCell($column, $row, $worksheetName = '') {
+ // Only read the heading row, and the configured rows
+ if (($row == 1) || ($row >= $this->_startRow && $row < $this->_endRow)) {
+ return true;
+ }
+ return false;
+ }
+}
+
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+/** Define how many rows we want to read for each "chunk" **/
+$chunkSize = 2048;
+/** Create a new Instance of our Read Filter **/
+$chunkFilter = new chunkReadFilter();
+
+/** Tell the Reader that we want to use the Read Filter **/
+$objReader->setReadFilter($chunkFilter);
+
+/** Loop to read our worksheet in "chunk size" blocks **/
+for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) {
+ /** Tell the Read Filter which rows we want this iteration **/
+ $chunkFilter->setRows($startRow,$chunkSize);
+ /** Load only the rows that match our filter **/
+ $objPHPExcel = $objReader->load($inputFileName);
+ // Do some processing here
+}
+```
+ > See Examples/Reader/exampleReader12.php for a working example of this code.
+
+Using Read Filters applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | YES | Excel5 | YES | Excel2003XML | YES |
+OOCalc | YES | SYLK | NO | Gnumeric | YES |
+CSV | YES | HTML | NO
+
+### Combining Multiple Files into a Single PHPExcel Object
+
+While you can limit the number of worksheets that are read from a workbook file using the setLoadSheetsOnly() method, certain readers also allow you to combine several individual "sheets" from different files into a single PHPExcel object, where each individual file is a single worksheet within that workbook. For each file that you read, you need to indicate which worksheet index it should be loaded into using the setSheetIndex() method of the $objReader, then use the loadIntoExisting() method rather than the load() method to actually read the file into that worksheet.
+
+```php
+$inputFileType = 'CSV';
+$inputFileNames = array('./sampleData/example1.csv',
+ './sampleData/example2.csv'
+ './sampleData/example3.csv'
+);
+
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+/** Extract the first named file from the array list **/
+$inputFileName = array_shift($inputFileNames);
+/** Load the initial file to the first worksheet in a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+/** Set the worksheet title (to the filename that we've loaded) **/
+$objPHPExcel->getActiveSheet()
+ ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+
+
+/** Loop through all the remaining files in the list **/
+foreach($inputFileNames as $sheet => $inputFileName) {
+ /** Increment the worksheet index pointer for the Reader **/
+ $objReader->setSheetIndex($sheet+1);
+ /** Load the current file into a new worksheet in PHPExcel **/
+ $objReader->loadIntoExisting($inputFileName,$objPHPExcel);
+ /** Set the worksheet title (to the filename that we've loaded) **/
+ $objPHPExcel->getActiveSheet()
+ ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME));
+}
+```
+ > See Examples/Reader/exampleReader13.php for a working example of this code.
+
+Note that using the same sheet index for multiple sheets won't append files into the same sheet, but overwrite the results of the previous load. You cannot load multiple CSV files into the same worksheet.
+
+Combining Multiple Files into a Single PHPExcel Object applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
+OOCalc | NO | SYLK | YES | Gnumeric | NO |
+CSV | YES | HTML | NO
+
+### Combining Read Filters with the setSheetIndex() method to split a large CSV file across multiple Worksheets
+
+An Excel5 BIFF .xls file is limited to 65536 rows in a worksheet, while the Excel2007 Microsoft Office Open XML SpreadsheetML .xlsx file is limited to 1,048,576 rows in a worksheet; but a CSV file is not limited other than by available disk space. This means that we wouldn’t ordinarily be able to read all the rows from a very large CSV file that exceeded those limits, and save it as an Excel5 or Excel2007 file. However, by using Read Filters to read the CSV file in “chunks†(using the chunkReadFilter Class that we defined in section REF _Ref275604563 \r \p 5.3 above), and the setSheetIndex() method of the $objReader, we can split the CSV file across several individual worksheets.
+
+```php
+$inputFileType = 'CSV';
+$inputFileName = './sampleData/example2.csv';
+
+
+echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
';
+/** Create a new Reader of the type defined in $inputFileType **/
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+
+/** Define how many rows we want to read for each "chunk" **/
+$chunkSize = 65530;
+/** Create a new Instance of our Read Filter **/
+$chunkFilter = new chunkReadFilter();
+
+/** Tell the Reader that we want to use the Read Filter **/
+/** and that we want to store it in contiguous rows/columns **/
+
+$objReader->setReadFilter($chunkFilter)
+ ->setContiguous(true);
+
+/** Instantiate a new PHPExcel object manually **/
+$objPHPExcel = new PHPExcel();
+
+/** Set a sheet index **/
+$sheet = 0;
+/** Loop to read our worksheet in "chunk size" blocks **/
+/** $startRow is set to 2 initially because we always read the headings in row #1 **/
+for ($startRow = 2; $startRow <= 1000000; $startRow += $chunkSize) {
+ /** Tell the Read Filter which rows we want to read this loop **/
+ $chunkFilter->setRows($startRow,$chunkSize);
+
+ /** Increment the worksheet index pointer for the Reader **/
+ $objReader->setSheetIndex($sheet);
+ /** Load only the rows that match our filter into a new worksheet **/
+ $objReader->loadIntoExisting($inputFileName,$objPHPExcel);
+ /** Set the worksheet title for the sheet that we've justloaded) **/
+ /** and increment the sheet index as well **/
+ $objPHPExcel->getActiveSheet()->setTitle('Country Data #'.(++$sheet));
+}
+```
+ > See Examples/Reader/exampleReader14.php for a working example of this code.
+
+This code will read 65,530 rows at a time from the CSV file that we’re loading, and store each "chunk" in a new worksheet.
+
+The setContiguous() method for the Reader is important here. It is applicable only when working with a Read Filter, and identifies whether or not the cells should be stored by their position within the CSV file, or their position relative to the filter.
+
+For example, if the filter returned true for cells in the range B2:C3, then with setContiguous set to false (the default) these would be loaded as B2:C3 in the PHPExcel object; but with setContiguous set to true, they would be loaded as A1:B2.
+
+Splitting a single loaded file across multiple worksheets applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
+OOCalc | NO | SYLK | NO | Gnumeric | NO |
+CSV | YES | HTML | NO
+
+### Pipe or Tab Separated Value Files
+
+The CSV loader defaults to loading a file where comma is used as the separator, but you can modify this to load tab- or pipe-separated value files using the setDelimiter() method.
+
+```php
+$inputFileType = 'CSV';
+$inputFileName = './sampleData/example1.tsv';
+
+/** Create a new Reader of the type defined in $inputFileType **/ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+/** Set the delimiter to a TAB character **/
+$objReader->setDelimiter("\t");
+// $objReader->setDelimiter('|');
+
+/** Load the file to a PHPExcel Object **/
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader15.php for a working example of this code.
+
+In addition to the delimiter, you can also use the following methods to set other attributes for the data load:
+
+setEnclosure() | default is "
+setLineEnding() | default is PHP_EOL
+setInputEncoding() | default is UTF-8
+
+Setting CSV delimiter applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
+OOCalc | NO | SYLK | NO | Gnumeric | NO |
+CSV | YES | HTML | NO
+
+### A Brief Word about the Advanced Value Binder
+
+When loading data from a file that contains no formatting information, such as a CSV file, then data is read either as strings or numbers (float or integer). This means that PHPExcel does not automatically recognise dates/times (such as "16-Apr-2009" or "13:30"), booleans ("TRUE" or "FALSE"), percentages ("75%"), hyperlinks ("http://www.phpexcel.net"), etc as anything other than simple strings. However, you can apply additional processing that is executed against these values during the load process within a Value Binder.
+
+A Value Binder is a class that implement the PHPExcel_Cell_IValueBinder interface. It must contain a bindValue() method that accepts a PHPExcel_Cell and a value as arguments, and return a boolean true or false that indicates whether the workbook cell has been populated with the value or not. The Advanced Value Binder implements such a class: amongst other tests, it identifies a string comprising "TRUE" or "FALSE" (based on locale settings) and sets it to a boolean; or a number in scientific format (e.g. "1.234e-5") and converts it to a float; or dates and times, converting them to their Excel timestamp value – before storing the value in the cell object. It also sets formatting for strings that are identified as dates, times or percentages. It could easily be extended to provide additional handling (including text or cell formatting) when it encountered a hyperlink, or HTML markup within a CSV file.
+
+So using a Value Binder allows a great deal more flexibility in the loader logic when reading unformatted text files.
+
+```php
+/** Tell PHPExcel that we want to use the Advanced Value Binder **/
+PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
+
+$inputFileType = 'CSV';
+$inputFileName = './sampleData/example1.tsv';
+
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$objReader->setDelimiter("\t");
+$objPHPExcel = $objReader->load($inputFileName);
+```
+ > See Examples/Reader/exampleReader15.php for a working example of this code.
+
+Loading using a Value Binder applies to:
+
+Reader | Y/N |Reader | Y/N |Reader | Y/N |
+----------|:---:|--------|:---:|--------------|:---:|
+Excel2007 | NO | Excel5 | NO | Excel2003XML | NO |
+OOCalc | NO | SYLK | NO | Gnumeric | NO |
+CSV | YES | HTML | YES
+
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/06-Error-Handling.md b/Documentation/markdown/ReadingSpreadsheetFiles/06-Error-Handling.md
new file mode 100644
index 0000000..d3e064f
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/06-Error-Handling.md
@@ -0,0 +1,20 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+## Error Handling
+
+Of course, you should always apply some error handling to your scripts as well. PHPExcel throws exceptions, so you can wrap all your code that accesses the library methods within Try/Catch blocks to trap for any problems that are encountered, and deal with them in an appropriate manner.
+
+The PHPExcel Readers throw a PHPExcel_Reader_Exception.
+
+```php
+$inputFileName = './sampleData/example-1.xls';
+
+try {
+ /** Load $inputFileName to a PHPExcel Object **/
+ $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
+} catch(PHPExcel_Reader_Exception $e) {
+ die('Error loading file: '.$e->getMessage());
+}
+```
+ > See Examples/Reader/exampleReader16.php for a working example of this code.
+
diff --git a/Documentation/markdown/ReadingSpreadsheetFiles/07-Helper-Methods.md b/Documentation/markdown/ReadingSpreadsheetFiles/07-Helper-Methods.md
new file mode 100644
index 0000000..57dbec7
--- /dev/null
+++ b/Documentation/markdown/ReadingSpreadsheetFiles/07-Helper-Methods.md
@@ -0,0 +1,47 @@
+# PHPExcel User Documentation – Reading Spreadsheet Files
+
+
+## Helper Methods
+
+You can retrieve a list of worksheet names contained in a file without loading the whole file by using the Reader’s `listWorksheetNames()` method; similarly, a `listWorksheetInfo()` method will retrieve the dimensions of worksheet in a file without needing to load and parse the whole file.
+
+### listWorksheetNames
+
+The `listWorksheetNames()` method returns a simple array listing each worksheet name within the workbook:
+
+```php
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+$worksheetNames = $objReader->listWorksheetNames($inputFileName);
+
+echo 'Worksheet Names
';
+echo '';
+foreach ($worksheetNames as $worksheetName) {
+ echo '- ', $worksheetName, '
';
+}
+echo '
';
+```
+ > See Examples/Reader/exampleReader18.php for a working example of this code.
+
+### listWorksheetInfo
+
+The `listWorksheetInfo()` method returns a nested array, with each entry listing the name and dimensions for a worksheet:
+
+```php
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+
+$worksheetData = $objReader->listWorksheetInfo($inputFileName);
+
+echo 'Worksheet Information
';
+echo '';
+foreach ($worksheetData as $worksheet) {
+ echo '- ', $worksheet['worksheetName'], '
';
+ echo 'Rows: ', $worksheet['totalRows'],
+ ' Columns: ', $worksheet['totalColumns'], '
';
+ echo 'Cell Range: A1:',
+ $worksheet['lastColumnLetter'], $worksheet['totalRows'];
+ echo ' ';
+}
+echo '
';
+```
+ > See Examples/Reader/exampleReader19.php for a working example of this code.
diff --git a/Examples/.gitignore b/Examples/.gitignore
new file mode 100644
index 0000000..d53fd7f
--- /dev/null
+++ b/Examples/.gitignore
@@ -0,0 +1,5 @@
+*.xls
+*.xlsx
+*.csv
+*.jpg
+*.pdf
diff --git a/Examples/01pharSimple.php b/Examples/01pharSimple.php
new file mode 100644
index 0000000..84b86cc
--- /dev/null
+++ b/Examples/01pharSimple.php
@@ -0,0 +1,112 @@
+');
+
+/** Include PHPExcel */
+require_once '../Build/PHPExcel.phar';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel5 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/01simple-download-ods.php b/Examples/01simple-download-ods.php
new file mode 100644
index 0000000..30dbd7e
--- /dev/null
+++ b/Examples/01simple-download-ods.php
@@ -0,0 +1,89 @@
+getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+// Rename worksheet
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Redirect output to a client’s web browser (OpenDocument)
+header('Content-Type: application/vnd.oasis.opendocument.spreadsheet');
+header('Content-Disposition: attachment;filename="01simple.ods"');
+header('Cache-Control: max-age=0');
+// If you're serving to IE 9, then the following may be needed
+header('Cache-Control: max-age=1');
+
+// If you're serving to IE over SSL, then the following may be needed
+header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
+header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
+header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
+header ('Pragma: public'); // HTTP/1.0
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'OpenDocument');
+$objWriter->save('php://output');
+exit;
diff --git a/Examples/01simple-download-pdf.php b/Examples/01simple-download-pdf.php
new file mode 100644
index 0000000..133af3a
--- /dev/null
+++ b/Examples/01simple-download-pdf.php
@@ -0,0 +1,104 @@
+getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PDF Test Document")
+ ->setSubject("PDF Test Document")
+ ->setDescription("Test document for PDF, generated using PHP classes.")
+ ->setKeywords("pdf php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+// Rename worksheet
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+$objPHPExcel->getActiveSheet()->setShowGridLines(false);
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+if (!PHPExcel_Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ '
' .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+// Redirect output to a client’s web browser (PDF)
+header('Content-Type: application/pdf');
+header('Content-Disposition: attachment;filename="01simple.pdf"');
+header('Cache-Control: max-age=0');
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
+$objWriter->save('php://output');
+exit;
diff --git a/Examples/01simple-download-xls.php b/Examples/01simple-download-xls.php
new file mode 100644
index 0000000..96bb780
--- /dev/null
+++ b/Examples/01simple-download-xls.php
@@ -0,0 +1,89 @@
+getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+// Rename worksheet
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Redirect output to a client’s web browser (Excel5)
+header('Content-Type: application/vnd.ms-excel');
+header('Content-Disposition: attachment;filename="01simple.xls"');
+header('Cache-Control: max-age=0');
+// If you're serving to IE 9, then the following may be needed
+header('Cache-Control: max-age=1');
+
+// If you're serving to IE over SSL, then the following may be needed
+header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
+header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
+header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
+header ('Pragma: public'); // HTTP/1.0
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save('php://output');
+exit;
diff --git a/Examples/01simple-download-xlsx.php b/Examples/01simple-download-xlsx.php
new file mode 100644
index 0000000..d441f41
--- /dev/null
+++ b/Examples/01simple-download-xlsx.php
@@ -0,0 +1,89 @@
+getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+// Rename worksheet
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Redirect output to a client’s web browser (Excel2007)
+header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+header('Content-Disposition: attachment;filename="01simple.xlsx"');
+header('Cache-Control: max-age=0');
+// If you're serving to IE 9, then the following may be needed
+header('Cache-Control: max-age=1');
+
+// If you're serving to IE over SSL, then the following may be needed
+header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
+header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
+header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
+header ('Pragma: public'); // HTTP/1.0
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save('php://output');
+exit;
diff --git a/Examples/01simple.php b/Examples/01simple.php
new file mode 100644
index 0000000..13f8027
--- /dev/null
+++ b/Examples/01simple.php
@@ -0,0 +1,125 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8',"Hello\nWorld");
+$objPHPExcel->getActiveSheet()->getRowDimension(8)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true);
+
+
+$value = "-ValueA\n-Value B\n-Value C";
+$objPHPExcel->getActiveSheet()->setCellValue('A10', $value);
+$objPHPExcel->getActiveSheet()->getRowDimension(10)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A10')->getAlignment()->setWrapText(true);
+$objPHPExcel->getActiveSheet()->getStyle('A10')->setQuotePrefix(true);
+
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/01simplePCLZip.php b/Examples/01simplePCLZip.php
new file mode 100644
index 0000000..0af4cbd
--- /dev/null
+++ b/Examples/01simplePCLZip.php
@@ -0,0 +1,106 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8',"Hello\nWorld");
+$objPHPExcel->getActiveSheet()->getRowDimension(8)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true);
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+// Use PCLZip rather than ZipArchive to create the Excel2007 OfficeOpenXML file
+PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/02types-xls.php b/Examples/02types-xls.php
new file mode 100644
index 0000000..93ce17e
--- /dev/null
+++ b/Examples/02types-xls.php
@@ -0,0 +1,183 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+// Set default font
+echo date('H:i:s') , " Set default font" , EOL;
+$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')
+ ->setSize(10);
+
+// Add some data, resembling some different data types
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String')
+ ->setCellValue('B1', 'Simple')
+ ->setCellValue('C1', 'PHPExcel');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String')
+ ->setCellValue('B2', 'Symbols')
+ ->setCellValue('C2', '!+&=()~§±æþ');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String')
+ ->setCellValue('B3', 'UTF-8')
+ ->setCellValue('C3', 'Создать MS Excel Книги из PHP Ñкриптов');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number')
+ ->setCellValue('B4', 'Integer')
+ ->setCellValue('C4', 12);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number')
+ ->setCellValue('B5', 'Float')
+ ->setCellValue('C5', 34.56);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number')
+ ->setCellValue('B6', 'Negative')
+ ->setCellValue('C6', -7.89);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean')
+ ->setCellValue('B7', 'True')
+ ->setCellValue('C7', true);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean')
+ ->setCellValue('B8', 'False')
+ ->setCellValue('C8', false);
+
+$dateTimeNow = time();
+$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
+ ->setCellValue('B9', 'Date')
+ ->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
+ ->setCellValue('B10', 'Time')
+ ->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
+ ->setCellValue('B11', 'Date and Time')
+ ->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
+ ->setCellValue('C12', NULL);
+
+$objRichText = new PHPExcel_RichText();
+$objRichText->createText('ä½ å¥½ ');
+$objPayable = $objRichText->createTextRun('ä½ å¥½ å—?');
+$objPayable->getFont()->setBold(true);
+$objPayable->getFont()->setItalic(true);
+$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
+
+$objRichText->createText(', unless specified otherwise on the invoice.');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A13', 'Rich Text')
+ ->setCellValue('C13', $objRichText);
+
+
+$objRichText2 = new PHPExcel_RichText();
+$objRichText2->createText("black text\n");
+
+$objRed = $objRichText2->createTextRun("red text");
+$objRed->getFont()->setColor( new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_RED ) );
+
+$objPHPExcel->getActiveSheet()->getCell("C14")->setValue($objRichText2);
+$objPHPExcel->getActiveSheet()->getStyle("C14")->getAlignment()->setWrapText(true);
+
+
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Datatypes');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Reload workbook from saved file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+var_dump($objPHPExcel->getActiveSheet()->toArray());
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done testing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/02types.php b/Examples/02types.php
new file mode 100644
index 0000000..394a73d
--- /dev/null
+++ b/Examples/02types.php
@@ -0,0 +1,204 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+// Set default font
+echo date('H:i:s') , " Set default font" , EOL;
+$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial')
+ ->setSize(10);
+
+// Add some data, resembling some different data types
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String')
+ ->setCellValue('B1', 'Simple')
+ ->setCellValue('C1', 'PHPExcel');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'String')
+ ->setCellValue('B2', 'Symbols')
+ ->setCellValue('C2', '!+&=()~§±æþ');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A3', 'String')
+ ->setCellValue('B3', 'UTF-8')
+ ->setCellValue('C3', 'Создать MS Excel Книги из PHP Ñкриптов');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Number')
+ ->setCellValue('B4', 'Integer')
+ ->setCellValue('C4', 12);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Number')
+ ->setCellValue('B5', 'Float')
+ ->setCellValue('C5', 34.56);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Number')
+ ->setCellValue('B6', 'Negative')
+ ->setCellValue('C6', -7.89);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Boolean')
+ ->setCellValue('B7', 'True')
+ ->setCellValue('C7', true);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Boolean')
+ ->setCellValue('B8', 'False')
+ ->setCellValue('C8', false);
+
+$dateTimeNow = time();
+$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Date/Time')
+ ->setCellValue('B9', 'Date')
+ ->setCellValue('C9', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C9')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Date/Time')
+ ->setCellValue('B10', 'Time')
+ ->setCellValue('C10', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C10')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Date/Time')
+ ->setCellValue('B11', 'Date and Time')
+ ->setCellValue('C11', PHPExcel_Shared_Date::PHPToExcel( $dateTimeNow ));
+$objPHPExcel->getActiveSheet()->getStyle('C11')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_DATETIME);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A12', 'NULL')
+ ->setCellValue('C12', NULL);
+
+$objRichText = new PHPExcel_RichText();
+$objRichText->createText('ä½ å¥½ ');
+
+$objPayable = $objRichText->createTextRun('ä½ å¥½ å—?');
+$objPayable->getFont()->setBold(true);
+$objPayable->getFont()->setItalic(true);
+$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
+
+$objRichText->createText(', unless specified otherwise on the invoice.');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A13', 'Rich Text')
+ ->setCellValue('C13', $objRichText);
+
+
+$objRichText2 = new PHPExcel_RichText();
+$objRichText2->createText("black text\n");
+
+$objRed = $objRichText2->createTextRun("red text");
+$objRed->getFont()->setColor( new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_RED ) );
+
+$objPHPExcel->getActiveSheet()->getCell("C14")->setValue($objRichText2);
+$objPHPExcel->getActiveSheet()->getStyle("C14")->getAlignment()->setWrapText(true);
+
+
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
+
+$objRichText3 = new PHPExcel_RichText();
+$objRichText3->createText("Hello ");
+
+$objUnderlined = $objRichText3->createTextRun("underlined");
+$objUnderlined->getFont()->setUnderline(true);
+$objRichText3->createText(' World.');
+
+$objPHPExcel->getActiveSheet()
+ ->getCell("C15")
+ ->setValue($objRichText3);
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('A17', 'Hyperlink');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C17', 'www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('C17')->getHyperlink()->setUrl('http://www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('C17')->getHyperlink()->setTooltip('Navigate to website');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")');
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Datatypes');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Reload workbook from saved file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.xlsx', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+var_dump($objPHPExcel->getActiveSheet()->toArray());
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done testing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/03formulas.php b/Examples/03formulas.php
new file mode 100644
index 0000000..6c5d1dd
--- /dev/null
+++ b/Examples/03formulas.php
@@ -0,0 +1,149 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data, we will use some formulas here
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Sum:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range #1')
+ ->setCellValue('B2', 3)
+ ->setCellValue('B3', 7)
+ ->setCellValue('B4', 13)
+ ->setCellValue('B5', '=SUM(B2:B4)');
+echo date('H:i:s') , " Sum of Range #1 is " ,
+ $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue() , EOL;
+
+$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range #2')
+ ->setCellValue('C2', 5)
+ ->setCellValue('C3', 11)
+ ->setCellValue('C4', 17)
+ ->setCellValue('C5', '=SUM(C2:C4)');
+echo date('H:i:s') , " Sum of Range #2 is " ,
+ $objPHPExcel->getActiveSheet()->getCell('C5')->getCalculatedValue() , EOL;
+
+$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total of both ranges:');
+$objPHPExcel->getActiveSheet()->setCellValue('B7', '=SUM(B5:C5)');
+echo date('H:i:s') , " Sum of both Ranges is " ,
+ $objPHPExcel->getActiveSheet()->getCell('B7')->getCalculatedValue() , EOL;
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Minimum of both ranges:');
+$objPHPExcel->getActiveSheet()->setCellValue('B8', '=MIN(B2:C4)');
+echo date('H:i:s') , " Minimum value in either Range is " ,
+ $objPHPExcel->getActiveSheet()->getCell('B8')->getCalculatedValue() , EOL;
+
+$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Maximum of both ranges:');
+$objPHPExcel->getActiveSheet()->setCellValue('B9', '=MAX(B2:C4)');
+echo date('H:i:s') , " Maximum value in either Range is " ,
+ $objPHPExcel->getActiveSheet()->getCell('B9')->getCalculatedValue() , EOL;
+
+$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Average of both ranges:');
+$objPHPExcel->getActiveSheet()->setCellValue('B10', '=AVERAGE(B2:C4)');
+echo date('H:i:s') , " Average value of both Ranges is " ,
+ $objPHPExcel->getActiveSheet()->getCell('B10')->getCalculatedValue() , EOL;
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Formulas');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+
+//
+// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
+// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae
+// using functions or features (such as array formulae) that aren't yet supported by the calculation engine
+// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to
+// open the file) will need to recalculate values itself to guarantee that the correct results are available.
+//
+//$objWriter->setPreCalculateFormulas(true);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/04printing.php b/Examples/04printing.php
new file mode 100644
index 0000000..58d5f6a
--- /dev/null
+++ b/Examples/04printing.php
@@ -0,0 +1,125 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data, we will use printing features
+echo date('H:i:s') , " Add some data" , EOL;
+for ($i = 1; $i < 200; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $i);
+ $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, 'Test value');
+}
+
+// Set header and footer. When no different headers for odd/even are used, odd header is assumed.
+echo date('H:i:s') , " Set header/footer" , EOL;
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&G&C&HPlease treat this document as confidential!');
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
+
+// Add a drawing to the header
+echo date('H:i:s') , " Add a drawing to the header" , EOL;
+$objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing();
+$objDrawing->setName('PHPExcel logo');
+$objDrawing->setPath('./images/phpexcel_logo.gif');
+$objDrawing->setHeight(36);
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_LEFT);
+
+// Set page orientation and size
+echo date('H:i:s') , " Set page orientation and size" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Printing');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/05featuredemo.inc.php b/Examples/05featuredemo.inc.php
new file mode 100644
index 0000000..003379c
--- /dev/null
+++ b/Examples/05featuredemo.inc.php
@@ -0,0 +1,394 @@
+getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet, representing sales data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Invoice');
+$objPHPExcel->getActiveSheet()->setCellValue('D1', PHPExcel_Shared_Date::PHPToExcel( gmmktime(0,0,0,date('m'),date('d'),date('Y')) ));
+$objPHPExcel->getActiveSheet()->getStyle('D1')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
+$objPHPExcel->getActiveSheet()->setCellValue('E1', '#12566');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Product Id');
+$objPHPExcel->getActiveSheet()->setCellValue('B3', 'Description');
+$objPHPExcel->getActiveSheet()->setCellValue('C3', 'Price');
+$objPHPExcel->getActiveSheet()->setCellValue('D3', 'Amount');
+$objPHPExcel->getActiveSheet()->setCellValue('E3', 'Total');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A4', '1001');
+$objPHPExcel->getActiveSheet()->setCellValue('B4', 'PHP for dummies');
+$objPHPExcel->getActiveSheet()->setCellValue('C4', '20');
+$objPHPExcel->getActiveSheet()->setCellValue('D4', '1');
+$objPHPExcel->getActiveSheet()->setCellValue('E4', '=IF(D4<>"",C4*D4,"")');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', '1012');
+$objPHPExcel->getActiveSheet()->setCellValue('B5', 'OpenXML for dummies');
+$objPHPExcel->getActiveSheet()->setCellValue('C5', '22');
+$objPHPExcel->getActiveSheet()->setCellValue('D5', '2');
+$objPHPExcel->getActiveSheet()->setCellValue('E5', '=IF(D5<>"",C5*D5,"")');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E6', '=IF(D6<>"",C6*D6,"")');
+$objPHPExcel->getActiveSheet()->setCellValue('E7', '=IF(D7<>"",C7*D7,"")');
+$objPHPExcel->getActiveSheet()->setCellValue('E8', '=IF(D8<>"",C8*D8,"")');
+$objPHPExcel->getActiveSheet()->setCellValue('E9', '=IF(D9<>"",C9*D9,"")');
+
+$objPHPExcel->getActiveSheet()->setCellValue('D11', 'Total excl.:');
+$objPHPExcel->getActiveSheet()->setCellValue('E11', '=SUM(E4:E9)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('D12', 'VAT:');
+$objPHPExcel->getActiveSheet()->setCellValue('E12', '=E11*0.21');
+
+$objPHPExcel->getActiveSheet()->setCellValue('D13', 'Total incl.:');
+$objPHPExcel->getActiveSheet()->setCellValue('E13', '=E11+E12');
+
+// Add comment
+echo date('H:i:s') , " Add comments" , EOL;
+
+$objPHPExcel->getActiveSheet()->getComment('E11')->setAuthor('PHPExcel');
+$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('PHPExcel:');
+$objCommentRichText->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun("\r\n");
+$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('Total amount on the current invoice, excluding VAT.');
+
+$objPHPExcel->getActiveSheet()->getComment('E12')->setAuthor('PHPExcel');
+$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun('PHPExcel:');
+$objCommentRichText->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun("\r\n");
+$objPHPExcel->getActiveSheet()->getComment('E12')->getText()->createTextRun('Total amount of VAT on the current invoice.');
+
+$objPHPExcel->getActiveSheet()->getComment('E13')->setAuthor('PHPExcel');
+$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun('PHPExcel:');
+$objCommentRichText->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun("\r\n");
+$objPHPExcel->getActiveSheet()->getComment('E13')->getText()->createTextRun('Total amount on the current invoice, including VAT.');
+$objPHPExcel->getActiveSheet()->getComment('E13')->setWidth('100pt');
+$objPHPExcel->getActiveSheet()->getComment('E13')->setHeight('100pt');
+$objPHPExcel->getActiveSheet()->getComment('E13')->setMarginLeft('150pt');
+$objPHPExcel->getActiveSheet()->getComment('E13')->getFillColor()->setRGB('EEEEEE');
+
+
+// Add rich-text string
+echo date('H:i:s') , " Add rich-text string" , EOL;
+$objRichText = new PHPExcel_RichText();
+$objRichText->createText('This invoice is ');
+
+$objPayable = $objRichText->createTextRun('payable within thirty days after the end of the month');
+$objPayable->getFont()->setBold(true);
+$objPayable->getFont()->setItalic(true);
+$objPayable->getFont()->setColor( new PHPExcel_Style_Color( PHPExcel_Style_Color::COLOR_DARKGREEN ) );
+
+$objRichText->createText(', unless specified otherwise on the invoice.');
+
+$objPHPExcel->getActiveSheet()->getCell('A18')->setValue($objRichText);
+
+// Merge cells
+echo date('H:i:s') , " Merge cells" , EOL;
+$objPHPExcel->getActiveSheet()->mergeCells('A18:E22');
+$objPHPExcel->getActiveSheet()->mergeCells('A28:B28'); // Just to test...
+$objPHPExcel->getActiveSheet()->unmergeCells('A28:B28'); // Just to test...
+
+// Protect cells
+echo date('H:i:s') , " Protect cells" , EOL;
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // Needs to be set to true in order to enable any worksheet protection!
+$objPHPExcel->getActiveSheet()->protectCells('A3:E13', 'PHPExcel');
+
+// Set cell number formats
+echo date('H:i:s') , " Set cell number formats" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('E4:E13')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+
+// Set column widths
+echo date('H:i:s') , " Set column widths" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12);
+
+// Set fonts
+echo date('H:i:s') , " Set fonts" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
+
+$objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
+$objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
+
+$objPHPExcel->getActiveSheet()->getStyle('D13')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('E13')->getFont()->setBold(true);
+
+// Set alignments
+echo date('H:i:s') , " Set alignments" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('D11')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+$objPHPExcel->getActiveSheet()->getStyle('D12')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+$objPHPExcel->getActiveSheet()->getStyle('D13')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+
+$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
+$objPHPExcel->getActiveSheet()->getStyle('A18')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
+
+$objPHPExcel->getActiveSheet()->getStyle('B5')->getAlignment()->setShrinkToFit(true);
+
+// Set thin black border outline around column
+echo date('H:i:s') , " Set thin black border outline around column" , EOL;
+$styleThinBlackBorderOutline = array(
+ 'borders' => array(
+ 'outline' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THIN,
+ 'color' => array('argb' => 'FF000000'),
+ ),
+ ),
+);
+$objPHPExcel->getActiveSheet()->getStyle('A4:E10')->applyFromArray($styleThinBlackBorderOutline);
+
+
+// Set thick brown border outline around "Total"
+echo date('H:i:s') , " Set thick brown border outline around Total" , EOL;
+$styleThickBrownBorderOutline = array(
+ 'borders' => array(
+ 'outline' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THICK,
+ 'color' => array('argb' => 'FF993300'),
+ ),
+ ),
+);
+$objPHPExcel->getActiveSheet()->getStyle('D13:E13')->applyFromArray($styleThickBrownBorderOutline);
+
+// Set fills
+echo date('H:i:s') , " Set fills" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
+$objPHPExcel->getActiveSheet()->getStyle('A1:E1')->getFill()->getStartColor()->setARGB('FF808080');
+
+// Set style for header row using alternative method
+echo date('H:i:s') , " Set style for header row using alternative method" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->applyFromArray(
+ array(
+ 'font' => array(
+ 'bold' => true
+ ),
+ 'alignment' => array(
+ 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
+ ),
+ 'borders' => array(
+ 'top' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THIN
+ )
+ ),
+ 'fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR,
+ 'rotation' => 90,
+ 'startcolor' => array(
+ 'argb' => 'FFA0A0A0'
+ ),
+ 'endcolor' => array(
+ 'argb' => 'FFFFFFFF'
+ )
+ )
+ )
+);
+
+$objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray(
+ array(
+ 'alignment' => array(
+ 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+ ),
+ 'borders' => array(
+ 'left' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THIN
+ )
+ )
+ )
+);
+
+$objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray(
+ array(
+ 'alignment' => array(
+ 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+ )
+ )
+);
+
+$objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray(
+ array(
+ 'borders' => array(
+ 'right' => array(
+ 'style' => PHPExcel_Style_Border::BORDER_THIN
+ )
+ )
+ )
+);
+
+// Unprotect a cell
+echo date('H:i:s') , " Unprotect a cell" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
+
+// Add a hyperlink to the sheet
+echo date('H:i:s') , " Add a hyperlink to an external website" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
+$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
+$objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+
+echo date('H:i:s') , " Add a hyperlink to another cell on a different worksheet within the workbook" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
+$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
+$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
+$objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
+
+// Add a drawing to the worksheet
+echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
+$objDrawing = new PHPExcel_Worksheet_Drawing();
+$objDrawing->setName('Logo');
+$objDrawing->setDescription('Logo');
+$objDrawing->setPath('./images/officelogo.jpg');
+$objDrawing->setHeight(36);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+
+// Add a drawing to the worksheet
+echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
+$objDrawing = new PHPExcel_Worksheet_Drawing();
+$objDrawing->setName('Paid');
+$objDrawing->setDescription('Paid');
+$objDrawing->setPath('./images/paid.png');
+$objDrawing->setCoordinates('B15');
+$objDrawing->setOffsetX(110);
+$objDrawing->setRotation(25);
+$objDrawing->getShadow()->setVisible(true);
+$objDrawing->getShadow()->setDirection(45);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+
+// Add a drawing to the worksheet
+echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
+$objDrawing = new PHPExcel_Worksheet_Drawing();
+$objDrawing->setName('PHPExcel logo');
+$objDrawing->setDescription('PHPExcel logo');
+$objDrawing->setPath('./images/phpexcel_logo.gif');
+$objDrawing->setHeight(36);
+$objDrawing->setCoordinates('D24');
+$objDrawing->setOffsetX(10);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+
+// Play around with inserting and removing rows and columns
+echo date('H:i:s') , " Play around with inserting and removing rows and columns" , EOL;
+$objPHPExcel->getActiveSheet()->insertNewRowBefore(6, 10);
+$objPHPExcel->getActiveSheet()->removeRow(6, 10);
+$objPHPExcel->getActiveSheet()->insertNewColumnBefore('E', 5);
+$objPHPExcel->getActiveSheet()->removeColumn('E', 5);
+
+// Set header and footer. When no different headers for odd/even are used, odd header is assumed.
+echo date('H:i:s') , " Set header/footer" , EOL;
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BInvoice&RPrinted on &D');
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
+
+// Set page orientation and size
+echo date('H:i:s') , " Set page orientation and size" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
+
+// Rename first worksheet
+echo date('H:i:s') , " Rename first worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Invoice');
+
+
+// Create a new worksheet, after the default sheet
+echo date('H:i:s') , " Create a second Worksheet object" , EOL;
+$objPHPExcel->createSheet();
+
+// Llorem ipsum...
+$sLloremIpsum = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vivamus eget ante. Sed cursus nunc semper tortor. Aliquam luctus purus non elit. Fusce vel elit commodo sapien dignissim dignissim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur accumsan magna sed massa. Nullam bibendum quam ac ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin augue. Praesent malesuada justo sed orci. Pellentesque lacus ligula, sodales quis, ultricies a, ultricies vitae, elit. Sed luctus consectetuer dolor. Vivamus vel sem ut nisi sodales accumsan. Nunc et felis. Suspendisse semper viverra odio. Morbi at odio. Integer a orci a purus venenatis molestie. Nam mattis. Praesent rhoncus, nisi vel mattis auctor, neque nisi faucibus sem, non dapibus elit pede ac nisl. Cras turpis.';
+
+// Add some data to the second sheet, resembling some different data types
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(1);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Terms and conditions');
+$objPHPExcel->getActiveSheet()->setCellValue('A3', $sLloremIpsum);
+$objPHPExcel->getActiveSheet()->setCellValue('A4', $sLloremIpsum);
+$objPHPExcel->getActiveSheet()->setCellValue('A5', $sLloremIpsum);
+$objPHPExcel->getActiveSheet()->setCellValue('A6', $sLloremIpsum);
+
+// Set the worksheet tab color
+echo date('H:i:s') , " Set the worksheet tab color" , EOL;
+$objPHPExcel->getActiveSheet()->getTabColor()->setARGB('FF0094FF');;
+
+// Set alignments
+echo date('H:i:s') , " Set alignments" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getAlignment()->setWrapText(true);
+
+// Set column widths
+echo date('H:i:s') , " Set column widths" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(80);
+
+// Set fonts
+echo date('H:i:s') , " Set fonts" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(20);
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
+
+$objPHPExcel->getActiveSheet()->getStyle('A3:A6')->getFont()->setSize(8);
+
+// Add a drawing to the worksheet
+echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
+$objDrawing = new PHPExcel_Worksheet_Drawing();
+$objDrawing->setName('Terms and conditions');
+$objDrawing->setDescription('Terms and conditions');
+$objDrawing->setPath('./images/termsconditions.jpg');
+$objDrawing->setCoordinates('B14');
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+
+// Set page orientation and size
+echo date('H:i:s') , " Set page orientation and size" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
+
+// Rename second worksheet
+echo date('H:i:s') , " Rename second worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Terms and conditions');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
diff --git a/Examples/05featuredemo.php b/Examples/05featuredemo.php
new file mode 100644
index 0000000..9e502ac
--- /dev/null
+++ b/Examples/05featuredemo.php
@@ -0,0 +1,78 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/06largescale-with-cellcaching-sqlite.php b/Examples/06largescale-with-cellcaching-sqlite.php
new file mode 100644
index 0000000..8baa743
--- /dev/null
+++ b/Examples/06largescale-with-cellcaching-sqlite.php
@@ -0,0 +1,129 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite;
+if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
+ echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+} else {
+ echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
+}
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
+$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
+$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone");
+$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax");
+$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?");
+
+
+// Hide "Phone" and "fax" column
+echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+
+
+// Set outline levels
+echo date('H:i:s') , " Set outline levels" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
+ ->setVisible(false)
+ ->setCollapsed(true);
+
+// Freeze panes
+echo date('H:i:s') , " Freeze panes" , EOL;
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+// Rows to repeat at top
+echo date('H:i:s') , " Rows to repeat at top" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
+
+
+// Add data
+for ($i = 2; $i <= 5000; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
+ ->setCellValue('B' . $i, "LName $i")
+ ->setCellValue('C' . $i, "PhoneNo $i")
+ ->setCellValue('D' . $i, "FaxNo $i")
+ ->setCellValue('E' . $i, true);
+}
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/06largescale-with-cellcaching-sqlite3.php b/Examples/06largescale-with-cellcaching-sqlite3.php
new file mode 100644
index 0000000..1f480d1
--- /dev/null
+++ b/Examples/06largescale-with-cellcaching-sqlite3.php
@@ -0,0 +1,129 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3;
+if (PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
+ echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+} else {
+ echo date('H:i:s') , " Unable to set Cell Caching using " , $cacheMethod , " method, reverting to memory" , EOL;
+}
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
+$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
+$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone");
+$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax");
+$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?");
+
+
+// Hide "Phone" and "fax" column
+echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+
+
+// Set outline levels
+echo date('H:i:s') , " Set outline levels" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
+ ->setVisible(false)
+ ->setCollapsed(true);
+
+// Freeze panes
+echo date('H:i:s') , " Freeze panes" , EOL;
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+// Rows to repeat at top
+echo date('H:i:s') , " Rows to repeat at top" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
+
+
+// Add data
+for ($i = 2; $i <= 5000; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
+ ->setCellValue('B' . $i, "LName $i")
+ ->setCellValue('C' . $i, "PhoneNo $i")
+ ->setCellValue('D' . $i, "FaxNo $i")
+ ->setCellValue('E' . $i, true);
+}
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/06largescale-with-cellcaching.php b/Examples/06largescale-with-cellcaching.php
new file mode 100644
index 0000000..d20b29f
--- /dev/null
+++ b/Examples/06largescale-with-cellcaching.php
@@ -0,0 +1,128 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
+if (!PHPExcel_Settings::setCacheStorageMethod($cacheMethod)) {
+ die($cacheMethod . " caching method is not available" . EOL);
+}
+echo date('H:i:s') , " Enable Cell Caching using " , $cacheMethod , " method" , EOL;
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
+$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
+$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone");
+$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax");
+$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?");
+
+
+// Hide "Phone" and "fax" column
+echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+
+
+// Set outline levels
+echo date('H:i:s') , " Set outline levels" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
+ ->setVisible(false)
+ ->setCollapsed(true);
+
+// Freeze panes
+echo date('H:i:s') , " Freeze panes" , EOL;
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+// Rows to repeat at top
+echo date('H:i:s') , " Rows to repeat at top" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
+
+
+// Add data
+for ($i = 2; $i <= 5000; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
+ ->setCellValue('B' . $i, "LName $i")
+ ->setCellValue('C' . $i, "PhoneNo $i")
+ ->setCellValue('D' . $i, "FaxNo $i")
+ ->setCellValue('E' . $i, true);
+}
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/06largescale-xls.php b/Examples/06largescale-xls.php
new file mode 100644
index 0000000..5adc3d2
--- /dev/null
+++ b/Examples/06largescale-xls.php
@@ -0,0 +1,136 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+/*
+After doing some test, I've got these results benchmarked
+for writing to Excel2007:
+
+ Number of rows Seconds to generate
+ 200 3
+ 500 4
+ 1000 6
+ 2000 12
+ 4000 36
+ 8000 64
+ 15000 465
+*/
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
+$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
+$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone");
+$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax");
+$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?");
+
+
+// Hide "Phone" and "fax" column
+echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+
+
+// Set outline levels
+echo date('H:i:s') , " Set outline levels" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
+ ->setVisible(false)
+ ->setCollapsed(true);
+
+// Freeze panes
+echo date('H:i:s') , " Freeze panes" , EOL;
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+// Rows to repeat at top
+echo date('H:i:s') , " Rows to repeat at top" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
+
+
+// Add data
+for ($i = 2; $i <= 5000; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
+ ->setCellValue('B' . $i, "LName $i")
+ ->setCellValue('C' . $i, "PhoneNo $i")
+ ->setCellValue('D' . $i, "FaxNo $i")
+ ->setCellValue('E' . $i, true);
+}
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/06largescale.php b/Examples/06largescale.php
new file mode 100644
index 0000000..cb21caf
--- /dev/null
+++ b/Examples/06largescale.php
@@ -0,0 +1,136 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+/*
+After doing some test, I've got these results benchmarked
+for writing to Excel2007:
+
+ Number of rows Seconds to generate
+ 200 3
+ 500 4
+ 1000 6
+ 2000 12
+ 4000 36
+ 8000 64
+ 15000 465
+*/
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname");
+$objPHPExcel->getActiveSheet()->setCellValue('B1', "Lastname");
+$objPHPExcel->getActiveSheet()->setCellValue('C1', "Phone");
+$objPHPExcel->getActiveSheet()->setCellValue('D1', "Fax");
+$objPHPExcel->getActiveSheet()->setCellValue('E1', "Is Client ?");
+
+
+// Hide "Phone" and "fax" column
+echo date('H:i:s') , " Hide 'Phone' and 'fax' columns" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setVisible(false);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setVisible(false);
+
+
+// Set outline levels
+echo date('H:i:s') , " Set outline levels" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1)
+ ->setVisible(false)
+ ->setCollapsed(true);
+
+// Freeze panes
+echo date('H:i:s') , " Freeze panes" , EOL;
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+// Rows to repeat at top
+echo date('H:i:s') , " Rows to repeat at top" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 1);
+
+
+// Add data
+for ($i = 2; $i <= 5000; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i")
+ ->setCellValue('B' . $i, "LName $i")
+ ->setCellValue('C' . $i, "PhoneNo $i")
+ ->setCellValue('D' . $i, "FaxNo $i")
+ ->setCellValue('E' . $i, true);
+}
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/07reader.php b/Examples/07reader.php
new file mode 100644
index 0000000..318ba18
--- /dev/null
+++ b/Examples/07reader.php
@@ -0,0 +1,76 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+if (!file_exists("05featuredemo.xlsx")) {
+ exit("Please run 05featuredemo.php first." . EOL);
+}
+
+echo date('H:i:s') , " Load from Excel2007 file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/07readerPCLZip.php b/Examples/07readerPCLZip.php
new file mode 100644
index 0000000..f1da9c5
--- /dev/null
+++ b/Examples/07readerPCLZip.php
@@ -0,0 +1,79 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+if (!file_exists("05featuredemo.xlsx")) {
+ exit("Please run 05featuredemo.php first." . EOL);
+}
+
+// Use PCLZip rather than ZipArchive to read the Excel2007 OfficeOpenXML file
+PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
+
+echo date('H:i:s') , " Load from Excel2007 file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel = PHPExcel_IOFactory::load("05featuredemo.xlsx");
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/08conditionalformatting.php b/Examples/08conditionalformatting.php
new file mode 100644
index 0000000..514a8bb
--- /dev/null
+++ b/Examples/08conditionalformatting.php
@@ -0,0 +1,189 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet, representing sales data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Description')
+ ->setCellValue('B1', 'Amount');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Paycheck received')
+ ->setCellValue('B2', 100);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought')
+ ->setCellValue('B3', -1.5);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought')
+ ->setCellValue('B4', -1.5);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Cup of tea bought')
+ ->setCellValue('B5', -1.2);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Found some money')
+ ->setCellValue('B6', 8);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Total:')
+ ->setCellValue('B7', '=SUM(B2:B6)');
+
+
+// Set column widths
+echo date('H:i:s') , " Set column widths" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30);
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
+
+
+// Add conditional formatting
+echo date('H:i:s') , " Add conditional formatting" , EOL;
+$objConditional1 = new PHPExcel_Style_Conditional();
+$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
+ ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_BETWEEN)
+ ->addCondition('200')
+ ->addCondition('400');
+$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_YELLOW);
+$objConditional1->getStyle()->getFont()->setBold(true);
+$objConditional1->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+
+$objConditional2 = new PHPExcel_Style_Conditional();
+$objConditional2->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
+ ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
+ ->addCondition('0');
+$objConditional2->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
+$objConditional2->getStyle()->getFont()->setItalic(true);
+$objConditional2->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+
+$objConditional3 = new PHPExcel_Style_Conditional();
+$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
+ ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
+ ->addCondition('0');
+$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
+$objConditional3->getStyle()->getFont()->setItalic(true);
+$objConditional3->getStyle()->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
+
+$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles();
+array_push($conditionalStyles, $objConditional1);
+array_push($conditionalStyles, $objConditional2);
+array_push($conditionalStyles, $objConditional3);
+$objPHPExcel->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles);
+
+
+// duplicate the conditional styles across a range of cells
+echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL;
+$objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
+ $objPHPExcel->getActiveSheet()->getStyle('B2')->getConditionalStyles(),
+ 'B3:B7'
+ );
+
+
+// Set fonts
+echo date('H:i:s') , " Set fonts" , EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:B1')->getFont()->setBold(true);
+//$objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('A7:B7')->getFont()->setBold(true);
+//$objPHPExcel->getActiveSheet()->getStyle('B7')->getFont()->setBold(true);
+
+
+// Set header and footer. When no different headers for odd/even are used, odd header is assumed.
+echo date('H:i:s') , " Set header/footer" , EOL;
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D');
+$objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
+
+
+// Set page orientation and size
+echo date('H:i:s') , " Set page orientation and size" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
+$objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Invoice');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Save Excel5 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/08conditionalformatting2.php b/Examples/08conditionalformatting2.php
new file mode 100644
index 0000000..aeb2a31
--- /dev/null
+++ b/Examples/08conditionalformatting2.php
@@ -0,0 +1,136 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet, representing sales data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A1', '-0.5')
+ ->setCellValue('A2', '-0.25')
+ ->setCellValue('A3', '0.0')
+ ->setCellValue('A4', '0.25')
+ ->setCellValue('A5', '0.5')
+ ->setCellValue('A6', '0.75')
+ ->setCellValue('A7', '1.0')
+ ->setCellValue('A8', '1.25')
+;
+
+$objPHPExcel->getActiveSheet()->getStyle('A1:A8')
+ ->getNumberFormat()
+ ->setFormatCode(
+ PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00
+ );
+
+
+// Add conditional formatting
+echo date('H:i:s') , " Add conditional formatting" , EOL;
+$objConditional1 = new PHPExcel_Style_Conditional();
+$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
+ ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_LESSTHAN)
+ ->addCondition('0');
+$objConditional1->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
+
+$objConditional3 = new PHPExcel_Style_Conditional();
+$objConditional3->setConditionType(PHPExcel_Style_Conditional::CONDITION_CELLIS)
+ ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_GREATERTHANOREQUAL)
+ ->addCondition('1');
+$objConditional3->getStyle()->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);
+
+$conditionalStyles = $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles();
+array_push($conditionalStyles, $objConditional1);
+array_push($conditionalStyles, $objConditional3);
+$objPHPExcel->getActiveSheet()->getStyle('A1')->setConditionalStyles($conditionalStyles);
+
+
+// duplicate the conditional styles across a range of cells
+echo date('H:i:s') , " Duplicate the conditional formatting across a range of cells" , EOL;
+$objPHPExcel->getActiveSheet()->duplicateConditionalStyle(
+ $objPHPExcel->getActiveSheet()->getStyle('A1')->getConditionalStyles(),
+ 'A2:A8'
+ );
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Save Excel5 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/09pagebreaks.php b/Examples/09pagebreaks.php
new file mode 100644
index 0000000..36e21ae
--- /dev/null
+++ b/Examples/09pagebreaks.php
@@ -0,0 +1,134 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data and page breaks" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Firstname")
+ ->setCellValue('B1', "Lastname")
+ ->setCellValue('C1', "Phone")
+ ->setCellValue('D1', "Fax")
+ ->setCellValue('E1', "Is Client ?");
+
+
+// Add data
+for ($i = 2; $i <= 50; $i++) {
+ $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, "FName $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, "LName $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i");
+ $objPHPExcel->getActiveSheet()->setCellValue('E' . $i, true);
+
+ // Add page breaks every 10 rows
+ if ($i % 10 == 0) {
+ // Add a page break
+ $objPHPExcel->getActiveSheet()->setBreak( 'A' . $i, PHPExcel_Worksheet::BREAK_ROW );
+ }
+}
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setTitle('Printing Options');
+
+// Set print headers
+$objPHPExcel->getActiveSheet()
+ ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A');
+$objPHPExcel->getActiveSheet()
+ ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A');
+
+// Set print footers
+$objPHPExcel->getActiveSheet()
+ ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N');
+$objPHPExcel->getActiveSheet()
+ ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N');
+
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/10autofilter-selection-1.php b/Examples/10autofilter-selection-1.php
new file mode 100644
index 0000000..8cdc0de
--- /dev/null
+++ b/Examples/10autofilter-selection-1.php
@@ -0,0 +1,221 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s').' Create new PHPExcel object'.EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s').' Set document properties'.EOL;
+$objPHPExcel->getProperties()->setCreator('Maarten Balliauw')
+ ->setLastModifiedBy('Maarten Balliauw')
+ ->setTitle('PHPExcel Test Document')
+ ->setSubject('PHPExcel Test Document')
+ ->setDescription('Test document for PHPExcel, generated using PHP classes.')
+ ->setKeywords('office PHPExcel php')
+ ->setCategory('Test result file');
+
+// Create the worksheet
+echo date('H:i:s').' Add data'.EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
+ ->setCellValue('B1', 'Financial Period')
+ ->setCellValue('C1', 'Country')
+ ->setCellValue('D1', 'Date')
+ ->setCellValue('E1', 'Sales Value')
+ ->setCellValue('F1', 'Expenditure')
+ ;
+$startYear = $endYear = $currentYear = date('Y');
+$startYear--;
+$endYear++;
+
+$years = range($startYear,$endYear);
+$periods = range(1,12);
+$countries = array( 'United States', 'UK', 'France', 'Germany',
+ 'Italy', 'Spain', 'Portugal', 'Japan'
+ );
+
+$row = 2;
+foreach($years as $year) {
+ foreach($periods as $period) {
+ foreach($countries as $country) {
+ $endDays = date('t',mktime(0,0,0,$period,1,$year));
+ for($i = 1; $i <= $endDays; ++$i) {
+ $eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
+ $year,
+ $period,
+ $i
+ );
+ $value = rand(500,1000) * (1 + rand(-0.25,+0.25));
+ $salesValue = $invoiceValue = NULL;
+ $incomeOrExpenditure = rand(-1,1);
+ if ($incomeOrExpenditure == -1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = NULL;
+ } elseif ($incomeOrExpenditure == 1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ } else {
+ $expenditure = NULL;
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ }
+ $dataArray = array( $year,
+ $period,
+ $country,
+ $eDate,
+ $income,
+ $expenditure,
+ );
+ $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++);
+ }
+ }
+ }
+}
+$row--;
+
+
+// Set styling
+echo date('H:i:s').' Set styling'.EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
+$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+
+// Set autofilter range
+echo date('H:i:s').' Set autofilter range'.EOL;
+// Always include the complete filter range!
+// Excel does support setting only the caption
+// row, but that's not a best practise...
+$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
+
+// Set active filters
+$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
+echo date('H:i:s').' Set active filters'.EOL;
+// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
+// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
+$autoFilter->getColumn('C')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'u*'
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+$autoFilter->getColumn('C')
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'japan'
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+// Filter the Date column on a filter value of the first day of every period of the current year
+// We us a dateGroup ruletype for this, although it is still a standard filter
+foreach($periods as $period) {
+ $endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
+
+ $autoFilter->getColumn('D')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ array(
+ 'year' => $currentYear,
+ 'month' => $period,
+ 'day' => $endDate
+ )
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+}
+// Display only sales values that are blank
+// Standard filter, operator equals, and value of NULL
+$autoFilter->getColumn('E')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ ''
+ );
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL;
+
+// Echo done
+echo date('H:i:s').' Done writing files'.EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/10autofilter-selection-2.php b/Examples/10autofilter-selection-2.php
new file mode 100644
index 0000000..e2aea74
--- /dev/null
+++ b/Examples/10autofilter-selection-2.php
@@ -0,0 +1,213 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s').' Create new PHPExcel object'.EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s').' Set document properties'.EOL;
+$objPHPExcel->getProperties()->setCreator('Maarten Balliauw')
+ ->setLastModifiedBy('Maarten Balliauw')
+ ->setTitle('PHPExcel Test Document')
+ ->setSubject('PHPExcel Test Document')
+ ->setDescription('Test document for PHPExcel, generated using PHP classes.')
+ ->setKeywords('office PHPExcel php')
+ ->setCategory('Test result file');
+
+// Create the worksheet
+echo date('H:i:s').' Add data'.EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
+ ->setCellValue('B1', 'Financial Period')
+ ->setCellValue('C1', 'Country')
+ ->setCellValue('D1', 'Date')
+ ->setCellValue('E1', 'Sales Value')
+ ->setCellValue('F1', 'Expenditure')
+ ;
+$startYear = $endYear = $currentYear = date('Y');
+$startYear--;
+$endYear++;
+
+$years = range($startYear,$endYear);
+$periods = range(1,12);
+$countries = array( 'United States', 'UK', 'France', 'Germany',
+ 'Italy', 'Spain', 'Portugal', 'Japan'
+ );
+
+$row = 2;
+foreach($years as $year) {
+ foreach($periods as $period) {
+ foreach($countries as $country) {
+ $endDays = date('t',mktime(0,0,0,$period,1,$year));
+ for($i = 1; $i <= $endDays; ++$i) {
+ $eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
+ $year,
+ $period,
+ $i
+ );
+ $value = rand(500,1000) * (1 + rand(-0.25,+0.25));
+ $salesValue = $invoiceValue = NULL;
+ $incomeOrExpenditure = rand(-1,1);
+ if ($incomeOrExpenditure == -1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = NULL;
+ } elseif ($incomeOrExpenditure == 1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ } else {
+ $expenditure = NULL;
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ }
+ $dataArray = array( $year,
+ $period,
+ $country,
+ $eDate,
+ $income,
+ $expenditure,
+ );
+ $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++);
+ }
+ }
+ }
+}
+$row--;
+
+
+// Set styling
+echo date('H:i:s').' Set styling'.EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
+$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+
+// Set autofilter range
+echo date('H:i:s').' Set autofilter range'.EOL;
+// Always include the complete filter range!
+// Excel does support setting only the caption
+// row, but that's not a best practise...
+$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
+
+// Set active filters
+$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
+echo date('H:i:s').' Set active filters'.EOL;
+// Filter the Country column on a filter value of Germany
+// As it's just a simple value filter, we can use FILTERTYPE_FILTER
+$autoFilter->getColumn('C')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'Germany'
+ );
+// Filter the Date column on a filter value of the year to date
+$autoFilter->getColumn('D')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ NULL,
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
+// Display only sales values that are between 400 and 600
+$autoFilter->getColumn('E')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
+ 400
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+$autoFilter->getColumn('E')
+ ->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL,
+ 600
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL;
+
+// Echo done
+echo date('H:i:s').' Done writing files'.EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/10autofilter-selection-display.php b/Examples/10autofilter-selection-display.php
new file mode 100644
index 0000000..ba3fed9
--- /dev/null
+++ b/Examples/10autofilter-selection-display.php
@@ -0,0 +1,198 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s').' Create new PHPExcel object'.EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s').' Set document properties'.EOL;
+$objPHPExcel->getProperties()->setCreator('Maarten Balliauw')
+ ->setLastModifiedBy('Maarten Balliauw')
+ ->setTitle('PHPExcel Test Document')
+ ->setSubject('PHPExcel Test Document')
+ ->setDescription('Test document for PHPExcel, generated using PHP classes.')
+ ->setKeywords('office PHPExcel php')
+ ->setCategory('Test result file');
+
+// Create the worksheet
+echo date('H:i:s').' Add data'.EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Financial Year')
+ ->setCellValue('B1', 'Financial Period')
+ ->setCellValue('C1', 'Country')
+ ->setCellValue('D1', 'Date')
+ ->setCellValue('E1', 'Sales Value')
+ ->setCellValue('F1', 'Expenditure')
+ ;
+$startYear = $endYear = $currentYear = date('Y');
+$startYear--;
+$endYear++;
+
+$years = range($startYear,$endYear);
+$periods = range(1,12);
+$countries = array( 'United States', 'UK', 'France', 'Germany',
+ 'Italy', 'Spain', 'Portugal', 'Japan'
+ );
+
+$row = 2;
+foreach($years as $year) {
+ foreach($periods as $period) {
+ foreach($countries as $country) {
+ $endDays = date('t',mktime(0,0,0,$period,1,$year));
+ for($i = 1; $i <= $endDays; ++$i) {
+ $eDate = PHPExcel_Shared_Date::FormattedPHPToExcel(
+ $year,
+ $period,
+ $i
+ );
+ $value = rand(500,1000) * (1 + rand(-0.25,+0.25));
+ $salesValue = $invoiceValue = NULL;
+ $incomeOrExpenditure = rand(-1,1);
+ if ($incomeOrExpenditure == -1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = NULL;
+ } elseif ($incomeOrExpenditure == 1) {
+ $expenditure = rand(-500,-1000) * (1 + rand(-0.25,+0.25));
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ } else {
+ $expenditure = NULL;
+ $income = rand(500,1000) * (1 + rand(-0.25,+0.25));;
+ }
+ $dataArray = array( $year,
+ $period,
+ $country,
+ $eDate,
+ $income,
+ $expenditure,
+ );
+ $objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A'.$row++);
+ }
+ }
+ }
+}
+$row--;
+
+
+// Set styling
+echo date('H:i:s').' Set styling'.EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
+$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(TRUE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(12.5);
+$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(10.5);
+$objPHPExcel->getActiveSheet()->getStyle('D2:D'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);
+$objPHPExcel->getActiveSheet()->getStyle('E2:F'.$row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
+$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(14);
+$objPHPExcel->getActiveSheet()->freezePane('A2');
+
+
+
+// Set autofilter range
+echo date('H:i:s').' Set autofilter range'.EOL;
+// Always include the complete filter range!
+// Excel does support setting only the caption
+// row, but that's not a best practise...
+$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
+
+// Set active filters
+$autoFilter = $objPHPExcel->getActiveSheet()->getAutoFilter();
+echo date('H:i:s').' Set active filters'.EOL;
+// Filter the Country column on a filter value of countries beginning with the letter U (or Japan)
+// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter
+$autoFilter->getColumn('C')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'u*'
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+$autoFilter->getColumn('C')
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ 'japan'
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
+// Filter the Date column on a filter value of the first day of every period of the current year
+// We us a dateGroup ruletype for this, although it is still a standard filter
+foreach($periods as $period) {
+ $endDate = date('t',mktime(0,0,0,$period,1,$currentYear));
+
+ $autoFilter->getColumn('D')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ array(
+ 'year' => $currentYear,
+ 'month' => $period,
+ 'day' => $endDate
+ )
+ )
+ ->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
+}
+// Display only sales values that are blank
+// Standard filter, operator equals, and value of NULL
+$autoFilter->getColumn('E')
+ ->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER)
+ ->createRule()
+ ->setRule(
+ PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL,
+ ''
+ );
+
+// Execute filtering
+echo date('H:i:s').' Execute filtering'.EOL;
+$autoFilter->showHideRows();
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Display Results of filtering
+echo date('H:i:s').' Display filtered rows'.EOL;
+foreach ($objPHPExcel->getActiveSheet()->getRowIterator() as $row) {
+ if ($objPHPExcel->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) {
+ echo ' Row number - ' , $row->getRowIndex() , ' ';
+ echo $objPHPExcel->getActiveSheet()->getCell('C'.$row->getRowIndex())->getValue(), ' ';
+ echo $objPHPExcel->getActiveSheet()->getCell('D'.$row->getRowIndex())->getFormattedValue(), ' ';
+ echo EOL;
+ }
+}
diff --git a/Examples/10autofilter.php b/Examples/10autofilter.php
new file mode 100644
index 0000000..015e9cf
--- /dev/null
+++ b/Examples/10autofilter.php
@@ -0,0 +1,171 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+// Create new PHPExcel object
+echo date('H:i:s').' Create new PHPExcel object'.EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s').' Set document properties'.EOL;
+$objPHPExcel->getProperties()->setCreator('Maarten Balliauw')
+ ->setLastModifiedBy('Maarten Balliauw')
+ ->setTitle('PHPExcel Test Document')
+ ->setSubject('PHPExcel Test Document')
+ ->setDescription('Test document for PHPExcel, generated using PHP classes.')
+ ->setKeywords('office PHPExcel php')
+ ->setCategory('Test result file');
+
+// Create the worksheet
+echo date('H:i:s').' Add data'.EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Year')
+ ->setCellValue('B1', 'Quarter')
+ ->setCellValue('C1', 'Country')
+ ->setCellValue('D1', 'Sales');
+
+$dataArray = array(array('2010', 'Q1', 'United States', 790),
+ array('2010', 'Q2', 'United States', 730),
+ array('2010', 'Q3', 'United States', 860),
+ array('2010', 'Q4', 'United States', 850),
+ array('2011', 'Q1', 'United States', 800),
+ array('2011', 'Q2', 'United States', 700),
+ array('2011', 'Q3', 'United States', 900),
+ array('2011', 'Q4', 'United States', 950),
+ array('2010', 'Q1', 'Belgium', 380),
+ array('2010', 'Q2', 'Belgium', 390),
+ array('2010', 'Q3', 'Belgium', 420),
+ array('2010', 'Q4', 'Belgium', 460),
+ array('2011', 'Q1', 'Belgium', 400),
+ array('2011', 'Q2', 'Belgium', 350),
+ array('2011', 'Q3', 'Belgium', 450),
+ array('2011', 'Q4', 'Belgium', 500),
+ array('2010', 'Q1', 'UK', 690),
+ array('2010', 'Q2', 'UK', 610),
+ array('2010', 'Q3', 'UK', 620),
+ array('2010', 'Q4', 'UK', 600),
+ array('2011', 'Q1', 'UK', 720),
+ array('2011', 'Q2', 'UK', 650),
+ array('2011', 'Q3', 'UK', 580),
+ array('2011', 'Q4', 'UK', 510),
+ array('2010', 'Q1', 'France', 510),
+ array('2010', 'Q2', 'France', 490),
+ array('2010', 'Q3', 'France', 460),
+ array('2010', 'Q4', 'France', 590),
+ array('2011', 'Q1', 'France', 620),
+ array('2011', 'Q2', 'France', 650),
+ array('2011', 'Q3', 'France', 415),
+ array('2011', 'Q4', 'France', 570),
+ array('2010', 'Q1', 'Germany', 720),
+ array('2010', 'Q2', 'Germany', 680),
+ array('2010', 'Q3', 'Germany', 640),
+ array('2010', 'Q4', 'Germany', 660),
+ array('2011', 'Q1', 'Germany', 680),
+ array('2011', 'Q2', 'Germany', 620),
+ array('2011', 'Q3', 'Germany', 710),
+ array('2011', 'Q4', 'Germany', 690),
+ array('2010', 'Q1', 'Spain', 510),
+ array('2010', 'Q2', 'Spain', 490),
+ array('2010', 'Q3', 'Spain', 470),
+ array('2010', 'Q4', 'Spain', 420),
+ array('2011', 'Q1', 'Spain', 460),
+ array('2011', 'Q2', 'Spain', 390),
+ array('2011', 'Q3', 'Spain', 430),
+ array('2011', 'Q4', 'Spain', 415),
+ array('2010', 'Q1', 'Italy', 440),
+ array('2010', 'Q2', 'Italy', 410),
+ array('2010', 'Q3', 'Italy', 420),
+ array('2010', 'Q4', 'Italy', 450),
+ array('2011', 'Q1', 'Italy', 430),
+ array('2011', 'Q2', 'Italy', 370),
+ array('2011', 'Q3', 'Italy', 350),
+ array('2011', 'Q4', 'Italy', 335),
+ );
+$objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A2');
+
+// Set title row bold
+echo date('H:i:s').' Set title row bold'.EOL;
+$objPHPExcel->getActiveSheet()->getStyle('A1:D1')->getFont()->setBold(true);
+
+// Set autofilter
+echo date('H:i:s').' Set autofilter'.EOL;
+// Always include the complete filter range!
+// Excel does support setting only the caption
+// row, but that's not a best practise...
+$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s').' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB'.EOL;
+
+// Echo done
+echo date('H:i:s').' Done writing files'.EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/11documentsecurity-xls.php b/Examples/11documentsecurity-xls.php
new file mode 100644
index 0000000..2348ce9
--- /dev/null
+++ b/Examples/11documentsecurity-xls.php
@@ -0,0 +1,109 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello');
+$objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!');
+$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello');
+$objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set document security
+echo date('H:i:s') , " Set document security" , EOL;
+$objPHPExcel->getSecurity()->setLockWindows(true);
+$objPHPExcel->getSecurity()->setLockStructure(true);
+$objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel");
+
+
+// Set sheet security
+echo date('H:i:s') , " Set sheet security" , EOL;
+$objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel');
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following!
+$objPHPExcel->getActiveSheet()->getProtection()->setSort(true);
+$objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true);
+$objPHPExcel->getActiveSheet()->getProtection()->setFormatCells(true);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/11documentsecurity.php b/Examples/11documentsecurity.php
new file mode 100644
index 0000000..9fd4fb2
--- /dev/null
+++ b/Examples/11documentsecurity.php
@@ -0,0 +1,109 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello');
+$objPHPExcel->getActiveSheet()->setCellValue('B2', 'world!');
+$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello');
+$objPHPExcel->getActiveSheet()->setCellValue('D2', 'world!');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set document security
+echo date('H:i:s') , " Set document security" , EOL;
+$objPHPExcel->getSecurity()->setLockWindows(true);
+$objPHPExcel->getSecurity()->setLockStructure(true);
+$objPHPExcel->getSecurity()->setWorkbookPassword("PHPExcel");
+
+
+// Set sheet security
+echo date('H:i:s') , " Set sheet security" , EOL;
+$objPHPExcel->getActiveSheet()->getProtection()->setPassword('PHPExcel');
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following!
+$objPHPExcel->getActiveSheet()->getProtection()->setSort(true);
+$objPHPExcel->getActiveSheet()->getProtection()->setInsertRows(true);
+$objPHPExcel->getActiveSheet()->getProtection()->setFormatCells(true);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/12cellProtection.php b/Examples/12cellProtection.php
new file mode 100644
index 0000000..e12c9ae
--- /dev/null
+++ b/Examples/12cellProtection.php
@@ -0,0 +1,107 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Mark Baker")
+ ->setLastModifiedBy("Mark Baker")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Crouching');
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Tiger');
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Hidden');
+$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Dragon');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set document security
+echo date('H:i:s') , " Set cell protection" , EOL;
+
+
+// Set sheet security
+echo date('H:i:s') , " Set sheet security" , EOL;
+$objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);
+$objPHPExcel->getActiveSheet()
+ ->getStyle('A2:B2')
+ ->getProtection()->setLocked(
+ PHPExcel_Style_Protection::PROTECTION_UNPROTECTED
+ );
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/13calculation.php b/Examples/13calculation.php
new file mode 100644
index 0000000..e255d11
--- /dev/null
+++ b/Examples/13calculation.php
@@ -0,0 +1,235 @@
+');
+
+date_default_timezone_set('Europe/London');
+mt_srand(1234567890);
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// List functions
+echo date('H:i:s') , " List implemented functions" , EOL;
+$objCalc = PHPExcel_Calculation::getInstance();
+print_r($objCalc->listFunctionNames());
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Add some data, we will use some formulas here
+echo date('H:i:s') , " Add some data and formulas" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:')
+ ->setCellValue('A15', 'Sum:')
+ ->setCellValue('A16', 'Max:')
+ ->setCellValue('A17', 'Min:')
+ ->setCellValue('A18', 'Average:')
+ ->setCellValue('A19', 'Median:')
+ ->setCellValue('A20', 'Mode:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A22', 'CountA:')
+ ->setCellValue('A23', 'MaxA:')
+ ->setCellValue('A24', 'MinA:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A26', 'StDev:')
+ ->setCellValue('A27', 'StDevA:')
+ ->setCellValue('A28', 'StDevP:')
+ ->setCellValue('A29', 'StDevPA:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A31', 'DevSq:')
+ ->setCellValue('A32', 'Var:')
+ ->setCellValue('A33', 'VarA:')
+ ->setCellValue('A34', 'VarP:')
+ ->setCellValue('A35', 'VarPA:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A37', 'Date:');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1')
+ ->setCellValue('B2', 2)
+ ->setCellValue('B3', 8)
+ ->setCellValue('B4', 10)
+ ->setCellValue('B5', True)
+ ->setCellValue('B6', False)
+ ->setCellValue('B7', 'Text String')
+ ->setCellValue('B9', '22')
+ ->setCellValue('B10', 4)
+ ->setCellValue('B11', 6)
+ ->setCellValue('B12', 12);
+
+$objPHPExcel->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)')
+ ->setCellValue('B15', '=SUM(B2:B12)')
+ ->setCellValue('B16', '=MAX(B2:B12)')
+ ->setCellValue('B17', '=MIN(B2:B12)')
+ ->setCellValue('B18', '=AVERAGE(B2:B12)')
+ ->setCellValue('B19', '=MEDIAN(B2:B12)')
+ ->setCellValue('B20', '=MODE(B2:B12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B22', '=COUNTA(B2:B12)')
+ ->setCellValue('B23', '=MAXA(B2:B12)')
+ ->setCellValue('B24', '=MINA(B2:B12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B26', '=STDEV(B2:B12)')
+ ->setCellValue('B27', '=STDEVA(B2:B12)')
+ ->setCellValue('B28', '=STDEVP(B2:B12)')
+ ->setCellValue('B29', '=STDEVPA(B2:B12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B31', '=DEVSQ(B2:B12)')
+ ->setCellValue('B32', '=VAR(B2:B12)')
+ ->setCellValue('B33', '=VARA(B2:B12)')
+ ->setCellValue('B34', '=VARP(B2:B12)')
+ ->setCellValue('B35', '=VARPA(B2:B12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B37', '=DATE(2007, 12, 21)')
+ ->setCellValue('B38', '=DATEDIF( DATE(2007, 12, 21), DATE(2007, 12, 22), "D" )')
+ ->setCellValue('B39', '=DATEVALUE("01-Feb-2006 10:06 AM")')
+ ->setCellValue('B40', '=DAY( DATE(2006, 1, 2) )')
+ ->setCellValue('B41', '=DAYS360( DATE(2002, 2, 3), DATE(2005, 5, 31) )');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range 2')
+ ->setCellValue('C2', 1)
+ ->setCellValue('C3', 2)
+ ->setCellValue('C4', 2)
+ ->setCellValue('C5', 3)
+ ->setCellValue('C6', 3)
+ ->setCellValue('C7', 3)
+ ->setCellValue('C8', '0')
+ ->setCellValue('C9', 4)
+ ->setCellValue('C10', 4)
+ ->setCellValue('C11', 4)
+ ->setCellValue('C12', 4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)')
+ ->setCellValue('C15', '=SUM(C2:C12)')
+ ->setCellValue('C16', '=MAX(C2:C12)')
+ ->setCellValue('C17', '=MIN(C2:C12)')
+ ->setCellValue('C18', '=AVERAGE(C2:C12)')
+ ->setCellValue('C19', '=MEDIAN(C2:C12)')
+ ->setCellValue('C20', '=MODE(C2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C22', '=COUNTA(C2:C12)')
+ ->setCellValue('C23', '=MAXA(C2:C12)')
+ ->setCellValue('C24', '=MINA(C2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C26', '=STDEV(C2:C12)')
+ ->setCellValue('C27', '=STDEVA(C2:C12)')
+ ->setCellValue('C28', '=STDEVP(C2:C12)')
+ ->setCellValue('C29', '=STDEVPA(C2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C31', '=DEVSQ(C2:C12)')
+ ->setCellValue('C32', '=VAR(C2:C12)')
+ ->setCellValue('C33', '=VARA(C2:C12)')
+ ->setCellValue('C34', '=VARP(C2:C12)')
+ ->setCellValue('C35', '=VARPA(C2:C12)');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Range 3')
+ ->setCellValue('D2', 2)
+ ->setCellValue('D3', 3)
+ ->setCellValue('D4', 4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('D14', '=((D2 * D3) + D4) & " should be 10"');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E12', 'Other functions')
+ ->setCellValue('E14', '=PI()')
+ ->setCellValue('E15', '=RAND()')
+ ->setCellValue('E16', '=RANDBETWEEN(5, 10)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E17', 'Count of both ranges:')
+ ->setCellValue('F17', '=COUNT(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E18', 'Total of both ranges:')
+ ->setCellValue('F18', '=SUM(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E19', 'Maximum of both ranges:')
+ ->setCellValue('F19', '=MAX(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E20', 'Minimum of both ranges:')
+ ->setCellValue('F20', '=MIN(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E21', 'Average of both ranges:')
+ ->setCellValue('F21', '=AVERAGE(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E22', 'Median of both ranges:')
+ ->setCellValue('F22', '=MEDIAN(B2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E23', 'Mode of both ranges:')
+ ->setCellValue('F23', '=MODE(B2:C12)');
+
+
+// Calculated data
+echo date('H:i:s') , " Calculated data" , EOL;
+for ($col = 'B'; $col != 'G'; ++$col) {
+ for($row = 14; $row <= 41; ++$row) {
+ if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) &&
+ ($formula[0] == '=')) {
+ echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' ,
+ $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL;
+ }
+ }
+}
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+
+//
+// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
+// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae
+// using functions or features (such as array formulae) that aren't yet supported by the calculation engine
+// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to
+// open the file) will need to recalculate values itself to guarantee that the correct results are available.
+//
+//$objWriter->setPreCalculateFormulas(true);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/13calculationCyclicFormulae.php b/Examples/13calculationCyclicFormulae.php
new file mode 100644
index 0000000..8512a3e
--- /dev/null
+++ b/Examples/13calculationCyclicFormulae.php
@@ -0,0 +1,97 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Add some data, we will use some formulas here
+echo date('H:i:s') , " Add some data and formulas" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A1', '=B1')
+ ->setCellValue('A2', '=B2+1')
+ ->setCellValue('B1', '=A1+1')
+ ->setCellValue('B2', '=A2');
+
+PHPExcel_Calculation::getInstance($objPHPExcel)->cyclicFormulaCount = 100;
+
+// Calculated data
+echo date('H:i:s') , " Calculated data" , EOL;
+for($row = 1; $row <= 2; ++$row) {
+ for ($col = 'A'; $col != 'C'; ++$col) {
+ if ((!is_null($formula = $objPHPExcel->getActiveSheet()->getCell($col.$row)->getValue())) &&
+ ($formula[0] == '=')) {
+ echo 'Value of ' , $col , $row , ' [' , $formula , ']: ' ,
+ $objPHPExcel->getActiveSheet()->getCell($col.$row)->getCalculatedValue() . EOL;
+ }
+ }
+}
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+
+//
+// If we set Pre Calculated Formulas to true then PHPExcel will calculate all formulae in the
+// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae
+// using functions or features (such as array formulae) that aren't yet supported by the calculation engine
+// If the value is false (the default) for the Excel2007 Writer, then MS Excel (or the application used to
+// open the file) will need to recalculate values itself to guarantee that the correct results are available.
+//
+//$objWriter->setPreCalculateFormulas(true);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/14excel5.php b/Examples/14excel5.php
new file mode 100644
index 0000000..7a9f685
--- /dev/null
+++ b/Examples/14excel5.php
@@ -0,0 +1,63 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/15datavalidation-xls.php b/Examples/15datavalidation-xls.php
new file mode 100644
index 0000000..3f0afde
--- /dev/null
+++ b/Examples/15datavalidation-xls.php
@@ -0,0 +1,155 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...")
+ ->setCellValue('A3', "Number:")
+ ->setCellValue('B3', "10")
+ ->setCellValue('A5', "List:")
+ ->setCellValue('B5', "Item A")
+ ->setCellValue('A7', "List #2:")
+ ->setCellValue('B7', "Item #2")
+ ->setCellValue('D2', "Item #1")
+ ->setCellValue('D3', "Item #2")
+ ->setCellValue('D4', "Item #3")
+ ->setCellValue('D5', "Item #4")
+ ->setCellValue('D6', "Item #5")
+ ->setCellValue('A9', 'Text:')
+ ;
+
+
+// Set data validation
+echo date('H:i:s') , " Set data validation" , EOL;
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Only numbers between 10 and 20 are allowed!');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Only numbers between 10 and 20 are allowed.');
+$objValidation->setFormula1(10);
+$objValidation->setFormula2(20);
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
+$objValidation->setAllowBlank(false);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setShowDropDown(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Value is not in list.');
+$objValidation->setPromptTitle('Pick from list');
+$objValidation->setPrompt('Please pick a value from the drop-down list.');
+$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " !!!
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
+$objValidation->setAllowBlank(false);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setShowDropDown(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Value is not in list.');
+$objValidation->setPromptTitle('Pick from list');
+$objValidation->setPrompt('Please pick a value from the drop-down list.');
+$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!!
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B9')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Text exceeds maximum length');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Maximum text length is 6 characters.');
+$objValidation->setFormula1(6);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/15datavalidation.php b/Examples/15datavalidation.php
new file mode 100644
index 0000000..132063d
--- /dev/null
+++ b/Examples/15datavalidation.php
@@ -0,0 +1,156 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Create a first sheet
+echo date('H:i:s') , " Add data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', "Cell B3 and B5 contain data validation...")
+ ->setCellValue('A3', "Number:")
+ ->setCellValue('B3', "10")
+ ->setCellValue('A5', "List:")
+ ->setCellValue('B5', "Item A")
+ ->setCellValue('A7', "List #2:")
+ ->setCellValue('B7', "Item #2")
+ ->setCellValue('D2', "Item #1")
+ ->setCellValue('D3', "Item #2")
+ ->setCellValue('D4', "Item #3")
+ ->setCellValue('D5', "Item #4")
+ ->setCellValue('D6', "Item #5")
+ ->setCellValue('A9', 'Text:')
+ ;
+
+
+// Set data validation
+echo date('H:i:s') , " Set data validation" , EOL;
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B3')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Only numbers between 10 and 20 are allowed!');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Only numbers between 10 and 20 are allowed.');
+$objValidation->setFormula1(10);
+$objValidation->setFormula2(20);
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B5')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
+$objValidation->setAllowBlank(false);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setShowDropDown(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Value is not in list.');
+$objValidation->setPromptTitle('Pick from list');
+$objValidation->setPrompt('Please pick a value from the drop-down list.');
+$objValidation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!!
+
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B7')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
+$objValidation->setAllowBlank(false);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setShowDropDown(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Value is not in list.');
+$objValidation->setPromptTitle('Pick from list');
+$objValidation->setPrompt('Please pick a value from the drop-down list.');
+$objValidation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " !!!
+
+$objValidation = $objPHPExcel->getActiveSheet()->getCell('B9')->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH );
+$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
+$objValidation->setAllowBlank(true);
+$objValidation->setShowInputMessage(true);
+$objValidation->setShowErrorMessage(true);
+$objValidation->setErrorTitle('Input error');
+$objValidation->setError('Text exceeds maximum length');
+$objValidation->setPromptTitle('Allowed input');
+$objValidation->setPrompt('Maximum text length is 6 characters.');
+$objValidation->setFormula1(6);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/16csv.php b/Examples/16csv.php
new file mode 100644
index 0000000..8d42fcb
--- /dev/null
+++ b/Examples/16csv.php
@@ -0,0 +1,105 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** PHPExcel_IOFactory */
+require_once '../Classes/PHPExcel/IOFactory.php';
+
+
+echo date('H:i:s') , " Write to CSV format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV')->setDelimiter(',')
+ ->setEnclosure('"')
+ ->setSheetIndex(0)
+ ->save(str_replace('.php', '.csv', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Read from CSV format" , EOL;
+$callStartTime = microtime(true);
+$objReader = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')
+ ->setEnclosure('"')
+ ->setSheetIndex(0);
+$objPHPExcelFromCSV = $objReader->load(str_replace('.php', '.csv', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to reload Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter2007 = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'Excel2007');
+$objWriter2007->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Write to CSV format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriterCSV = PHPExcel_IOFactory::createWriter($objPHPExcelFromCSV, 'CSV');
+$objWriterCSV->setExcelCompatibility(true);
+$objWriterCSV->save(str_replace('.php', '_excel.csv', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo date('H:i:s') , " File written to " , str_replace('.php', '_excel.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/17html.php b/Examples/17html.php
new file mode 100644
index 0000000..b84f8d4
--- /dev/null
+++ b/Examples/17html.php
@@ -0,0 +1,64 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+echo date('H:i:s') , " Write to HTML format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
+$objWriter->setSheetIndex(0);
+//$objWriter->setImagesRoot('http://www.example.com');
+$objWriter->save(str_replace('.php', '.htm', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/18extendedcalculation.php b/Examples/18extendedcalculation.php
new file mode 100644
index 0000000..59aeb30
--- /dev/null
+++ b/Examples/18extendedcalculation.php
@@ -0,0 +1,108 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// List functions
+echo date('H:i:s') . " List implemented functions\n";
+$objCalc = PHPExcel_Calculation::getInstance();
+print_r($objCalc->listFunctionNames());
+
+// Create new PHPExcel object
+echo date('H:i:s') . " Create new PHPExcel object\n";
+$objPHPExcel = new PHPExcel();
+
+// Add some data, we will use some formulas here
+echo date('H:i:s') . " Add some data\n";
+$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Count:');
+
+$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Range 1');
+$objPHPExcel->getActiveSheet()->setCellValue('B2', 2);
+$objPHPExcel->getActiveSheet()->setCellValue('B3', 8);
+$objPHPExcel->getActiveSheet()->setCellValue('B4', 10);
+$objPHPExcel->getActiveSheet()->setCellValue('B5', True);
+$objPHPExcel->getActiveSheet()->setCellValue('B6', False);
+$objPHPExcel->getActiveSheet()->setCellValue('B7', 'Text String');
+$objPHPExcel->getActiveSheet()->setCellValue('B9', '22');
+$objPHPExcel->getActiveSheet()->setCellValue('B10', 4);
+$objPHPExcel->getActiveSheet()->setCellValue('B11', 6);
+$objPHPExcel->getActiveSheet()->setCellValue('B12', 12);
+
+$objPHPExcel->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Range 2');
+$objPHPExcel->getActiveSheet()->setCellValue('C2', 1);
+$objPHPExcel->getActiveSheet()->setCellValue('C3', 2);
+$objPHPExcel->getActiveSheet()->setCellValue('C4', 2);
+$objPHPExcel->getActiveSheet()->setCellValue('C5', 3);
+$objPHPExcel->getActiveSheet()->setCellValue('C6', 3);
+$objPHPExcel->getActiveSheet()->setCellValue('C7', 3);
+$objPHPExcel->getActiveSheet()->setCellValue('C8', '0');
+$objPHPExcel->getActiveSheet()->setCellValue('C9', 4);
+$objPHPExcel->getActiveSheet()->setCellValue('C10', 4);
+$objPHPExcel->getActiveSheet()->setCellValue('C11', 4);
+$objPHPExcel->getActiveSheet()->setCellValue('C12', 4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Range 3');
+$objPHPExcel->getActiveSheet()->setCellValue('D2', 2);
+$objPHPExcel->getActiveSheet()->setCellValue('D3', 3);
+$objPHPExcel->getActiveSheet()->setCellValue('D4', 4);
+
+$objPHPExcel->getActiveSheet()->setCellValue('D5', '=((D2 * D3) + D4) & " should be 10"');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E1', 'Other functions');
+$objPHPExcel->getActiveSheet()->setCellValue('E2', '=PI()');
+$objPHPExcel->getActiveSheet()->setCellValue('E3', '=RAND()');
+$objPHPExcel->getActiveSheet()->setCellValue('E4', '=RANDBETWEEN(5, 10)');
+
+$objPHPExcel->getActiveSheet()->setCellValue('E14', 'Count of both ranges:');
+$objPHPExcel->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)');
+
+// Calculated data
+echo date('H:i:s') . " Calculated data\n";
+echo 'Value of B14 [=COUNT(B2:B12)]: ' . $objPHPExcel->getActiveSheet()->getCell('B14')->getCalculatedValue() . "\r\n";
+
+
+// Echo memory peak usage
+echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";
+
+// Echo done
+echo date('H:i:s') . " Done" , EOL;
diff --git a/Examples/19namedrange.php b/Examples/19namedrange.php
new file mode 100644
index 0000000..7876ea5
--- /dev/null
+++ b/Examples/19namedrange.php
@@ -0,0 +1,129 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:')
+ ->setCellValue('A2', 'Lastname:')
+ ->setCellValue('A3', 'Fullname:')
+ ->setCellValue('B1', 'Maarten')
+ ->setCellValue('B2', 'Balliauw')
+ ->setCellValue('B3', '=B1 & " " & B2');
+
+// Define named ranges
+echo date('H:i:s') , " Define named ranges" , EOL;
+$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1') );
+$objPHPExcel->addNamedRange( new PHPExcel_NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2') );
+
+// Rename named ranges
+echo date('H:i:s') , " Rename named ranges" , EOL;
+$objPHPExcel->getNamedRange('PersonName')->setName('PersonFN');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Person');
+
+
+// Create a new worksheet, after the default sheet
+echo date('H:i:s') , " Create new Worksheet object" , EOL;
+$objPHPExcel->createSheet();
+
+// Add some data to the second sheet, resembling some different data types
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(1);
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:')
+ ->setCellValue('A2', 'Lastname:')
+ ->setCellValue('A3', 'Fullname:')
+ ->setCellValue('B1', '=PersonFN')
+ ->setCellValue('B2', '=PersonLN')
+ ->setCellValue('B3', '=PersonFN & " " & PersonLN');
+
+// Resolve range
+echo date('H:i:s') , " Resolve range" , EOL;
+echo 'Cell B1 {=PersonFN}: ' , $objPHPExcel->getActiveSheet()->getCell('B1')->getCalculatedValue() , EOL;
+echo 'Cell B3 {=PersonFN & " " & PersonLN}: ' , $objPHPExcel->getActiveSheet()->getCell('B3')->getCalculatedValue() , EOL;
+echo 'Cell Person!B1: ' , $objPHPExcel->getActiveSheet()->getCell('Person!B1')->getCalculatedValue() , EOL;
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Person (cloned)');
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/20readexcel5.php b/Examples/20readexcel5.php
new file mode 100644
index 0000000..7625c7b
--- /dev/null
+++ b/Examples/20readexcel5.php
@@ -0,0 +1,79 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+if (!file_exists("14excel5.xls")) {
+ exit("Please run 14excel5.php first.\n");
+}
+
+echo date('H:i:s') , " Load workbook from Excel5 file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel = PHPExcel_IOFactory::load("14excel5.xls");
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo 'Call time to load Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done reading file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/21pdf.php b/Examples/21pdf.php
new file mode 100644
index 0000000..b26ddb8
--- /dev/null
+++ b/Examples/21pdf.php
@@ -0,0 +1,94 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+// Change these values to select the Rendering library that you wish to use
+// and its directory location on your server
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
+$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
+//$rendererLibrary = 'tcPDF5.9';
+//$rendererLibrary = 'mPDF5.4';
+$rendererLibrary = 'domPDF0.6.0beta3';
+$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
+
+
+echo date('H:i:s') , " Hide grid lines" , EOL;
+$objPHPExcel->getActiveSheet()->setShowGridLines(false);
+
+echo date('H:i:s') , " Set orientation to landscape" , EOL;
+$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
+
+
+echo date('H:i:s') , " Write to PDF format using {$rendererName}" , EOL;
+
+if (!PHPExcel_Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
+$objWriter->setSheetIndex(0);
+$objWriter->save(str_replace('.php', '_'.$rendererName.'.pdf', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo date('H:i:s') , " File written to " , str_replace('.php', '_'.$rendererName.'.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/22heavilyformatted.php b/Examples/22heavilyformatted.php
new file mode 100644
index 0000000..98c7d18
--- /dev/null
+++ b/Examples/22heavilyformatted.php
@@ -0,0 +1,116 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+
+$objPHPExcel->getActiveSheet()->getStyle('A1:T100')->applyFromArray(
+ array('fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_SOLID,
+ 'color' => array('argb' => 'FFCCFFCC')
+ ),
+ 'borders' => array(
+ 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
+ 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
+ )
+ )
+ );
+
+$objPHPExcel->getActiveSheet()->getStyle('C5:R95')->applyFromArray(
+ array('fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_SOLID,
+ 'color' => array('argb' => 'FFFFFF00')
+ ),
+ )
+ );
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/23sharedstyles.php b/Examples/23sharedstyles.php
new file mode 100644
index 0000000..22eadba
--- /dev/null
+++ b/Examples/23sharedstyles.php
@@ -0,0 +1,124 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0);
+
+$sharedStyle1 = new PHPExcel_Style();
+$sharedStyle2 = new PHPExcel_Style();
+
+$sharedStyle1->applyFromArray(
+ array('fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_SOLID,
+ 'color' => array('argb' => 'FFCCFFCC')
+ ),
+ 'borders' => array(
+ 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
+ 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
+ )
+ ));
+
+$sharedStyle2->applyFromArray(
+ array('fill' => array(
+ 'type' => PHPExcel_Style_Fill::FILL_SOLID,
+ 'color' => array('argb' => 'FFFFFF00')
+ ),
+ 'borders' => array(
+ 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN),
+ 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM)
+ )
+ ));
+
+$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A1:T100");
+$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, "C5:R95");
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/24readfilter.php b/Examples/24readfilter.php
new file mode 100644
index 0000000..000d180
--- /dev/null
+++ b/Examples/24readfilter.php
@@ -0,0 +1,77 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+// Check prerequisites
+if (!file_exists("06largescale.xlsx")) {
+ exit("Please run 06largescale.php first.\n");
+}
+
+class MyReadFilter implements PHPExcel_Reader_IReadFilter
+{
+ public function readCell($column, $row, $worksheetName = '') {
+ // Read title row and rows 20 - 30
+ if ($row == 1 || ($row >= 20 && $row <= 30)) {
+ return true;
+ }
+
+ return false;
+ }
+}
+
+
+echo date('H:i:s') , " Load from Excel2007 file" , EOL;
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objReader->setReadFilter( new MyReadFilter() );
+$objPHPExcel = $objReader->load("06largescale.xlsx");
+
+echo date('H:i:s') , " Remove unnecessary rows" , EOL;
+$objPHPExcel->getActiveSheet()->removeRow(2, 18);
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/25inmemoryimage.php b/Examples/25inmemoryimage.php
new file mode 100644
index 0000000..6c3b0b8
--- /dev/null
+++ b/Examples/25inmemoryimage.php
@@ -0,0 +1,89 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+// Generate an image
+echo date('H:i:s') , " Generate an image" , EOL;
+$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream');
+$textColor = imagecolorallocate($gdImage, 255, 255, 255);
+imagestring($gdImage, 1, 5, 5, 'Created with PHPExcel', $textColor);
+
+// Add a drawing to the worksheet
+echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
+$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
+$objDrawing->setName('Sample image');
+$objDrawing->setDescription('Sample image');
+$objDrawing->setImageResource($gdImage);
+$objDrawing->setRenderingFunction(PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG);
+$objDrawing->setMimeType(PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT);
+$objDrawing->setHeight(36);
+$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+echo date('H:i:s') , " Write to HTML format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
+$objWriter->save(str_replace('.php', '.html', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.html', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/26utf8.php b/Examples/26utf8.php
new file mode 100644
index 0000000..112c5c7
--- /dev/null
+++ b/Examples/26utf8.php
@@ -0,0 +1,122 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Change these values to select the PDF Rendering library that you wish to use
+// and its directory location on your server
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
+$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
+//$rendererLibrary = 'tcPDF5.9';
+//$rendererLibrary = 'mPDF5.4';
+$rendererLibrary = 'domPDF0.6.0beta3';
+$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
+
+
+// Read from Excel2007 (.xlsx) template
+echo date('H:i:s') , " Load Excel2007 template file" , EOL;
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objPHPExcel = $objReader->load("templates/26template.xlsx");
+
+/** at this point, we could do some manipulations with the template, but we skip this step */
+
+// Export to Excel2007 (.xlsx)
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Export to Excel5 (.xls)
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Export to HTML (.html)
+echo date('H:i:s') , " Write to HTML format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
+$objWriter->save(str_replace('.php', '.htm', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.htm', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Export to PDF (.pdf)
+echo date('H:i:s') , " Write to PDF format" , EOL;
+try {
+ if (!PHPExcel_Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ echo (
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure' .
+ EOL
+ );
+ } else {
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
+ $objWriter->save(str_replace('.php', '.pdf', __FILE__));
+ echo date('H:i:s') , " File written to " , str_replace('.php', '.pdf', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+ }
+} catch (Exception $e) {
+ echo date('H:i:s') , ' EXCEPTION: ', $e->getMessage() , EOL;
+}
+
+// Remove first two rows with field headers before exporting to CSV
+echo date('H:i:s') , " Removing first two heading rows for CSV export" , EOL;
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->removeRow(1, 2);
+
+// Export to CSV (.csv)
+echo date('H:i:s') , " Write to CSV format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
+$objWriter->save(str_replace('.php', '.csv', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Export to CSV with BOM (.csv)
+echo date('H:i:s') , " Write to CSV format (with BOM)" , EOL;
+$objWriter->setUseBOM(true);
+$objWriter->save(str_replace('.php', '-bom.csv', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '-bom.csv', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/27imagesexcel5.php b/Examples/27imagesexcel5.php
new file mode 100644
index 0000000..a4f6a9d
--- /dev/null
+++ b/Examples/27imagesexcel5.php
@@ -0,0 +1,64 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Read from Excel5 (.xls) template
+echo date('H:i:s') , " Load Excel2007 template file" , EOL;
+$objReader = PHPExcel_IOFactory::createReader('Excel5');
+$objPHPExcel = $objReader->load("templates/27template.xls");
+
+// Export to Excel2007 (.xlsx)
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Export to Excel5 (.xls)
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/28iterator.php b/Examples/28iterator.php
new file mode 100644
index 0000000..1ba9cbe
--- /dev/null
+++ b/Examples/28iterator.php
@@ -0,0 +1,82 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+echo date('H:i:s') , " Load from Excel2007 file" , EOL;
+$objReader = PHPExcel_IOFactory::createReader('Excel2007');
+$objPHPExcel = $objReader->load("./templates/28iterators.xlsx");
+
+echo date('H:i:s') , " Iterate worksheets by Row" , EOL;
+foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ echo 'Worksheet - ' , $worksheet->getTitle() , EOL;
+
+ foreach ($worksheet->getRowIterator() as $row) {
+ echo ' Row number - ' , $row->getRowIndex() , EOL;
+
+ $cellIterator = $row->getCellIterator();
+ $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
+ foreach ($cellIterator as $cell) {
+ if (!is_null($cell)) {
+ echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL;
+ }
+ }
+ }
+}
+
+
+echo date('H:i:s') , " Iterate worksheets by Column" , EOL;
+foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ echo 'Worksheet - ' , $worksheet->getTitle() , EOL;
+
+ foreach ($worksheet->getColumnIterator() as $column) {
+ echo ' Column index - ' , $column->getColumnIndex() , EOL;
+
+ $cellIterator = $column->getCellIterator();
+ $cellIterator->setIterateOnlyExistingCells(true); // Loop all cells, even if it is not set
+ foreach ($cellIterator as $cell) {
+ if (!is_null($cell)) {
+ echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL;
+ }
+ }
+ }
+}
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
diff --git a/Examples/29advancedvaluebinder.php b/Examples/29advancedvaluebinder.php
new file mode 100644
index 0000000..a172c6c
--- /dev/null
+++ b/Examples/29advancedvaluebinder.php
@@ -0,0 +1,183 @@
+');
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Set timezone
+echo date('H:i:s') , " Set timezone" , EOL;
+date_default_timezone_set('UTC');
+
+// Set value binder
+echo date('H:i:s') , " Set value binder" , EOL;
+PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+ ->setKeywords("office 2007 openxml php")
+ ->setCategory("Test result file");
+
+// Set default font
+echo date('H:i:s') , " Set default font" , EOL;
+$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('Arial');
+$objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(10);
+
+// Set column widths
+echo date('H:i:s') , " Set column widths" , EOL;
+$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setAutoSize(true);
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(14);
+
+// Add some data, resembling some different data types
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->getActiveSheet()->setCellValue('A1', 'String value:')
+ ->setCellValue('B1', 'Mark Baker');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Numeric value #1:')
+ ->setCellValue('B2', 12345);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Numeric value #2:')
+ ->setCellValue('B3', -12.345);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Numeric value #3:')
+ ->setCellValue('B4', .12345);
+
+$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Numeric value #4:')
+ ->setCellValue('B5', '12345');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Numeric value #5:')
+ ->setCellValue('B6', '1.2345');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A7', 'Numeric value #6:')
+ ->setCellValue('B7', '.12345');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8', 'Numeric value #7:')
+ ->setCellValue('B8', '1.234e-5');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A9', 'Numeric value #8:')
+ ->setCellValue('B9', '-1.234e+5');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A10', 'Boolean value:')
+ ->setCellValue('B10', 'TRUE');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A11', 'Percentage value #1:')
+ ->setCellValue('B11', '10%');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A12', 'Percentage value #2:')
+ ->setCellValue('B12', '12.5%');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A13', 'Fraction value #1:')
+ ->setCellValue('B13', '-1/2');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A14', 'Fraction value #2:')
+ ->setCellValue('B14', '3 1/2');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A15', 'Fraction value #3:')
+ ->setCellValue('B15', '-12 3/4');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A16', 'Fraction value #4:')
+ ->setCellValue('B16', '13/4');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A17', 'Currency value #1:')
+ ->setCellValue('B17', '$12345');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A18', 'Currency value #2:')
+ ->setCellValue('B18', '$12345.67');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A19', 'Currency value #3:')
+ ->setCellValue('B19', '$12,345.67');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A20', 'Date value #1:')
+ ->setCellValue('B20', '21 December 1983');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A21', 'Date value #2:')
+ ->setCellValue('B21', '19-Dec-1960');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A22', 'Date value #3:')
+ ->setCellValue('B22', '07/12/1982');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A23', 'Date value #4:')
+ ->setCellValue('B23', '24-11-1950');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A24', 'Date value #5:')
+ ->setCellValue('B24', '17-Mar');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A25', 'Time value #1:')
+ ->setCellValue('B25', '01:30');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A26', 'Time value #2:')
+ ->setCellValue('B26', '01:30:15');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A27', 'Date/Time value:')
+ ->setCellValue('B27', '19-Dec-1960 01:30');
+
+$objPHPExcel->getActiveSheet()->setCellValue('A28', 'Formula:')
+ ->setCellValue('B28', '=SUM(B2:B9)');
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Advanced value binder');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+// Save Excel5 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/30template.php b/Examples/30template.php
new file mode 100644
index 0000000..db9cbb4
--- /dev/null
+++ b/Examples/30template.php
@@ -0,0 +1,91 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+
+echo date('H:i:s') , " Load from Excel5 template" , EOL;
+$objReader = PHPExcel_IOFactory::createReader('Excel5');
+$objPHPExcel = $objReader->load("templates/30template.xls");
+
+
+
+
+echo date('H:i:s') , " Add new data to the template" , EOL;
+$data = array(array('title' => 'Excel for dummies',
+ 'price' => 17.99,
+ 'quantity' => 2
+ ),
+ array('title' => 'PHP for dummies',
+ 'price' => 15.99,
+ 'quantity' => 1
+ ),
+ array('title' => 'Inside OOP',
+ 'price' => 12.95,
+ 'quantity' => 1
+ )
+ );
+
+$objPHPExcel->getActiveSheet()->setCellValue('D1', PHPExcel_Shared_Date::PHPToExcel(time()));
+
+$baseRow = 5;
+foreach($data as $r => $dataRow) {
+ $row = $baseRow + $r;
+ $objPHPExcel->getActiveSheet()->insertNewRowBefore($row,1);
+
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$row, $r+1)
+ ->setCellValue('B'.$row, $dataRow['title'])
+ ->setCellValue('C'.$row, $dataRow['price'])
+ ->setCellValue('D'.$row, $dataRow['quantity'])
+ ->setCellValue('E'.$row, '=C'.$row.'*D'.$row);
+}
+$objPHPExcel->getActiveSheet()->removeRow($baseRow-1,1);
+
+
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/31docproperties_write-xls.php b/Examples/31docproperties_write-xls.php
new file mode 100644
index 0000000..e9a5e87
--- /dev/null
+++ b/Examples/31docproperties_write-xls.php
@@ -0,0 +1,119 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$inputFileType = 'Excel5';
+$inputFileName = 'templates/31docproperties.xls';
+
+
+echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
+$objPHPExcel = $objPHPExcelReader->load($inputFileName);
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Adjust properties" , EOL;
+$objPHPExcel->getProperties()->setTitle("Office 95 XLS Test Document")
+ ->setSubject("Office 95 XLS Test Document")
+ ->setDescription("Test XLS document, generated using PHPExcel")
+ ->setKeywords("office 95 biff php");
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL;
+
+
+echo EOL;
+// Reread File
+echo date('H:i:s') , " Reread Excel5 file" , EOL;
+$objPHPExcelRead = PHPExcel_IOFactory::load(str_replace('.php', '.xls', __FILE__));
+
+// Set properties
+echo date('H:i:s') , " Get properties" , EOL;
+
+echo 'Core Properties:' , EOL;
+echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL;
+echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' ,
+ date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL;
+echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL;
+echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' ,
+ date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL;
+echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL;
+echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL;
+echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL;
+echo ' Keywords: - ' , $objPHPExcel->getProperties()->getKeywords() , EOL;
+
+
+echo 'Extended (Application) Properties:' , EOL;
+echo ' Category - ' , $objPHPExcel->getProperties()->getCategory() , EOL;
+echo ' Company - ' , $objPHPExcel->getProperties()->getCompany() , EOL;
+echo ' Manager - ' , $objPHPExcel->getProperties()->getManager() , EOL;
+
+
+echo 'Custom Properties:' , EOL;
+$customProperties = $objPHPExcel->getProperties()->getCustomProperties();
+foreach($customProperties as $customProperty) {
+ $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
+ $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
+ echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
+ if ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE) {
+ echo date('d-M-Y H:i:s',$propertyValue) , EOL;
+ } elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
+ echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
+ } else {
+ echo $propertyValue , EOL;
+ }
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL;
diff --git a/Examples/31docproperties_write.php b/Examples/31docproperties_write.php
new file mode 100644
index 0000000..4cd4779
--- /dev/null
+++ b/Examples/31docproperties_write.php
@@ -0,0 +1,119 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$inputFileType = 'Excel2007';
+$inputFileName = 'templates/31docproperties.xlsx';
+
+
+echo date('H:i:s') , " Load Tests from $inputFileType file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcelReader = PHPExcel_IOFactory::createReader($inputFileType);
+$objPHPExcel = $objPHPExcelReader->load($inputFileName);
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Adjust properties" , EOL;
+$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document")
+ ->setSubject("Office 2007 XLSX Test Document")
+ ->setDescription("Test XLSX document, generated using PHPExcel")
+ ->setKeywords("office 2007 openxml php");
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL;
+
+
+echo EOL;
+// Reread File
+echo date('H:i:s') , " Reread Excel2007 file" , EOL;
+$objPHPExcelRead = PHPExcel_IOFactory::load(str_replace('.php', '.xlsx', __FILE__));
+
+// Set properties
+echo date('H:i:s') , " Get properties" , EOL;
+
+echo 'Core Properties:' , EOL;
+echo ' Created by - ' , $objPHPExcel->getProperties()->getCreator() , EOL;
+echo ' Created on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getCreated()) , ' at ' ,
+ date('H:i:s',$objPHPExcel->getProperties()->getCreated()) , EOL;
+echo ' Last Modified by - ' , $objPHPExcel->getProperties()->getLastModifiedBy() , EOL;
+echo ' Last Modified on - ' , date('d-M-Y',$objPHPExcel->getProperties()->getModified()) , ' at ' ,
+ date('H:i:s',$objPHPExcel->getProperties()->getModified()) , EOL;
+echo ' Title - ' , $objPHPExcel->getProperties()->getTitle() , EOL;
+echo ' Subject - ' , $objPHPExcel->getProperties()->getSubject() , EOL;
+echo ' Description - ' , $objPHPExcel->getProperties()->getDescription() , EOL;
+echo ' Keywords: - ' , $objPHPExcel->getProperties()->getKeywords() , EOL;
+
+
+echo 'Extended (Application) Properties:' , EOL;
+echo ' Category - ' , $objPHPExcel->getProperties()->getCategory() , EOL;
+echo ' Company - ' , $objPHPExcel->getProperties()->getCompany() , EOL;
+echo ' Manager - ' , $objPHPExcel->getProperties()->getManager() , EOL;
+
+
+echo 'Custom Properties:' , EOL;
+$customProperties = $objPHPExcel->getProperties()->getCustomProperties();
+foreach($customProperties as $customProperty) {
+ $propertyValue = $objPHPExcel->getProperties()->getCustomPropertyValue($customProperty);
+ $propertyType = $objPHPExcel->getProperties()->getCustomPropertyType($customProperty);
+ echo ' ' , $customProperty , ' - (' , $propertyType , ') - ';
+ if ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE) {
+ echo date('d-M-Y H:i:s',$propertyValue) , EOL;
+ } elseif ($propertyType == PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN) {
+ echo (($propertyValue) ? 'TRUE' : 'FALSE') , EOL;
+ } else {
+ echo $propertyValue , EOL;
+ }
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) . " MB" , EOL;
diff --git a/Examples/32chartreadwrite.php b/Examples/32chartreadwrite.php
new file mode 100644
index 0000000..5aeedca
--- /dev/null
+++ b/Examples/32chartreadwrite.php
@@ -0,0 +1,131 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** Include path **/
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
+
+/** PHPExcel_IOFactory */
+include 'PHPExcel/IOFactory.php';
+
+$inputFileType = 'Excel2007';
+$inputFileNames = 'templates/32readwrite*[0-9].xlsx';
+
+if ((isset($argc)) && ($argc > 1)) {
+ $inputFileNames = array();
+ for($i = 1; $i < $argc; ++$i) {
+ $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
+ }
+} else {
+ $inputFileNames = glob($inputFileNames);
+}
+foreach($inputFileNames as $inputFileName) {
+ $inputFileNameShort = basename($inputFileName);
+
+ if (!file_exists($inputFileName)) {
+ echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
+ continue;
+ }
+
+ echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
+
+ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+ $objReader->setIncludeCharts(TRUE);
+ $objPHPExcel = $objReader->load($inputFileName);
+
+
+ echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
+ foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ $sheetName = $worksheet->getTitle();
+ echo 'Worksheet: ' , $sheetName , EOL;
+
+ $chartNames = $worksheet->getChartNames();
+ if(empty($chartNames)) {
+ echo ' There are no charts in this worksheet' , EOL;
+ } else {
+ natsort($chartNames);
+ foreach($chartNames as $i => $chartName) {
+ $chart = $worksheet->getChartByName($chartName);
+ if (!is_null($chart->getTitle())) {
+ $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
+ } else {
+ $caption = 'Untitled';
+ }
+ echo ' ' , $chartName , ' - ' , $caption , EOL;
+ echo str_repeat(' ',strlen($chartName)+3);
+ $groupCount = $chart->getPlotArea()->getPlotGroupCount();
+ if ($groupCount == 1) {
+ $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
+ echo ' ' , $chartType , EOL;
+ } else {
+ $chartTypes = array();
+ for($i = 0; $i < $groupCount; ++$i) {
+ $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
+ }
+ $chartTypes = array_unique($chartTypes);
+ if (count($chartTypes) == 1) {
+ $chartType = 'Multiple Plot ' . array_pop($chartTypes);
+ echo ' ' , $chartType , EOL;
+ } elseif (count($chartTypes) == 0) {
+ echo ' *** Type not yet implemented' , EOL;
+ } else {
+ echo ' Combination Chart' , EOL;
+ }
+ }
+ }
+ }
+ }
+
+
+ $outputFileName = basename($inputFileName);
+
+ echo date('H:i:s') , " Write Tests to Excel2007 file " , EOL;
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+ $objWriter->setIncludeCharts(TRUE);
+ $objWriter->save($outputFileName);
+ echo date('H:i:s') , " File written to " , $outputFileName , EOL;
+
+ $objPHPExcel->disconnectWorksheets();
+ unset($objPHPExcel);
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-area.php b/Examples/33chartcreate-area.php
new file mode 100644
index 0000000..fac8ce9
--- /dev/null
+++ b/Examples/33chartcreate-area.php
@@ -0,0 +1,142 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test %age-Stacked Area Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-bar-stacked.php b/Examples/33chartcreate-bar-stacked.php
new file mode 100644
index 0000000..af9493f
--- /dev/null
+++ b/Examples/33chartcreate-bar-stacked.php
@@ -0,0 +1,145 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+// Set additional dataseries parameters
+// Make it a horizontal bar rather than a vertical column graph
+$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-bar.php b/Examples/33chartcreate-bar.php
new file mode 100644
index 0000000..653675d
--- /dev/null
+++ b/Examples/33chartcreate-bar.php
@@ -0,0 +1,145 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+// Set additional dataseries parameters
+// Make it a horizontal bar rather than a vertical column graph
+$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_BAR);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Bar Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-column-2.php b/Examples/33chartcreate-column-2.php
new file mode 100644
index 0000000..0ade332
--- /dev/null
+++ b/Examples/33chartcreate-column-2.php
@@ -0,0 +1,154 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', '', 'Budget', 'Forecast', 'Actual'),
+ array('2010', 'Q1', 47, 44, 43 ),
+ array('', 'Q2', 56, 53, 50 ),
+ array('', 'Q3', 52, 46, 45 ),
+ array('', 'Q4', 45, 40, 40 ),
+ array('2011', 'Q1', 51, 42, 46 ),
+ array('', 'Q2', 53, 58, 56 ),
+ array('', 'Q3', 64, 66, 69 ),
+ array('', 'Q4', 54, 55, 56 ),
+ array('2012', 'Q1', 49, 52, 58 ),
+ array('', 'Q2', 68, 73, 86 ),
+ array('', 'Q3', 72, 78, 0 ),
+ array('', 'Q4', 50, 60, 0 ),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 'Budget'
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 'Forecast'
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), // 'Actual'
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$B$13', NULL, 12), // Q1 to Q4 for 2010 to 2012
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E$2:$E$13', NULL, 12),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+// Set additional dataseries parameters
+// Make it a vertical column rather than a horizontal bar graph
+$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_BOTTOM, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Grouped Column Chart');
+$xAxisLabel = new PHPExcel_Chart_Title('Financial Period');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ $xAxisLabel, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('G2');
+$chart->setBottomRightPosition('P20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-column.php b/Examples/33chartcreate-column.php
new file mode 100644
index 0000000..67f4178
--- /dev/null
+++ b/Examples/33chartcreate-column.php
@@ -0,0 +1,145 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+// Set additional dataseries parameters
+// Make it a vertical column rather than a horizontal bar graph
+$series->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Column Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-composite.php b/Examples/33chartcreate-composite.php
new file mode 100644
index 0000000..be7ad94
--- /dev/null
+++ b/Examples/33chartcreate-composite.php
@@ -0,0 +1,203 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'),
+ array('Jan', 78, 52, 61),
+ array('Feb', 64, 54, 62),
+ array('Mar', 62, 57, 63),
+ array('Apr', 21, 62, 59),
+ array('May', 11, 75, 60),
+ array('Jun', 1, 75, 57),
+ array('Jul', 1, 79, 56),
+ array('Aug', 1, 79, 59),
+ array('Sep', 10, 75, 60),
+ array('Oct', 40, 68, 63),
+ array('Nov', 69, 62, 64),
+ array('Dec', 89, 57, 66),
+ )
+);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels1 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // Temperature
+);
+$dataSeriesLabels2 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // Rainfall
+);
+$dataSeriesLabels3 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // Humidity
+);
+
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
+);
+
+
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues1 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$13', NULL, 12),
+);
+
+// Build the dataseries
+$series1 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_CLUSTERED, // plotGrouping
+ range(0, count($dataSeriesValues1)-1), // plotOrder
+ $dataSeriesLabels1, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues1 // plotValues
+);
+// Set additional dataseries parameters
+// Make it a vertical column rather than a horizontal bar graph
+$series1->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
+
+
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues2 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
+);
+
+// Build the dataseries
+$series2 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
+ range(0, count($dataSeriesValues2)-1), // plotOrder
+ $dataSeriesLabels2, // plotLabel
+ NULL, // plotCategory
+ $dataSeriesValues2 // plotValues
+);
+
+
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues3 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
+);
+
+// Build the dataseries
+$series3 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
+ range(0, count($dataSeriesValues2)-1), // plotOrder
+ $dataSeriesLabels3, // plotLabel
+ NULL, // plotCategory
+ $dataSeriesValues3 // plotValues
+);
+
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series1, $series2, $series3));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Average Weather Chart for Crete');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ NULL // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('F2');
+$chart->setBottomRightPosition('O16');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-line.php b/Examples/33chartcreate-line.php
new file mode 100644
index 0000000..90c2e60
--- /dev/null
+++ b/Examples/33chartcreate-line.php
@@ -0,0 +1,142 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_LINECHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STACKED, // plotGrouping
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Stacked Line Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-multiple-charts.php b/Examples/33chartcreate-multiple-charts.php
new file mode 100644
index 0000000..0e5ac60
--- /dev/null
+++ b/Examples/33chartcreate-multiple-charts.php
@@ -0,0 +1,220 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels1 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues1 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues1 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series1 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_AREACHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping
+ range(0, count($dataSeriesValues1)-1), // plotOrder
+ $dataSeriesLabels1, // plotLabel
+ $xAxisTickValues1, // plotCategory
+ $dataSeriesValues1 // plotValues
+);
+
+// Set the series in the plot area
+$plotArea1 = new PHPExcel_Chart_PlotArea(NULL, array($series1));
+// Set the chart legend
+$legend1 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
+
+$title1 = new PHPExcel_Chart_Title('Test %age-Stacked Area Chart');
+$yAxisLabel1 = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart1 = new PHPExcel_Chart(
+ 'chart1', // name
+ $title1, // title
+ $legend1, // legend
+ $plotArea1, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel1 // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart1->setTopLeftPosition('A7');
+$chart1->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart1);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels2 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues2 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues2 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series2 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_BARCHART, // plotType
+ PHPExcel_Chart_DataSeries::GROUPING_STANDARD, // plotGrouping
+ range(0, count($dataSeriesValues2)-1), // plotOrder
+ $dataSeriesLabels2, // plotLabel
+ $xAxisTickValues2, // plotCategory
+ $dataSeriesValues2 // plotValues
+);
+// Set additional dataseries parameters
+// Make it a vertical column rather than a horizontal bar graph
+$series2->setPlotDirection(PHPExcel_Chart_DataSeries::DIRECTION_COL);
+
+// Set the series in the plot area
+$plotArea2 = new PHPExcel_Chart_PlotArea(NULL, array($series2));
+// Set the chart legend
+$legend2 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title2 = new PHPExcel_Chart_Title('Test Column Chart');
+$yAxisLabel2 = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart2 = new PHPExcel_Chart(
+ 'chart2', // name
+ $title2, // title
+ $legend2, // legend
+ $plotArea2, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel2 // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart2->setTopLeftPosition('I7');
+$chart2->setBottomRightPosition('P20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart2);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-pie.php b/Examples/33chartcreate-pie.php
new file mode 100644
index 0000000..78b6293
--- /dev/null
+++ b/Examples/33chartcreate-pie.php
@@ -0,0 +1,215 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels1 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues1 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues1 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+);
+
+// Build the dataseries
+$series1 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_PIECHART, // plotType
+ NULL, // plotGrouping (Pie charts don't have any grouping)
+ range(0, count($dataSeriesValues1)-1), // plotOrder
+ $dataSeriesLabels1, // plotLabel
+ $xAxisTickValues1, // plotCategory
+ $dataSeriesValues1 // plotValues
+);
+
+// Set up a layout object for the Pie chart
+$layout1 = new PHPExcel_Chart_Layout();
+$layout1->setShowVal(TRUE);
+$layout1->setShowPercent(TRUE);
+
+// Set the series in the plot area
+$plotArea1 = new PHPExcel_Chart_PlotArea($layout1, array($series1));
+// Set the chart legend
+$legend1 = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title1 = new PHPExcel_Chart_Title('Test Pie Chart');
+
+
+// Create the chart
+$chart1 = new PHPExcel_Chart(
+ 'chart1', // name
+ $title1, // title
+ $legend1, // legend
+ $plotArea1, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ NULL // yAxisLabel - Pie charts don't have a Y-Axis
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart1->setTopLeftPosition('A7');
+$chart1->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart1);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels2 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues2 = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues2 = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+);
+
+// Build the dataseries
+$series2 = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_DONUTCHART, // plotType
+ NULL, // plotGrouping (Donut charts don't have any grouping)
+ range(0, count($dataSeriesValues2)-1), // plotOrder
+ $dataSeriesLabels2, // plotLabel
+ $xAxisTickValues2, // plotCategory
+ $dataSeriesValues2 // plotValues
+);
+
+// Set up a layout object for the Pie chart
+$layout2 = new PHPExcel_Chart_Layout();
+$layout2->setShowVal(TRUE);
+$layout2->setShowCatName(TRUE);
+
+// Set the series in the plot area
+$plotArea2 = new PHPExcel_Chart_PlotArea($layout2, array($series2));
+
+$title2 = new PHPExcel_Chart_Title('Test Donut Chart');
+
+
+// Create the chart
+$chart2 = new PHPExcel_Chart(
+ 'chart2', // name
+ $title2, // title
+ NULL, // legend
+ $plotArea2, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ NULL // yAxisLabel - Like Pie charts, Donut charts don't have a Y-Axis
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart2->setTopLeftPosition('I7');
+$chart2->setBottomRightPosition('P20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart2);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-radar.php b/Examples/33chartcreate-radar.php
new file mode 100644
index 0000000..7d1047a
--- /dev/null
+++ b/Examples/33chartcreate-radar.php
@@ -0,0 +1,155 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Jan', 47, 45, 71),
+ array('Feb', 56, 73, 86),
+ array('Mar', 52, 61, 69),
+ array('Apr', 40, 52, 60),
+ array('May', 42, 55, 71),
+ array('Jun', 58, 63, 76),
+ array('Jul', 53, 61, 89),
+ array('Aug', 46, 69, 85),
+ array('Sep', 62, 75, 81),
+ array('Oct', 51, 70, 96),
+ array('Nov', 55, 66, 89),
+ array('Dec', 68, 62, 0),
+ )
+);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$13', NULL, 12), // Jan to Dec
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$13', NULL, 12),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$13', NULL, 12),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_RADARCHART, // plotType
+ NULL, // plotGrouping (Radar charts don't have any grouping)
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues, // plotValues
+ NULL, // plotDirection
+ NULL, // smooth line
+ PHPExcel_Chart_DataSeries::STYLE_MARKER // plotStyle
+);
+
+// Set up a layout object for the Pie chart
+$layout = new PHPExcel_Chart_Layout();
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea($layout, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Radar Chart');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ NULL // yAxisLabel - Radar charts don't have a Y-Axis
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('F2');
+$chart->setBottomRightPosition('M15');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-scatter.php b/Examples/33chartcreate-scatter.php
new file mode 100644
index 0000000..a5fab82
--- /dev/null
+++ b/Examples/33chartcreate-scatter.php
@@ -0,0 +1,139 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('', 2010, 2011, 2012),
+ array('Q1', 12, 15, 21),
+ array('Q2', 56, 73, 86),
+ array('Q3', 52, 61, 69),
+ array('Q4', 30, 32, 0),
+ )
+);
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), // 2010
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), // 2011
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), // 2012
+);
+// Set the X-Axis Labels
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$5', NULL, 4), // Q1 to Q4
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$5', NULL, 4),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$5', NULL, 4),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_SCATTERCHART, // plotType
+ NULL, // plotGrouping (Scatter charts don't have any grouping)
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues, // plotValues
+ NULL, // plotDirection
+ NULL, // smooth line
+ PHPExcel_Chart_DataSeries::STYLE_LINEMARKER // plotStyle
+);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_TOPRIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Scatter Chart');
+$yAxisLabel = new PHPExcel_Chart_Title('Value ($k)');
+
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'chart1', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ NULL, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/33chartcreate-stock.php b/Examples/33chartcreate-stock.php
new file mode 100644
index 0000000..465107b
--- /dev/null
+++ b/Examples/33chartcreate-stock.php
@@ -0,0 +1,151 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+$objPHPExcel = new PHPExcel();
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array('Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold' ),
+ array(10, 10, 5, 0, 50 ),
+ array(30, 20, 10, 0, 50 ),
+ array(20, 30, 15, 0, 50 ),
+ array(40, 10, 0, 0, 50 ),
+ array(100, 40, 5, 0, 50 ),
+ ), null, 'A1', true
+);
+$objWorksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
+
+
+// Set the Labels for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesLabels = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$B$1', NULL, 1), //Max / Open
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$C$1', NULL, 1), //Min / Close
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$D$1', NULL, 1), //Min Threshold / Min
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$E$1', NULL, 1), //Max Threshold / Max
+);
+// Set the X-Axis Labels
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$xAxisTickValues = array(
+ new PHPExcel_Chart_DataSeriesValues('String', 'Worksheet!$A$2:$A$6', NULL, 5), // Counts
+);
+// Set the Data values for each data series we want to plot
+// Datatype
+// Cell reference for data
+// Format Code
+// Number of datapoints in series
+// Data values
+// Data Marker
+$dataSeriesValues = array(
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$B$2:$B$6', NULL, 5),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$C$2:$C$6', NULL, 5),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$D$2:$D$6', NULL, 5),
+ new PHPExcel_Chart_DataSeriesValues('Number', 'Worksheet!$E$2:$E$6', NULL, 5),
+);
+
+// Build the dataseries
+$series = new PHPExcel_Chart_DataSeries(
+ PHPExcel_Chart_DataSeries::TYPE_STOCKCHART, // plotType
+ null, // plotGrouping - if we set this to not null, then xlsx throws error
+ range(0, count($dataSeriesValues)-1), // plotOrder
+ $dataSeriesLabels, // plotLabel
+ $xAxisTickValues, // plotCategory
+ $dataSeriesValues // plotValues
+);
+
+// Set the series in the plot area
+$plotArea = new PHPExcel_Chart_PlotArea(NULL, array($series));
+// Set the chart legend
+$legend = new PHPExcel_Chart_Legend(PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
+
+$title = new PHPExcel_Chart_Title('Test Stock Chart');
+$xAxisLabel = new PHPExcel_Chart_Title('Counts');
+$yAxisLabel = new PHPExcel_Chart_Title('Values');
+
+// Create the chart
+$chart = new PHPExcel_Chart(
+ 'stock-chart', // name
+ $title, // title
+ $legend, // legend
+ $plotArea, // plotArea
+ true, // plotVisibleOnly
+ 0, // displayBlanksAs
+ $xAxisLabel, // xAxisLabel
+ $yAxisLabel // yAxisLabel
+);
+
+// Set the position where the chart should appear in the worksheet
+$chart->setTopLeftPosition('A7');
+$chart->setBottomRightPosition('H20');
+
+// Add the chart to the worksheet
+$objWorksheet->addChart($chart);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$filename = str_replace('.php', '.xlsx', __FILE__);
+if(file_exists($filename)) {
+ unlink($filename);
+}
+$objWriter->save($filename);
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/34chartupdate.php b/Examples/34chartupdate.php
new file mode 100644
index 0000000..f4b36c6
--- /dev/null
+++ b/Examples/34chartupdate.php
@@ -0,0 +1,78 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+if (!file_exists("33chartcreate-bar.xlsx")) {
+ exit("Please run 33chartcreate-bar.php first." . EOL);
+}
+
+echo date('H:i:s') , " Load from Excel2007 file" , EOL;
+$objReader = PHPExcel_IOFactory::createReader("Excel2007");
+$objReader->setIncludeCharts(TRUE);
+$objPHPExcel = $objReader->load("33chartcreate-bar.xlsx");
+
+
+echo date('H:i:s') , " Update cell data values that are displayed in the chart" , EOL;
+$objWorksheet = $objPHPExcel->getActiveSheet();
+$objWorksheet->fromArray(
+ array(
+ array(50-12, 50-15, 50-21),
+ array(50-56, 50-73, 50-86),
+ array(50-52, 50-61, 50-69),
+ array(50-30, 50-32, 50),
+ ),
+ NULL,
+ 'B2'
+);
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->setIncludeCharts(TRUE);
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/35chartrender.php b/Examples/35chartrender.php
new file mode 100644
index 0000000..62719e5
--- /dev/null
+++ b/Examples/35chartrender.php
@@ -0,0 +1,134 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** Include path **/
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
+
+/** PHPExcel_IOFactory */
+include 'PHPExcel/IOFactory.php';
+
+
+// Change these values to select the Rendering library that you wish to use
+// and its directory location on your server
+$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
+$rendererLibrary = 'jpgraph3.5.0b1/src/';
+$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
+
+
+if (!PHPExcel_Settings::setChartRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+$inputFileType = 'Excel2007';
+$inputFileNames = 'templates/32readwrite*[0-9].xlsx';
+
+ if ((isset($argc)) && ($argc > 1)) {
+ $inputFileNames = array();
+ for($i = 1; $i < $argc; ++$i) {
+ $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
+ }
+} else {
+ $inputFileNames = glob($inputFileNames);
+}
+foreach($inputFileNames as $inputFileName) {
+ $inputFileNameShort = basename($inputFileName);
+
+ if (!file_exists($inputFileName)) {
+ echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
+ continue;
+ }
+
+ echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
+
+ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+ $objReader->setIncludeCharts(TRUE);
+ $objPHPExcel = $objReader->load($inputFileName);
+
+
+ echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
+ foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ $sheetName = $worksheet->getTitle();
+ echo 'Worksheet: ' , $sheetName , EOL;
+
+ $chartNames = $worksheet->getChartNames();
+ if(empty($chartNames)) {
+ echo ' There are no charts in this worksheet' , EOL;
+ } else {
+ natsort($chartNames);
+ foreach($chartNames as $i => $chartName) {
+ $chart = $worksheet->getChartByName($chartName);
+ if (!is_null($chart->getTitle())) {
+ $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
+ } else {
+ $caption = 'Untitled';
+ }
+ echo ' ' , $chartName , ' - ' , $caption , EOL;
+ echo str_repeat(' ',strlen($chartName)+3);
+
+ $jpegFile = '35'.str_replace('.xlsx', '.jpg', substr($inputFileNameShort,2));
+ if (file_exists($jpegFile)) {
+ unlink($jpegFile);
+ }
+ try {
+ $chart->render($jpegFile);
+ } catch (Exception $e) {
+ echo 'Error rendering chart: ',$e->getMessage();
+ }
+ }
+ }
+ }
+
+
+ $objPHPExcel->disconnectWorksheets();
+ unset($objPHPExcel);
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done rendering charts as images" , EOL;
+echo 'Image files have been created in ' , getcwd() , EOL;
diff --git a/Examples/36chartreadwriteHTML.php b/Examples/36chartreadwriteHTML.php
new file mode 100644
index 0000000..7fc26fd
--- /dev/null
+++ b/Examples/36chartreadwriteHTML.php
@@ -0,0 +1,151 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** Include path **/
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
+
+/** PHPExcel_IOFactory */
+include 'PHPExcel/IOFactory.php';
+
+
+// Change these values to select the Rendering library that you wish to use
+// and its directory location on your server
+$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
+$rendererLibrary = 'jpgraph3.5.0b1/src/';
+$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
+
+
+if (!PHPExcel_Settings::setChartRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+$inputFileType = 'Excel2007';
+$inputFileNames = 'templates/36write*.xlsx';
+
+if ((isset($argc)) && ($argc > 1)) {
+ $inputFileNames = array();
+ for($i = 1; $i < $argc; ++$i) {
+ $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
+ }
+} else {
+ $inputFileNames = glob($inputFileNames);
+}
+foreach($inputFileNames as $inputFileName) {
+ $inputFileNameShort = basename($inputFileName);
+
+ if (!file_exists($inputFileName)) {
+ echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
+ continue;
+ }
+
+ echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
+
+ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+ $objReader->setIncludeCharts(TRUE);
+ $objPHPExcel = $objReader->load($inputFileName);
+
+
+ echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
+ foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ $sheetName = $worksheet->getTitle();
+ echo 'Worksheet: ' , $sheetName , EOL;
+
+ $chartNames = $worksheet->getChartNames();
+ if(empty($chartNames)) {
+ echo ' There are no charts in this worksheet' , EOL;
+ } else {
+ natsort($chartNames);
+ foreach($chartNames as $i => $chartName) {
+ $chart = $worksheet->getChartByName($chartName);
+ if (!is_null($chart->getTitle())) {
+ $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
+ } else {
+ $caption = 'Untitled';
+ }
+ echo ' ' , $chartName , ' - ' , $caption , EOL;
+ echo str_repeat(' ',strlen($chartName)+3);
+ $groupCount = $chart->getPlotArea()->getPlotGroupCount();
+ if ($groupCount == 1) {
+ $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
+ echo ' ' , $chartType , EOL;
+ } else {
+ $chartTypes = array();
+ for($i = 0; $i < $groupCount; ++$i) {
+ $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
+ }
+ $chartTypes = array_unique($chartTypes);
+ if (count($chartTypes) == 1) {
+ $chartType = 'Multiple Plot ' . array_pop($chartTypes);
+ echo ' ' , $chartType , EOL;
+ } elseif (count($chartTypes) == 0) {
+ echo ' *** Type not yet implemented' , EOL;
+ } else {
+ echo ' Combination Chart' , EOL;
+ }
+ }
+ }
+ }
+ }
+
+
+ $outputFileName = str_replace('.xlsx', '.html', basename($inputFileName));
+
+ echo date('H:i:s') , " Write Tests to HTML file " , EOL;
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
+ $objWriter->setIncludeCharts(TRUE);
+ $objWriter->save($outputFileName);
+ echo date('H:i:s') , " File written to " , $outputFileName , EOL;
+
+ $objPHPExcel->disconnectWorksheets();
+ unset($objPHPExcel);
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/36chartreadwritePDF.php b/Examples/36chartreadwritePDF.php
new file mode 100644
index 0000000..24d1c85
--- /dev/null
+++ b/Examples/36chartreadwritePDF.php
@@ -0,0 +1,174 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/**
+ * PHPExcel
+ *
+ * Copyright (c) 2006 - 2015 PHPExcel
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * @category PHPExcel
+ * @package PHPExcel
+ * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @version ##VERSION##, ##DATE##
+ */
+
+/** Include path **/
+set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../Classes/');
+
+/** PHPExcel_IOFactory */
+include 'PHPExcel/IOFactory.php';
+
+
+// Change these values to select the Rendering library that you wish to use
+// for PDF files, and its directory location on your server
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_TCPDF;
+$rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
+//$rendererName = PHPExcel_Settings::PDF_RENDERER_DOMPDF;
+//$rendererLibrary = 'tcPDF5.9';
+$rendererLibrary = 'mPDF5.4';
+//$rendererLibrary = 'domPDF0.6.0beta3';
+$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
+
+
+if (!PHPExcel_Settings::setPdfRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+// Change these values to select the Rendering library that you wish to use
+// for Chart images, and its directory location on your server
+$rendererName = PHPExcel_Settings::CHART_RENDERER_JPGRAPH;
+$rendererLibrary = 'jpgraph3.5.0b1/src/';
+$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary;
+
+
+if (!PHPExcel_Settings::setChartRenderer(
+ $rendererName,
+ $rendererLibraryPath
+ )) {
+ die(
+ 'NOTICE: Please set the $rendererName and $rendererLibraryPath values' .
+ EOL .
+ 'at the top of this script as appropriate for your directory structure'
+ );
+}
+
+
+$inputFileType = 'Excel2007';
+$inputFileNames = 'templates/36write*.xlsx';
+
+if ((isset($argc)) && ($argc > 1)) {
+ $inputFileNames = array();
+ for($i = 1; $i < $argc; ++$i) {
+ $inputFileNames[] = dirname(__FILE__) . '/templates/' . $argv[$i];
+ }
+} else {
+ $inputFileNames = glob($inputFileNames);
+}
+foreach($inputFileNames as $inputFileName) {
+ $inputFileNameShort = basename($inputFileName);
+
+ if (!file_exists($inputFileName)) {
+ echo date('H:i:s') , " File " , $inputFileNameShort , ' does not exist' , EOL;
+ continue;
+ }
+
+ echo date('H:i:s') , " Load Test from $inputFileType file " , $inputFileNameShort , EOL;
+
+ $objReader = PHPExcel_IOFactory::createReader($inputFileType);
+ $objReader->setIncludeCharts(TRUE);
+ $objPHPExcel = $objReader->load($inputFileName);
+
+
+ echo date('H:i:s') , " Iterate worksheets looking at the charts" , EOL;
+ foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
+ $sheetName = $worksheet->getTitle();
+ echo 'Worksheet: ' , $sheetName , EOL;
+
+ $chartNames = $worksheet->getChartNames();
+ if(empty($chartNames)) {
+ echo ' There are no charts in this worksheet' , EOL;
+ } else {
+ natsort($chartNames);
+ foreach($chartNames as $i => $chartName) {
+ $chart = $worksheet->getChartByName($chartName);
+ if (!is_null($chart->getTitle())) {
+ $caption = '"' . implode(' ',$chart->getTitle()->getCaption()) . '"';
+ } else {
+ $caption = 'Untitled';
+ }
+ echo ' ' , $chartName , ' - ' , $caption , EOL;
+ echo str_repeat(' ',strlen($chartName)+3);
+ $groupCount = $chart->getPlotArea()->getPlotGroupCount();
+ if ($groupCount == 1) {
+ $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
+ echo ' ' , $chartType , EOL;
+ } else {
+ $chartTypes = array();
+ for($i = 0; $i < $groupCount; ++$i) {
+ $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
+ }
+ $chartTypes = array_unique($chartTypes);
+ if (count($chartTypes) == 1) {
+ $chartType = 'Multiple Plot ' . array_pop($chartTypes);
+ echo ' ' , $chartType , EOL;
+ } elseif (count($chartTypes) == 0) {
+ echo ' *** Type not yet implemented' , EOL;
+ } else {
+ echo ' Combination Chart' , EOL;
+ }
+ }
+ }
+ }
+ }
+
+
+ $outputFileName = str_replace('.xlsx', '.pdf', basename($inputFileName));
+
+ echo date('H:i:s') , " Write Tests to HTML file " , EOL;
+ $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
+ $objWriter->setIncludeCharts(TRUE);
+ $objWriter->save($outputFileName);
+ echo date('H:i:s') , " File written to " , $outputFileName , EOL;
+
+ $objPHPExcel->disconnectWorksheets();
+ unset($objPHPExcel);
+}
+
+// Echo memory peak usage
+echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/37page_layout_view.php b/Examples/37page_layout_view.php
new file mode 100644
index 0000000..810ca3d
--- /dev/null
+++ b/Examples/37page_layout_view.php
@@ -0,0 +1,83 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("PHPOffice")
+ ->setLastModifiedBy("PHPOffice")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("Office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!');
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+// Set the page layout view as page layout
+$objPHPExcel->getActiveSheet()->getSheetView()->setView(PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT);
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+// Save Excel5 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/38cloneWorksheet.php b/Examples/38cloneWorksheet.php
new file mode 100644
index 0000000..245f7da
--- /dev/null
+++ b/Examples/38cloneWorksheet.php
@@ -0,0 +1,118 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', 'Hello')
+ ->setCellValue('B2', 'world!')
+ ->setCellValue('C1', 'Hello')
+ ->setCellValue('D2', 'world!');
+
+// Miscellaneous glyphs, UTF-8
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A4', 'Miscellaneous glyphs')
+ ->setCellValue('A5', 'éà èùâêîôûëïüÿäöüç');
+
+
+$objPHPExcel->getActiveSheet()->setCellValue('A8',"Hello\nWorld");
+$objPHPExcel->getActiveSheet()->getRowDimension(8)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true);
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Clone worksheet
+echo date('H:i:s') , " Clone worksheet" , EOL;
+$clonedSheet = clone $objPHPExcel->getActiveSheet();
+$clonedSheet
+ ->setCellValue('A1', 'Goodbye')
+ ->setCellValue('A2', 'cruel')
+ ->setCellValue('C1', 'Goodbye')
+ ->setCellValue('C2', 'cruel');
+
+// Rename cloned worksheet
+echo date('H:i:s') , " Rename cloned worksheet" , EOL;
+$clonedSheet->setTitle('Simple Clone');
+$objPHPExcel->addSheet($clonedSheet);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/39dropdown.php b/Examples/39dropdown.php
new file mode 100644
index 0000000..c8dcff6
--- /dev/null
+++ b/Examples/39dropdown.php
@@ -0,0 +1,175 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()
+ ->setCreator("PHPOffice")
+ ->setLastModifiedBy("PHPOffice")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("Office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+function transpose($value) {
+ return array($value);
+}
+
+// Add some data
+$continentColumn = 'D';
+$column = 'F';
+
+// Set data for dropdowns
+foreach(glob('./data/continents/*') as $key => $filename) {
+ $continent = pathinfo($filename, PATHINFO_FILENAME);
+ echo "Loading $continent", EOL;
+ $continent = str_replace(' ','_',$continent);
+ $countries = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
+ $countryCount = count($countries);
+
+ // Transpose $countries from a row to a column array
+ $countries = array_map('transpose', $countries);
+ $objPHPExcel->getActiveSheet()
+ ->fromArray($countries, null, $column . '1');
+ $objPHPExcel->addNamedRange(
+ new PHPExcel_NamedRange(
+ $continent,
+ $objPHPExcel->getActiveSheet(), $column . '1:' . $column . $countryCount
+ )
+ );
+ $objPHPExcel->getActiveSheet()
+ ->getColumnDimension($column)
+ ->setVisible(false);
+
+ $objPHPExcel->getActiveSheet()
+ ->setCellValue($continentColumn . ($key+1), $continent);
+
+ ++$column;
+}
+
+// Hide the dropdown data
+$objPHPExcel->getActiveSheet()
+ ->getColumnDimension($continentColumn)
+ ->setVisible(false);
+
+$objPHPExcel->addNamedRange(
+ new PHPExcel_NamedRange(
+ 'Continents',
+ $objPHPExcel->getActiveSheet(), $continentColumn . '1:' . $continentColumn . ($key+1)
+ )
+);
+
+
+// Set selection cells
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A1', 'Continent:');
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('B1', 'Select continent');
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('B3', '=' . $column . 1);
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('B3', 'Select country');
+$objPHPExcel->getActiveSheet()
+ ->getStyle('A1:A3')
+ ->getFont()->setBold(true);
+
+// Set linked validators
+$objValidation = $objPHPExcel->getActiveSheet()
+ ->getCell('B1')
+ ->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
+ ->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
+ ->setAllowBlank(false)
+ ->setShowInputMessage(true)
+ ->setShowErrorMessage(true)
+ ->setShowDropDown(true)
+ ->setErrorTitle('Input error')
+ ->setError('Continent is not in the list.')
+ ->setPromptTitle('Pick from the list')
+ ->setPrompt('Please pick a continent from the drop-down list.')
+ ->setFormula1('=Continents');
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A3', 'Country:');
+$objPHPExcel->getActiveSheet()
+ ->getStyle('A3')
+ ->getFont()->setBold(true);
+
+$objValidation = $objPHPExcel->getActiveSheet()
+ ->getCell('B3')
+ ->getDataValidation();
+$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST )
+ ->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION )
+ ->setAllowBlank(false)
+ ->setShowInputMessage(true)
+ ->setShowErrorMessage(true)
+ ->setShowDropDown(true)
+ ->setErrorTitle('Input error')
+ ->setError('Country is not in the list.')
+ ->setPromptTitle('Pick from the list')
+ ->setPrompt('Please pick a country from the drop-down list.')
+ ->setFormula1('=INDIRECT($B$1)');
+
+
+$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(12);
+$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+// Save Excel 2007 file
+// This linked validation list method only seems to work for Excel2007, not for Excel5
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/40duplicateStyle.php b/Examples/40duplicateStyle.php
new file mode 100644
index 0000000..be31951
--- /dev/null
+++ b/Examples/40duplicateStyle.php
@@ -0,0 +1,51 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+$worksheet = $objPHPExcel->getActiveSheet();
+
+echo date('H:i:s') , " Create styles array" , EOL;
+$styles = array();
+for ($i = 0; $i < 10; $i++) {
+ $style = new PHPExcel_Style();
+ $style->getFont()->setSize($i + 4);
+ $styles[] = $style;
+}
+
+echo date('H:i:s') , " Add data (begin)" , EOL;
+$t = microtime(true);
+for ($col = 0; $col < 50; $col++) {
+ for ($row = 0; $row < 100; $row++) {
+ $str = ($row + $col);
+ $style = $styles[$row % 10];
+ $coord = PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1);
+ $worksheet->setCellValue($coord, $str);
+ $worksheet->duplicateStyle($style, $coord);
+ }
+}
+$d = microtime(true) - $t;
+echo date('H:i:s') , " Add data (end), time: " . round($d, 2) . " s", EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+
+
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/41password.php b/Examples/41password.php
new file mode 100644
index 0000000..15aea7b
--- /dev/null
+++ b/Examples/41password.php
@@ -0,0 +1,84 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+include "05featuredemo.inc.php";
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+// Set password against the spreadsheet file
+$objPHPExcel->getSecurity()->setLockWindows(true);
+$objPHPExcel->getSecurity()->setLockStructure(true);
+$objPHPExcel->getSecurity()->setWorkbookPassword('secret');
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/42richText.php b/Examples/42richText.php
new file mode 100644
index 0000000..32bc401
--- /dev/null
+++ b/Examples/42richText.php
@@ -0,0 +1,164 @@
+');
+
+/** Include PHPExcel */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
+
+
+// Create new PHPExcel object
+echo date('H:i:s') , " Create new PHPExcel object" , EOL;
+$objPHPExcel = new PHPExcel();
+
+// Set document properties
+echo date('H:i:s') , " Set document properties" , EOL;
+$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+ ->setLastModifiedBy("Maarten Balliauw")
+ ->setTitle("PHPExcel Test Document")
+ ->setSubject("PHPExcel Test Document")
+ ->setDescription("Test document for PHPExcel, generated using PHP classes.")
+ ->setKeywords("office PHPExcel php")
+ ->setCategory("Test result file");
+
+
+// Add some data
+echo date('H:i:s') , " Add some data" , EOL;
+
+$html1 = '
+My very first example of rich text
generated from html markup
+
+
+This block contains an italicized word;
+while this block uses an underline.
+
+
+
+I want to eat healthy food pizza.
+
+';
+
+$html2 = '
+
+ 100°C is a hot temperature
+
+
+
+ 10°F is cold
+
+
';
+
+$html3 = '23 equals 8';
+
+$html4 = 'H2SO4 is the chemical formula for Sulphuric acid';
+
+$html5 = 'bold, italic, bold+italic';
+
+
+$wizard = new PHPExcel_Helper_HTML;
+$richText = $wizard->toRichTextObject($html1);
+
+$objPHPExcel->setActiveSheetIndex(0)
+ ->setCellValue('A1', $richText);
+
+$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(48);
+$objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A1')
+ ->getAlignment()
+ ->setWrapText(true);
+
+$richText = $wizard->toRichTextObject($html2);
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A2', $richText);
+
+$objPHPExcel->getActiveSheet()->getRowDimension(1)->setRowHeight(-1);
+$objPHPExcel->getActiveSheet()->getStyle('A2')
+ ->getAlignment()
+ ->setWrapText(true);
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A3', $wizard->toRichTextObject($html3));
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A4', $wizard->toRichTextObject($html4));
+
+$objPHPExcel->getActiveSheet()
+ ->setCellValue('A5', $wizard->toRichTextObject($html5));
+
+
+// Rename worksheet
+echo date('H:i:s') , " Rename worksheet" , EOL;
+$objPHPExcel->getActiveSheet()->setTitle('Simple');
+
+
+// Set active sheet index to the first sheet, so Excel opens this as the first sheet
+$objPHPExcel->setActiveSheetIndex(0);
+
+
+// Save Excel 2007 file
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Save Excel 95 file
+echo date('H:i:s') , " Write to Excel5 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing files" , EOL;
+echo 'Files have been created in ' , getcwd() , EOL;
diff --git a/Examples/43mergeWorkbooks.php b/Examples/43mergeWorkbooks.php
new file mode 100644
index 0000000..465b60a
--- /dev/null
+++ b/Examples/43mergeWorkbooks.php
@@ -0,0 +1,91 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+echo date('H:i:s') , " Load MergeBook1 from Excel2007 file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel1 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook1.xlsx");
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Mergebook1 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+echo date('H:i:s') , " Load MergeBook2 from Excel2007 file" , EOL;
+$callStartTime = microtime(true);
+
+$objPHPExcel2 = PHPExcel_IOFactory::load(dirname(__FILE__) . "/templates/43mergeBook2.xlsx");
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Mergebook2 was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+foreach($objPHPExcel2->getSheetNames() as $sheetName) {
+ $sheet = $objPHPExcel2->getSheetByName($sheetName);
+ $sheet->setTitle($sheet->getTitle() . ' copied');
+ $objPHPExcel1->addExternalSheet($sheet);
+}
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , EOL;
+$callStartTime = microtime(true);
+
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel1, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
+echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , EOL;
+echo 'File has been created in ' , getcwd() , EOL;
diff --git a/Examples/44worksheetInfo.php b/Examples/44worksheetInfo.php
new file mode 100644
index 0000000..5aeefcb
--- /dev/null
+++ b/Examples/44worksheetInfo.php
@@ -0,0 +1,58 @@
+');
+
+date_default_timezone_set('Europe/London');
+
+/** Include PHPExcel_IOFactory */
+require_once dirname(__FILE__) . '/../Classes/PHPExcel/IOFactory.php';
+
+
+if (!file_exists("05featuredemo.xlsx")) {
+ exit("Please run 05featuredemo.php first." . EOL);
+}
+
+$inputFileName = "05featuredemo.xlsx";
+$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
+$objReader = PHPExcel_IOFactory::createReader($inputFileType);
+$sheetList = $objReader->listWorksheetNames($inputFileName);
+$sheetInfo = $objReader->listWorksheetInfo($inputFileName);
+
+echo 'File Type:', PHP_EOL;
+var_dump($inputFileType);
+
+echo 'Worksheet Names:', PHP_EOL;
+var_dump($sheetList);
+
+echo 'Worksheet Names:', PHP_EOL;
+var_dump($sheetInfo);
+
diff --git a/Examples/Excel2003XMLReader.php b/Examples/Excel2003XMLReader.php
new file mode 100644
index 0000000..e77f8a9
--- /dev/null
+++ b/Examples/Excel2003XMLReader.php
@@ -0,0 +1,61 @@
+load("Excel2003XMLTest.xml");
+
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+
+echo date('H:i:s') , " Write to Excel5 format" , PHP_EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+$objWriter->save(str_replace('.php', '.xls', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xls', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
diff --git a/Examples/Excel2003XMLTest.xml b/Examples/Excel2003XMLTest.xml
new file mode 100644
index 0000000..fb2d305
--- /dev/null
+++ b/Examples/Excel2003XMLTest.xml
@@ -0,0 +1 @@
+3#0000004#0000ff5#0080006#00ccff7#8000808#9933669#c0c0c010#c4751211#ccffcc12#ddbc7d13#ff000014#ff00ff15#ff660016#ff990017#ff99cc18#ffff0090001386024075FalseFalseTest String 1Test for a simple colour-formatted string | 1 | 5 | | A | E | | 6 | | AE | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test - String 2 | 2 | 6 | | B | F | | 8 | | BF | | | | Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test #3 | 3 | 7 | | C | G | | 10 | | CG | Red | Red | | Dash | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test with (") in string | 4 | 8 | | D | H | | 12 | | DH | Orange | Orange | | Dash/Dot/Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | 10 | 26 | 36 | Yellow | Yellow | | Dash/Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test #3 | 1.23 | 1 | 1 | | | | | | | Green | Green | | Thin Line | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test #3 | 2.34 | 0 | 0 | | | | 0 | | | Blue | Blue | | Thick Dash/Dot/Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Test #3 | 3.45 | | | | | | | | | Purple | Purple | | Variant Thick Dash/Dot/Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | Pink | Pink | | Thick Dash/Dot | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
1960-12-19T00:00:00.000 | | TOP | | | | 0 | | | | Brown | Brown | | Thick Dash | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
1.5 | | | | | | 0 | | | | | | | Thick Line | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | BOTTOM | | | | | | | | | | | Extra Thick Line | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
1899-12-31T02:30:00.000 | | | | | Мойва ÑушенаÑTests for UTF-8 content | | | | | | | | Double Line | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | LEFT | | | Ärendetext | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
1960-12-19T01:30:00.000 | | | | | Højde | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | RIGHT | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| BOX | | | | Test Column 1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | Test Column 2 | | | Patterned | Patterned 2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | Test Column 3 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|
Underline None | Rotate 90 | Rotate 45 | Rotate -90 | Rotate -45 | |
Underline 1 | Subscript | |
Underline 2 | Superscript | |
Underline 3 | |
Underline 4 | |
|
I don't know if Gnumeric supports Rich Text in the same way as Excel, And this row should be autofit height with text wrap | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
PHPExcel | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Heading 1 | Heading 2 | Third Heading | Date Heading | Time Heading | | Adjusted Date | Adjusted Number | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| Adjusted Number | Third Heading |
1 | 1.11 | 1.11 |
2 | 4.44 | 2.22 |
3 | 9.99 | 3.33 |
4 | 17.76 | 4.44 |
5 | 27.75 | 5.55 |
6 | 39.96 | 6.66 |
7 | 54.39 | 7.77 |
8 | 71.04 | 8.88 |
9 | 89.91 | 9.99 |
10 | 111 | 11.1 |
11 | 134.31 | 12.21 |
12 | 159.84 | 13.32 |
13 | 1.11 | -1.11 |
ABC | 1 | 1.11 | 2001-01-01T00:00:00.000 | 1899-12-31T01:00:00.000 | | 2000-12-31T00:00:00.000 | 1.11 | | A | 1A | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
BCD | 2 | 2.22 | 2002-02-02T00:00:00.000 | 1899-12-31T02:00:00.000 | | 2002-01-31T00:00:00.000 | 4.44 | | B | 2B | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
CDE | 3 | 3.33 | 2003-03-03T00:00:00.000 | 1899-12-31T03:00:00.000 | | 2003-02-28T00:00:00.000 | 9.99 | | C | 3C | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
DEF | 4 | 4.44 | 2004-04-03T23:00:00.000 | 1899-12-31T04:00:00.000 | | 2004-03-30T23:00:00.000 | 17.76 | | D | 4D | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
EFG | 5 | 5.55 | 2005-05-04T23:00:00.000 | 1899-12-31T05:00:00.000 | | 2005-04-29T23:00:00.000 | 27.75 | | E | 5E | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
FGH | 6 | 6.66 | 2006-06-05T23:00:00.000 | 1899-12-31T06:00:00.000 | | 2006-05-30T23:00:00.000 | 39.96 | | F | 6F | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
GHI | 7 | 7.77 | 2007-07-06T23:00:00.000 | 1899-12-31T07:00:00.000 | | 2007-06-29T23:00:00.000 | 54.39 | | G | 7G | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
HIJ | 8 | 8.88 | 2008-08-07T23:00:00.000 | 1899-12-31T08:00:00.000 | | 2008-07-30T23:00:00.000 | 71.04 | | H | 8H | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
IJK | 9 | 9.99 | 2009-09-08T23:00:00.000 | 1899-12-31T09:00:00.000 | | 2009-08-30T23:00:00.000 | 89.91 | | I | 9I | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
JKL | 10 | 11.1 | 2010-10-09T23:00:00.000 | 1899-12-31T10:00:00.000 | | 2010-09-29T23:00:00.000 | 111 | | J | 10J | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
KLM | 11 | 12.21 | 2011-11-11T00:00:00.000 | 1899-12-31T11:00:00.000 | | 2011-10-31T00:00:00.000 | 134.31 | | K | 11K | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
LMN | 12 | 13.32 | 2012-12-12T00:00:00.000 | 1899-12-31T288:00:00.000 | | 2012-11-30T00:00:00.000 | 159.84 | | L | 12L | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
ZYX | -1 | -1.11 | 1999-12-01T00:00:00.000 | 1899-12-31T23:00:00.000 | | 1999-12-02T00:00:00.000 | 1.11 | | M | -1M | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ No newline at end of file
diff --git a/Examples/GnumericReader.php b/Examples/GnumericReader.php
new file mode 100644
index 0000000..1b22e2c
--- /dev/null
+++ b/Examples/GnumericReader.php
@@ -0,0 +1,60 @@
+load("GnumericTest.gnumeric");
+
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
diff --git a/Examples/GnumericTest.gnumeric b/Examples/GnumericTest.gnumeric
new file mode 100644
index 0000000..ea2fac3
Binary files /dev/null and b/Examples/GnumericTest.gnumeric differ
diff --git a/Examples/OOCalcReader.php b/Examples/OOCalcReader.php
new file mode 100644
index 0000000..70f3606
--- /dev/null
+++ b/Examples/OOCalcReader.php
@@ -0,0 +1,61 @@
+load("OOCalcTest.ods");
+
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
+
diff --git a/Examples/OOCalcReaderPCLZip.php b/Examples/OOCalcReaderPCLZip.php
new file mode 100644
index 0000000..2fc771c
--- /dev/null
+++ b/Examples/OOCalcReaderPCLZip.php
@@ -0,0 +1,64 @@
+load("OOCalcTest.ods");
+
+
+$callEndTime = microtime(true);
+$callTime = $callEndTime - $callStartTime;
+echo 'Call time to read Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , PHP_EOL;
+// Echo memory usage
+echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
+
diff --git a/Examples/OOCalcTest.ods b/Examples/OOCalcTest.ods
new file mode 100644
index 0000000..b29db76
Binary files /dev/null and b/Examples/OOCalcTest.ods differ
diff --git a/Examples/Quadratic.php b/Examples/Quadratic.php
new file mode 100644
index 0000000..11a712e
--- /dev/null
+++ b/Examples/Quadratic.php
@@ -0,0 +1,68 @@
+
+
+Quadratic Equation Solver
+
+
+
+Quadratic Equation Solver
+
+
+getActiveSheet()->setCellValue('A1', $_POST['A']);
+ $objPHPExcel->getActiveSheet()->setCellValue('B1', $_POST['B']);
+ $objPHPExcel->getActiveSheet()->setCellValue('C1', $_POST['C']);
+
+
+ /** Calculate and Display the results **/
+ echo '
Roots:
';
+
+ $callStartTime = microtime(true);
+ echo $objPHPExcel->getActiveSheet()->getCell('B5')->getCalculatedValue().'
';
+ echo $objPHPExcel->getActiveSheet()->getCell('B6')->getCalculatedValue().'
';
+ $callEndTime = microtime(true);
+ $callTime = $callEndTime - $callStartTime;
+
+ echo '
Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds
';
+ echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB
';
+ }
+}
+
+?>
+
+
+
diff --git a/Examples/Quadratic2.php b/Examples/Quadratic2.php
new file mode 100644
index 0000000..5f6013e
--- /dev/null
+++ b/Examples/Quadratic2.php
@@ -0,0 +1,65 @@
+
+
+Quadratic Equation Solver
+
+
+
+Quadratic Equation Solver
+
+
+Roots:
';
+
+ $callStartTime = microtime(true);
+ $discriminantFormula = '=POWER('.$_POST['B'].',2) - (4 * '.$_POST['A'].' * '.$_POST['C'].')';
+ $discriminant = PHPExcel_Calculation::getInstance()->calculateFormula($discriminantFormula);
+
+ $r1Formula = '=IMDIV(IMSUM(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].')';
+ $r2Formula = '=IF('.$discriminant.'=0,"Only one root",IMDIV(IMSUB(-'.$_POST['B'].',IMSQRT('.$discriminant.')),2 * '.$_POST['A'].'))';
+
+ echo PHPExcel_Calculation::getInstance()->calculateFormula($r1Formula).'
';
+ echo PHPExcel_Calculation::getInstance()->calculateFormula($r2Formula).'
';
+ $callEndTime = microtime(true);
+ $callTime = $callEndTime - $callStartTime;
+
+ echo '
Call time for Quadratic Equation Solution was '.sprintf('%.4f',$callTime).' seconds
';
+ echo ' Peak memory usage: '.(memory_get_peak_usage(true) / 1024 / 1024).' MB
';
+ }
+}
+
+?>
+
+
+
diff --git a/Examples/SylkReader.php b/Examples/SylkReader.php
new file mode 100644
index 0000000..a16a4f0
--- /dev/null
+++ b/Examples/SylkReader.php
@@ -0,0 +1,50 @@
+save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
diff --git a/Examples/SylkTest.slk b/Examples/SylkTest.slk
new file mode 100644
index 0000000..d5dd5bb
--- /dev/null
+++ b/Examples/SylkTest.slk
@@ -0,0 +1,152 @@
+ID;PWXL;N;E
+P;PGeneral
+P;P0
+P;P0.00
+P;P#,##0
+P;P#,##0.00
+P;P#,##0;;\-#,##0
+P;P#,##0;;[Red]\-#,##0
+P;P#,##0.00;;\-#,##0.00
+P;P#,##0.00;;[Red]\-#,##0.00
+P;P"$"#,##0;;\-"$"#,##0
+P;P"$"#,##0;;[Red]\-"$"#,##0
+P;P"$"#,##0.00;;\-"$"#,##0.00
+P;P"$"#,##0.00;;[Red]\-"$"#,##0.00
+P;P0%
+P;P0.00%
+P;P0.00E+00
+P;P##0.0E+0
+P;P#\ ?/?
+P;P#\ ??/??
+P;Pdd/mm/yyyy
+P;Pdd\-mmm\-yy
+P;Pdd\-mmm
+P;Pmmm\-yy
+P;Ph:mm\ AM/PM
+P;Ph:mm:ss\ AM/PM
+P;Phh:mm
+P;Phh:mm:ss
+P;Pdd/mm/yyyy\ hh:mm
+P;Pmm:ss
+P;Pmm:ss.0
+P;P@
+P;P[h]:mm:ss
+P;P_-"$"* #,##0_-;;\-"$"* #,##0_-;;_-"$"* "-"_-;;_-@_-
+P;P_-* #,##0_-;;\-* #,##0_-;;_-* "-"_-;;_-@_-
+P;P_-"$"* #,##0.00_-;;\-"$"* #,##0.00_-;;_-"$"* "-"??_-;;_-@_-
+P;P_-* #,##0.00_-;;\-* #,##0.00_-;;_-* "-"??_-;;_-@_-
+P;FArial;M200
+P;FArial;M200
+P;FArial;M200
+P;FArial;M200
+P;EArial;M200
+P;EArial;M200
+P;EArial;M200
+P;EArial;M200;SB
+P;EArial;M200;SBI
+P;EArial;M200;SI
+P;EArial;M200;SU
+P;EArial;M200;L11
+P;EArial;M200;SB
+P;EArial;M200
+P;EArial;M200;SI
+P;EArial;M200;SBI
+P;EArial;M200;SBU
+P;EArial;M200;SBIU
+P;EArial;M200
+P;EArial;M200;SI
+F;P0;DG0G8;M255
+B;Y18;X10;D0 0 17 9
+O;L;D;V0;K47;G100 0.001
+F;W1 1 17
+F;W4 6 6
+F;M270;R9
+F;M270;R12
+F;M270;R17
+F;M270;R18
+F;SM12;Y1;X1
+C;K"Test String 1"
+F;SM19;X2
+C;K1
+F;SM19;X3
+C;K5
+F;SIDM18;X5
+C;K"A"
+F;SDM17;X6
+C;K"E"
+C;X8;K6;ERC[-6]+RC[-5]
+C;X10;K"AE";ERC[-5]&RC[-4]
+F;SSM0;Y2;X1
+C;K"Test - String 2"
+C;X2;K2
+F;SM19;X3
+C;K6
+C;X5;K"B"
+C;X6;K"F"
+C;X8;K8;ERC[-6]+RC[-5]
+C;X10;K"BF";ERC[-5]&RC[-4]
+C;Y3;X1;K"Test #3"
+F;SM19;X2
+C;K3
+F;SM19;X3
+C;K7
+F;SDM13;X5
+C;K"C"
+F;SIDM16;X6
+C;K"G"
+C;X8;K10;ERC[-6]+RC[-5]
+C;X10;K"CG";ERC[-5]&RC[-4]
+F;SM11;Y4;X1
+C;K"Test with (;;) in string"
+C;X2;K4
+F;SM19;X3
+C;K8
+F;SIM15;X5
+C;K"D"
+C;X6;K"H"
+C;X8;K12;ERC[-6]+RC[-5]
+C;X10;K"DH";ERC[-5]&RC[-4]
+C;Y5;X8;K10;ESUM(R[-4]C[-6]:R[-1]C[-6])
+C;X9;K26;ESUM(R[-4]C[-6]:R[-1]C[-6])
+C;X10;K36;ESUM(R[-4]C[-8]:R[-1]C[-7])
+C;Y6;X2;K1.23
+C;X3;KTRUE
+F;P19;FG0G;X4
+C;Y7;X2;K2.34
+C;X3;KFALSE
+C;Y8;X2;K3.45
+F;Y9;X1
+F;X2
+F;X3
+F;X4
+F;X5
+F;X6
+F;X7
+F;X8
+F;X9
+F;X10
+F;P19;FG0G;Y10;X1
+C;K22269
+F;STM0;X3
+C;K"TOP"
+F;P17;FG0G;Y11;X1
+C;K1.5
+F;Y12
+F;X2
+F;SBM0;X3
+C;K"BOTTOM"
+F;X4
+F;X5
+F;X6
+F;X7
+F;X8
+F;X9
+F;X10
+F;SLM0;Y14;X3
+C;K"LEFT"
+F;SRM0;Y16
+C;K"RIGHT"
+F;Y17
+F;SLRTBM0;Y18
+C;K"BOX"
+E
diff --git a/Examples/XMLReader.php b/Examples/XMLReader.php
new file mode 100644
index 0000000..836f6b2
--- /dev/null
+++ b/Examples/XMLReader.php
@@ -0,0 +1,60 @@
+load($inputFileName);
+
+
+echo date('H:i:s') , " Write to Excel2007 format" , PHP_EOL;
+$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
+echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', __FILE__) , PHP_EOL;
+
+
+// Echo memory peak usage
+echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , PHP_EOL;
+
+// Echo done
+echo date('H:i:s') , " Done writing file" , PHP_EOL;
diff --git a/Examples/XMLTest.xml b/Examples/XMLTest.xml
new file mode 100644
index 0000000..95921bc
--- /dev/null
+++ b/Examples/XMLTest.xml
@@ -0,0 +1,450 @@
+
+
+
+
+ Excel 2003 XML Test Workbook
+ This is a test workbook saved as Excel 2003 XML
+ Mark Baker
+ PHPExcel Excel 2003 XML Reader
+ This is a test for the PHPExcel Reader for workbooks saved using Excel 2003's XML Format
+ Mark Baker
+ 2009-09-11T08:26:08Z
+ 2009-09-17T22:53:09Z
+ Reader
+ PHPExcel
+ 14.00
+
+
+
+
+
+ 13176
+ 28452
+ 240
+ 516
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test String 1 |
+ 1 |
+ 5 |
+ A |
+ E |
+ 6 |
+ AE |
+
+
+ Test - String 2 |
+ 2 |
+ 6 |
+ B |
+ F |
+ 8 |
+ BF |
+
+
+ Test #3 |
+ 3 |
+ 7 |
+ C |
+ G |
+ 10 |
+ CG |
+
+
+ Test with (") in string |
+ 4 |
+ 8 |
+ D |
+ H |
+ 12 |
+ DH |
+
+
+ 10 |
+ 26 |
+ 36 |
+
+
+ 1.23 |
+ 1 |
+ |
+
+
+ 2.34 |
+ 0 |
+
+
+ 3.45 |
+
+
+
+ 1960-12-19T00:00:00.000 |
+ TOP |
+ #N/A |
+
+
+ 1.5 |
+ #DIV/0! |
+
+
+ BOTTOM |
+
+
+ LEFT |
+
+
+ RIGHT |
+
+
+
+ BOX |
+ |
+ Test Column 1 |
+
+
+ Test Column 2 |
+
+
+ Test Column 3 |
+
+
+
+
+
+
+
+
+
+
+
+ 600
+ 600
+
+
+
+
+ 3
+ 17
+ 4
+
+
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Heading 1 |
+ Heading 2 |
+ Third Heading |
+ Date Heading |
+ Adjusted Date |
+ Adjusted Number |
+
+
+ ABC |
+ 1 |
+ 1.1100000000000001 |
+ 2001-01-01T00:00:00.000 |
+ 2000-12-31T00:00:00.000 |
+ 1.1100000000000001 |
+
+
+ BCD |
+ 2 |
+ 2.2200000000000002 |
+ 2002-02-02T00:00:00.000 |
+ 2002-01-31T00:00:00.000 |
+ 4.4400000000000004 |
+
+
+ CDE |
+ 3 |
+ 3.33 |
+ 2003-03-03T00:00:00.000 |
+ 2003-02-28T00:00:00.000 |
+ 9.99 |
+
+
+ DEF |
+ 4 |
+ 4.4400000000000004 |
+ 2004-04-03T23:00:00.000 |
+ 2004-03-30T23:00:00.000 |
+ 17.760000000000002 |
+
+
+ EFG |
+ 5 |
+ 5.55 |
+ 2005-05-04T23:00:00.000 |
+ 2005-04-29T23:00:00.000 |
+ 27.75 |
+
+
+ FGH |
+ 6 |
+ 6.66 |
+ 2006-06-05T23:00:00.000 |
+ 2006-05-30T23:00:00.000 |
+ 39.96 |
+
+
+ GHI |
+ 7 |
+ 7.77 |
+ 2007-07-06T23:00:00.000 |
+ 2007-06-29T23:00:00.000 |
+ 54.39 |
+
+
+ HIJ |
+ 8 |
+ 8.8800000000000008 |
+ 2008-08-07T23:00:00.000 |
+ 2008-07-30T23:00:00.000 |
+ 71.040000000000006 |
+
+
+ IJK |
+ 9 |
+ 9.99 |
+ 2009-09-08T23:00:00.000 |
+ 2009-08-30T23:00:00.000 |
+ 89.91 |
+
+
+ JKL |
+ 10 |
+ 11.1 |
+ 2010-10-09T23:00:00.000 |
+ 2010-09-29T23:00:00.000 |
+ 111 |
+
+
+ KLM |
+ 11 |
+ 12.21 |
+ 2011-11-11T00:00:00.000 |
+ 2011-10-31T00:00:00.000 |
+ 134.31 |
+
+
+ LMN |
+ 12 |
+ 13.32 |
+ 2012-12-12T00:00:00.000 |
+ 2012-11-30T00:00:00.000 |
+ 159.84 |
+
+
+ ZYX |
+ -1 |
+ -1.1100000000000001 |
+ 1999-12-01T00:00:00.000 |
+ 1999-12-02T00:00:00.000 |
+ 1.1100000000000001 |
+
+
+
+
+
+
+
+
+
+
+
+ 600
+ 600
+
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+
+
+ R2C3:R14C3
+
+ Greater
+ 0
+
+
+
+ Less
+ 0
+
+
+
+
+
diff --git a/Examples/data/continents/Africa.txt b/Examples/data/continents/Africa.txt
new file mode 100644
index 0000000..407fa76
--- /dev/null
+++ b/Examples/data/continents/Africa.txt
@@ -0,0 +1,54 @@
+Algeria
+Angola
+Benin
+Botswana
+Burkina
+Burundi
+Cameroon
+Cape Verde
+Central African Republic
+Chad
+Comoros
+Congo
+Congo, Democratic Republic of
+Djibouti
+Egypt
+Equatorial Guinea
+Eritrea
+Ethiopia
+Gabon
+Gambia
+Ghana
+Guinea
+Guinea-Bissau
+Ivory Coast
+Kenya
+Lesotho
+Liberia
+Libya
+Madagascar
+Malawi
+Mali
+Mauritania
+Mauritius
+Morocco
+Mozambique
+Namibia
+Niger
+Nigeria
+Rwanda
+Sao Tome and Principe
+Senegal
+Seychelles
+Sierra Leone
+Somalia
+South Africa
+South Sudan
+Sudan
+Swaziland
+Tanzania
+Togo
+Tunisia
+Uganda
+Zambia
+Zimbabwe
diff --git a/Examples/data/continents/Asia.txt b/Examples/data/continents/Asia.txt
new file mode 100644
index 0000000..9ce006c
--- /dev/null
+++ b/Examples/data/continents/Asia.txt
@@ -0,0 +1,44 @@
+Afghanistan
+Bahrain
+Bangladesh
+Bhutan
+Brunei
+Burma (Myanmar)
+Cambodia
+China
+East Timor
+India
+Indonesia
+Iran
+Iraq
+Israel
+Japan
+Jordan
+Kazakhstan
+Korea, North
+Korea, South
+Kuwait
+Kyrgyzstan
+Laos
+Lebanon
+Malaysia
+Maldives
+Mongolia
+Nepal
+Oman
+Pakistan
+Philippines
+Qatar
+Russian Federation
+Saudi Arabia
+Singapore
+Sri Lanka
+Syria
+Tajikistan
+Thailand
+Turkey
+Turkmenistan
+United Arab Emirates
+Uzbekistan
+Vietnam
+Yemen
diff --git a/Examples/data/continents/Europe.txt b/Examples/data/continents/Europe.txt
new file mode 100644
index 0000000..70c1160
--- /dev/null
+++ b/Examples/data/continents/Europe.txt
@@ -0,0 +1,47 @@
+Albania
+Andorra
+Armenia
+Austria
+Azerbaijan
+Belarus
+Belgium
+Bosnia and Herzegovina
+Bulgaria
+Croatia
+Cyprus
+Czech Republic
+Denmark
+Estonia
+Finland
+France
+Georgia
+Germany
+Greece
+Hungary
+Iceland
+Ireland
+Italy
+Latvia
+Liechtenstein
+Lithuania
+Luxembourg
+Macedonia
+Malta
+Moldova
+Monaco
+Montenegro
+Netherlands
+Norway
+Poland
+Portugal
+Romania
+San Marino
+Serbia
+Slovakia
+Slovenia
+Spain
+Sweden
+Switzerland
+Ukraine
+United Kingdom
+Vatican City
diff --git a/Examples/data/continents/North America.txt b/Examples/data/continents/North America.txt
new file mode 100644
index 0000000..5881ae1
--- /dev/null
+++ b/Examples/data/continents/North America.txt
@@ -0,0 +1,23 @@
+Antigua and Barbuda
+Bahamas
+Barbados
+Belize
+Canada
+Costa Rica
+Cuba
+Dominica
+Dominican Republic
+El Salvador
+Grenada
+Guatemala
+Haiti
+Honduras
+Jamaica
+Mexico
+Nicaragua
+Panama
+Saint Kitts and Nevis
+Saint Lucia
+Saint Vincent and the Grenadines
+Trinidad and Tobago
+United States
diff --git a/Examples/data/continents/Oceania.txt b/Examples/data/continents/Oceania.txt
new file mode 100644
index 0000000..cbdc896
--- /dev/null
+++ b/Examples/data/continents/Oceania.txt
@@ -0,0 +1,14 @@
+Australia
+Fiji
+Kiribati
+Marshall Islands
+Micronesia
+Nauru
+New Zealand
+Palau
+Papua New Guinea
+Samoa
+Solomon Islands
+Tonga
+Tuvalu
+Vanuatu
diff --git a/Examples/data/continents/South America.txt b/Examples/data/continents/South America.txt
new file mode 100644
index 0000000..777ffbf
--- /dev/null
+++ b/Examples/data/continents/South America.txt
@@ -0,0 +1,12 @@
+Argentina
+Bolivia
+Brazil
+Chile
+Colombia
+Ecuador
+Guyana
+Paraguay
+Peru
+Suriname
+Uruguay
+Venezuela
diff --git a/Examples/images/paid.png b/Examples/images/paid.png
new file mode 100644
index 0000000..a4355bd
Binary files /dev/null and b/Examples/images/paid.png differ
diff --git a/Examples/images/phpexcel_logo.gif b/Examples/images/phpexcel_logo.gif
new file mode 100644
index 0000000..6e1b5ee
Binary files /dev/null and b/Examples/images/phpexcel_logo.gif differ
diff --git a/Examples/runall.php b/Examples/runall.php
new file mode 100644
index 0000000..153cb76
--- /dev/null
+++ b/Examples/runall.php
@@ -0,0 +1,132 @@
+ inside the tag
+- Bugfix: (schir1964) Fix to listWorksheetInfo() method for OOCalc Reader
+- Bugfix: (MBaker) Support for "e" (epoch) date format mask
+ Rendered as a 4-digit CE year in non-Excel outputs
+- Bugfix: (MBaker) Work items 15799 and 18278 - Background color cell is always black when editing cell
+- Bugfix: (MBaker) Work items 15905 and 18183 - Allow "no impact" to formats on Conditional Formatting
+- Bugfix: (wackonline) OOCalc Reader fix for NULL cells
+- Bugfix: (seltzlab) Fix to excel2007 Chart Writer when a $plotSeriesValues is empty
+- Bugfix: (MBaker) Various fixes to Chart handling
+- Bugfix: (MBaker) Work item 18370 - Error loading xlsx file with column breaks
+- Bugfix: (MBaker) OOCalc Reader now handles percentage and currency data types
+- Bugfix: (MBaker) Work Item 18415 - mb_stripos empty delimiter
+- Bugfix: (takaakik) Work Item 15455 - getNestingLevel() Error on Excel5 Read
+- Bugfix: (MBaker) Fix to Excel5 Reader when cell annotations are defined before their referenced text objects
+- Bugfix: (MBaker) OOCalc Reader modified to process number-rows-repeated
+- Bugfix: (MBaker) Work item 18377 - Chart Title compatibility on Excel 2007
+- Bugfix: (MBaker) Work item 18146 - Chart Refresh returning cell reference rather than values
+- Bugfix: (MBaker) Work item 18145 - Autoshape being identified in twoCellAnchor when includeCharts is TRUE triggering load error
+- Bugfix: (MBaker) Work item 18325 - v-type texts for series labels now recognised and parsed correctly
+- Bugfix: (wolf5x) Work item 18492 - load file failed if the file has no extensionType
+- Bugfix: (dverspui) Pattern fill colours in Excel2007 Style Writer
+- Bugfix: (MBaker) Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack
+- Bugfix: (MBaker) Work item 18425 - Problems with $_activeSheetIndex when decreased below 0.
+- Bugfix: (MBaker) Work item 18597 - PHPExcel_CachedObjectStorage_SQLite3::cacheMethodIsAvailable() uses class_exists - autoloader throws error
+- Bugfix: (MBaker) Work item 18598 - Cannot access private property PHPExcel_CachedObjectStorageFactory::$_cacheStorageMethod
+- Bugfix: (MBaker) Work item 18397 - Data titles for charts
+ PHPExcel_Chart_Layout now has methods for getting/setting switches for displaying/hiding chart data labels
+- Bugfix: (MBaker) Discard single cell merge ranges when reading (stupid that Excel allows them in the first place)
+- Bugfix: (MBaker) Discard hidden autoFilter named ranges
+
+
+2012-05-19 (v1.7.7):
+- Bugfix: (Progi1984) Work item 8916 - Support for Rich-Text in PHPExcel_Writer_Excel5
+- Bugfix: (cyberconte) Work item 17471 - OOCalc cells contain same data bug?
+- Feature: (schir1964) listWorksheetInfo() method added to Readers... courtesy of Christopher Mullins
+- Feature: (MBaker) Options for cell caching using Igbinary and SQLite/SQlite3.
+- Feature: (MBaker) Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added.
+- Feature: (Progi1984) Work item 9759 - Implement document properties in Excel5 writer
+- Feature: (MBaker) Work item 16 - Implement chart functionality (EXPERIMENTAL)
+ Initial definition of chart objects.
+ Reading Chart definitions through the Excel2007 Reader
+ Facility to render charts to images using the 3rd-party jpgraph library
+ Writing Charts using the Excel2007 Writer
+- General: (MBaker) Fix to build to ensure that Examples are included with the documentation
+- General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed
+- General: (MBaker) Improved memory usage in CSV Writer
+- General: (MBaker) Improved speed and memory usage in Excel5 Writer
+- General: (MBaker) Experimental -
+ Added getHighestDataColumn(), getHighestDataRow(), getHighestRowAndColumn() and calculateWorksheetDataDimension() methods for the worksheet that return the highest row and column that have cell records
+- General: (MBaker) Change iterators to implement Iterator rather than extend CachingIterator, as a fix for PHP 5.4. changes in SPL
+- Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer
+- Bugfix: (MBaker) Work item 15518 - PCLZip library issue
+- Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug
+- Bugfix: (MBaker) Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula
+- Bugfix: (gilles06) Work item 15707 - ini_set() call in Calculation class destructor
+- Bugfix: (MBaker) Work item 15786 - RangeToArray strange array keys
+- Bugfix: (MBaker) Work item 15762 - INDIRECT() function doesn't work with named ranges
+- Bugfix: (MBaker) Locale-specific fix to text functions when passing a boolean argument instead of a string
+- Bugfix: (MBaker) Work item 16246 - reader/CSV fails on this file
+ auto_detect_line_endings now set in CSV reader
+- Bugfix: (MBaker) Work item 16212 - $arguments improperly used in CachedObjectStorage/PHPTemp.php
+- Bugfix: (MBaker) Work item 16643 - Bug In Cache System (cell reference when throwing caching errors)
+- Bugfix: (MBaker) Work item 16895 - PHP Invalid index notice on writing excel file when active sheet has been deleted
+- Bugfix: (MBaker) Work item 16956 - External links in Excel2010 files cause Fatal error
+- Bugfix: (MBaker) Work item 16960 - Previous calculation engine error conditions trigger cyclic reference errors
+- Bugfix: (mkopinsky) Work item 16266 - PHPExcel_Style::applyFromArray() returns null rather than style object in advanced mode
+- Bugfix: (fauvel) Work item 16958 - Cell::getFormattedValue returns RichText object instead of string
+- Bugfix: (MBaker) Work item 17166 - Indexed colors do not refer to Excel's indexed colors?
+- Bugfix: (MBaker) Work item 17199 - Indexed colors should be consistent with Excel and start from 1 (current index starts at 0)
+- Bugfix: (MBaker) Work item 17262 - Named Range definition in .xls when sheet reeference is quote wrapped
+- Bugfix: (MBaker) Work item 17403 - duplicateStyle() method doesn't duplicate conditional formats
+ Added an equivalent duplicateConditionalStyle() method for duplicating conditional styles
+- Bugfix: (bnr) Work item 17501 - =sumproduct(A,B) <> =sumproduct(B,A) in xlsx
+- Bugfix: (Progi1984) Work item 8916 - Support for Rich-Text in PHPExcel_Writer_Excel5
+- General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC)
+- General: (MBaker) Work item 15461 - Locale file paths not fit for windows
+- General: (MBaker) Work item 16643 - Add file directory as a cache option for cache_to_discISAM
+- General: (MBaker) Work item 16923 - Datatype.php & constant TYPE_NULL
+- General: (MBaker) Ensure use of system temp directory for all temporary work files, unless explicitly specified
+- General: (char101) Work item 16359 - [Patch] faster stringFromColumnIndex()
+- General: (whit1206) Work item 16028 - Fix for projects that still use old autoloaders
+- General: (atz) Work item 17024 - Unknown codepage: 10007
+ Additional Mac codepages
+
+
+2011-02-27 (v1.7.6):
+- Feature: (MBaker) Provide option to use PCLZip as an alternative to ZipArchive.
+ This allows the writing of Excel2007 files, even without ZipArchive enabled (it does require zlib), or when php_zip is one of the buggy PHP 5.2.6 or 5.2.8 versions
+ It can be enabled using PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
+ Note that it is not yet implemented as an alternative to ZipArchive for those Readers that are extracting from zips
+- Feature: (MBaker) Work item 14979 - Added listWorksheetNames() method to Readers that support multiple worksheets in a workbook, allowing a user to extract a list of all the worksheet names from a file without parsing/loading the whole file.
+- Feature: (MBaker) Speed boost and memory reduction in the Worksheet toArray() method.
+- Feature: (MBaker) Added new rangeToArray() and namedRangeToArray() methods to the PHPExcel_Worksheet object.
+ Functionally, these are identical to the toArray() method, except that they take an additional first parameter of a Range (e.g. 'B2:C3') or a Named Range name.
+ Modified the toArray() method so that it actually uses rangeToArray().
+- Feature: (MBaker) Added support for cell comments in the OOCalc, Gnumeric and Excel2003XML Readers, and in the Excel5 Reader
+- Feature: (MBaker) Improved toFormattedString() handling for Currency and Accounting formats to render currency symbols
+- Feature: (MBaker) Work Item 2346 - Implement more Excel calculation functions
+ Implemented the DAVERAGE(), DCOUNT(), DCOUNTA(), DGET(), DMAX(), DMIN(), DPRODUCT(), DSTDEV(), DSTDEVP(), DSUM(), DVAR() and DVARP() Database functions
+- Bugfix: (MBaker) Work item 14888 - Simple =IF() formula disappears
+- Bugfix: (MBaker) Work item 14898 - PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X
+- Bugfix: (MBaker) Work item 14901 - VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007
+- Bugfix: (MBaker) Work item 14973 - PHPExcel_Cell::isInRange() incorrect results - offset by one column
+- Bugfix: (MBaker) Treat CodePage of 0 as CP1251 (for .xls files written by applications that don't set the CodePage correctly, such as Apple Numbers)
+- Bugfix: (MB) Work item 11583 - Need method for removing autoFilter
+- Bugfix: (MBaker) Work item 15029 - coordinateFromString throws exception for rows greater than 99,999
+- Bugfix: (MBaker) Work item 14999 - PHPExcel Excel2007 Reader colour problems with solidfill
+- Bugfix: (MBaker) Work item 13215 - Formatting get lost and edit a template XLSX file
+- Bugfix: (MBaker) Work item 14029 - Excel 2007 Reader /writer lost fontcolor
+- Bugfix: (MBaker) Work item 13374 - file that makes cells go black
+- Bugfix: (MBaker) Minor patchfix for Excel2003XML Reader when XML is defined with a charset attribute
+- Bugfix: (MBaker) Work item 15089 - PHPExcel_Worksheet->toArray() index problem
+- Bugfix: (MBaker) Work item 15094 - Merge cells 'un-merge' when using an existing spreadsheet
+- Bugfix: (MBaker) Work item 15129 - Worksheet fromArray() only working with 2-D arrays
+- Bugfix: (xkeshav) Work item 15172 - rangeToarray function modified for non-existent cells
+- Bugfix: (MBaker) Work item 14980 - Images not getting copyied with the ->clone function
+- Bugfix: (MBaker) Work item 11576 - AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't
+- 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) Work item 15198 - FreezePane causing damaged or modified error
+ 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
+- Bugfix: (MBaker) Reduced false positives from isDateTimeFormatCode() method by suppressing testing within quoted strings
+- Bugfix: (MBaker) Work item 15312 - Caching and tmp partition exhaustion
+- Bugfix: (MBaker) Work item 15308 - Writing to Variable No Longer Works. $_tmp_dir Missing in PHPExcel\PHPExcel\Shared\OLE\PPS\Root.php
+- Bugfix: (MBaker) Work item 15379 - Named ranges with dot don't get parsed properly
+- Bugfix: (MBaker) Work item 15096 - insertNewRowBefore fails to consistently update references
+- Bugfix: (MBaker) "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method)
+- Bugfix: (MKunert) Work item 15421 - PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section
+- Bugfix: (MBaker) Work item 15409 - Full column/row references in named ranges not supported by updateCellReference()
+- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
+- General: (MBaker) Improved performance (speed), for PHP to Excel date conversions
+- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.
+- General: (MBaker) Removed Serialized Reader/Writer as these no longer work.
+
+
+2010-12-10 (v1.7.5):
+- Feature: (MBaker) Work item 8769 - Implement Gnumeric File Format
+ Initial work on Gnumeric Reader (Worksheet Data, Document Properties and basic Formatting)
+- Feature: (MBaker) (incorporating part of Workitem 9759) - Support for Extended Workbook Properties in Excel2007, Excel5 and OOCalc Readers; support for User-defined Workbook Properties in Excel2007 and OOCalc Readers
+- Feature: (MBaker) Support for Extended and User-defined Workbook Properties in Excel2007 Writer
+- Feature: (MBaker) Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML
+- Feature: (MBaker) Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean
+- Feature: (MBaker) Work item 14301 - PHPExcel_Worksheet->toArray() is returning truncated values
+- Feature: (MBaker) Configure PDF Writer margins based on Excel Worksheet Margin Settings value
+- Feature: (MBaker) Added Contiguous flag for the CSV Reader, when working with Read Filters
+- Feature: (MBaker) Added getFormattedValue() method for cell object
+- Feature: (MBaker) Added strictNullComparison argument to the worksheet fromArray() method
+- Feature: (MBaker) Fix to toFormattedString() method in PHPExcel_Style_NumberFormat to handle fractions with a # code for the integer part
+- Bugfix: (MB) Work item 14143 - NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : String constant containing double quotation mark
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Percent
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Error constant
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Concatenation operator
+- Bugfix: (MBaker) Work item 14146 - Worksheet clone broken for CachedObjectStorage_Memory
+- Bugfix: (MBaker) Work item 12998 - PHPExcel_Reader_Excel2007 fails when gradient fill without type is present in a file
+- Bugfix: (MBaker) Work item 14176 - @ format for numeric strings in XLSX to CSV conversion
+- Bugfix: (MBaker) Work item 14223 - Advanced Value Binder Not Working?
+- Bugfix: (MBaker) Work item 14226 - unassigned object variable in PHPExcel->removeCellXfByIndex
+- Bugfix: (MBaker) Work item 14236 - problem with getting cell values from another worksheet... (if cell doesn't exist)
+- Bugfix: (MBaker) Work items 14260 & 14233 - Setting cell values to one char strings & Trouble reading one character string (thanks gorfou)
+- Bugfix: (MBaker) Work item 14256 - Worksheet title exception when duplicate worksheet is being renamed but exceeds the 31 character limit
+- Bugfix: (MBaker) Work item 14086 - Named range with sheet name that contains the $ throws exception when getting the cell
+- Bugfix: (MBaker) Added autoloader to DefaultValueBinder and AdvancedValueBinder
+- Bugfix: (MBaker) Modified PHPExcel_Shared_Date::isDateTimeFormatCode() to return false if format code begins with "_" or with "0 " to prevent false positives
+ These leading characters are most commonly associated with number, currency or accounting (or occasionally fraction) formats
+- Bugfix: (MBaker) Work item 14374 - BUG : Excel5 and setReadFilter ?
+- Bugfix: (MBaker) Work item 14425 - Wrong exception message while deleting column
+- Bugfix: (MBaker) Work item 14679 - Formula evaluation fails with Japanese sheet refs
+- Bugfix: (MBaker) Work item 13559 - PHPExcel_Writer_PDF does not handle cell borders correctly
+- Bugfix: (MBaker) Work item 14831 - Style : applyFromArray() for 'allborders' not working
+- Bugfix: (MBaker) Work item 14837 - Using $this when not in object context in Excel5 Reader
+- General: (MBaker) Applied patch 6609 - Removes a unnecessary loop through each cell when applying conditional formatting to a range.
+- General: (MBaker) Applied patch 7169 - Removed spurious PHP end tags (?>)
+- General: (MBaker) Improved performance (speed) and reduced memory overheads, particularly for the Writers, but across the whole library.
+
+
+2010-08-26 (v1.7.4):
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Power
+- Bugfix: (Progi1984) Work item 7895 - Excel5 : Formula : Unary plus
+- Bugfix: (Progi1984) Excel5 : Just write the Escher stream if necessary in Worksheet
+- Bugfix: (MBaker) Work item 13433 - Syntax errors in memcache.php 1.7.3c
+- Bugfix: (MBaker) Work item 13450 - Standard Deviation functions returning DIV/0 Error when Standard Deviation is zero
+- Feature: (MBaker) Support for print area with several ranges in the Excel2007 reader, and improved features for editing print area with several ranges
+- Feature: (MBaker) Work item 13769 - Improved Cell Exception Reporting
+- Feature: (MBaker) Support for row or column ranges in the calculation engine, e.g. =SUM(C:C) or =SUM(1:2)
+ Also support in the calculation engine for absolute row or column ranges e.g. =SUM($C:$E) or =SUM($3:5)
+- Bugfix: (ET) Work item 13455 - Picture problem with Excel 2003
+- Bugfix: (MBaker) Work item 13484 - Wrong variable used in addExternalSheet in PHPExcel.php
+- Bugfix: (MBaker) Work item 13515 - "Invalid cell coordinate" error when formula access data from an other sheet
+- Bugfix: (MBaker) (related to Work item 13515) Calculation engine confusing cell range worksheet when referencing cells in a different worksheet to the formula
+- Bugfix: (MBaker) Work item 13752 - Wrong var naming in Worksheet->garbageCollect()
+- Bugfix: (MBaker) Work item 13764 - PHPExcel_Style_*::__clone() methods cause cloning loops?
+- Bugfix: (MBaker) Work item 11488 - Recent builds causing problems loading xlsx files? (ZipArchive issue?)
+- Bugfix: (MBaker) Work item 13856 - cache_to_apc causes fatal error when processing large data sets
+- Bugfix: (MBaker) Work item 13880 - OOCalc reader misses first line if it's a 'table-header-row'
+- Bugfix: (MBaker) Work item 14011 - using cache with copy or clone bug?
+ Fixed $worksheet->copy() or clone $worksheet when using cache_in_memory, cache_in_memory_gzip, cache_in_memory_serialized, cache_to_discISAM, cache_to_phpTemp, cache_to_apc and cache_to_memcache;
+ Fixed but untested when using cache_to_wincache.
+- Bugfix: (MBaker) Fixed problems with reading Excel2007 Properties
+- General: (MB) Applied patch 6324 - PHP Strict Standards: Non-static method PHPExcel_Shared_String::utf16_decode() should not be called statically
+- General: (MBaker) Applied patch 6360 - Array functions were ignored when loading an existing file containing them, and as a result, they would lose their 'cse' status.
+- General: (MBaker) Minor memory tweaks to Excel2007 Writer
+- General: (MBaker) Modified ReferenceHelper updateFormulaReferences() method to handle updates to row and column cell ranges (including absolute references e.g. =SUM(A:$E) or =SUM($5:5), and range/cell references that reference a worksheet by name), and to provide both performance and memory improvements.
+- General: (MBaker) Modified Excel2007 Reader so that ReferenceHelper class is instantiated only once rather than for every shared formula in a workbook.
+- General: (MBaker) Correct handling for additional (synonym) formula tokens in Excel5 Reader
+- General: (MBaker) Additional reading of some Excel2007 Extended Properties (Company, Manager)
+
+
+2010-06-01 (v1.7.3c):
+- Bugfix: (MB) Work item 13012 - Fatal error: Class 'ZipArchive' not found... ...Reader/Excel2007.php on line 217
+- Bugfix: (MBaker) Work item 13398 - PHPExcel_Writer_Excel2007 error after 1.7.3b
+
+
+2010-05-31 (v1.7.3b):
+- Bugfix: (MBaker) Work item 12903 - Infinite loop when reading
+- Bugfix: (MB) Work item 13381 - Wrong method chaining on PHPExcel_Worksheet class
+
+
+2010-05-17 (v1.7.3):
+- General: (ET) Applied patch 4990 (modified)
+- General: (MB) Applied patch 5568 (modified)
+- General: (MB) Applied patch 5943
+- General: (MB) Work item 13042 - Upgrade build script to use Phing
+- General: (ET) Work item 11586 - Replacing var with public/private
+- General: (MBaker) Applied Anthony's Sterling's Class Autoloader to reduce memory overhead by "Lazy Loading" of classes
+- General: (MBaker) Modification to functions that accept a date parameter to support string values containing ordinals as per Excel (English language only)
+- General: (MBaker) Modify PHPExcel_Style_NumberFormat::toFormattedString() to handle dates that fall outside of PHP's 32-bit date range
+- General: (MBaker) Applied patch 5207
+- General: (ET) Work item 11970 - PHPExcel developer documentation: Set page margins
+- Feature: (ET) Work item 11038 - Special characters and accents in SYLK reader
+- Feature: (MBaker) Work Item 2346 - Implement more Excel calculation functions
+ - Implemented the COUPDAYS(), COUPDAYBS(), COUPDAYSNC(), COUPNCD(), COUPPCD() and PRICE() Financial functions
+ - Implemented the N() and TYPE() Information functions
+ - Implemented the HYPERLINK() Lookup and Reference function
+- Feature: (ET) Work item 11526 - Horizontal page break support in PHPExcel_Writer_PDF
+- Feature: (ET) Work item 11529 - Introduce method setActiveSheetIndexByName()
+- Feature: (ET) Work item 11550 - AdvancedValueBinder.php: Automatically wrap text when there is new line in string (ALT+"Enter")
+- Feature: (ET) Work item 10300 - Data validation support in PHPExcel_Reader_Excel5 and PHPExcel_Writer_Excel5
+- Feature: (MB) Work item 11616 - Improve autosize calculation
+- Feature: (MBaker) Methods to translate locale-specific function names in formulae
+ - Language implementations for Czech (cs), Danish (da), German (de), English (uk), Spanish (es), Finnish (fi), French (fr), Hungarian (hu), Italian (it), Dutch (nl), Norwegian (no), Polish (pl), Portuguese (pt), Brazilian Portuguese (pt_br), Russian (ru) and Swedish (sv)
+- Feature: (ET) Work item 9759 - Implement document properties in Excel5 reader/writer
+ - Fixed so far for PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 11849 - Show/hide row and column headers in worksheet
+- Feature: (ET) Work item 11919 - Can't set font on writing PDF (by key)
+- Feature: (ET) Work item 12096 - Thousands scale (1000^n) support in PHPExcel_Style_NumberFormat::toFormattedString
+- Feature: (ET) Work item 6911 - Implement repeating rows in PDF and HTML writer
+- Feature: (ET) Work item 12289 - Sheet tabs in PHPExcel_Writer_HTML
+- Feature: (MB) Work item 13041 - Add Wincache CachedObjectProvider
+- Feature: (MBaker) Configure PDF Writer paper size based on Excel Page Settings value, and provided methods to override paper size and page orientation with the writer
+ - Note PHPExcel defaults to Letter size, while the previous PDF writer enforced A4 size, so PDF writer will now default to Letter
+- Feature: (MBaker) Initial implementation of cell caching: allowing larger workbooks to be managed, but at a cost in speed
+- Feature: (MBaker) Added an identify() method to the IO Factory that identifies the reader which will be used to load a particular file without actually loading it.
+- Bugfix: (MBaker) Work item 10979 - Warning messages with INDEX function having 2 arguments
+- Bugfix: (ET) Work item 11473 - setValue('=') should result in string instead of formula
+- Bugfix: (MBaker) Work item 11471 - method _raiseFormulaError should no be private
+- Bugfix: (ET) Work item 11485 - Fatal error: Call to undefined function mb_substr() in ...Classes\PHPExcel\Reader\Excel5.php on line 2903
+- Bugfix: (ET) Work item 11487 - getBold(), getItallic(), getStrikeThrough() not always working with PHPExcel_Reader_Excel2007
+- Bugfix: (ET) Work item 11492 - AdvancedValueBinder.php not working correctly for $cell->setValue('hh:mm:ss')
+- Bugfix: (MBaker) Fixed leap year handling for the YEARFRAC() Date/Time function when basis ia 1 (Actual/actual)
+- Bugfix: (MBaker) Work item 11490 - Warning messages
+ - Calculation Engine code modified to enforce strict standards for pass by reference
+- Bugfix: (ET) Work item 11483 - PHPExcel_Cell_AdvancedValueBinder doesnt work for dates in far future
+- Bugfix: (ET) Work item 11528 - MSODRAWING bug with long CONTINUE record in PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 11571 - PHPExcel_Reader_Excel2007 reads print titles as named range when there is more than one sheet
+- Bugfix: (ET) Work item 11561 - missing @return in phpdocblock in reader classes
+- Bugfix: (ET) Work item 11576 - AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't
+- Bugfix: (ET) Work item 11588 - Small numbers escape treatment in PHPExcel_Style_NumberFormat::toFormattedString()
+- Bugfix: (ET) Work item 11590 - Blank styled cells are not blank in output by HTML writer due to
+- Bugfix: (MBaker) Work item 11587 - Calculation engine bug: Existing, blank cell + number gives #NUM
+- Bugfix: (ET) Work item 11608 - AutoSize only measures length of first line in cell with multiple lines (ALT+Enter)
+- Bugfix: (ET) Work item 11608 - Fatal error running Tests/12serializedfileformat.php (PHPExcel 1.7.2)
+- Bugfix: (MBaker) Fixed various errors in the WORKDAY() and NETWORKDAYS() Date/Time functions (particularly related to holidays)
+- Bugfix: (ET) Work item 11660 - Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/SheetView.php:115
+- Bugfix: (ET) Work item 11551 - "Unrecognized token 39 in formula" with PHPExcel_Reader_Excel5 (occuring with add-in functions)
+- Bugfix: (ET) Work item 11668 - Excel2007 reader not reading PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+- Bugfix: (MBaker) Fix to the BESSELI(), BESSELJ(), BESSELK(), BESSELY() and COMPLEX() Engineering functions to use correct default values for parameters
+- Bugfix: (MBaker) Work item 11525 - DATEVALUE function not working for pure time values + allow DATEVALUE() function to handle partial dates (e.g. "1-Jun" or "12/2010")
+- Bugfix: (MBaker) Fix for empty quoted strings in formulae
+- Bugfix: (MBaker) Trap for division by zero in Bessel functions
+- Bugfix: (MBaker) Fix to OOCalc Reader to convert semi-colon (;) argument separator in formulae to a comma (,)
+- Bugfix: (ET) Work item 11693 - PHPExcel_Writer_Excel5_Parser cannot parse formula like =SUM(C$5:C5)
+- Bugfix: (MBaker) Fix to OOCalc Reader to handle dates that fall outside 32-bit PHP's date range
+- Bugfix: (ET) Work item 11692 - File->sys_get_temp_dir() can fail in safe mode
+- Bugfix: (ET) Work item 11727 - Sheet references in Excel5 writer do not work when referenced sheet title contains non-Latin symbols
+- Bugfix: (ET) Work item 11743 - Bug in HTML writer can result in missing rows in output
+- Bugfix: (ET) Work item 11674 - setShowGridLines(true) not working with PHPExcel_Writer_PDF
+- Bugfix: (ET) Work item 11836 - PHPExcel_Worksheet_RowIterator initial position incorrect
+- Bugfix: (ET) Work item 11835 - PHPExcel_Worksheet_HeaderFooterDrawing Strict Exception thrown (by jshaw86)
+- Bugfix: (ET) Work item 11850 - Parts of worksheet lost when there are embedded charts (Excel5 reader)
+- Bugfix: (MBaker) VLOOKUP() function error when lookup value is passed as a cell reference rather than an absolute value
+- Bugfix: (ET) Work item 12041 - First segment of Rich-Text not read correctly by PHPExcel_Reader_Excel2007
+- Bugfix: (MBaker) Work item 12048 - Fatal Error with getCell('name') when name matches the pattern for a cell reference
+- Bugfix: (ET) Work item 12039 - excel5 writer appears to be swapping image locations
+- Bugfix: (ET) Work item 11954 - Undefined index: host in ZipStreamWrapper.php, line 94 and line 101
+- Bugfix: (ET) Work item 11672 - BIFF8 File Format problem (too short COLINFO record)
+- Bugfix: (ET) Work item 12121 - Column width sometimes changed after read/write with Excel2007 reader/writer
+- Bugfix: (ET) Work item 11964 - Worksheet.php throws a fatal error when styling is turned off via setReadDataOnly on the reader
+- Bugfix: (MBaker) Work item 11851 - Checking for Circular References in Formulae
+ - Calculation Engine code now traps for cyclic references, raising an error or throwing an exception, or allows 1 or more iterations through cyclic references, based on a configuration setting
+- Bugfix: (ET) Work item 12244 - PNG transparency using Excel2007 writer
+- Bugfix: (ET) Work item 12221 - Custom readfilter error when cell formulas reference excluded cells (Excel5 reader)
+- Bugfix: (ET) Work item 12288 - Protection problem in XLS
+- Bugfix: (ET) Work item 12300 - getColumnDimension()->setAutoSize() incorrect on cells with Number Formatting
+- Bugfix: (ET) Work item 12378 - Notices reading Excel file with Add-in funcitons (PHPExcel_Reader_Excel5)
+- Bugfix: (ET) Work item 12380 - Excel5 reader not reading formulas with deleted sheet references
+- Bugfix: (ET) Work item 12404 - Named range (defined name) scope problems for in PHPExcel
+- Bugfix: (ET) Work item 12423 - PHP Parse error: syntax error, unexpected T_PUBLIC in PHPExcel/Calculation.php on line 3482
+- Bugfix: (ET) Work item 12505 - Named ranges don't appear in name box using Excel5 writer
+- Bugfix: (ET) Work item 12509 - Many merged cells + autoSize column -> slows down the writer
+- Bugfix: (ET) Work item 12539 - Incorrect fallback order comment in Shared/Strings.php ConvertEncoding()
+- Bugfix: (ET) Work item 12538 - IBM AIX iconv() will not work, should revert to mbstring etc. instead
+- Bugfix: (ET) Work item 12568 - Excel5 writer and mbstring functions overload
+- Bugfix: (MBaker) Work item 12672 - OFFSET needs to flattenSingleValue the $rows and $columns args
+- Bugfix: (MBaker) Work item 12546 - Formula with DMAX(): Notice: Undefined offset: 2 in ...\PHPExcel\Calculation.php on line 2365
+ - Note that the Database functions have not yet been implemented
+- Bugfix: (MBaker) Work item 12839 - Call to a member function getParent() on a non-object in Classes\\PHPExcel\\Calculation.php Title is required
+- Bugfix: (MBaker) Work item 12935 - Cyclic Reference in Formula
+- Bugfix: (MBaker) Work item 13025 - Memory error...data validation?
+
+
+2010/01/11 (v1.7.2):
+- General: (ET) Applied patch 4362
+- General: (ET) Applied patch 4363 (modified)
+- General: (MBaker) Work item 10874 - 1.7.1 Extremely Slow - Refactored PHPExcel_Calculation_Functions::flattenArray() method and set calculation cache timer default to 2.5 seconds
+- General: (MBaker) Allow formulae to contain line breaks
+- General: (ET) Work item 10910 - split() function deprecated in PHP 5.3.0
+- General: (ET) sys_get_temp_dir() requires PHP 5.2.1, not PHP 5.2 [provide fallback function for PHP 5.2.0]
+- General: (MBaker) Applied patch 4640 - Implementation of the ISPMT() Financial function by Matt Groves
+- General: (MBaker) Work item 11052 - Put the example of formula with more arguments in documentation
+- General: (MBaker) Improved accuracy for the GAMMAINV() Statistical Function
+- Feature: (ET) Work item 10409 - XFEXT record support to fix colors change from Excel5 reader, and copy/paste color change with Excel5 writer
+ - Excel5 reader reads RGB color information in XFEXT records for borders, font color and fill color
+- Feature: (MBaker) Work Item 2346 - Implement more Excel calculation functions
+ - Implemented the FVSCHEDULE(), XNPV(), IRR(), MIRR(), XIRR() and RATE() Financial functions
+ - Implemented the SUMPRODUCT() Mathematical function
+ - Implemented the ZTEST() Statistical Function
+- Feature: (ET) Work item 10919 - Multiple print areas in one sheet
+- Feature: (ET) Work item 10930 - Store calculated values in output by PHPExcel_Writer_Excel5
+- Feature: (ET) Work item 10939 - Sheet protection options in Excel5 reader/writer
+- Feature: (MBaker) Modification of the COUNT(), AVERAGE(), AVERAGEA(), DEVSQ, AVEDEV(), STDEV(), STDEVA(), STDEVP(), STDEVPA(), VARA() and VARPA() SKEW() and KURT() functions to correctly handle boolean values depending on whether they're passed in as values, values within a matrix or values within a range of cells.
+- Feature: (ET) Work item 9932 - Cell range selection
+- Feature: (MB) Work item 10266 - Root-relative path handling
+- Feature: (ET) Work item 11315 - Named Ranges not working with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 11206 - Excel2007 Reader fails to load Apache POI generated Excel
+- Bugfix: (MB) Work item 11154 - Number format is broken when system's thousands separator is empty
+- Bugfix: (MB) Work item 11401 - ReferenceHelper::updateNamedFormulas throws errors if oldName is empty
+- Bugfix: (MB) Work item 11296 - parse_url() fails to parse path to an image in xlsx
+- Bugfix: (ET) Work item 10876 - Workaround for iconv_substr() bug in PHP 5.2.0
+- Bugfix: (ET) Work item 10877 - 1 pixel error for image width and height with PHPExcel_Writer_Excel5
+- Bugfix: (MBaker) Fix to GEOMEAN() Statistical function
+- Bugfix: (ET) Work item 10884 - setValue('-') and setValue('.') sets numeric 0 instead of 1-character string
+- Bugfix: (ET) Work item 10885 - Row height sometimes much too low after read with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10888 - Diagonal border. Miscellaneous missing support.
+ - Constant PHPExcel_Style_Borders::DIAGONAL_BOTH added to support double-diagonal (cross)
+ - PHPExcel_Reader_Excel2007 not always reading diagonal borders (only recognizes 'true' and not '1')
+ - PHPExcel_Reader_Excel5 support for diagonal borders
+ - PHPExcel_Writer_Excel5 support for diagonal borders
+- Bugfix: (ET) Work item 10894 - Session bug: Fatal error: Call to a member function bindValue() on a non-object in ...\Classes\PHPExcel\Cell.php on line 217
+- Bugfix: (ET) Work item 10896 - Colors messed up saving twice with same instance of PHPExcel_Writer_Excel5 (regression since 1.7.0)
+- Bugfix: (ET) Work item 10917 - Method PHPExcel_Worksheet::setDefaultStyle is not working
+- Bugfix: (ET) Work item 10897 - PHPExcel_Reader_CSV::canRead() sometimes says false when it shouldn't
+- Bugfix: (ET) Work item 10922 - Changes in workbook not picked up between two saves with PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 10913 - Decimal and thousands separators missing in HTML and PDF output
+- Bugfix: (ET) Work item 10936 - Notices with PHPExcel_Reader_Excel5 and named array constants
+- Bugfix: (MBaker) Work item 10938 - Calculation engine limitation on 32-bit platform with integers > 2147483647
+- Bugfix: (ET) Work item 10959 - Shared(?) formulae containing absolute cell references not read correctly using Excel5 Reader
+- Bugfix: (MBaker) Work item 10962 - Warning messages with intersection operator involving single cell
+- Bugfix: (ET) Work item 10980 - Infinite loop in Excel5 reader caused by zero-length string in SST
+- Bugfix: (ET) Work item 10983 - Remove unnecessary cell sorting to improve speed by approx. 18% in HTML and PDF writers
+- Bugfix: (MBaker) Work item 10977 - Cannot read A1 cell content - OO_Reader
+- Bugfix: (ET) Work item 11000 - Transliteration failed, invalid encoding
+
+
+2009/11/02 (v1.7.1):
+- General: (ET) Work item 10687 - ereg() function deprecated in PHP 5.3.0
+- General: (MB) Work item 10739 - Writer Interface Inconsequence - setTempDir and setUseDiskCaching
+- General: (ET) Upgrade to TCPDF 4.8.009
+- Feature: (ET) Work item 7333 - Support for row and column styles (feature request)
+ - Basic implementation for Excel2007/Excel5 reader/writer
+- Feature: (ET) Work item 10459 - Hyperlink to local file in Excel5 reader/writer
+- Feature: (MB) Work item 10472 - Color Tab (Color Sheet's name)
+- Feature: (ET) Work item 10488 - Border style "double" support in PHPExcel_Writer_HTML
+- Feature: (ET) Work item 10492 - Multi-section number format support in HTML/PDF/CSV writers
+- Feature: (MBaker) - Some additional performance tweaks in the calculation engine
+- Feature: (MBaker) - Fix result of DB() and DDB() Financial functions to 2dp when in Gnumeric Compatibility mode
+- Feature: (MBaker) - Added AMORDEGRC(), AMORLINC() and COUPNUM() Financial function (no validation of parameters yet)
+- Feature: (MBaker) - Improved accuracy of TBILLEQ(), TBILLPRICE() and TBILLYIELD() Financial functions when in Excel or Gnumeric mode
+- Feature: (MBaker) - Added INDIRECT() Lookup/Reference function (only supports full addresses at the moment)
+- Feature: (MB) Work item 10498 - PHPExcel_Reader_CSV::canRead() improvements
+- Feature: (ET) Work item 10500 - Input encoding option for PHPExcel_Reader_CSV
+- Feature: (ET) Work item 10493 - Colored number format support, e.g. [Red], in HTML/PDF output
+- Feature: (ET) Work item 10559 - Color Tab (Color Sheet's name) [Excel5 reader/writer support]
+- Feature: (MBaker) Initial version of SYLK (slk) and Excel 2003 XML Readers (Cell data and basic cell formatting)
+- Feature: (MBaker) Initial version of Open Office Calc (ods) Reader (Cell data only)
+- Feature: (MBaker) Initial use of "pass by reference" in the calculation engine for ROW() and COLUMN() Lookup/Reference functions
+- Feature: (MBaker) Work item 2346 - COLUMNS() and ROWS() Lookup/Reference functions, and SUBSTITUTE() Text function
+- Feature: (ET) Work item 10502 - AdvancedValueBinder(): Re-enable zero-padded string-to-number conversion, e.g '0004' -> 4
+- Feature: (ET) Work item 10600 - Make PHP type match Excel datatype
+- Feature: (MB) Work item 10630 - Change first page number on header
+- Feature: (MB) Applied patch 3941
+- Feature: (MB,ET) Work item 10745 - Hidden sheets
+- Feature: (ET) Work item 10761 - mbstring fallback when iconv is broken
+- Feature: (MBaker) Added support for matrix/value comparisons (e.g. ={1,2;3,4}>=3 or 2<>{1,2;3,4}) - Note, can't yet handle comparison of two matrices
+- Feature: (MBaker) Improved handling for validation and error trapping in a number of functions
+- Feature: (MBaker) Improved support for fraction number formatting
+- Feature: (ET) Work item 10455 - Support Reading CSV with Byte Order Mark (BOM)
+- Feature: (ET) Work item 10860 - addExternalSheet() at specified index
+- Bugfix: (MBaker) Work item 10684 - Named range can no longer be passed to worksheet->getCell()
+- Bugfix: (ET) Work item 10455 - RichText HTML entities no longer working in PHPExcel 1.7.0
+- Bugfix: (ET) Work item 7610 - Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet [+ support for simultaneous scale/fitToPage]
+- Bugfix: (MB) Work item 10469 - Performance issue identified by profiling
+- Bugfix: (ET) Work item 10473 - setSelectedCell is wrong
+- Bugfix: (ET) Work item 10481 - Images get squeezed/stretched with (Mac) Verdana 10 Excel files using Excel5 reader/writer
+- Bugfix: (MBaker) Work item 10482 - Error in argument count for DATEDIF() function
+- Bugfix: (MBaker) Work item 10452 - updateFormulaReferences is buggy
+- Bugfix: (MB) Work item 10485 - CellIterator returns null Cell if onlyExistingCells is set and key() is in use
+- Bugfix: (MBaker) Work item 10453 - Wrong RegEx for parsing cell references in formulas
+- Bugfix: (MB) Work item 10486 - Optimisation subverted to devastating effect if IterateOnlyExistingCells is clear
+- Bugfix: (ET) Work item 10494 - Fatal error: Uncaught exception 'Exception' with message 'Unrecognized token 6C in formula'... with PHPExcel_Reader_Excel5
+- Bugfix: (MBaker) Work item 10490 - Fractions stored as text are not treated as numbers by PHPExcel's calculation engine
+- Bugfix: (ET) Work item 10503 - AutoFit (autosize) row height not working in PHPExcel_Writer_Excel5
+- Bugfix: (MBaker) Fixed problem with null values breaking the calculation stack
+- Bugfix: (ET) Work item 10524 - Date number formats sometimes fail with PHPExcel_Style_NumberFormat::toFormattedString, e.g. [$-40047]mmmm d yyyy
+- Bugfix: (MBaker) Fixed minor problem with DATEDIFF YM calculation
+- Bugfix: (MB) Applied patch 3695
+- Bugfix: (ET) Work item 10536 - setAutosize() and Date cells not working properly
+- Bugfix: (ET) Work item 10556 - Time value hour offset in output by HTML/PDF/CSV writers (system timezone problem)
+- Bugfix: (ET) Work item 10558 - Control characters 0x14-0x1F are not treated by PHPExcel
+- Bugfix: (ET) Work item 10560 - PHPExcel_Writer_Excel5 not working when open_basedir restriction is in effect
+- Bugfix: (MBaker) Work item 10563 - IF formula calculation problem in PHPExcel 1.7.0 (string comparisons)
+- Bugfix: (MBaker) Improved CODE() Text function result for UTF-8 characters
+- Bugfix: (ET) Work item 10568 - Empty rows are collapsed with HTML/PDF writer
+- Bugfix: (ET) Work item 10569 - Gaps between rows in output by PHPExcel_Writer_PDF (Upgrading to TCPDF 4.7.003)
+- Bugfix: (ET) Work item 10575 - Problem reading formulas (Excel5 reader problem with "fake" shared formulas)
+- Bugfix: (MBaker) Work item 10588 - Error type in formula: "_raiseFormulaError message is Formula Error: An unexpected error occured"
+- Bugfix: (ET) Work item 10599 - Miscellaneous column width problems in Excel5/Excel2007 writer
+- Bugfix: (ET) Work item 10615 - Reader/Excel5 'Unrecognized token 2D in formula' in latest version
+- Bugfix: (ET) Work item 10623 - on php 5.3 PHPExcel 1.7 Excel 5 reader fails in _getNextToken, token = 2C, throws exception
+- Bugfix: (ET) Work item 10617 - Fatal error when altering styles after workbook has been saved
+- Bugfix: (ET) Work item 10661 - Images vertically stretched or squeezed when default font size is changed (PHPExcel_Writer_Excel5)
+- Bugfix: (ET) Work item 10676 - Styles not read in "manipulated" Excel2007 workbook
+- Bugfix: (ET) Work item 10059 - Windows 7 says corrupt file by PHPExcel_Writer_Excel5 when opening in Excel
+- Bugfix: (MBaker) Work item 10708 - Calculations sometimes not working with cell references to other sheets
+- Bugfix: (ET) Work item 10706 - Problem with merged cells after insertNewRowBefore()
+- Bugfix: (MBaker) Applied patch 4023
+- Bugfix: (MBaker) Fix to SUMIF() and COUNTIF() Statistical functions for when condition is a match against a string value
+- Bugfix: (ET) Work item 10721 - PHPExcel_Cell::coordinateFromString should throw exception for bad string parameter
+- Bugfix: (ET) Work item 10723 - EucrosiaUPC (Thai font) not working with PHPExcel_Writer_Excel5
+- Bugfix: (MBaker) Improved the return of calculated results when the result value is an array
+- Bugfix: (MBaker) Allow calculation engine to support Functions prefixed with @ within formulae
+- Bugfix: (MBaker) Work item 10632 - Intersection operator (space operator) fatal error with calculation engine
+- Bugfix: (ET) Work item 10742 - Chinese, Japanese, Korean characters show as squares in PDF
+- Bugfix: (ET) Work item 10756 - sheet title allows invalid characters
+- Bugfix: (ET) Work item 10757 - Sheet!$A$1 as function argument in formula causes infinite loop in Excel5 writer
+- Bugfix: (MBaker) Work item 10740 - Cell range involving name not working with calculation engine - Modified calculation parser to handle range operator (:), but doesn't currently handle worksheet references with spaces or other non-alphameric characters, or trap erroneous references
+- Bugfix: (MBaker) Work item 10798 - DATE function problem with calculation engine (says too few arguments given)
+- Bugfix: (MBaker) Work item 10799 - Blank cell can cause wrong calculated value
+- Bugfix: (MBaker) Modified ROW() and COLUMN() Lookup/Reference Functions to return an array when passed a cell range, plus some additional work on INDEX()
+- Bugfix: (ET) Work item 10817 - Images not showing in Excel 97 using PHPExcel_Writer_Excel5 (patch by Jordi Gutiérrez Hermoso)
+- Bugfix: (ET) Work item 10785 - When figures are contained in the excel sheet, Reader was stopped
+- Bugfix: (MBaker) Work item 10818 - Formulas changed after insertNewRowBefore()
+- Bugfix: (ET) Work item 10825 - Cell range row offset problem with shared formulas using PHPExcel_Reader_Excel5
+- Bugfix: (MBaker) Work item 10832 - Warning: Call-time pass-by-reference has been deprecated
+- Bugfix: (ET) Work item 10849 - Image should "Move but don't size with cells" instead of "Move and size with cells" with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 10856 - Opening a Excel5 generated XLS in Excel 2007 results in header/footer entry not showing on input
+- Bugfix: (ET) Work item 10859 - addExternalSheet() not returning worksheet
+- Bugfix: (MBaker) Work item 10629 - Invalid results in formulas with named ranges
+
+
+2009/08/10 (v1.7.0):
+- General: (ET) Work item 9893 - Expand documentation: Number formats
+- General: (ET) Work item 9941 - Class 'PHPExcel_Cell_AdvancedValueBinder' not found
+- General: (MB) Work item 9960 - Change return type of date functions to PHPExcel_Calculation_Functions::RETURNDATE_EXCEL
+- Feature: (MBaker) - New RPN and stack-based calculation engine for improved performance of formula calculation
+ - Faster (anything between 2 and 12 times faster than the old parser, depending on the complexity and nature of the formula)
+ - Significantly more memory efficient when formulae reference cells across worksheets
+ - Correct behaviour when referencing Named Ranges that exist on several worksheets
+ - Support for Excel ^ (Exponential) and % (Percentage) operators
+ - Support for matrices within basic arithmetic formulae (e.g. ={1,2,3;4,5,6;7,8,9}/2)
+ - Better trapping/handling of NaN and infinity results (return #NUM! error)
+ - Improved handling of empty parameters for Excel functions
+ - Optional logging of calculation steps
+- Feature: (MBaker) - New calculation engine can be accessed independently of workbooks (for use as a standalone calculator)
+- Feature: (MBaker) Work Item 2346 - Implement more Excel calculation functions
+ - Initial implementation of the COUNTIF() and SUMIF() Statistical functions
+ - Added ACCRINT() Financial function
+- Feature: (MBaker) - Modifications to number format handling for dddd and ddd masks in dates, use of thousand separators even when locale only implements it for money, and basic fraction masks (0 ?/? and ?/?)
+- Feature: (ET) Work item 9794 - Support arbitrary fixed number of decimals in PHPExcel_Style_NumberFormat::toFormattedString()
+- Feature: (ET) Work item 6857 - Improving performance and memory on data dumps
+ - Various style optimizations (merging from branch wi6857-memory)
+ - Moving hyperlink and dataValidation properties from cell to worksheet for lower PHP memory usage
+- Feature: (MB) Work item 9869 - Provide fluent interfaces where possible
+- Feature: (ET) Work item 9899 - Make easy way to apply a border to a rectangular selection
+- Feature: (ET) Work item 9906 - Support for system window colors in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 9911 - Horizontal center across selection
+- Feature: (ET) Work item 9919 - Merged cells record, write to full record size in PHPExcel_Writer_Excel5
+- Feature: (MB) Work item 9895 - Add page break between sheets in exported PDF
+- Feature: (ET) Work item 9902 - Sanitization of UTF-8 input for cell values
+- Feature: (ET) Work item 9930 - Read cached calculated value with PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 9896 - Miscellaneous CSS improvements for PHPExcel_Writer_HTML
+- Feature: (ET) Work item 9947 - getProperties: setCompany feature request
+- Feature: (MB) Patch 2981 - Insert worksheet at a specified index
+- Feature: (MB) Patch 3018 - Change worksheet index
+- Feature: (MB) Patch 3039 - Readfilter for CSV reader
+- Feature: (ET) Work item 10172 - Check value of mbstring.func_overload when saving with PHPExcel_Writer_Excel5
+- Feature: (ET) Work item 10251 - Eliminate dependency of an include path pointing to class directory
+- Feature: (ET) Work item 10292 - Method for getting the correct reader for a certain file (contribution)
+- Feature: (ET) Work item 10287 - Choosing specific row in fromArray method
+- Feature: (ET) Work item 10319 - Shared formula support in PHPExcel_Reader_Excel5
+- Feature: (MB,ET) Work item 10345 - Right-to-left column direction in worksheet
+- Bugfix: (ET) Work item 9824 - PHPExcel_Reader_Excel5 not reading PHPExcel_Style_NumberFormat::FORMAT_NUMBER ('0')
+- Bugfix: (ET) Work item 9858 - Fractional row height in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 9846 - Fractional (decimal) numbers not inserted correctly when locale is other than English
+- Bugfix: (ET) Work item 9863 - Fractional calculated value in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 9830 - Locale aware decimal and thousands separator in exported formats HTML, CSV, PDF
+- Bugfix: (MB) Work item 9819 - Cannot Add Image with Space on its Name
+- Bugfix: (ET) Work item 9884 - Black line at top of every page in output by PHPExcel_Writer_PDF
+- Bugfix: (ET) Work item 9885 - Border styles and border colors not showing in HTML output (regression since 1.6.4)
+- Bugfix: (ET) Work item 9888 - Hidden screen gridlines setting in worksheet not read by PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9913 - Some valid sheet names causes corrupt output using PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 9934 - More than 32,767 characters in a cell gives corrupt Excel file
+- Bugfix: (ET) Work item 9937 - Images not getting copyied with the ->copy() function
+- Bugfix: (ET) Work item 9940 - Bad calculation of column width setAutoSize(true) function
+- Bugfix: (ET) Work item 9968 - Dates are sometimes offset by 1 day in output by HTML and PDF writers depending on system timezone setting
+- Bugfix: (ET) Work item 10003 - Wingdings symbol fonts not working with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 10010 - White space string prefix stripped by PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 10023 - The name of the Workbook stream MUST be "Workbook", not "Book"
+- Bugfix: (ET) Work item 10030 - Avoid message "Microsoft Excel recalculates formulas..." when closing xls file from Excel
+- Bugfix: (ET) Work item 10031 - Non-unique newline representation causes problems with LEN formula
+- Bugfix: (ET) Work item 10033 - Newline in cell not showing with PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
+- Bugfix: (ET) Work item 10046 - Rich-Text strings get prefixed by when output by HTML writer
+- Bugfix: (ET) Work item 10052 - Leading spaces do not appear in output by HTML/PDF writers
+- Bugfix: (MB) Work item 10061 - Empty Apache POI-generated file can not be read
+- Bugfix: (ET) Work item 10068 - Column width not scaling correctly with font size in HTML and PDF writers
+- Bugfix: (ET) Work item 10069 - Inaccurate row heights with HTML writer
+- Bugfix: (MB) Patch 2992 - Reference helper
+- Bugfix: (MBaker) - Excel 5 Named ranges should not be local to the worksheet, but accessible from all worksheets
+- Bugfix: (ET) Work item 10088 - Row heights are ignored by PHPExcel_Writer_PDF
+- Bugfix: (MB) Patch 3003 - Write raw XML
+- Bugfix: (ET) Work item 10098 - removeRow(), removeColumn() not always clearing cell values
+- Bugfix: (ET) Work item 10142 - Problem reading certain hyperlink records with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10143 - Hyperlink cell range read failure with PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 10149 - 'Column string index can not be empty.'
+- Bugfix: (ET) Work item 10204 - getHighestColumn() sometimes says there are 256 columns with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10220 - extractSheetTitle fails when sheet title contains exclamation mark (!)
+- Bugfix: (ET) Work item 10221 - setTitle() sometimes erroneously appends integer to sheet name
+- Bugfix: (ET) Work item 10229 - Mac BIFF5 Excel file read failure (missing support for Mac OS Roman character set)
+- Bugfix: (ET) Work item 10230 - BIFF5 header and footer incorrectly read by PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10259 - iconv notices when reading hyperlinks with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10252 - Excel5 reader OLE read failure with small Mac BIFF5 Excel files
+- Bugfix: (ET) Work item 10272 - Problem in reading formula : IF( IF ) with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10274 - Error reading formulas referencing external sheets with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10291 - Image horizontally stretched when default font size is increased (PHPExcel_Writer_Excel5)
+- Bugfix: (ET) Work item 10333 - Undefined offset in Reader\Excel5.php on line 3572
+- Bugfix: (MB) Work item 10340 - PDF output different then XLS (copied data)
+- Bugfix: (ET) Work item 10352 - Internal hyperlinks with UTF-8 sheet names not working in PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 10361 - String shared formula result read error with PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 10363 - Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/PageSetup.php:338
+- Bugfix: (ET) Work item 10355 - Using setLoadSheetsOnly fails if you do not use setReadDataOnly(true) and sheet is not the first sheet
+- Bugfix: (MB) Work item 10362 - getCalculatedValue() sometimes incorrect with IF formula and 0-values
+- Bugfix: (MBaker) Work Item 10198 - Excel Reader 2007 problem with "shared" formulae when "master" is an error
+- Bugfix: (MBaker) Work Item 10106 - Named Range Bug, using the same range name on different worksheets
+- Bugfix: (MBaker) Work Item 10004 - Java code in JAMA classes
+- Bugfix: (MBaker) Work Item 9659 - getCalculatedValue() not working with some formulas involving error types
+- Bugfix: (MBaker) Work Item 9447 - evaluation of both return values in an IF() statement returning an error if either result was an error, irrespective of the IF evaluation
+- Bugfix: (MBaker) Work Item 6203 - Power in formulas: new calculation engine no longer treats ^ as a bitwise XOR operator
+- Bugfix: (MBaker) - Bugfixes and improvements to many of the Excel functions in PHPExcel
+ - Added optional "places" parameter in the BIN2HEX(), BIN2OCT, DEC2BIN(), DEC2OCT(), DEC2HEX(), HEX2BIN(), HEX2OCT(), OCT2BIN() and OCT2HEX() Engineering Functions
+ - Trap for unbalanced matrix sizes in MDETERM() and MINVERSE() Mathematic and Trigonometric functions
+ - Fix for default characters parameter value for LEFT() and RIGHT() Text functions
+ - Fix for GCD() and LCB() Mathematical functions when the parameters include a zero (0) value
+ - Fix for BIN2OCT() Engineering Function for 2s complement values (which were returning hex values)
+ - Fix for BESSELK() and BESSELY() Engineering functions
+ - Fix for IMDIV() Engineering Function when result imaginary component is positive (wasn't setting the sign)
+ - Fix for ERF() Engineering Function when called with an upper limit value for the integration
+ - Fix to DATE() Date/Time Function for year value of 0
+ - Set ISPMT() function as category FINANCIAL
+ - Fix for DOLLARDE() and DOLLARFR() Financial functions
+ - Fix to EFFECT() Financial function (treating $nominal_rate value as a variable name rather than a value)
+ - Fix to CRITBINOM() Statistical function (CurrentValue and EssentiallyZero treated as constants rather than variables)
+ Note that an Error in the function logic can still lead to a permanent loop
+ - Fix to MOD() Mathematical function to work with floating point results
+ - Fix for QUOTIENT() Mathematical function
+ - Fix to HOUR(), MINUTE() and SECOND() Date/Time functions to return an error when passing in a floating point value of 1.0 or greater, or less than 0
+ - LOG() Function now correctly returns base-10 log when called with only one parameter, rather than the natural log as the default base
+ - Modified text functions to handle multibyte character set (UTF-8).
+
+
+2009/04/22 (v1.6.7):
+- General: (MB) Work item 9416 - Deprecate misspelled setStriketrough() and getStriketrough() methods
+- General: (MB) Work item 9526 - Performance improvement when saving file
+- Feature: (MB) Work item 9598 - Check that sheet title has maximum 31 characters
+- Feature: (MB, ET) Work item 9631 - True support for Excel built-in number format codes
+- Feature: (ET) Work item 9683 - Ability to read defect BIFF5 Excel file without CODEPAGE record
+- Feature: (MB) Work item 9701 - Auto-detect which reader to invoke
+- Feature: (ET) Work item 9214 - Deprecate insertion of dates using PHP-time (Unix time) [request for removal of feature]
+- Feature: (ET) Work item 9747 - Support for entering time values like '9:45', '09:45' using AdvancedValueBinder
+- Feature: (ET) Work item 9797 - DataType dependent horizontal alignment in HTML and PDF writer
+- Bugfix: (MB) Work item 9375 - Cloning data validation object causes script to stop
+- Bugfix: (ET) Work item 9400 - Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 9399 - Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 9437 - Row outline level not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 9452 - Occasional notices with PHPExcel_Reader_Excel5 when Excel file contains drawing elements
+- Bugfix: (ET) Work item 9453 - PHPExcel_Reader_Excel5 fails as a whole when workbook contains images other than JPEG/PNG
+- Bugfix: (ET) Work item 9444 - Excel5 writer checks for iconv but does not necessarily use it
+- Bugfix: (ET) Work item 9463 - Altering a style on copied worksheet alters also the original
+- Bugfix: (MB) Work item 9480 - Formulas are incorrectly updated when a sheet is renamed
+- Bugfix: (MB) Work item 9513 - PHPExcel_Worksheet::extractSheetTitle not treating single quotes correctly
+- Bugfix: (MB) Work item 9477 - PHP Warning raised in function array_key_exists
+- Bugfix: (MB) Work item 9599 - getAlignWithMargins() gives wrong value when using PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9600 - getScaleWithDocument() gives wrong value when using PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9630 - PHPExcel_Reader_Excel2007 not reading the first user-defined number format
+- Bugfix: (MB) Work item 9647 - Print area converted to uppercase after read with PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9661 - Incorrect reading of scope for named range using PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9690 - Error with pattern (getFillType) and rbg (getRGB)
+- Bugfix: (ET) Work item 9712 - AdvancedValueBinder affected by system timezone setting when inserting date values
+- Bugfix: (ET) Work item 9743 - PHPExcel_Reader_Excel2007 not reading value of active sheet index
+- Bugfix: (ET) Work item 9742 - getARGB() sometimes returns SimpleXMLElement object instead of string with PHPExcel_Reader_Excel2007
+- Bugfix: (ET) Work item 9731 - Negative image offset causes defects in 14excel5.xls and 20readexcel5.xlsx
+- Bugfix: (ET) Work item 9758 - HTML & PDF Writer not working with mergeCells (regression since 1.6.5)
+- Bugfix: (ET) Work item 9774 - Too wide columns with HTML and PDF writer
+- Bugfix: (MB) Work item 9775 - PDF and cyrillic fonts
+- Bugfix: (ET) Work item 9793 - Percentages not working correctly with HTML and PDF writers (shows 0.25% instead of 25%)
+- Bugfix: (ET) Work item 9791 - PHPExcel_Writer_HTML creates extra borders around cell contents using setUseInlineCss(true)
+- Bugfix: (ET) Work item 9784 - Problem with text wrap + merged cells in HTML and PDF writer
+- Bugfix: (ET) Work item 9814 - Adjacent path separators in include_path causing IOFactory to violate open_basedir restriction
+
+
+--------------------------------------------------------------------------------
+BREAKING CHANGE! In previous versions of PHPExcel up to and including 1.6.6,
+when a cell had a date-like number format code, it was possible to enter a date
+directly using an integer PHP-time without converting to Excel date format.
+
+Starting with PHPExcel 1.6.7 this is no longer supported. Refer to the developer
+documentation for more information on entering dates into a cell.
+--------------------------------------------------------------------------------
+
+
+2009/03/02 (v1.6.6):
+- General: (MB) Work item 9102 - Improve support for built-in number formats in PHPExcel_Reader_Excel2007
+- General: (ET) Work item 9281 - Source files are in both UNIX and DOS formats - changed to UNIX
+- General: (MB) Work item 9338 - Update documentation: Which language to write formulas in?
+- Feature: (ET) Work item 8817 - Ignore DEFCOLWIDTH records with value 8 in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 8847 - Support for width, height, offsetX, offsetY for images in PHPExcel_Reader_Excel5
+- Feature: (MB) Work item 8870 - Disk Caching in specific folder
+- Feature: (MBaker) Work item 2346 - Added SUMX2MY2, SUMX2PY2, SUMXMY2, MDETERM and MINVERSE Mathematical and Trigonometric Functions
+- Feature: (MBaker) Work item 2346 - Added CONVERT Engineering Function
+- Feature: (MBaker) Work item 2346 - Added DB, DDB, DISC, DOLLARDE, DOLLARFR, INTRATE, IPMT, PPMT, PRICEDISC, PRICEMAT and RECEIVED Financial Functions
+- Feature: (MBaker) Work item 2346 - Added ACCRINTM, CUMIPMT, CUMPRINC, TBILLEQ, TBILLPRICE, TBILLYIELD, YIELDDISC and YIELDMAT Financial Functions
+- Feature: (MBaker) Work item 2346 - Added DOLLAR Text Function
+- Feature: (MBaker) Work item 2346 - Added CORREL, COVAR, FORECAST, INTERCEPT, RSQ, SLOPE and STEYX Statistical Functions
+- Feature: (MBaker) Work item 2346 - Added PEARSON Statistical Functions as a synonym for CORREL
+- Feature: (MBaker) Work item 2346 - Added LINEST, LOGEST (currently only valid for stats = false), TREND and GROWTH Statistical Functions
+- Feature: (MBaker) Work item 2346 - Added RANK and PERCENTRANK Statistical Functions
+- Feature: (MBaker) Work item 2346 - Added ROMAN Mathematical Function (Classic form only)
+- Feature: (MB) Work item 8931 - Update documentation to show example of getCellByColumnAndRow($col, $row)
+- Feature: (MB) Work item 8770 - Implement worksheet, row and cell iterators
+- Feature: (MB) Work item 9001 - Support for arbitrary defined names (named range)
+- Feature: (MB, ET) Work item 9016 - Update formulas when sheet title / named range title changes
+- Feature: (MB) Work item 9103 - Ability to read cached calculated value
+- Feature: (MBaker, ET) Work item 8483 - Support for Excel 1904 calendar date mode (Mac)
+- Feature: (ET) Work item 9194 - PHPExcel_Writer_Excel5 improvements writing shared strings table
+- Feature: (ET) Work item 9248 - PHPExcel_Writer_Excel5 iconv fallback when mbstring extension is not enabled
+- Feature: (ET) Work item 9253 - UTF-8 support in font names in PHPExcel_Writer_Excel5
+- Feature: (MB) Work item 9215 - Implement value binding architecture
+- Feature: (MB) Work item 6742 - PDF writer not working with UTF-8
+- Feature: (ET) Work item 9355 - Eliminate duplicate style entries in multisheet workbook written by PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8810 - Redirect to client browser fails due to trailing white space in class definitions
+- Bugfix: (MB) Work item 8816 - Spurious column dimension element introduced in blank worksheet after using PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 8830 - Image gets slightly narrower than expected when using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8831 - Image laid over non-visible row gets squeezed in height when using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8860 - PHPExcel_Reader_Excel5 fails when there are 10 or more images in the workbook
+- Bugfix: (MB) Work item 8909 - Different header/footer images in different sheets not working with PHPExcel_Writer_Excel2007
+- Bugfix: (MB, ET) Work item 8924 - Fractional seconds disappear when using PHPExcel_Reader_Excel2007 and PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 7994 - Images not showing in OpenOffice when using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 9047 - Images not showing on print using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 9085 - PHPExcel_Writer_Excel5 maximum allowed record size 4 bytes too short
+- Bugfix: (MB) Work item 9119 - Not numeric strings are formatted as dates and numbers using worksheet's toArray method
+- Bugfix: (ET) Work item 9132 - Excel5 simple formula parsing error
+- Bugfix: (ET) Work item 9206 - Problems writing dates with CSV
+- Bugfix: (ET) Work item 9203 - PHPExcel_Reader_Excel5 reader fails with fatal error when reading group shapes
+- Bugfix: (ET) Work item 9231 - PHPExcel_Writer_Excel5 fails completely when workbook contains more than 57 colors
+- Bugfix: (ET) Work item 9244 - PHPExcel_Writer_PDF not compatible with autoload
+- Bugfix: (ET) Work item 9250 - Fatal error: Call to a member function getNestingLevel() on a non-object in PHPExcel/Reader/Excel5.php on line 690
+- Bugfix: (MB) Work item 9246 - Notices when running test 04printing.php on PHP 5.2.8
+- Bugfix: (MB) Work item 9294 - insertColumn() spawns creation of spurious RowDimension
+- BugFix: (MBaker) Work item 9296 - Fix declarations for methods in extended Trend classes
+- Bugfix: (MBaker) Work item 2346 - Fix to parameters for the FORECAST Statistical Function
+- Bugfix: (MB) Work item 7083 - PDF writer problems with cell height and text wrapping
+- Bugfix: (MBaker) Work Item 9337 - Fix test for calculated value in case the returned result is an array
+- Bugfix: (ET) Work Item 9354 - Column greater than 256 results in corrupt Excel file using PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 9351 - Excel Numberformat 0.00 results in non internal decimal places values in toArray() Method
+- Bugfix: (MB,ET) Work item 9356 - setAutoSize not taking into account text rotation
+- Bugfix: (ET) Work item 9372 - Call to undefined method PHPExcel_Worksheet_MemoryDrawing::getPath() in PHPExcel/Writer/HTML.php
+
+
+2009/01/05 (v1.6.5):
+- General: (MB) Applied patch 2063
+- General: (MB) Applied patch from work item 8073 - Optimise Shared Strings
+- General: (MB) Applied patch from work item 8074 - Optimise Cell Sorting
+- General: (MB) Applied patch from work item 8075 - Optimise Style Hashing
+- General: (ET) Applied patch from work item 8245 - UTF-8 enhancements
+- General: (ET) Applied patch from work item 8283 - PHPExcel_Writer_HTML validation errors against strict HTML 4.01 / CSS 2.1
+- General: (MB) Documented work items 6203 and 8110 in manual
+- General: (ET) Restructure package hierachy so classes can be found more easily in auto-generated API (from work item 8468)
+- General: (MB) Work item 8806 - Redirect output to a client's browser: Update recommendation in documentation
+- Feature: (ET) Work item 7897 - PHPExcel_Reader_Excel5 support for print gridlines
+- Feature: (ET) Work item 7899 - Screen gridlines support in Excel5 reader/writer
+- Feature: (MB, ET) Work item 7552 - Option for adding image to spreadsheet from image resource in memory
+- Feature: (ET) Work item 7862 - PHPExcel_Reader_Excel5 style support for BIFF5 files (Excel 5.0 - Excel 95)
+- Feature: (ET) Work item 7918 - PHPExcel_Reader_Excel5 support for user-defined colors and special built-in colors
+- Feature: (ET) Work item 7992 - Support for freeze panes in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 7996 - Support for header and footer margins in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 7997 - Support for active sheet index in Excel5 reader/writer
+- Feature: (MB) Work item 7991 - Freeze panes not read by PHPExcel_Reader_Excel2007
+- Feature: (MB, ET) Work item 7993 - Support for screen zoom level (feature request)
+- Feature: (ET) Work item 8012 - Support for default style in PHPExcel_Reader_Excel5
+- Feature: (MB) Work item 8094 - Apple iWork / Numbers.app incompatibility
+- Feature: (MB) Work item 7931 - Support "between rule" in conditional formatting
+- Feature: (MB) Work item 8308 - Comment size, width and height control (feature request)
+- Feature: (ET) Work item 8418 - Improve method for storing MERGEDCELLS records in PHPExcel_Writer_Excel5
+- Feature: (ET) Work item 8435 - Support for protectCells() in Excel5 reader/writer
+- Feature: (ET) Work item 8472 - Support for fitToWidth and fitToHeight pagesetup properties in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 8489 - Support for setShowSummaryBelow() and setShowSummaryRight() in PHPExcel_Writer_Excel5
+- Feature: (MB) Work item 8483 - Support for Excel 1904 calendar date mode (Mac)
+- Feature: (ET) Work item 7538 - Excel5 reader: Support for reading images (bitmaps)
+- Feature: (ET) Work item 8787 - Support for default style in PHPExcel_Writer_Excel5
+- Feature: (MBaker) Modified calculate() method to return either an array or the first value from the array for those functions that return arrays rather than single values (e.g the MMULT and TRANSPOSE function). This performance can be modified based on the $returnArrayAsType which can be set/retrieved by calling the setArrayReturnType() and getArrayReturnType() methods of the PHPExcel_Calculation class.
+- Feature: (MBaker) Work item 2346 - Added ERROR.TYPE Information Function, MMULT Mathematical and Trigonometry Function, and TRANSPOSE Lookup and Reference Function
+- Bugfix: (ET) Work item 7896 - setPrintGridlines(true) not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7907 - Incorrect mapping of fill patterns in PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7898 - setShowGridlines(false) not working with PHPExcel_Writer_Excel2007
+- Bugfix: (MB) Work item 7905 - getShowGridlines() gives inverted value when reading sheet with PHPExcel_Reader_Excel2007
+- Bugfix: (ET) Work item 7944 - User-defined column width becomes slightly larger after read/write with Excel5
+- Bugfix: (ET) Work item 7949 - Incomplete border style support in PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7928 - Conditional formatting "containsText" read/write results in MS Office Excel 2007 crash
+- Bugfix: (MB) Work item 7995 - All sheets are always selected in output when using PHPExcel_Writer_Excel2007
+- Bugfix: (MB) Work item 8013 - COLUMN function warning message during plain read/write
+- Bugfix: (MB) Work item 8155 - setValue(0) results in string data type '0'
+- Bugfix: (MB) Work item 8226 - Styles not removed when removing rows from sheet
+- Bugfix: (MB) Work item 8301 - =IF formula causes fatal error during $objWriter->save() in Excel2007 format
+- Bugfix: (ET) Work item 8333 - Exception thrown reading valid xls file: "Excel file is corrupt. Didn't find CONTINUE record while reading shared strings"
+- Bugfix: (ET) Work item 8320 - MS Outlook corrupts files generated by PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 8351 - Undefined method PHPExcel_Worksheet::setFreezePane() in ReferenceHelper.php on line 271
+- Bugfix: (MB) Work item 8401 - Ampersands (&), left and right angles (<, >) in Rich-Text strings leads to corrupt output using PHPExcel_Writer_Excel2007
+- Bugfix: (ET) Work item 8408 - Print header and footer not supporting UTF-8 in PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8463 - Vertical page breaks not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8476 - Missing support for accounting underline types in PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8482 - Infinite loops when reading corrupt xls file using PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 8566 - Sheet protection password not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8596 - PHPExcel_Style_NumberFormat::FORMAT_NUMBER ignored by PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8781 - PHPExcel_Reader_Excel5 fails a whole when workbook contains a chart
+- Bugfix: (ET) Work item 8788 - Occasional loss of column widths using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 8795 - Notices while reading formulas with deleted sheet references using PHPExcel_Reader_Excel5
+- Bugfix: (MB) Work item 8807 - Default style not read by PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 9341 - Blank rows occupy too much space in file generated by PHPExcel_Writer_Excel2007
+
+
+2008/10/27 (v1.6.4):
+- General: (ET) Work item 7882 - RK record number error in MS developer documentation: 0x007E should be 0x027E
+- Feature: (MBaker) Work item 7878 - getHighestColumn() returning "@" for blank worksheet causes corrupt output
+- Feature: (MBaker) Work item 2346 - Implement ROW and COLUMN Lookup/Reference Functions (when specified with a parameter)
+- Feature: (MBaker) Work item 2346 - Implement initial work on OFFSET Lookup/Reference Function (returning address rather than value at address)
+- Feature: (ET) Work item 7416 - Excel5 reader: Page margins
+- Feature: (ET) Work item 7417 - Excel5 reader: Header & Footer
+- Feature: (ET) Work item 7449 - Excel5 reader support for page setup (paper size etc.)
+- Feature: (MB) Work item 7445 - Improve speed and memory consumption of PHPExcel_Writer_CSV
+- Feature: (MB) Work item 7432 - Better recognition of number format in HTML, CSV, and PDF writer
+- Feature: (MB) Work item 7485 - Font support: Superscript and Subscript
+- Feature: (ET) Work item 7509 - Excel5 reader font support: Super- and subscript
+- Feature: (ET) Work item 7521 - Excel5 reader style support: Text rotation and stacked text
+- Feature: (ET) Work item 7530 - Excel5 reader: Support for hyperlinks
+- Feature: (MB, ET) Work item 7557 - Import sheet by request
+- Feature: (ET) Work item 7607 - PHPExcel_Reader_Excel5 support for page breaks
+- Feature: (ET) Work item 7622 - PHPExcel_Reader_Excel5 support for shrink-to-fit
+- Feature: (MB, ET) Work item 7675 - Support for error types
+- Feature: (ET) Work item 7388 - Excel5 reader true formula support
+- Feature: (ET) Work item 7701 - Support for named ranges (defined names) in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 7781 - Support for repeating rows and repeating columns (print titles) in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 7783 - Support for print area in PHPExcel_Reader_Excel5
+- Feature: (ET) Work item 7795 - Excel5 reader and writer support for horizontal and vertical centering of page
+- Feature: (MB) Applied patch 1962
+- Feature: (ET) Work item 7866 - Excel5 reader and writer support for hidden cells (formulas)
+- Feature: (MB, ET) Work item 7612 - Support for indentation in cells (feature request)
+- Feature: (MB, ET) Work item 7828 - Option for reading only specified interval of rows in a sheet
+- Bugfix: (MBaker) Work item 7367 - PHPExcel_Calculation_Functions::DATETIMENOW() and PHPExcel_Calculation_Functions::DATENOW() to force UTC
+- Bugfix: (MBaker) Work item 7395 - Modified PHPExcel_Shared_Date::FormattedPHPToExcel() and PHPExcel_Shared_Date::ExcelToPHP to force datatype for return values
+- Bugfix: (ET) Work item 7450 - Excel5 reader not producing UTF-8 strings with BIFF5 files
+- Bugfix: (MB) Work item 7470 - Array constant in formula gives run-time notice with Excel2007 writer
+- Bugfix: (MB) Work item 7494 - PHPExcel_Reader_Excel2007 setReadDataOnly(true) returns Rich-Text
+- Bugfix: (ET) Work item 7496 - PHPExcel_Reader_Excel5 setReadDataOnly(true) returns Rich-Text
+- Bugfix: (MB) Work item 7497 - Characters before superscript or subscript losing style
+- Bugfix: (MB) Work item 7507 - Subscript not working with HTML writer
+- Bugfix: (MB) Work item 7508 - DefaultColumnDimension not working on first column (A)
+- Bugfix: (MB) Work item 7527 - Negative numbers are stored as text in PHPExcel_Writer_2007
+- Bugfix: (ET) Work item 7531 - Text rotation and stacked text not working with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7536 - PHPExcel_Shared_Date::isDateTimeFormatCode erroneously says true
+- Bugfix: (MB) Work item 7559 - Different images with same filename in separate directories become duplicates
+- Bugfix: (ET) Work item 7568 - PHPExcel_Reader_Excel5 not returning sheet names as UTF-8 using for Excel 95 files
+- Bugfix: (MB) Work item 7575 - setAutoSize(true) on empty column gives column width of 10 using PHPExcel_Writer_Excel2007
+- Bugfix: (MB, ET) Work item 7573 - setAutoSize(true) on empty column gives column width of 255 using PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7514 - Worksheet_Drawing bug
+- Bugfix: (MB) Work item 7593 - getCalculatedValue() with REPT function causes script to stop
+- Bugfix: (MB) Work item 7594 - getCalculatedValue() with LEN function causes script to stop
+- Bugfix: (MB) Work item 7600 - Explicit fit-to-width (page setup) results in fit-to-height becoming 1
+- Bugfix: (MB) Work item 7610 - Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet
+- Bugfix: (MB) Work item 7516 - Conditional styles not read properly using PHPExcel_Reader_Excel2007
+- Bugfix: (MB) Work item 7611 - PHPExcel_Writer_2007: Default worksheet style works only for first sheet
+- Bugfix: (ET) Work item 6940 - Cannot Lock Cells using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7621 - Incorrect cell protection values found when using Excel5 reader
+- Bugfix: (ET) Work item 7623 - Default row height not working above highest row using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7637 - Default column width does not get applied when using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7642 - Broken support for UTF-8 string formula results in PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 7643 - UTF-8 sheet names not working with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7631 - getCalculatedValue() with ISNONTEXT function causes script to stop
+- Bugfix: (ET) Work item 7652 - Missing BIFF3 functions in PHPExcel_Writer_Excel5: USDOLLAR (YEN), FINDB, SEARCHB, REPLACEB, LEFTB, RIGHTB, MIDB, LENB, ASC, DBCS (JIS)
+- Bugfix: (ET) Work item 7663 - Excel5 reader doesn't read numbers correctly in 64-bit systems
+- Bugfix: (ET) Work item 7667 - Missing BIFF5 functions in PHPExcel_Writer_Excel5: ISPMT, DATEDIF, DATESTRING, NUMBERSTRING
+- Bugfix: (ET) Work item 7668 - Missing BIFF8 functions in PHPExcel_Writer_Excel5: GETPIVOTDATA, HYPERLINK, PHONETIC, AVERAGEA, MAXA, MINA, STDEVPA, VARPA, STDEVA, VARA
+- Bugfix: (MB) Work item 7657 - Wrong host value in PHPExcel_Shared_ZipStreamWrapper::stream_open()
+- Bugfix: (ET) Work item 7676 - PHPExcel_Reader_Excel5 not reading explicitly entered error types in cells
+- Bugfix: (ET) Work item 7678 - Boolean and error data types not preserved for formula results in PHPExcel_Reader_Excel5
+- Bugfix: (MB) Work item 7695 - PHPExcel_Reader_Excel2007 ignores cell data type
+- Bugfix: (ET) Work item 7712 - PHPExcel_Reader_Excel5 ignores cell data type
+- Bugfix: (ET) Work item 7587 - PHPExcel_Writer_Excel5 not aware of data type
+- Bugfix: (ET) Work item 7713 - Long strings sometimes truncated when using PHPExcel_Reader_Excel5
+- Bugfix: (ET) Work item 7727 - Direct entry of boolean or error type in cell not supported by PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 7714 - PHPExcel_Reader_Excel2007: Error reading cell with data type string, date number format, and numeric-like cell value
+- Bugfix: (ET) Work item 7735 - Row and column outlines (group indent level) not showing after using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7737 - Missing UTF-8 support in number format codes for PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7750 - Missing UTF-8 support with PHPExcel_Writer_Excel5 for explicit string in formula
+- Bugfix: (MB) Work item 7726 - Problem with class constants in PHPExcel_Style_NumberFormat
+- Bugfix: (ET) Work item 7758 - Sometimes errors with PHPExcel_Reader_Excel5 reading hyperlinks
+- Bugfix: (ET) Work item 7759 - Hyperlink in cell always results in string data type when using PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7771 - Excel file with blank sheet seen as broken in MS Office Excel 2007 when created by PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7785 - PHPExcel_Reader_Excel5: Incorrect reading of formula with explicit string containing (escaped) double-quote
+- Bugfix: (MB) Work item 7787 - getCalculatedValue() fails on formula with sheet name containing (escaped) single-quote
+- Bugfix: (MB) Work item 7786 - getCalculatedValue() fails on formula with explicit string containing (escaped) double-quote
+- Bugfix: (MB) Work item 7780 - Problems with simultaneous repeatRowsAtTop and repeatColumnsAtLeft using Excel2007 reader and writer
+- Bugfix: (ET) Work item 7802 - PHPExcel_Reader_Excel5: Error reading formulas with sheet reference containing special characters
+- Bugfix: (ET) Work item 7831 - Off-sheet references sheet!A1 not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7834 - Repeating rows/columns (print titles), print area not working with PHPExcel_Writer_Excel5
+- Bugfix: (ET) Work item 7849 - Formula having datetime number format shows as text when using PHPExcel_Writer_Excel5
+- Bugfix: (MBaker) Work item 7863 - Cannot set formula to hidden using applyFromArray()
+- Bugfix: (MBaker) Work item 7805 - HTML/PDF Writers limited to 26 columns by calculateWorksheetDimension (erroneous comparison in getHighestColumn() method)
+- Bugfix: (MB) Work item 7873 - Formula returning error type is lost when read by PHPExcel_Reader_Excel2007
+- Bugfix: (ET) Work item 7883 - PHPExcel_Reader_Excel5: Cell style lost for last column in group of blank cells
+- Bugfix: (MB) Work item 7886 - Column width sometimes collapses to auto size using Excel2007 reader/writer
+- Bugfix: (MB) Work item 9343 - Data Validation Formula = 0 crashes Excel
+
+
+2008/08/25 (v1.6.3):
+- Bugfix: (MBaker) Work item 7367 - Modified PHPExcel_Shared_Date::PHPToExcel() to force UTC
+- General: (MB) Applied patch 1629
+- General: (MB) Applied patch 1644
+- General: (MB) Work item 6485 - Implement repeatRow and repeatColumn in Excel5 writer
+- General: (MB) Work item 6838 - Remove scene3d filter in Excel2007 drawing
+- Feature: (MBaker) Work item 2346 - Implement CHOOSE and INDEX Lookup/Reference Functions
+- Feature: (MBaker) Work item 2346 - Implement CLEAN Text Functions
+- Feature: (MBaker) Work item 2346 - Implement YEARFRAC Date/Time Functions
+- Feature: (MB) Work item 6508 - Implement 2 options for print/show gridlines
+- Feature: (MB) Work item 7270 - Add VLOOKUP function (contribution)
+- Feature: (MB) Work item 7182 - Implemented: ShrinkToFit
+- Feature: (MB) Work item 7218 - Row heights not updated correctly when inserting new rows
+- Feature: (MB) Work item 7157 - Copy worksheets within the same workbook
+- Feature: (ET) Work item 7290 - Excel5 reader style support: horizontal and vertical alignment plus text wrap
+- Feature: (ET) Work item 7294 - Excel5 reader support for merged cells
+- Feature: (ET) Work item 7296 - Excel5 reader: Sheet Protection
+- Feature: (ET) Work item 7297 - Excel5 reader: Password for sheet protection
+- Feature: (ET) Work item 7299 - Excel5 reader: Column width
+- Feature: (ET) Work item 7301 - Excel5 reader: Row height
+- Feature: (ET) Work item 7304 - Excel5 reader: Font support
+- Feature: (ET) Work item 7324 - Excel5 reader: support for locked cells
+- Feature: (ET) Work item 7330 - Excel5 reader style support: Fill (background colors and patterns)
+- Feature: (ET) Work item 7332 - Excel5 reader style support: Borders (style and color)
+- Feature: (ET) Work item 7346 - Excel5 reader: Rich-Text support
+- Feature: (MB) Work item 7313 - Read Excel built-in number formats with Excel 2007 reader
+- Feature: (ET) Work item 7317 - Excel5 reader: Number format support
+- Feature: (MB) Work item 7362 - Creating a copy of PHPExcel object
+- Feature: (ET) Work item 7373 - Excel5 reader: support for row / column outline (group)
+- Feature: (MB) Work item 7380 - Implement default row/column sizes
+- Feature: (MB) Work item 7364 - Writer HTML - option to return styles and table separately
+- Feature: (ET) Work item 7393 - Excel5 reader: Support for remaining built-in number formats
+- Bugfix: (MBaker) Fixed rounding in HOUR MINUTE and SECOND Time functions, and improved performance for these
+- Bugfix: (MBaker) Fix to TRIM function
+- Bugfix: (MBaker) Fixed range validation in TIME Functions.php
+- Bugfix: (MBaker) EDATE and EOMONTH functions now return date values based on the returnDateType flag
+- Bugfix: (MBaker) Write date values that are the result of a calculation function correctly as Excel serialized dates rather than PHP serialized date values
+- Bugfix: (MB) Work item 6690 - Excel2007 reader not always reading boolean correctly
+- Bugfix: (MB) Work item 6275 - Columns above IZ
+- Bugfix: (MB) Work item 6853 - Other locale than English causes Excel2007 writer to produce broken xlsx
+- Bugfix: (MB) Work item 7061 - Typo: Number_fromat in NumberFormat.php
+- Bugfix: (MB) Work item 6865 - Bug in Worksheet_BaseDrawing setWidth()
+- Bugfix: (MB) Work item 6891 - PDF writer collapses column width for merged cells
+- Bugfix: (MB) Work item 6867 - Issues with drawings filenames
+- Bugfix: (MB) Work item 7073 - fromArray() local variable isn't defined
+- Bugfix: (MB) Work item 7276 - PHPExcel_Writer_Excel5->setTempDir() not passed to all classes involved in writing to a file
+- Bugfix: (MB) Work item 7277 - Excel5 reader not handling UTF-8 properly
+- Bugfix: (MB) Work item 7327 - If you write a 0 value in cell, cell shows as empty
+- Bugfix: (MB) Work item 7302 - Excel2007 writer: Row height ignored for empty rows
+- Bugfix: (MB) Work item 7281 - Excel2007 (comments related error)
+- Bugfix: (MB) Work item 7345 - Column width in other locale
+- Bugfix: (MB) Work item 7347 - Excel2007 reader not reading underlined Rich-Text
+- Bugfix: (ET) Work item 7357 - Excel5 reader converting booleans to strings
+- Bugfix: (MB) Work item 7365 - Recursive Object Memory Leak
+- Bugfix: (MB) Work item 7372 - Excel2007 writer ignoring row dimensions without cells
+- Bugfix: (ET) Work item 7382 - Excel5 reader is converting formatted numbers / dates to strings
+
+
+2008/06/23 (v1.6.2):
+- General: (MB) Work item 6088 - Document style array values
+- General: (MB) Applied patch 1195
+- General: (MB) Work item 6178 - Redirecting output to a client’s web browser - http headers
+- General: (MB) Work item 6187 - Improve worksheet garbage collection
+- General: (MBaker) Functions that return date values can now be configured to return as Excel serialized date/time, PHP serialized date/time, or a PHP date/time object.
+- General: (MBaker) Functions that explicitly accept dates as parameters now permit values as Excel serialized date/time, PHP serialized date/time, a valid date string, or a PHP date/time object.
+- General: (MBaker) Implement ACOSH, ASINH and ATANH functions for those operating platforms/PHP versions that don't include these functions
+- General: (MBaker) Implement ATAN2 logic reversing the arguments as per Excel
+- General: (MBaker) Additional validation of parameters for COMBIN
+- General: (MBaker) Fixed validation for CEILING and FLOOR when the value and significance parameters have different signs; and allowed default value of 1 or -1 for significance when in GNUMERIC compatibility mode
+- Feature: (MBaker) Work item 2346 - Implement ADDRESS, ISLOGICAL, ISTEXT and ISNONTEXT functions
+- Feature: (MBaker) Work item 2346 - Implement COMPLEX, IMAGINARY, IMREAL, IMARGUMENT, IMCONJUGATE, IMABS, IMSUB, IMDIV, IMSUM, IMPRODUCT, IMSQRT, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER IMCOS and IMSIN Engineering functions
+- Feature: (MBaker) Work item 2346 - Implement NETWORKDAYS and WORKDAY Date/Time functions
+- Feature: (MB) Work item 6100 - Make cell column AAA available
+- Feature: (MB) Work item 6095 - Mark particular cell as selected when opening Excel
+- Feature: (MB) Work item 6120 - Multiple sheets in PDF and HTML
+- Feature: (MB) Work item 6227 - Implement PHPExcel_ReaderFactory and PHPExcel_WriterFactory
+- Feature: (MB) Work item 6249 - Set image root of PHPExcel_Writer_HTML
+- Feature: (MB) Work item 6264 - Enable/disable calculation cache
+- Feature: (MB) Work item 6259 - PDF writer and multi-line text
+- Feature: (MB) Work item 6350 - Feature request - setCacheExpirationTime()
+- Feature: (JB) Work item 6370 - Implement late-binding mechanisms to reduce memory footprint
+- Feature: (JB) Work item 6430 - Implement shared styles
+- Feature: (MB) Work item 6391 - Copy sheet from external Workbook to active Workbook
+- Feature: (MB) Work item 6428 - Functions in Conditional Formatting
+- Bugfix: (MB) Work item 6096 - Default Style in Excel5
+- Bugfix: (MB) Work item 6150 - Numbers starting with '+' cause Excel 2007 errors
+- Bugfix: (MB) Work item 6092 - ExcelWriter5 is not PHP5 compatible, using it with E_STRICT results in a bunch of errors (applied patches)
+- Bugfix: (MB) Work item 6179 - Error Reader Excel2007 line 653 foreach ($relsDrawing->Relationship as $ele)
+- Bugfix: (MB) Work item 6229 - Worksheet toArray() screws up DATE
+- Bugfix: (MB) Work item 6253 - References to a Richtext cell in a formula
+- Bugfix: (MB) Work item 6285 - insertNewColumnBefore Bug
+- Bugfix: (MB) Work item 6319 - Error reading Excel2007 file with shapes
+- Bugfix: (MBaker) Work item 6302 - Determine whether date values need conversion from PHP dates to Excel dates before writing to file, based on the data type (float or integer)
+- Bugfix: (MBaker) Fixes to DATE function when it is given negative input parameters
+- Bugfix: (MB) Work item 6347 - PHPExcel handles empty cells other than Excel
+- Bugfix: (MB) Work item 6348 - PHPExcel handles 0 and "" as being the same
+- Bugfix: (MB) Work item 6357 - Problem Using Excel2007 Reader for Spreadsheets containing images
+- Bugfix: (MB) Work item 6359 - ShowGridLines ignored when reading/writing Excel 2007
+- Bugfix: (MB) Work item 6426 - Bug With Word Wrap in Excel 2007 Reader
+
+
+2008/04/28 (v1.6.1):
+- General: (MB) Work item 5532 - Fix documentation printing
+- General: (MB) Work item 5586 - Memory usage improvements
+- General: (MB) Applied patch 990
+- General: (MB) Applied patch 991
+- Feature: (BM) Work item 2841 - Implement PHPExcel_Reader_Excel5
+- Feature: (MB) Work item 5564 - Implement "toArray" and "fromArray" method
+- Feature: (MB) Work item 5665 - Read shared formula
+- Feature: (MB) Work item 5681 - Read image twoCellAnchor
+- Feature: (MB) Work item 4446 - &G Image as bg for headerfooter
+- Feature: (MB) Work item 5834 - Implement page layout functionality for Excel5 format
+- Feature: (MB) Work item 6039 - Feature request: PHPExcel_Writer_PDF
+- Bugfix: (MB) Work item 5517 - DefinedNames null check
+- Bugfix: (MB) Work item 5463 - Hyperlinks should not always have trailing slash
+- Bugfix: (MB) Work item 5592 - Saving Error - Uncaught exception (#REF! named range)
+- Bugfix: (MB) Work item 5634 - Error when creating Zip file on Linux System (Not Windows)
+- Bugfix: (MB) Work item 5876 - Time incorrecly formated
+- Bugfix: (MB) Work item 5914 - Conditional formatting - second rule not applied
+- Bugfix: (MB) Work item 5978 - PHPExcel_Reader_Excel2007 cannot load PHPExcel_Shared_File
+- Bugfix: (MB) Work item 6020 - Output redirection to web browser
+
+
+2008/02/14 (v1.6.0):
+- General: (MB) Work item 3156 - Use PHPExcel datatypes in formula calculation
+- Feature: (MB) Work item 5019 - Center on page when printing
+- Feature: (MB) Work item 5099 - Hyperlink to other spreadsheet
+- Feature: (MB) Work item 5104 - Set the print area of a worksheet
+- Feature: (MB) Work item 5118 - Read "definedNames" property of worksheet
+- Feature: (MB) Work item 5338 - Set default style for all cells
+- Feature: (MB) Work item 4216 - Named Ranges
+- Feature: (MB) Work item 5398 - Implement worksheet references (Sheet1!A1)
+- Bugfix: (MB) Work item 4967 - Redirect output to a client's web browser
+- Bugfix: (MB) Work item 5008 - "File Error: data may have been lost." seen in Excel 2007 and Excel 2003 SP3 when opening XLS file
+- Bugfix: (MB) Work item 5165 - Bug in style's getHashCode()
+- Bugfix: (MB) Work item 5165 - PHPExcel_Reader not correctly reading numeric values
+- Bugfix: (MB) Work item 5324 - Text rotation is read incorrectly
+- Bugfix: (MB) Work item 5326 - Enclosure " and data " result a bad data : \" instead of ""
+- Bugfix: (MB) Work item 5332 - Formula parser - IF statement returning array instead of scalar
+- Bugfix: (MB) Work item 5351 - setFitToWidth(nbpage) & setFitToWidth(nbpage) work partially
+- Bugfix: (MB) Work item 5361 - Worksheet::setTitle() causes unwanted renaming
+- Bugfix: (MB) Work item 5407 - Hyperlinks not working. Results in broken xlsx file.
+
+
+2007/12/24 (v1.5.5):
+- General: (MB) Work item 4135 - Grouping Rows
+- General: (MB) Work item 4427 - Semi-nightly builds
+- Feature: (MB) Work item 3155 - Implement "date" datatype
+- Feature: (MB) Work item 4150 - Date format not honored in CSV writer
+- Feature: (MB) Work item 4199 - RichText and sharedStrings
+- Feature: (MB) Work item 2346 - Implement more Excel calculation functions
+ - Addition of DATE, DATEDIF, DATEVALUE, DAY, DAYS360
+- Feature: (MBaker) Work item 2346 - Implement more Excel calculation functions
+ - Addition of AVEDEV, HARMEAN and GEOMEAN
+ - Addition of the BINOMDIST (Non-cumulative only), COUNTBLANK, EXPONDIST, FISHER, FISHERINV, NORMDIST, NORMSDIST, PERMUT, POISSON (Non-cumulative only) and STANDARDIZE Statistical Functions
+ - Addition of the CEILING, COMBIN, EVEN, FACT, FACTDOUBLE, FLOOR, MULTINOMIAL, ODD, ROUNDDOWN, ROUNDUP, SIGN, SQRTPI and SUMSQ Mathematical Functions
+ - Addition of the NORMINV, NORMSINV, CONFIDENCE and SKEW Statistical Functions
+ - Addition of the CRITBINOM, HYPGEOMDIST, KURT, LOGINV, LOGNORMDIST, NEGBINOMDIST and WEIBULL Statistical Functions
+ - Addition of the LARGE, PERCENTILE, QUARTILE, SMALL and TRIMMEAN Statistical Functions
+ - Addition of the BIN2HEX, BIN2OCT, DELTA, ERF, ERFC, GESTEP, HEX2BIN, HEX2DEC, HEX2OCT, OCT2BIN and OCT2HEX Engineering Functions
+ - Addition of the CHIDIST, GAMMADIST and GAMMALN Statistical Functions
+ - Addition of the GCD, LCM, MROUND and SUBTOTAL Mathematical Functions
+ - Addition of the LOWER, PROPER and UPPER Text Functions
+ - Addition of the BETADIST and BETAINV Statistical Functions
+ - Addition of the CHIINV and GAMMAINV Statistical Functions
+ - Addition of the SERIESSUM Mathematical Function
+ - Addition of the CHAR, CODE, FIND, LEN, REPT, SEARCH, T, TRIM Text Functions
+ - Addition of the FALSE and TRUE Boolean Functions
+ - Addition of the TDIST and TINV Statistical Functions
+ - Addition of the EDATE, EOMONTH, YEAR, MONTH, TIME, TIMEVALUE, HOUR, MINUTE, SECOND, WEEKDAY, WEEKNUM, NOW, TODAY and Date/Time Function
+ - Addition of the BESSELI, BESSELJ, BESSELK and BESSELY Engineering Functions
+ - Addition of the SLN and SYD Financial Functions
+ - reworked MODE calculation to handle floating point numbers
+ - Improved error trapping for invalid input values
+ - Fix to SMALL, LARGE, PERCENTILE and TRIMMEAN to eliminate non-numeric values
+ - Added CDF to BINOMDIST and POISSON
+ - Fix to a potential endless loop in CRITBINOM, together with other bugfixes to the algorithm
+ - Fix to SQRTPI so that it will work with a real value parameter rather than just integers
+ - Trap for passing negative values to FACT
+ - Improved accuracy of the NORMDIST cumulative function, and of the ERF and ERFC functions
+ - Replicated Excel data-type and error handling for BIN, DEC, OCT and HEX conversion functions
+ - Replicated Excel data-type and error handling for AND and OR Boolean functions
+ - Bugfix to MROUND
+ - Rework of the DATE, DATEVALUE, DAY, DAYS360 and DATEDIF date/Time functions to use Excel dates rather than straight PHP dates
+ - Rework of the AND, OR Boolean functions to ignore string values
+ - Rework of the BIN2DEC, BIN2HEX, BIN2OCT, DEC2BIN, DEC2HEX, DEC2OCT Engineering functions to handle two's complement
+ - Excel, Gnumeric and OpenOffice Calc compatibility flag for functions
+ Note, not all functions have yet been written to work with the Gnumeric and OpenOffice Calc compatibility flags
+ - 1900 or 1904 Calendar flag for date functions
+ - Reworked ExcelToPHP date method to handle the Excel 1900 leap year
+ Note that this will not correctly return values prior to 13-Dec-1901 20:45:52 as this is the minimum value that PHP date serial values can handle. If you need to work with dates prior to this, then an ExcelToPHPObject method has been added which will work correctly with values between Excel's 1900 calendar base date of 1-Jan-1900, and 13-Dec-1901
+ - Addition of ExcelToPHPObject date method to return a PHP DateTime object from an Excel date serial value
+ - PHPToExcel method modified to accept either PHP date serial numbers or PHP DateTime objects
+ - Addition of FormattedPHPToExcel which will accept a date and time broken to into year, month, day, hour, minute, second and return an Excel date serial value
+- Feature: (MB) Work item 4485 - Control characters in Excel 2007
+- Feature: (MB) Work item 4796 - BaseDrawing::setWidthAndHeight method request
+- Feature: (MB) Work item 4798 - Page Setup -> Print Titles -> Sheet -> 'Rows to repeat at top'
+- Feature: (MB) Work item 4433 - Comment functionality
+- Bugfix: (MB) Work item 4124 - Undefined variable in PHPExcel_Writer_Serialized
+- Bugfix: (MB) Work item 4125 - Notice: Object of class PHPExcel_RichText could not be converted to int
+- Bugfix: (MB) Work item 4126 - Excel5Writer: utf8 string not converted to utf16
+- Bugfix: (MB) Work item 4180 - PHPExcel_RichText and autosize
+- Bugfix: (MB) Work item 4574 - Excel5Writer produces broken xls files after change mentioned in work item 4126
+- Bugfix: (MB) Work item 4797 - Small bug in PHPExcel_Reader_Excel2007 function _readStyle
+
+
+2007/10/23 (v 1.5.0):
+- General: (MB) Work item 3265 - Refactor PHPExcel Drawing
+- Feature: (CS) Work item 3079 - Update Shared/OLE.php to latest version from PEAR
+- Feature: (MB) Work item 3217 - Excel2007 vs Excel2003 compatibility pack
+- Feature: (MB) Work item 3234 - Cell protection (lock/unlock)
+- Feature: (MB) Work item 3543 - Create clickable links (hyperlinks)
+- Feature: (MB) Work item 3241 - Additional page setup parameters
+- Feature: (MB) Work item 3300 - Make temporary file path configurable (Excel5)
+- Feature: (MB) Work item 3306 - Small addition to applyFromArray for font
+- Feature: (MB) Work item 3373 - Better feedback when save of file is not possible
+- Bugfix: (MB) Work item 3181 - Text Rotation
+- Bugfix: (MB) Work item 3237 - Small bug in Page Orientation
+- Bugfix: (MB) Work item 3812 - insertNewColumnBeforeByColumn undefined
+- Bugfix: (MB) Work item 3893 - Sheet references not working in formula (Excel5 Writer)
+
+
+2007/08/23 (v 1.4.5):
+- General: (MB) Work item 3003 - Class file endings
+- General: (MB) Work item 3081 - Different calculation engine improvements
+- General: (MB) Work item 3082 - Different improvements in PHPExcel_Reader_Excel2007
+- General: (MB) Work item 3146 - Set XML indentation in PHPExcel_Writer_Excel2007
+- Feature: (MB) Work item 3159 - Optionally store temporary Excel2007 writer data in file instead of memory
+- Feature: (MB) Work item 3063 - Implement show/hide gridlines
+- Feature: (MB) Work item 3064 - Implement option to read only data
+- Feature: (MB) Work item 3080 - Optionally disable formula precalculation
+- Feature: (MB) Work item 3154 - Explicitly set cell datatype
+- Feature: (MBaker) Work item 2346 - Implement more Excel calculation functions
+ - Addition of MINA, MAXA, COUNTA, AVERAGEA, MEDIAN, MODE, DEVSQ, STDEV, STDEVA, STDEVP, STDEVPA, VAR, VARA, VARP and VARPA Excel Functions
+ - Fix to SUM, PRODUCT, QUOTIENT, MIN, MAX, COUNT and AVERAGE functions when cell contains a numeric value in a string datatype, bringing it in line with MS Excel behaviour
+- Bugfix: (MB) Work item 2881 - File_exists on ZIP fails on some installations
+- Bugfix: (MB) Work item 2879 - Argument in textRotation should be -90..90
+- Bugfix: (MB) Work item 2883 - Excel2007 reader/writer not implementing OpenXML/SpreadsheetML styles 100% correct
+- Bugfix: (MB) Work item 2513 - Active sheet index not read/saved
+- Bugfix: (MB) Work item 2935 - Print and print preview of generated XLSX causes Excel2007 to crash
+- Bugfix: (MB) Work item 2952 - Error in Calculations - COUNT() function
+- Bugfix: (MB) Work item 3002 - HTML and CSV writer not writing last row
+- Bugfix: (MB) Work item 3017 - Memory leak in Excel5 writer
+- Bugfix: (MB) Work item 3044 - Printing (PHPExcel_Writer_Excel5)
+- Bugfix: (MB) Work item 3046 - Problems reading zip://
+- Bugfix: (MB) Work item 3047 - Error reading conditional formatting
+- Bugfix: (MB) Work item 3067 - Bug in Excel5 writer (storePanes)
+- Bugfix: (MB) Work item 3077 - Memory leak in PHPExcel_Style_Color
+
+
+2007/07/23 (v 1.4.0):
+- General: (MB) Work item 2687 - Coding convention / code cleanup
+- General: (MB) Work item 2717 - Use set_include_path in tests
+- General: (MB) Work item 2812 - Move PHPExcel_Writer_Excel5 OLE to PHPExcel_Shared_OLE
+- Feature: (MB) Work item 2679 - Hide/Unhide Column or Row
+- Feature: (MB) Work item 2271 - Implement multi-cell styling
+- Feature: (MB) Work item 2720 - Implement CSV file format (reader/writer)
+- Feature: (MB) Work item 2845 - Implement HTML file format
+- Bugfix: (MB) Work item 2513 - Active sheet index not read/saved
+- Bugfix: (MB) Work item 2678 - Freeze Panes with PHPExcel_Writer_Excel5
+- Bugfix: (MB) Work item 2680 - OLE.php
+- Bugfix: (MB) Work item 2736 - Copy and pasting multiple drop-down list cells breaks reader
+- Bugfix: (MB) Work item 2775 - Function setAutoFilterByColumnAndRow takes wrong arguments
+- Bugfix: (MB) Work item 2858 - Simplexml_load_file fails on ZipArchive
+
+
+2007/06/27 (v 1.3.5):
+- General: (MB) Work item 15 - Documentation
+- Feature: (JV) PHPExcel_Writer_Excel5
+- Feature: (JV) PHPExcel_Reader_Excel2007: Image shadows
+- Feature: (MB) Work item 2385 - Data validation
+- Feature: (MB) Work item 187 - Implement richtext strings
+- Bugfix: (MB) Work item 2443 - Empty relations when adding image to any sheet but the first one
+- Bugfix: (MB) Work item 2536 - Excel2007 crashes on print preview
+
+
+2007/06/05 (v 1.3.0):
+- General: (MB) Work item 1942 - Create PEAR package
+- General: (MB) Work item 2331 - Replace *->duplicate() by __clone()
+- Feature: (JV) PHPExcel_Reader_Excel2007: Column auto-size, Protection, Merged cells, Wrap text, Page breaks, Auto filter, Images
+- Feature: (MB) Work item 245 - Implement "freezing" panes
+- Feature: (MB) Work item 2273 - Cell addressing alternative
+- Feature: (MB) Work item 2270 - Implement cell word-wrap attribute
+- Feature: (MB) Work item 2282 - Auto-size column
+- Feature: (MB) Work item 241 - Implement formula calculation
+- Feature: (MB) Work item 2375 - Insert/remove row/column
+- Bugfix: (MB) Work item 1931 - PHPExcel_Worksheet::getCell() should not accept absolute coordinates
+- Bugfix: (MB) Work item 2272 - Cell reference without row number
+- Bugfix: (MB) Work item 2276 - Styles with same coordinate but different worksheet
+- Bugfix: (MB) Work item 2290 - PHPExcel_Worksheet->getCellCollection() usort error
+- Bugfix: (SS) Work item 2353 - Bug in PHPExcel_Cell::stringFromColumnIndex
+- Bugfix: (JV) Work item 2353 - Reader: numFmts can be missing, use cellStyleXfs instead of cellXfs in styles
+
+
+2007/04/26 (v 1.2.0):
+- General: (MB) Stringtable attribute "count" not necessary, provides wrong info to Excel sometimes...
+- General: (MB) Updated tests to address more document properties
+- General: (MB) Some refactoring in PHPExcel_Writer_Excel2007_Workbook
+- General: (MB) New package: PHPExcel_Shared
+- General: (MB) Password hashing algorithm implemented in PHPExcel_Shared_PasswordHasher
+- General: (MB) Moved pixel conversion functions to PHPExcel_Shared_Drawing
+- General: (MB) Work item 244 - Switch over to LGPL license
+- General: (MB) Work item 5 - Include PHPExcel version in file headers
+- Feature: (MB) Work item 6 - Autofilter
+- Feature: (MB) Work item 7 - Extra document property: keywords
+- Feature: (MB) Work item 8 - Extra document property: category
+- Feature: (MB) Work item 9 - Document security
+- Feature: (MB) Work item 10 - PHPExcel_Writer_Serialized and PHPExcel_Reader_Serialized
+- Feature: (MB) Work item 11 - Alternative syntax: Addressing a cell
+- Feature: (MB) Work item 12 - Merge cells
+- Feature: (MB) Work item 13 - Protect ranges of cells with a password
+- Bugfix: (JV) Work item 14 - (style/fill/patternFill/fgColor or bgColor can be empty)
+
+
+2007/03/26 (v 1.1.1):
+- Bugfix: (MB) Work item 1250 - Syntax error in "Classes/PHPExcel/Writer/Excel2007.php" on line 243
+- General: (MB) Work item 1282 - Reader should check if file exists and throws an exception when it doesn't
+
+
+2007/03/22 (v 1.1.0):
+- Changed filenames of tests
+- Bugfix: (MB) Work item 836 - Style information lost after passing trough Excel2007_Reader
+- Bugfix: (MB) Work item 913 - Number of columns > AZ fails fixed in PHPExcel_Cell::columnIndexFromString
+- General: (MB) Added a brief file with installation instructions
+- Feature: (MB) Page breaks (horizontal and vertical)
+- Feature: (MB) Image shadows
+
+
+
+2007/02/22 (v 1.0.0):
+- Changelog now includes developer initials
+- Bugfix: (JV) PHPExcel->removeSheetByIndex now re-orders sheets after deletion, so no array indexes are lost
+- Bugfix: (JV) PHPExcel_Writer_Excel2007_Worksheet::_writeCols() used direct assignment to $pSheet->getColumnDimension('A')->Width instead of $pSheet->getColumnDimension('A')->setWidth()
+- Bugfix: (JV) DocumentProperties used $this->LastModifiedBy instead of $this->_lastModifiedBy.
+- Bugfix: (JV) Only first = should be removed when writing formula in PHPExcel_Writer_Excel2007_Worksheet.
+- General: (JV) Consistency of method names to camelCase
+- General: (JV) Updated tests to match consistency changes
+- General: (JV) Detection of mime-types now with image_type_to_mime_type()
+- General: (JV) Constants now hold string value used in Excel 2007
+- General: (MB) Fixed folder name case (WorkSheet -> Worksheet)
+- Feature: (MB) PHPExcel classes (not the Writer classes) can be duplicated, using a duplicate() method.
+- Feature: (MB) Cell styles can now be duplicated to a range of cells using PHPExcel_Worksheet->duplicateStyle()
+- Feature: (MB) Conditional formatting
+- Feature: (JV) Reader for Excel 2007 (not supporting full specification yet!)
+
+
+
+2007/01/31 (v 1.0.0 RC):
+- Project name has been changed to PHPExcel
+- Project homepage is now http://www.codeplex.com/PHPExcel
+- Started versioning at number: PHPExcel 1.0.0 RC
+
+
+
+2007/01/22:
+- Fixed some performance issues on large-scale worksheets (mainly loops vs. indexed arrays)
+- Performance on creating StringTable has been increased
+- Performance on writing Excel2007 worksheet has been increased
+
+
+
+2007/01/18:
+- Images can now be rotated
+- Fixed bug: When drawings have full path specified, no mime type can be deducted
+- Fixed bug: Only one drawing can be added to a worksheet
+
+
+
+2007/01/12:
+- Refactoring of some classes to use ArrayObject instead of array()
+- Cell style now has support for number format (i.e. #,##0)
+- Implemented embedding images
+
+
+
+2007/01/02:
+- Cell style now has support for fills, including gradient fills
+- Cell style now has support for fonts
+- Cell style now has support for border colors
+- Cell style now has support for font colors
+- Cell style now has support for alignment
+
+
+
+2006/12/21:
+- Support for cell style borders
+- Support for cell styles
+- Refactoring of Excel2007 Writer into multiple classes in package SpreadSheet_Writer_Excel2007
+- Refactoring of all classes, changed public members to public properties using getter/setter
+- Worksheet names are now unique. On duplicate worksheet names, a number is appended.
+- Worksheet now has parent SpreadSheet object
+- Worksheet now has support for page header and footer
+- Worksheet now has support for page margins
+- Worksheet now has support for page setup (only Paper size and Orientation)
+- Worksheet properties now accessible by using getProperties()
+- Worksheet now has support for row and column dimensions (height / width)
+- Exceptions thrown have a more clear description
+
+
+
+Initial version:
+- Create a Spreadsheet object
+- Add one or more Worksheet objects
+- Add cells to Worksheet objects
+- Export Spreadsheet object to Excel 2007 OpenXML format
+- Each cell supports the following data formats: string, number, formula, boolean.
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..8aa4480
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,43 @@
+{
+ "name": "phpoffice/phpexcel",
+ "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
+ "keywords": ["PHP","Excel","OpenXML","xlsx","xls","spreadsheet"],
+ "homepage": "https://github.com/PHPOffice/PHPExcel",
+ "type": "library",
+ "license": "LGPL-2.1",
+ "authors": [
+ {
+ "name": "Maarten Balliauw",
+ "homepage": "http://blog.maartenballiauw.be"
+ },
+ {
+ "name": "Mark Baker",
+ "homepage": "http://markbakeruk.net"
+ },
+ {
+ "name": "Franck Lefevre",
+ "homepage": "http://rootslabs.net"
+ },
+ {
+ "name": "Erik Tilt"
+ }
+ ],
+ "require": {
+ "php": "^5.2|^7.0",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "ext-xmlwriter": "*"
+ },
+ "require-dev": {
+ "squizlabs/php_codesniffer": "2.*"
+ },
+ "recommend": {
+ "ext-zip": "*",
+ "ext-gd": "*"
+ },
+ "autoload": {
+ "psr-0": {
+ "PHPExcel": "Classes/"
+ }
+ }
+}
diff --git a/install.txt b/install.txt
new file mode 100644
index 0000000..1a999d2
--- /dev/null
+++ b/install.txt
@@ -0,0 +1,75 @@
+**************************************************************************************
+* PHPExcel
+*
+* Copyright (c) 2006 - 2011 PHPExcel
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*
+* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel)
+* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+* @version ##VERSION##, ##DATE##
+**************************************************************************************
+
+Requirements
+------------
+
+The following requirements should be met prior to using PHPExcel:
+* PHP version 5.2.0 or higher
+* PHP extension php_zip enabled *)
+* PHP extension php_xml enabled
+* PHP extension php_gd2 enabled (if not compiled in)
+
+*) php_zip is only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007,
+ PHPExcel_Reader_OOCalc. In other words, if you need PHPExcel to handle .xlsx or .ods
+ files you will need the zip extension, but otherwise not.
+
+
+
+Installation instructions
+-------------------------
+
+Installation is quite easy: copy the contents of the Classes folder to any location
+in your application required.
+
+Example:
+
+If your web root folder is /var/www/ you may want to create a subfolder called
+/var/www/Classes/ and copy the files into that folder so you end up with files:
+
+/var/www/Classes/PHPExcel.php
+/var/www/Classes/PHPExcel/Calculation.php
+/var/www/Classes/PHPExcel/Cell.php
+...
+
+
+
+Getting started
+---------------
+
+A good way to get started is to run some of the tests included in the download.
+Copy the "Examples" folder next to your "Classes" folder from above so you end up with:
+
+/var/www/Examples/01simple.php
+/var/www/Examples/02types.php
+...
+
+Start running the test by pointing your browser to the test scripts:
+
+http://example.com/Examples/01simple.php
+http://example.com/Examples/02types.php
+...
+
+Note: It may be necessary to modify the include/require statements at the beginning of
+each of the test scripts if your "Classes" folder from above is named differently.
diff --git a/license.md b/license.md
new file mode 100644
index 0000000..57b74d4
--- /dev/null
+++ b/license.md
@@ -0,0 +1,345 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+END OF TERMS AND CONDITIONS
\ No newline at end of file