如何在html页面中嵌入一个ppt嵌入word文档档

JavaEE(4)
将Word转Html的原理是这样的:
1、客户上传Word文档到服务器
2、服务器调用OpenOffice程序打开上传的Word文档
3、OpenOffice将Word文档另存为Html格式
具体步骤:
1、下载OpenOffice,OpenOffice支持跨平台&
2、下载Jodconverter,开启OpenOffice进行格式转化的第三方jar包。
3.安装OpenOffice一定要调用cmd,启动OpenOffice的一项服务:C:\Program Files (x86)\OpenOffice4\program&soffice -headless -accept=&socket,host=127.0.0.1,port=8100;& & & && 注意:按照安装的真实路径进行启动openoffice,一般路径不同无法启动;
4.打开eclipse(Myeclipse)新建eclipse项目,导入Jodconverter/lib 下jar包。
import java.io.F
import java.net.ConnectE
import com.artofsolving.jodconverter.DocumentC
import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeC
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeC
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentC
public class Test {
public static void main(String[] args) {
File inputFile = new File(&C:/Users/Desktop/培训课程.doc&);
File outputFile = new File(&C:/Users/Desktop/培训课程.html&);
OpenOfficeConnection con = new SocketOpenOfficeConnection(8100);
con.connect();
} catch (ConnectException e) {
System.err.println(&文件转换出错,请检查OpenOffice服务是否启动。&);
e.printStackTrace();
DocumentConverter converter = new OpenOfficeDocumentConverter(con);
converter.convert(inputFile, outputFile);
con.disconnect();
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:8382次
排名:千里之外
原创:80篇
转载:29篇
(20)(8)(17)(8)(10)(14)(19)(9)(3)(2)&&&&.Net 读取Word文档在html页面显示
&.Net 读取Word文档在html页面显示
读取Word内容在html页面显示
布局灵活多变
代码简单易读
若举报审核通过,可奖励20下载分
被举报人:
huangyanqiu001
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
Q.为什么我点的下载下不了,但积分却被扣了
A. 由于下载人数众多,下载服务器做了并发的限制。若发现下载不了,请稍后再试,多次下载是不会重复扣分的。
Q.我的积分不多了,如何获取积分?
A. 获得积分,详细见。
完成任务获取积分。
论坛可用分兑换下载积分。
第一次绑定手机,将获得5个C币,C币可。
关注并绑定CSDNID,送10个下载分
下载资源意味着您已经同意遵守以下协议
资源的所有权益归上传用户所有
未经权益所有人同意,不得将资源中的内容挪作商业或盈利用途
CSDN下载频道仅提供交流平台,并不能对任何下载资源负责
下载资源中如有侵权或不适当内容,
本站不保证本站提供的资源的准确性,安全性和完整性,同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
开发技术下载排行
您当前C币:0&&&可兑换 0 下载积分
兑换下载分:&
消耗C币:0&
立即兑换&&
兑换成功你当前的下载分为 。前去下载资源
你下载资源过于频繁,请输入验证码
如何快速获得积分?
你已经下载过该资源,再次下载不需要扣除积分
.Net 读取Word文档在html页面显示
所需积分:3
剩余积分:0
扫描微信二维码精彩活动、课程更新抢先知
VIP会员,免积分下载
会员到期时间:日
剩余下载次数:1000
.Net 读取Word文档在html页面显示
剩余次数:&&&&有效期截止到:
你还不是VIP会员VIP会员享免积分 . 专属通道极速下载
VIP下载次数已满VIP会员享免积分 . 专属通道极速下载,请继续开通VIP会员
你的VIP会员已过期VIP会员享免积分 . 专属通道极速下载,请继续开通VIP会员&&&&《霍元甲》中的乞丐说,就在今天。是的,就在今天,尽管我的论文没有遵循问题导向的研究思路,尽管我答辩时同几个不懂技术的专家简直是在鸡同鸭讲,答辩委员会还是一致通过,建议授予我管理学硕士学位。Anyway,终于自由了!
&&&&言归正传,答辩前,我们的研究生秘书遇到麻烦了,呵呵,60多个研究生每个人都要打印一个下图所示格式的审核表:
& &&&要是一个学生一个学生的填写,工作量还真是很大,而且以后每年都要这样填写,实在是太麻烦了。
&&&& 好了,这应该是一个很简单的问题,假设数据都准备好了(事实上这部分也是一团糟,尽管比较简单),我们可以考虑使用报表设计器做一个报表,但是其中报表的细节比较麻烦(比如答辩委员会的成员可能只有7个,而不是图示的8个,一般的报表设计器不是很好处理)。再考虑直接用程序生成WORD文档吧,嗯,WORD的对象模型可以参考,但生成这种格式还是比较麻烦的,我们可以考虑一种变通的方法——使用HTML文件作为中转:
&&&& 先使用Dreamweaver等HTML生成工具,生成上图所示的表格,保存为一个html文件。用WORD打开这个html文件,看一下效果(使用“页面”视图),除了表格线好像太粗了,其它的CSS样式应用效果还是很好的。现在,我们就可以考虑像ASP时代开发的时候使用代码循环为每一个学生那样生成这个表格了。另外,还有一个需求需要满足,就是每个学生的审核表应该占一页,也就是说每次循环都应该插入一个分页符。HTML文件中没有分页的概念,我们可以先在WORD中插入一个分页符,然后将这个WORD文档另存为HTML文件,然后查看其源文件,可以看到,分页符是这样的:
&br&clear=all&style='page-break-before:always'&
&&&&至于细线表格,当然可以在CSS样式中加以定义,也可以按照上面分页符的方式查看其源代码:
&table&width='610'&border='1'&cellpadding='0'&cellspacing='0'&bordercolor='#000000'&style='border-collapse:border:mso-border-alt:solid&windowtext&.5&mso-yfti-tbllook:480;mso-padding-alt:0cm&5.4pt&0cm&5.4mso-border-insideh:.5pt&solid&mso-border-insidev:.5pt&solid&windowtext'&&/table&
&&&&OK,下面的代码就可以为所有学生一次生成审核表了:
&1&&&&&&&&&&&&string&strFilePath&=&Application.StartupPath&+&@"\wordfile.doc";&2&3&&&&&&&&&&&&System.IO.StreamWriter&sw&=&new&System.IO.StreamWriter(strFilePath,&false,&System.Text.Encoding.GetEncoding("gb2312"));&4&&&&&&&&&&&&sw.WriteLine("&html&&head&&meta&http-equiv='Content-Type'&content='application/&charset=gb2312'&&title&学位论文答辩委员会成员审核表&/title&");&5&&&&&&&&&&&&sw.WriteLine("&style&type='text/css'&&!--.STYLE1&{&&&&font-family:&'宋体';&&&&font-size:&18&&&&font-weight:&&}&.STYLE2&{&&&&font-family:&'宋体';&&&&font-size:&11&&&&font-weight:&&}&--&&&/style&");&6&&&&&&&&&&&&sw.WriteLine("&/head&");&7&&&&&&&&&&&&sw.WriteLine("&body&");&8&9&&&&&&&&&&&&System.Data.OleDb.OleDbDataAdapter&odda&=&new&System.Data.OleDb.OleDbDataAdapter("SELECT&研究生.编号,&研究生.姓名,&研究生.学科专业,&研究生.导师,&研究生.论文题目&FROM&研究生&ORDER&BY&研究生.编号",&"Provider=Microsoft.Jet.OLEDB.4.0;Data&Source="&+&System.Windows.Forms.Application.StartupPath&+&@"\database.mdb");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&System.Data.DataSet&dsStudent&=&new&DataSet();<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&odda.Fill(dsStudent);<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&for&(int&i&=&<span style="COLOR: #;&i&&&dsStudent.Tables[<span style="COLOR: #].Rows.C&i++)<span style="COLOR: #&&&&&&&&&&&&{<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&div&align='center'&class='STYLE1'&&u&&&硕&&&/u&士学位论文答辩委员会成员审核表&/div&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&table&width='610'&border='1'&cellpadding='0'&cellspacing='0'&bordercolor='#000000'&style='border-collapse:border:mso-border-alt:solid&windowtext&.5&mso-yfti-tbllook:480;mso-padding-alt:0cm&5.4pt&0cm&5.4mso-border-insideh:.5pt&solid&mso-border-insidev:.5pt&solid&windowtext'&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&width='68'&align='center'&valign='middle'&class='STYLE2'&height='50pt'&研究生&br&/&姓&&名&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&width='93'&align='center'&valign='middle'&class='STYLE2'&height='50pt'&"&+&dsStudent.Tables[<span style="COLOR: #].Rows[i]["姓名"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&width='68'&align='center'&valign='middle'&class='STYLE2'&height='50pt'&专&&业&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&colspan='3'&align='center'&valign='middle'&class='STYLE2'&height='50pt'&"&+&dsStudent.Tables[<span style="COLOR: #].Rows[i]["学科专业"].ToString()&+&"&/td&&/tr&");<span style="COLOR: #<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&align='center'&valign='middle'&class='STYLE2'&height='50pt'&导&&师&br&/&姓&&名&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='50pt'&"&+&dsStudent.Tables[<span style="COLOR: #].Rows[i]["导师"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='50pt'&论&&文&br&/&题&&目&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&colspan='3'&align='center'&valign='middle'&class='STYLE2'&height='50pt'&"&+&dsStudent.Tables[<span style="COLOR: #].Rows[i]["论文题目"].ToString()&+&"&/td&&/tr&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&rowspan='8'&align='center'&valign='middle'&class='STYLE2'&答&br&/&&br&/&辩&br&/&&br&/&委&br&/&&br&/&员&br&/&&br&/&会&br&/&&br&/&成&br&/&&br&/&员&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&姓&&名&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&职&&称&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&width='204'&align='center'&valign='middle'&class='STYLE2'&height='36'&工&&作&&单&&位&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&width='100'&align='center'&valign='middle'&class='STYLE2'&height='36'&在委员会中&br&/&担任的职务&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&width='63'&align='center'&valign='middle'&class='STYLE2'&height='36'&备&&注&/td&&/tr&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&System.Data.OleDb.OleDbDataAdapter&oddaT&=&new&System.Data.OleDb.OleDbDataAdapter("SELECT&答辩老师小组.顺序,&答辩老师.姓名,&答辩老师.职称,&答辩老师.单位,&答辩老师小组.答辩职务,&答辩老师.备注&FROM&答辩老师&INNER&JOIN&(答辩老师小组&INNER&JOIN&(答辩小组&INNER&JOIN&研究生小组&ON&答辩小组.编号&=&研究生小组.小组)&ON&答辩老师小组.小组编号&=&答辩小组.编号)&ON&答辩老师.编号&=&答辩老师小组.答辩老师编号&WHERE&(((研究生小组.研究生)="&+&dsStudent.Tables[<span style="COLOR: #].Rows[i]["编号"].ToString()&+&"))&ORDER&BY&答辩老师小组.顺序",&"Provider=Microsoft.Jet.OLEDB.4.0;Data&Source="&+&System.Windows.Forms.Application.StartupPath&+&@"\database.mdb");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&System.Data.DataSet&dsTeacher&=&new&DataSet();<span style="COLOR: #&&&&&&&&&&&&&&&&oddaT.Fill(dsTeacher);<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&for&(int&j&=&<span style="COLOR: #;&j&&&<span style="COLOR: #;&j++)<span style="COLOR: #&&&&&&&&&&&&&&&&{<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&if&(j&&&dsTeacher.Tables[<span style="COLOR: #].Rows.Count)<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&{<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&align='center'&valign='middle'&class='STYLE2'&height='36'&"&+&dsTeacher.Tables[<span style="COLOR: #].Rows[j]["姓名"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&"&+&dsTeacher.Tables[<span style="COLOR: #].Rows[j]["职称"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&"&+&dsTeacher.Tables[<span style="COLOR: #].Rows[j]["单位"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&"&+&dsTeacher.Tables[<span style="COLOR: #].Rows[j]["答辩职务"].ToString()&+&"&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&"&+&dsTeacher.Tables[<span style="COLOR: #].Rows[j]["备注"].ToString()&+&"&/td&&/tr&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&}<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&else<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&{&<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&align='center'&valign='middle'&class='STYLE2'&height='36'&&&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&&&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&&&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&&&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&sw.WriteLine("&td&align='center'&valign='middle'&class='STYLE2'&height='36'&&&/td&&/tr&");<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&}<span style="COLOR: #&&&&&&&&&&&&&&&&}<span style="COLOR: #&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&<span style="COLOR: #&&&&&&&&&&&&&&&&dsTeacher.Dispose();<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&align='center'&valign='middle'&class='STYLE2'&分学&br&/&科学&br&/&位评&br&/&定委&br&/&员会&br&/&意见&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&colspan='5'&class='STYLE2'&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&p&&&&&&&&&分委员会主席(签字)&&&&&&&&&&&&&&&&&&&&日&/p&&/td&&/tr&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&tr&&td&align='center'&valign='middle'&class='STYLE2'&校学&br&/&位评&br&/&定委&br&/&员会&br&/&审批&br&/&意见&/td&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&td&colspan='5'&class='STYLE2'&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&&p&&&/p&");<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&p&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&日&/p&&/td&&/tr&&/table&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&&&&&sw.WriteLine("&br&clear=all&style='page-break-before:always'&");<span style="COLOR: #&&&&&&&&&&&&}<span style="COLOR: #<span style="COLOR: #&&&&&&&&dsStudent.Dispose();<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&sw.WriteLine("&/body&&/html&");<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&sw.Close();<span style="COLOR: #<span style="COLOR: #&&&&&&&&&&&&System.Diagnostics.Process.Start(strFilePath);
阅读(...) 评论()html中嵌入word文档,寻求帮助!
html中嵌入word文档,寻求帮助!只要能够嵌入到html中预览就行了!!
09-07-07 &匿名提问
能具体点吗?
请登录后再发表评论!
&a href=&url&&Text to be displayed&/a&把word的地址写到 &url& 加个连接就可以了~如果直接镶嵌的话定义用&textarea rows(行)=? size=?或者cols=?(列)&
请登录后再发表评论!

我要回帖

更多关于 js html嵌入word文档 的文章

 

随机推荐