These are chat archives for PHPOffice/PhpSpreadsheet

22nd
Dec 2017
aramgevorgyan86
@aramgevorgyan86
Dec 22 2017 15:54

hello, I am trying to use text Rotation to 90 to have cell with vertical text, but it is not working, all text shown horizontally, maybe I make something wrong?
Here is my php code
$spreadsheet = new Spreadsheet();

// Create a new worksheet called "Technical Skills"
$technicalSkillsSheet = new Worksheet($spreadsheet, 'Technical Skills');
// Attach the "Technical Skills" worksheet as the first worksheet in the Spreadsheet object
$spreadsheet->addSheet($technicalSkillsSheet, TECHNICAL_SKILLS_INDEX);
$sheet = $spreadsheet->getSheet(TECHNICAL_SKILLS_INDEX);
foreach($term_sheet_array as $term_sheet){
$sheet->setCellValue($term_sheet['cell'], $term_sheet['name']);
$styleArray = array(
'fill' => array(
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
'startColor' => array(
'argb' => $term_sheet["color"],
),
),
'alignment' => array(
'wrapText' => TRUE,
'textRotation' => 90,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_BOTTOM,
),
);
$sheet->getStyle($term_sheet['cell'])->applyFromArray($styleArray);
$color_key++;

    if($color_key >= count($sheetColors)){
      $color_key = 0;
    }
  }