Reputation:
I have to write texts in cells that are combinations of RTL and LTR languages inline and the prior language is the RTL one. So I need the text in xls file generated by PHPExcel to be RTL by default. What can I do?
Upvotes: 1
Views: 1589
Reputation: 212402
To set direction for the entire worksheet, you can use:
$objPHPExcel->getActiveSheet()
->setRightToLeft(true);
For an individual cell (or range of cells) you can try:
// Set the character order as RTL
$objPHPExcel->getActiveSheet()
->getStyle('A1')
->getAlignment()
->setReadorder(PHPExcel_Style_Alignment::READORDER_RTL);
// Set cell alignment to the right
$objPHPExcel->getActiveSheet()
->getStyle('A1')
->getAlignment()
->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
Upvotes: 4