code: private function writeCols(XMLWriter $objWriter, PhpspreadsheetWorksheet $pSheet)
      {
          // 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', Coordinate::columnIndexFromString($colDimension->getColumnIndex()));
                  $objWriter->writeAttribute('max', Coordinate::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', StringHelper::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();
          }
      }
docs: Write Cols.
  
  @param XMLWriter $objWriter XML Writer
  @param PhpspreadsheetWorksheet $pSheet Worksheet