手机版

把word翻译成swf 像百度文库一样阅读实现思路和代码

时间:2021-11-17 来源:互联网 编辑:宝哥软件园 浏览:

复制的代码如下: span style=' font-family : aarial,Helvetica,无衬线'。要实现类似百度文库的功能,需要一系列的改造。一般的流程是先把word转换成pdf格式,再把pdf格式转换成swf格式。事实上,网页上显示的内容是swf格式的。/SPAN首先,要将word转换为swf,需要调用com组件,可以通过office或wps进行转换,但我的尝试失败了。最后,通过openOffice 4.0.0成功实现了转换。OpenOffice 4.0.0支持windows和linux操作系统,所以需要先下载OpenOffice,官方网站上应该有。将word转换为pdf似乎只是一个支持英文标题的文档,而不支持中文名称的文档。您可以先将文档重命名为英文,然后将其转换为中文。您可能还需要启动openoffice服务,如上所示

验证服务已打开,如上图

代码如下:复制代码代码如下: PRE类php名称='代码'?服务器端编程语言(Professional Hypertext Preprocessor的缩写)类RunTime//页面执行时间类{ private $ starttime//页面开始执行时间private $ stoptime/页面结束执行时间private $ spendtime/页面执行花费时间函数getmicrotime()//获取返回当前微秒数的浮点数{ list($usec,$sec)=explode(',micro time());return((float)$ usec(float)$ sec);}函数start()//页面开始执行函数,返回开始页面执行的时间{ $ this-start time=$ this-getmicrotime();}函数end()//显示页面执行的时间{ $ this-stop time=$ this-getmicrotime();$ this-花费时间=$ this-停止时间-$ this-开始时间;//返回回合($this-spendtime,10);}函数display(){//$ this-end();回声报运行时间:'.一轮(这次花了10美元)。'秒/p ';} } /*调用方法*/$ timer=new Runtime();$ timer-start();函数MakePropertyValue($name,$value,$ osm){ $ ostr uct=$ osm-Bridge _ GetStruct(' com。星期日明星。豆子。property value’);$ ost struct-Name=$ Name;$奥斯特鲁特-价值=$价值;返回$ oStruct}函数word2pdf($doc_url,$ output _ URL){ $ osm=new COM(' COM。星期日明星。服务经理')或' die('请确保安装了OpenOffice.org .\ n ');$ args=array(MakePropertyValue(' Hided ',true,$ osm));$ ODeskTop=$ osm-create instance(' com。星期日明星。框架。桌面');$ oWriterDoc=$ oDesktop-LoadComponentFromURl($ doc _ URl,' _blank ',0,$ args);$ Export _ args=array(MakePropertyValue('筛选器名称',' writer_pdf_Export ',$ osm));$ oWriterDoc-store turl($ output _ URL,$ export _ args);$ oWriterDoc-close(true);} $ output _ dir=' c :/';$ doc _ file=' c :/t . doc ';$ pdf _ file=' 9 . pdf $ output _ file=$ output _ dir .$ pdf _ file $ doc _ file=' file :///' .$ doc _ file $ output _ file=' file :///' .$ output _ filewordpdf($ doc _ file,$ output _ file);$ timer-end();$ timer-display();/PREBR P/P PRE/PRE P/P PBR /P花费时间进行分析:P将一个大小为148万的单词文档转化为可移植文档格式文件的扩展名(可移植文档格式的缩写)需要SPAN style=' FONT-FAMILY : Simsun;' FONT-SIZE: 14px '运行时间:1.3652579784秒/SPAN自己电脑是这个时间,自己测试PBR其次将可移植文档格式文件的扩展名(可移植文档格式的缩写)转化为主权财富基金,需要运用另外一个软件swftools通过代码调用煤矿管理局命令,直接上代码/P PPRE类php名称='代码?服务器端编程语言(Professional Hypertext Preprocessor的缩写)类RunTime//页面执行时间类{ private $ starttime//页面开始执行时间private $ stoptime/页面结束执行时间private $ spendtime/页面执行花费时间函数getmicrotime()//获取返回当前微秒数的浮点数{ list($usec,$sec)=explode(',micro time());return((float)$ usec(float)$ sec);}函数start()//页面开始执行函数,返回开始页面执行的时间{ $ this-start time=$ this-getmicrotime();}函数end()//显示页面执行的时间{ $ this-stop time=$ this-getmicrotime();$ this-花费时间=$ this-停止时间-$ this-开始时间;//返回回合($this-spendtime,10);}函数display(){//$ this-end();回声报运行时间:'.一轮(这次花了10美元)。'秒/p ';} } /*调用方法*/$ timer=new Runtime();$ timer-start();//调用系统软件$ command=' \ ' c : \程序文件\ swf工具\ pdf F2 swf。exe \ '-t c : \ 8。pdf-s flash version=9-o c : \ m . swf ';回声$命令;exec($ command);echo ' ok $ timer-end();$ timer-display();/PREBR将刚才转化而来的可移植文档格式文件的扩展名(可移植文档格式的缩写)转化为冲击波闪光文件需要用SPAN style=' FONT-FAMILY : Simsun;' FONT-SIZE: 14px '运行时间:1.3119211197秒时间/SPANP/P PSPAN style=' FONT-FAMILY : Simsun;'' FONT-SIZE: 14px '最后则是将冲击波闪光文件显示在网页中,这一步需要引入多个射流研究…文件和其他文件,代码就不写了,直接下载,在我的上传资料中/SPAN/P PBR /P PBR BR /P PBR /P

版权声明:把word翻译成swf 像百度文库一样阅读实现思路和代码是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。