Moodle PHP Documentation 4.1
Moodle 4.1.19+ (Build: 20250711) (5f47dc23ffc)
Box\Spout\Writer\Common\Manager\Style\StyleManager Class Reference
Inheritance diagram for Box\Spout\Writer\Common\Manager\Style\StyleManager:
Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface Box\Spout\Writer\ODS\Manager\Style\StyleManager Box\Spout\Writer\XLSX\Manager\Style\StyleManager

Public Member Functions

 __construct (StyleRegistry $styleRegistry)
 
 applyExtraStylesIfNeeded (Cell $cell)
 Apply additional styles if the given row needs it.
 
 registerStyle ($style)
 Registers the given style as a used style.
 

Protected Member Functions

 applyWrapTextIfCellContainsNewLine (Cell $cell)
 Set the "wrap text" option if a cell of the given row contains a new line.
 
 getDefaultStyle ()
 Returns the default style.
 

Protected Attributes

StyleRegistry $styleRegistry
 Registry for all used styles.
 

Constructor & Destructor Documentation

◆ __construct()

Box\Spout\Writer\Common\Manager\Style\StyleManager::__construct ( StyleRegistry $styleRegistry)
Parameters
StyleRegistry$styleRegistry

Member Function Documentation

◆ applyExtraStylesIfNeeded()

Box\Spout\Writer\Common\Manager\Style\StyleManager::applyExtraStylesIfNeeded ( Cell $cell)

Apply additional styles if the given row needs it.

Typically, set "wrap text" if a cell contains a new line.

Parameters
Cell$cell
Return values
PossiblyUpdatedStyleThe eventually updated style

Implements Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface.

◆ applyWrapTextIfCellContainsNewLine()

Box\Spout\Writer\Common\Manager\Style\StyleManager::applyWrapTextIfCellContainsNewLine ( Cell $cell)
protected

Set the "wrap text" option if a cell of the given row contains a new line.

@NOTE: There is a bug on the Mac version of Excel (2011 and below) where new lines are ignored even when the "wrap text" option is set. This only occurs with inline strings (shared strings do work fine). A workaround would be to encode "::n" as "_x000D_" but it does not work on the Windows version of Excel...

Parameters
Cell$cellThe cell the style should be applied to
Return values
PossiblyUpdatedStyleThe eventually updated style

◆ getDefaultStyle()

Box\Spout\Writer\Common\Manager\Style\StyleManager::getDefaultStyle ( )
protected

Returns the default style.

Return values
StyleDefault style

◆ registerStyle()

Box\Spout\Writer\Common\Manager\Style\StyleManager::registerStyle ( $style)

Registers the given style as a used style.

Duplicate styles won't be registered more than once.

Parameters
Style$styleThe style to be registered
Return values
StyleThe registered style, updated with an internal ID.

Implements Box\Spout\Writer\Common\Manager\Style\StyleManagerInterface.


The documentation for this class was generated from the following file: