48 if ($pSheet !== NULL) {
50 $aStringTable =
array();
51 $cellCollection = null;
52 $aFlippedStringTable = null;
55 if (($pExistingTable !== NULL) && is_array($pExistingTable)) {
56 $aStringTable = $pExistingTable;
63 foreach ($pSheet->getCellCollection() as $cellID) {
64 $cell = $pSheet->getCell($cellID);
65 $cellValue = $cell->getValue();
66 if (!is_object($cellValue) &&
67 ($cellValue !== NULL) &&
69 !isset($aFlippedStringTable[$cellValue]) &&
71 $aStringTable[] = $cellValue;
72 $aFlippedStringTable[$cellValue] =
true;
74 ($cellValue !== NULL) &&
75 !isset($aFlippedStringTable[$cellValue->getHashCode()])) {
76 $aStringTable[] = $cellValue;
77 $aFlippedStringTable[$cellValue->getHashCode()] =
true;
97 if ($pStringTable !== NULL) {
107 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
111 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
112 $objWriter->writeAttribute(
'uniqueCount', count($pStringTable));
115 foreach ($pStringTable as $textElement) {
121 if ($textToWrite !== trim($textToWrite)) {
122 $objWriter->writeAttribute(
'xml:space',
'preserve');
126 }
else if ($textElement instanceof PHPExcel_RichText) {
152 if ($prefix !== NULL)
155 $elements = $pRichText->getRichTextElements();
156 foreach ($elements as $element) {
167 $objWriter->writeAttribute(
'val', $element->getFont()->getName());
172 $objWriter->writeAttribute(
'val', ($element->getFont()->getBold() ?
'true' :
'false'));
177 $objWriter->writeAttribute(
'val', ($element->getFont()->getItalic() ?
'true' :
'false'));
181 if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
182 $objWriter->startElement($prefix.
'vertAlign');
183 if ($element->getFont()->getSuperScript()) {
184 $objWriter->writeAttribute(
'val',
'superscript');
185 }
else if ($element->getFont()->getSubScript()) {
186 $objWriter->writeAttribute(
'val',
'subscript');
193 $objWriter->writeAttribute(
'val', ($element->getFont()->getStrikethrough() ?
'true' :
'false'));
198 $objWriter->writeAttribute(
'rgb', $element->getFont()->getColor()->getARGB());
203 $objWriter->writeAttribute(
'val', $element->getFont()->getSize());
208 $objWriter->writeAttribute(
'val', $element->getFont()->getUnderline());
216 $objWriter->writeAttribute(
'xml:space',
'preserve');
235 $textRun = $pRichText;
236 $pRichText =
new PHPExcel_RichText();
237 $pRichText->createTextRun($textRun);
240 if ($prefix !== NULL)
243 $elements = $pRichText->getRichTextElements();
244 foreach ($elements as $element) {
252 $objWriter->writeAttribute(
'b', ($element->getFont()->getBold() ? 1 : 0));
254 $objWriter->writeAttribute(
'i', ($element->getFont()->getItalic() ? 1 : 0));
256 $underlineType = $element->getFont()->getUnderline();
257 switch($underlineType) {
259 $underlineType =
'sng';
262 $underlineType =
'dbl';
265 $objWriter->writeAttribute(
'u', $underlineType);
267 $objWriter->writeAttribute(
'strike', ($element->getFont()->getStrikethrough() ?
'sngStrike' :
'noStrike'));
271 $objWriter->writeAttribute(
'typeface', $element->getFont()->getName());
305 $returnValue =
array();
308 foreach ($stringTable as $key => $value) {
310 $returnValue[$value] = $key;
311 }
else if ($value instanceof PHPExcel_RichText) {
312 $returnValue[$value->getHashCode()] = $key;
writeRichText(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_RichText $pRichText=null, $prefix=NULL)
Write Rich Text.
getParentWriter()
Get parent IWriter object.
writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter=null, $pRichText=null, $prefix=NULL)
Write Rich Text.
flipStringTable($stringTable=array())
Flip string table (for index searching)
Create styles array
The data for the language used.
writeStringTable($pStringTable=null)
Write string table to XML format.
const STORAGE_MEMORY
Temporary storage method.
createStringTable($pSheet=null, $pExistingTable=null)
Create worksheet stringtable.
static ControlCharacterPHP2OOXML($value='')
Convert from PHP control character to OpenXML escaped control character.