Additional examples for HTML to Rich Text helper (superscript and subscript)

This commit is contained in:
MarkBaker 2015-01-13 23:44:38 +00:00
parent 98f4754048
commit 16f2eb63a1
1 changed files with 13 additions and 2 deletions

View File

@ -78,6 +78,11 @@ $html2='<p>
</font> </font>
</p>'; </p>';
$html3='2<sup>3</sup> equals 8';
$html4='H<sub>2</sub>SO<sub>4</sub> is the chemical formula for Sulphuric acid';
$wizard = new PHPExcel_Helper_HTML; $wizard = new PHPExcel_Helper_HTML;
$richText = $wizard->toRichTextObject($html1); $richText = $wizard->toRichTextObject($html1);
@ -100,6 +105,12 @@ $objPHPExcel->getActiveSheet()->getStyle('A2')
->getAlignment() ->getAlignment()
->setWrapText(true); ->setWrapText(true);
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A3', $wizard->toRichTextObject($html3));
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A4', $wizard->toRichTextObject($html4));
// Rename worksheet // Rename worksheet
echo date('H:i:s') , " Rename worksheet" , EOL; echo date('H:i:s') , " Rename worksheet" , EOL;