title: How to center the text in PHPExcel merged cell
body: <p>How to center text "test"?</p>
  
  <p><strong>This is my code:</strong></p>
  
  <pre><code>&lt;?php
      /** Error reporting */
      error_reporting(E_ALL);
      ini_set('display_errors', TRUE);
      ini_set('display_startup_errors', TRUE);
      date_default_timezone_set('Europe/London');
  
      /** Include PHPExcel */
      require_once '../Classes/PHPExcel.php';
  
      $objPHPExcel = new PHPExcel();
      $sheet = $objPHPExcel-&gt;getActiveSheet();
      $sheet-&gt;setCellValueByColumnAndRow(0, 1, "test");
      $sheet-&gt;mergeCells('A1:B1');
      $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
      $objWriter-&gt;save("test.xlsx");
  </code></pre>
  
  <p><strong>Output Excel document:</strong></p>
  
  <p><img src="https://i.stack.imgur.com/E0Xwh.png" alt="enter image description here"></p>