This commit is contained in:
Laurent Destailleur 2023-02-09 15:58:28 +01:00
parent 5ae079b018
commit 04c0272d05

View File

@ -152,12 +152,12 @@ class Odf
} }
/** /**
* Replaces html tags in odt tags and returns a compatible string * Replaces html tags found into the $value with ODT compatible tags and return the converted compatible string
* *
* @param string $value Replacement value * @param string $value Replacement value
* @param bool $encode If true, special XML characters are encoded * @param bool $encode If true, special XML characters are encoded
* @param string $charset Charset * @param string $charset Charset
* @return string * @return string String in ODTsyntax format
*/ */
public function convertVarToOdf($value, $encode = true, $charset = 'ISO-8859') public function convertVarToOdf($value, $encode = true, $charset = 'ISO-8859')
{ {
@ -203,13 +203,16 @@ class Odf
} }
} }
$this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml); $this->contentXml = str_replace('</office:font-face-decls>', $fonts . '</office:font-face-decls>', $this->contentXml);
} else $convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value); } else {
$convertedValue = preg_replace('/(\r\n|\r|\n)/i', "<text:line-break/>", $value);
}
return $convertedValue; return $convertedValue;
} }
/** /**
* Replaces html tags in with odt tags and returns an odt string * Replaces html tags in with odt tags and returns an odt string
*
* @param array $tags An array with html tags generated by the getDataFromHtml() function * @param array $tags An array with html tags generated by the getDataFromHtml() function
* @param array $customStyles An array of style defenitions that should be included inside the odt file * @param array $customStyles An array of style defenitions that should be included inside the odt file
* @param array $fontDeclarations An array of font declarations that should be included inside the odt file * @param array $fontDeclarations An array of font declarations that should be included inside the odt file