code: public function duplicateStyle(Style $pCellStyle, $pRange)
      {
          // 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) = Coordinate::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(Coordinate::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex);
              }
          }
  
          return $this;
      }
docs: Duplicate cell style to a range of cells.
  
  Please note that this will overwrite existing cell styles for cells in range!
  
  @param Style $pCellStyle Cell style to duplicate
  @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
  
  @throws Exception
  
  @return Worksheet