开发者

Create RTF files from PHP (any better way?)

开发者 https://www.devze.com 2023-04-06 16:46 出处:网络
Currently I am generating RTF documents using PHPRtfLite. It works perfectly. The only issue is that I have more than 1000 documents with one or more pages in each. To output them via PHPRtfLite, I ha

Currently I am generating RTF documents using PHPRtfLite. It works perfectly. The only issue is that I have more than 1000 documents with one or more pages in each. To output them via PHPRtfLite, I have to copy paste the data + write formatting details (such as b开发者_如何学JAVAold, italics or table) into my php file using PHPRtfLite methods. That means a lot of copy and paste. The resulting PHP file is big and messy.

Is there any better / easier way?

Currently I create one PHP file per RTF file.

Thank you for any suggestions.

Best regards,

Tony.


Look at the PHPRtfLite code, you'll see how to format text to rtf.

Then, put in a loop in your php, and open each file, read the file and output it.
Then close both files and move on to next file

EDIT

@TonyGeorge in that case, load the rtf file

$h=fopen("myfile.rtf", "r");
$text=fread($h);
fclose($h);
//Now put the code that handles the rtf conversion, the contents of the rtf will be in $text
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号