1

I have some issue when i saving RTF file with phpword lib.

I open an RTF file with IOFactory::load, then i save it with function write and I have some metadata on the file i don't know why.

Here is my code:

<?php
include_once 'vendor/phpoffice/phpword/samples/Sample_Header.php';
// Read contents
$name = 'Sample';
$source = __DIR__ . "/vendor/phpoffice/phpword/samples/resources/{$name}.rtf";
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'RTF');
// Save file
echo write($phpWord, basename(__FILE__, '.php'), $writers);
 include_once 'vendor/phpoffice/phpword/samples/Sample_Footer.php';

and when i open the new file who have been save It shows:

"Normal;Default Paragraph Font;Normal Table;Body Text;Corps de texte Car;footer;Pied de page Car;page number;Balloon Text;Texte de bulles Car;?;;?;;?;;?;?;?;?;?;?;;http://schemas.microsoft.com/office/word/2003/wordml2450



6

1

...)()()()()()Annexe I"

If someone have an idea why I have some metadata on my file that will be good.

Mobin F.R.G
  • 317
  • 1
  • 15
necroma
  • 11
  • 2
  • What's inside `$writers` ? – Zyigh Jul 19 '18 at 08:33
  • inside `$writers` there is an array who display all extensions file, like "docx", "RTF", "PHP...` `$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf');` – necroma Jul 19 '18 at 12:44

0 Answers0