Errors in RTF Escaping
1. Codes meant to be in hex are specified in decimal.
Consequently characters which don't need escaping are escaped.
2. Special handling (prepend backslash) needed for {, }, and .
RTF docs generated with those characters cannot be opened in Word.
3. Tab character needs to be escaped as \tab.
RTF docs drop these characters.
While running test suite, found that Writer/RTF/ElementTest was coded
only for Unix line endings, and fails on Windows. Changed so that it
would work on either.
This commit is contained in:
parent
a10fe823b2
commit
2513e54540
|
|
@ -15,8 +15,10 @@
|
|||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Escaper;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Writer\RTF\Style subnamespace
|
||||
* Test class for PhpOffice\PhpWord\Escaper\RTF
|
||||
*/
|
||||
class RtfEscaperTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ use PhpOffice\PhpWord\Writer\RTF;
|
|||
*/
|
||||
class ElementTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function removeCr($field) {
|
||||
public function removeCr($field)
|
||||
{
|
||||
return str_replace("\r\n", "\n", $field->write());
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue