/** This method divides the string into the tags and puts the result into wt_DataInfo variable. @param $pStr - string to be printed @return nothing */ function DivideByTags($pStr, $return = false) { $pStr = str_replace("\t", "<ttags>\t</ttags>", $pStr); $pStr = str_replace(PARAGRAPH_STRING, "<pparg>\t</pparg>", $pStr); $pStr = str_replace("\r", "", $pStr); //initialize the String_TAGS class $sWork = new String_TAGS(5); //get the string divisions by tags $this->wt_DataInfo = $sWork->get_tags($pStr); if ($return) { return $this->wt_DataInfo; } }
/** This method returns the number of lines that will a text ocupy on the specified width @param $w - with of the cell $pStr - string to be printed @return $nb_lines - number of lines */ function NbLines($w, $pStr) { //save the current style settings, this will be the default in case of no style is specified $this->SaveCurrentStyle(); $this->_wt_Reset_Datas(); $pStr = str_replace("\t", "<ttags>\t</ttags>", $pStr); $pStr = str_replace("\r", "", $pStr); //initialize the String_TAGS class $sWork = new String_TAGS(5); //get the string divisions by tags $this->wt_DataInfo = $sWork->get_tags($pStr); $first_line = true; $last_line = !(count($this->wt_DataInfo) > 0); $nb_lines = 0; while (!$last_line) { //make a line $str_data = $this->MakeLine($w); //check for last line $last_line = !(count($this->wt_DataInfo) > 0); if ($first_line) { $first_line = false; } $nb_lines++; } //while(! $last_line){ //APPLY THE DEFAULT STYLE $this->ApplyStyle("DEFAULT"); return $nb_lines; }