Added support for mergeCells, cell height, shrink to fit

Added support for
    mergeCells:
        // mergeCells (B2:G2), you may use CellHelper::getColumnLettersFromColumnIndex() to convert from "B2" to "[1,2]"
	    $writer->mergeCells([1,2], [6, 2]);

    cell height:
        $row->setHeight(30);

    shouldShrinkToFit:
        $style->setShouldShrinkToFit();

These changes are implemented for XLSX as that's what I need and test spout on.
This commit is contained in:
Lucian Sirbu committed 2020-05-04 16:48:18 +03:00
1 parent ab973cab34
commit 488bc371a5
10 files changed
+174 -2

No files matched your search

@@ -183,6 +183,17 @@ class StyleBuilder
return $this;
}
/**
* Set should shrink to fit
* @param boolean $shrinkToFit
* @return void
*/
public function setShouldShrinkToFit($shrinkToFit = true)
{
$this->style->setShouldShrinkToFit($shrinkToFit);
return $this;
}
/**
* Returns the configured style. The style is cached and can be reused.
*
@@ -20,4 +20,10 @@ abstract class Options
// XLSX specific options
const SHOULD_USE_INLINE_STRINGS = 'shouldUseInlineStrings';
// XLSX column widths
const COLUMN_WIDTHS = 'columnWidths';
// XLSX merge cells
const MERGE_CELLS = 'mergeCells';
}
+22
View File
@@ -27,6 +27,9 @@ class Sheet
/** @var SheetManager Sheet manager */
private $sheetManager;
/** @var bool Sheet is started */
private $isSheetStarted = false;
/**
* @param int $sheetIndex Index of the sheet, based on order in the workbook (zero-based)
* @param string $associatedWorkbookId ID of the sheet's associated workbook
@@ -108,4 +111,23 @@ class Sheet
return $this;
}
/**
* @return bool isSheetStarted Sheet was started
*/
public function isSheetStarted()
{
return $this->isSheetStarted;
}
/**
* @param bool $isSheetStarted Set if sheet was started
* @return Sheet
*/
public function setIsSheetStarted($isSheetStarted)
{
$this->isSheetStarted = $isSheetStarted;
return $this;
}
}