function MsExcel_ConvertToExplicit_Item(&$Txt, $Tag, $Att, $CellRow) {

		$tag_pc = strlen($Tag) + 1;
		$rpl = '<'.$Tag.' '.$Att.'="';
		$rpl_len = strlen($rpl);
		$rpl_nbr = 0;
		$p = 0;
		$empty_first_pos = false;
		$empty_nbr = 0;
		$item_num = 0;
		$rpl_nbr = 0;

		while (($p=clsTinyButStrong::f_Xml_FindTagStart($Txt, $Tag, true, $p, true, true))!==false) {

			$item_num++;
			
			if ($empty_first_pos===false) $empty_first_pos = $p;
			
			$p = $p + $tag_pc;
			if (substr($Txt, $p, 1) == '/') {
				// It's an empty item
				$empty_nbr++;
			} else {
				// The item is not empty => relace attribute and delete the previus empty item in the same time
				$ref = ($CellRow===false) ? $item_num : $this->Misc_CellRef($item_num, $CellRow);
				$x = $rpl.$ref.'"';
				$len = $p - $empty_first_pos;
				$Txt = substr_replace($Txt, $x, $empty_first_pos, $len);
				$rpl_nbr++;
				
				// If it's a row => search for cells
				if ($CellRow===false) {
					$loc = new clsTbsXmlLoc($Txt, $Tag, $p);
					$loc->FindEndTag();
					$src = $loc->GetSrc();
					$nbr = $this->MsExcel_ConvertToExplicit_Item($src, 'c', 'r', $item_num);
					if ($nbr>0) {
						$loc->ReplaceSrc($src);
					}
					$p = $loc->PosEnd;
				} else {
					$p = $empty_first_pos + $tag_pc;
				}
				// Ini variables
				$empty_nbr = 0;
				$empty_first_pos = false;
			}
			
		}
		
		return $rpl_nbr;

	}
function MsExcel_ConvertToExplicit_Item(&$Txt, $Tag, $Att, $CellRow) {

		$tag_pc = strlen($Tag) + 1;
		$rpl = '<'.$Tag.' '.$Att.'="';
		$rpl_len = strlen($rpl);
		$rpl_nbr = 0;
		$p = 0;
		$empty_first_pos = false;
		$empty_nbr = 0;
		$item_num = 0;
		$rpl_nbr = 0;

		while (($p=clsTinyButStrong::f_Xml_FindTagStart($Txt, $Tag, true, $p, true, true))!==false) {

			$item_num++;
			
			if ($empty_first_pos===false) $empty_first_pos = $p;
			
			$p = $p + $tag_pc;
			if (substr($Txt, $p, 1) == '/') {
				// It's an empty item
				$empty_nbr++;
			} else {
				// The item is not empty => relace attribute and delete the previus empty item in the same time
				$ref = ($CellRow===false) ? $item_num : $this->Misc_CellRef($item_num, $CellRow);
				$x = $rpl.$ref.'"';
				$len = $p - $empty_first_pos;
				$Txt = substr_replace($Txt, $x, $empty_first_pos, $len);
				$rpl_nbr++;
				
				// If it's a row => search for cells
				if ($CellRow===false) {
					$loc = new clsTbsXmlLoc($Txt, $Tag, $p);
					$loc->FindEndTag();
					$src = $loc->GetSrc();
					$nbr = $this->MsExcel_ConvertToExplicit_Item($src, 'c', 'r', $item_num);
					if ($nbr>0) {
						$loc->ReplaceSrc($src);
					}
					$p = $loc->PosEnd;
				} else {
					$p = $empty_first_pos + $tag_pc;
				}
				// Ini variables
				$empty_nbr = 0;
				$empty_first_pos = false;
			}
			
		}
		
		return $rpl_nbr;

	}
function MsExcel_ConvertToExplicit_Item ( & $ Txt , $ Tag , $ Att , $ CellRow ) { $ tag_pc = strlen ( $ Tag ) + 1 ; $ rpl = '<' . $ Tag . ' ' . $ Att . '="' ; $ rpl_len = strlen ( $ rpl ) ; $ rpl_nbr = 0 ; $ p = 0 ; $ empty_first_pos = false ; $ empty_nbr = 0 ; $ item_num = 0 ; $ rpl_nbr = 0 ; while ( ( $ p = clsTinyButStrong :: f_Xml_FindTagStart ( $ Txt , $ Tag , true , $ p , true , true ) ) !== false ) { $ item_num ++ ; if ( $ empty_first_pos === false ) $ empty_first_pos = $ p ; $ p = $ p + $ tag_pc ; if ( substr ( $ Txt , $ p , 1 ) == '/' ) { // It's an empty item $ empty_nbr ++ ; } else { // The item is not empty => relace attribute and delete the previus empty item in the same time $ ref = ( $ CellRow === false ) ? $ item_num : $ this -> Misc_CellRef ( $ item_num , $ CellRow ) ; $ x = $ rpl . $ ref . '"' ; $ len = $ p - $ empty_first_pos ; $ Txt = substr_replace ( $ Txt , $ x , $ empty_first_pos , $ len ) ; $ rpl_nbr ++ ; // If it's a row => search for cells if ( $ CellRow === false ) { $ loc = new clsTbsXmlLoc ( $ Txt , $ Tag , $ p ) ; $ loc -> FindEndTag ( ) ; $ src = $ loc -> GetSrc ( ) ; $ nbr = $ this -> MsExcel_ConvertToExplicit_Item ( $ src , 'c' , 'r' , $ item_num ) ; if ( $ nbr > 0 ) { $ loc -> ReplaceSrc ( $ src ) ; } $ p = $ loc -> PosEnd ; } else { $ p = $ empty_first_pos + $ tag_pc ; } // Ini variables $ empty_nbr = 0 ; $ empty_first_pos = false ; } } return $ rpl_nbr ; }
Add the attribute that gives the reference of the item.
Return the number of inserted attributes.
Add the attribute that gives the reference of the item . Return the number of inserted attributes .