ワード文書の生成

/ **
*構成コンテンツをdocファイルにダウンロード
* /
パブリック関数actionSaveCompositionWord()
{
//データモデルをロードします
$ model = $ this-> loadModel();

header( "Cache-Control:no-cache、must-revalidate");
header( "プラグマ:no-cache");

$ wordStr = '<html xmlns:o = "urn:schemas-microsoft-com:office:office" 
           xmlns:w = "urn:schemas-microsoft-com:office:word" xmlns = "http://www.w3.org/TR/REC-html40">
           <head> <STYLE> BR.page {page-break-after:always} </ STYLE> </ head> <body> ';

$ wordStr。= $ model-> content;

$ wordStr。= '</ body> </ html>';

$ fileName = $ model-> composition_name。'_'。$ model-> real_name;

//エクスポートが文字化けしないようにします
$ file = iconv( "utf-8"、 "GBK"、$ fileName);

header( "Content-Type:application / doc");
header( "Content-Disposition:attachment; filename ="。$ file。 ".doc");

echo $ wordStr;
}
公開された14元の記事 ウォンの賞賛3 ビュー2029

おすすめ

転載: blog.csdn.net/energy_tank/article/details/46621161