Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   1  <?php
   2  
   3  namespace PhpOffice\PhpSpreadsheet\Worksheet\Table;
   4  
   5  use PhpOffice\PhpSpreadsheet\Worksheet\Table;
   6  
   7  class TableStyle
   8  {
   9      const TABLE_STYLE_NONE = '';
  10      const TABLE_STYLE_LIGHT1 = 'TableStyleLight1';
  11      const TABLE_STYLE_LIGHT2 = 'TableStyleLight2';
  12      const TABLE_STYLE_LIGHT3 = 'TableStyleLight3';
  13      const TABLE_STYLE_LIGHT4 = 'TableStyleLight4';
  14      const TABLE_STYLE_LIGHT5 = 'TableStyleLight5';
  15      const TABLE_STYLE_LIGHT6 = 'TableStyleLight6';
  16      const TABLE_STYLE_LIGHT7 = 'TableStyleLight7';
  17      const TABLE_STYLE_LIGHT8 = 'TableStyleLight8';
  18      const TABLE_STYLE_LIGHT9 = 'TableStyleLight9';
  19      const TABLE_STYLE_LIGHT10 = 'TableStyleLight10';
  20      const TABLE_STYLE_LIGHT11 = 'TableStyleLight11';
  21      const TABLE_STYLE_LIGHT12 = 'TableStyleLight12';
  22      const TABLE_STYLE_LIGHT13 = 'TableStyleLight13';
  23      const TABLE_STYLE_LIGHT14 = 'TableStyleLight14';
  24      const TABLE_STYLE_LIGHT15 = 'TableStyleLight15';
  25      const TABLE_STYLE_LIGHT16 = 'TableStyleLight16';
  26      const TABLE_STYLE_LIGHT17 = 'TableStyleLight17';
  27      const TABLE_STYLE_LIGHT18 = 'TableStyleLight18';
  28      const TABLE_STYLE_LIGHT19 = 'TableStyleLight19';
  29      const TABLE_STYLE_LIGHT20 = 'TableStyleLight20';
  30      const TABLE_STYLE_LIGHT21 = 'TableStyleLight21';
  31      const TABLE_STYLE_MEDIUM1 = 'TableStyleMedium1';
  32      const TABLE_STYLE_MEDIUM2 = 'TableStyleMedium2';
  33      const TABLE_STYLE_MEDIUM3 = 'TableStyleMedium3';
  34      const TABLE_STYLE_MEDIUM4 = 'TableStyleMedium4';
  35      const TABLE_STYLE_MEDIUM5 = 'TableStyleMedium5';
  36      const TABLE_STYLE_MEDIUM6 = 'TableStyleMedium6';
  37      const TABLE_STYLE_MEDIUM7 = 'TableStyleMedium7';
  38      const TABLE_STYLE_MEDIUM8 = 'TableStyleMedium8';
  39      const TABLE_STYLE_MEDIUM9 = 'TableStyleMedium9';
  40      const TABLE_STYLE_MEDIUM10 = 'TableStyleMedium10';
  41      const TABLE_STYLE_MEDIUM11 = 'TableStyleMedium11';
  42      const TABLE_STYLE_MEDIUM12 = 'TableStyleMedium12';
  43      const TABLE_STYLE_MEDIUM13 = 'TableStyleMedium13';
  44      const TABLE_STYLE_MEDIUM14 = 'TableStyleMedium14';
  45      const TABLE_STYLE_MEDIUM15 = 'TableStyleMedium15';
  46      const TABLE_STYLE_MEDIUM16 = 'TableStyleMedium16';
  47      const TABLE_STYLE_MEDIUM17 = 'TableStyleMedium17';
  48      const TABLE_STYLE_MEDIUM18 = 'TableStyleMedium18';
  49      const TABLE_STYLE_MEDIUM19 = 'TableStyleMedium19';
  50      const TABLE_STYLE_MEDIUM20 = 'TableStyleMedium20';
  51      const TABLE_STYLE_MEDIUM21 = 'TableStyleMedium21';
  52      const TABLE_STYLE_MEDIUM22 = 'TableStyleMedium22';
  53      const TABLE_STYLE_MEDIUM23 = 'TableStyleMedium23';
  54      const TABLE_STYLE_MEDIUM24 = 'TableStyleMedium24';
  55      const TABLE_STYLE_MEDIUM25 = 'TableStyleMedium25';
  56      const TABLE_STYLE_MEDIUM26 = 'TableStyleMedium26';
  57      const TABLE_STYLE_MEDIUM27 = 'TableStyleMedium27';
  58      const TABLE_STYLE_MEDIUM28 = 'TableStyleMedium28';
  59      const TABLE_STYLE_DARK1 = 'TableStyleDark1';
  60      const TABLE_STYLE_DARK2 = 'TableStyleDark2';
  61      const TABLE_STYLE_DARK3 = 'TableStyleDark3';
  62      const TABLE_STYLE_DARK4 = 'TableStyleDark4';
  63      const TABLE_STYLE_DARK5 = 'TableStyleDark5';
  64      const TABLE_STYLE_DARK6 = 'TableStyleDark6';
  65      const TABLE_STYLE_DARK7 = 'TableStyleDark7';
  66      const TABLE_STYLE_DARK8 = 'TableStyleDark8';
  67      const TABLE_STYLE_DARK9 = 'TableStyleDark9';
  68      const TABLE_STYLE_DARK10 = 'TableStyleDark10';
  69      const TABLE_STYLE_DARK11 = 'TableStyleDark11';
  70  
  71      /**
  72       * Theme.
  73       *
  74       * @var string
  75       */
  76      private $theme;
  77  
  78      /**
  79       * Show First Column.
  80       *
  81       * @var bool
  82       */
  83      private $showFirstColumn = false;
  84  
  85      /**
  86       * Show Last Column.
  87       *
  88       * @var bool
  89       */
  90      private $showLastColumn = false;
  91  
  92      /**
  93       * Show Row Stripes.
  94       *
  95       * @var bool
  96       */
  97      private $showRowStripes = false;
  98  
  99      /**
 100       * Show Column Stripes.
 101       *
 102       * @var bool
 103       */
 104      private $showColumnStripes = false;
 105  
 106      /**
 107       * Table.
 108       *
 109       * @var null|Table
 110       */
 111      private $table;
 112  
 113      /**
 114       * Create a new Table Style.
 115       *
 116       * @param string $theme (e.g. TableStyle::TABLE_STYLE_MEDIUM2)
 117       */
 118      public function __construct(string $theme = self::TABLE_STYLE_MEDIUM2)
 119      {
 120          $this->theme = $theme;
 121      }
 122  
 123      /**
 124       * Get theme.
 125       */
 126      public function getTheme(): string
 127      {
 128          return $this->theme;
 129      }
 130  
 131      /**
 132       * Set theme.
 133       */
 134      public function setTheme(string $theme): self
 135      {
 136          $this->theme = $theme;
 137  
 138          return $this;
 139      }
 140  
 141      /**
 142       * Get show First Column.
 143       */
 144      public function getShowFirstColumn(): bool
 145      {
 146          return $this->showFirstColumn;
 147      }
 148  
 149      /**
 150       * Set show First Column.
 151       */
 152      public function setShowFirstColumn(bool $showFirstColumn): self
 153      {
 154          $this->showFirstColumn = $showFirstColumn;
 155  
 156          return $this;
 157      }
 158  
 159      /**
 160       * Get show Last Column.
 161       */
 162      public function getShowLastColumn(): bool
 163      {
 164          return $this->showLastColumn;
 165      }
 166  
 167      /**
 168       * Set show Last Column.
 169       */
 170      public function setShowLastColumn(bool $showLastColumn): self
 171      {
 172          $this->showLastColumn = $showLastColumn;
 173  
 174          return $this;
 175      }
 176  
 177      /**
 178       * Get show Row Stripes.
 179       */
 180      public function getShowRowStripes(): bool
 181      {
 182          return $this->showRowStripes;
 183      }
 184  
 185      /**
 186       * Set show Row Stripes.
 187       */
 188      public function setShowRowStripes(bool $showRowStripes): self
 189      {
 190          $this->showRowStripes = $showRowStripes;
 191  
 192          return $this;
 193      }
 194  
 195      /**
 196       * Get show Column Stripes.
 197       */
 198      public function getShowColumnStripes(): bool
 199      {
 200          return $this->showColumnStripes;
 201      }
 202  
 203      /**
 204       * Set show Column Stripes.
 205       */
 206      public function setShowColumnStripes(bool $showColumnStripes): self
 207      {
 208          $this->showColumnStripes = $showColumnStripes;
 209  
 210          return $this;
 211      }
 212  
 213      /**
 214       * Get this Style's Table.
 215       */
 216      public function getTable(): ?Table
 217      {
 218          return $this->table;
 219      }
 220  
 221      /**
 222       * Set this Style's Table.
 223       */
 224      public function setTable(?Table $table = null): self
 225      {
 226          $this->table = $table;
 227  
 228          return $this;
 229      }
 230  }