Sample 28 ReadRTF

00:22:41 Reading contents from `/www/wwwroot/w.lqbxl.cn/samples/resources/Sample_28_ReadRTF.rtf`
00:22:41 Write to Word2007 format
00:22:41 Write to ODText format
00:22:41 Write to RTF format
00:22:41 Write to HTML format
00:22:41 Write to PDF format
00:22:41 Done writing file(s)
00:22:41 Peak memory usage: 2 MB

 

Results: docx odt rtf html pdf


<?php

include_once 'Sample_Header.php';

// Read contents
$name basename(__FILE__'.php');
$source __DIR__ "/resources/{$name}.rtf";

echo 
date('H:i:s'), " Reading contents from `{$source}`"EOL;
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source'RTF');

// Save file
echo write($phpWordbasename(__FILE__'.php'), $writers);
if (!
CLI) {
    include_once 
'Sample_Footer.php';
}