
1.thinkphp 生成word
直接将 html生成word就行了 部分代码
//导出word
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="
echo '<xml><w:WordDocument><w:View>Print</w:View></xml> ';
$this->display($tpl);;
echo '</html>';
$wordname = $title;
ob_start(); //打开缓冲区
Header("Cache-Control: public");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
if (strpos($_SERVER["HTTP_USER_AGENT"],'MSIE')) {
Header("Content-Disposition: attachment; filename=$wordname.doc");
}else if (strpos($_SERVER["HTTP_USER_AGENT"],'Firefox')) {
Header("Content-Disposition: attachment; filename=$wordname.doc");
} else {
Header("Content-Disposition: attachment; filename=$wordname.doc");
}
Header("Pragma:no-cache");
Header("Expires:0");
ob_end_flush();//输出全部内容到浏览器
2.在thinkphp框架中如何使用phpword
也不很懂就说说 导入第三方 就假如
public function qrcode(){
Vendor('phpqrcode.phpqrcode');//按住ctrl 鼠标左键点vendor,一步步找到vendor目录该存放在哪儿。。应该是在../core/library下面,没有新建vendor文件夹,再把第三方文件放进去
$object = new \QRcode();//QRcode()是phpqrcode文件夹下面phpqrcode.php里的一个类
$object->png($url, false, $errorCorrectionLevel, $matrixPointSize, 2);
}//这就下面的一个png函数试下吧,能行就行,不行我也没有办法
3.用thinkPHP上传一份word文件,怎样显示出来
<?php
/*
* 必须将 php.ini 中的 com.allow_dcom 设为 TRUE
*/
function php_Word($wordname,$htmlname,$content)
{
//获取链接地址
$url = $_SERVER['HTTP_HOST'];
$url = ";
$url = $url.$_SERVER['PHP_SELF'];
$url = dirname($url)."/";
//建立一个指向新COM组件的索引
$word = new COM("word.application") or die("Unable to instanciate Word");
//显示目前正在使用的Word的版本号
echo "Loading Word, v. {$word->Version}";
//把它的可见性设置为0(假),如果要使它在最前端打开,使用1(真)
$word->Visible = 1;
//---------------------------------读取Word内容操作 START-----------------------------------------
//打开一个word文档
$word->Documents->Open($url.$wordname);
//将filename.doc转换为html格式,并保存为html文件
$word->Documents[1]->SaveAs(dirname(__FILE__)."/".$htmlname,8);
//获取htm文件内容并输出到页面 (文本的样式不会丢失)
$content = file_get_contents($url.$htmlname);
echo $content;
//获取word文档内容并输出到页面(文本的原样式已丢失)
$content= $word->ActiveDocument->content->Text;
echo $content;
//关闭与COM组件之间的连接
$word->Documents->close(true);
$word->Quit();
$word = null;
unset($word);
//---------------------------------新建立Word文档操作 START--------------------------------------
//建立一个空的word文档
$word->Documents->Add();
//写入内容到新建word
$word->Selection->TypeText("$content");
//保存新建的word文档
$word->Documents[1]->SaveAs(dirname(__FILE__)."/".$wordname);
//关闭与COM组件之间的连接
$word->Quit();
}
php_Word("tesw.doc","filename.html","写入word的内容");
?>
4.thinkphp怎么生成word
PHP操作Word文档的方法有很多,这里为大家提供一种高效方法,要比服务器安装com组件效率高的多,因为 word的com组件还要打开客户端。
首先保证你的服务器安装Microsoft Office
本文以下载素材火的特效页面,作为word输出内容。当然你也可以自定义字符串内容,比如表格、列表、标题等。
若是有图片的话,咱们必须转换成mht格式。
PHP生成word,并即时下载代码:
$url = file_get_contents("/js");
$fileContent = getWordDocument($url);
$fileName = iconv("utf-8", "GBK", '素材火' . '_' . $id . '_' . rand(100, 999));
header("Content-Type: application/doc");
header("Content-Disposition: attachment; filename=" . $fileName . ".doc");
echo $fileContent;
5.thinkphp怎么生成word
PHP操作Word文档的方法有很多,这里为大家提供一种高效方法,要比服务器安装com组件效率高的多,因为 word的com组件还要打开客户端。
首先保证你的服务器安装Microsoft Office本文以下载素材火的特效页面,作为word输出内容。当然你也可以自定义字符串内容,比如表格、列表、标题等。
若是有图片的话,咱们必须转换成mht格式。PHP生成word,并即时下载代码:$url = file_get_contents("/js"); $fileContent = getWordDocument($url); $fileName = iconv("utf-8", "GBK", '素材火' . '_' . $id . '_' . rand(100, 999)); header("Content-Type: application/doc"); header("Content-Disposition: attachment; filename=" . $fileName . ".doc"); echo $fileContent;。
6.java中hallo word怎么编写
新加一个文本文件,为HelloWorld.java
打开编辑如下代码:
class HelloWorld {
public static void main(String args[]){
System.out.println("Hello World!");
}
}
保存!!
在命令行窗口
找到该文件的存放的目录,
输入命令:
javac HelloWorld.java
执行代码命令:
java HelloWorld
即可
转载请注明出处51数据库 » thinkPHP5.0holleword
你的乳房滑过我的钢枪