static function FindElement(&$TxtOrObj, $Tag, $PosBeg, $Forward = true)
 {
     $XmlLoc = clsTbsXmlLoc::FindStartTag($TxtOrObj, $Tag, $PosBeg, $Forward);
     if ($XmlLoc === false) {
         return false;
     }
     $XmlLoc->FindEndTag();
     return $XmlLoc;
 }
Example #2
0
 public function OpenDoc_ChartRenameSeries(&$Txt, &$series, $NewName)
 {
     $NewName = htmlspecialchars($NewName);
     $col_name = $series['col_name'];
     $el = clsTbsXmlLoc::FindStartTag($Txt, 'table:table-header-rows', 0);
     $el = clsTbsXmlLoc::FindStartTag($Txt, 'table:table-row', $el->PosEnd);
     for ($i = 1; $i < $col_name; $i++) {
         $el = clsTbsXmlLoc::FindStartTag($Txt, 'table:table-cell', $el->PosEnd);
     }
     $elCell = clsTbsXmlLoc::FindElement($Txt, 'table:table-cell', $el->PosEnd);
     $elP = clsTbsXmlLoc::FindElement($elCell, 'text:p', 0);
     if ($elP === false) {
         $elCell->ReplaceInnerSrc($elCell->InnerSrc . '<text:p>' . $NewName . '</text:p>');
     } else {
         if ($elP->SelfClosing) {
             $elP->ReplaceSrc('<text:p>' . $NewName . '</text:p>');
         } else {
             $elP->ReplaceInnerSrc($NewName);
         }
         $elP->UpdateParent();
     }
 }