java htm插入word htm转word
发布日期:2020-09-28摘要:怎用用java导入、导入word形式的考试题目? 使用java中的io进行读取BufferedReader bufferedReader = null;File file = new File("文档...
怎用用java导入、导入word形式的考试题目?
使用java中的io进行读取BufferedReader bufferedReader = null;File file = new File("文档地址+文档名.docx");if(!file.exists()){System.out.println("文件不存在");} else {bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "读取的字符格式(UTF-8或GBK)"));String lineText = null;while((lineText = bufferedReader.readLine()) != null){if (linText != null && !lineText.eq("")){System.out.println("一次读取一行,一行内容为:" + lineText);
JAVA编辑WORD文件插入图片
以前做过其他office的没做过微软的,不过大同小异这个你就需要在java中获取到word的某种对象,方法有很多,但是要看你用什么方式调用的office了,如果是某个牌子的中间件,那就用那个中间件的二次开发文档里面应该就有提到这些方法,如果是第三方的jar包,应该也不麻烦,通过jar包中的方法,可能要有一个word的实例创建的过程吧,然后获取到range或者textrange等这些对象(应该是这俩对象……)通过这对象然后找到插入图片的方法,然后传入位置参数(可能是两个数用逗号隔开)
JAVA中如何把WORD文档直接转换成html?
jaco是java和windows下的com桥,通过它我们可以在java程序中调用COM组件。
如果你的JDK是1.4,那你需要下载jaco1.9的jni库才能正常运行,早期版本在JDK1.4下有些问题。
package com;** * Title:Wod文档转html类 * Desciption: * Copyight:() 2002 * @autho 舵手 * @vesion 1.0 *impot com.jaco.com.*;impot com.jaco.activeX.*; pulic class WodtoHtml { ** *文档转换函数 *@paam docfile wod文档的绝对路径加文件名(包含扩展名) *@paam htmlfile 转换后的html文件绝对路径和文件名(不含扩展名) * pulic static void change(Sting docfile, Sting htmlfile) { ActiveXComponent app = new ActiveXComponent("Wod.Application"); 启动wod ty { app.setPopety("Visile", new Vaiant(false)); 设置wod不可见 Oject docs = app.getPopety("Documents").toDispatch(); Oject doc = Dispatch.invoke(docs,"Open",Dispatch.Method,new Oject[] { docfile, new Vaiant(false),new Vaiant(tue) }, new int[1]).toDispatch(); 打开wod文件 Dispatch.invoke(doc, "SaveAs", Dispatch.Method, new Oject[] {htmlfile, new Vaiant(8) }, new int[1]); 作为html格式保存到临时文件 Vaiant f = new Vaiant(false); Dispatch.call(doc, "Close", f); } catch (Exception e) { e.pintStackTace(); } finally { app.invoke("Quit", new Vaiant[]{}); } } pulic static void main(Sting[] sts){ WodtoHtml.change("c:\\a\\运输管理调度系统总体方案.doc", "c:\\a\\t"); }}
如何用WORD插入表格?请问一下,我在WORD先打好字,然后怎样
Java Excel API 文档 http://www.andykhan.com/jexcelapi/ 1、一个jacob操作Word的例子,其他操作excel,pdf的sample里都有 import java.io.File; import com.jacob.com.*; import com.jacob.activeX.*; public class WordTest { public static void main(String[] args) { WordBean word=new WordBean(); word.openWord(true); word.createNewDocument(); word.insertText("Hello word."); } } import com.jacob.activeX.*; import com.jacob.com.*; public class WordBean extends java.awt.Panel { private ActiveXComponent MsWordApp = null; private Dispatch document = null; public WordBean() { super(); } public void openWord(boolean makeVisible) { //Open Word if we"ve not done it already if (MsWordApp == null) { MsWordApp = new ActiveXComponent("Word.Application"); } //Set the visible property as required. Dispatch.put(MsWordApp, "Visible", new Variant(makeVisible)); } public void createNewDocument() { //Find the Documents collection object maintained by Word Dispatch documents = Dispatch.get(MsWordApp,"Documents").toDispatch(); //Call the Add method of the Documents collection to create //a new document to edit document = Dispatch.call(documents,"Add").toDispatch(); } public void insertText(String textToInsert) { // Get the current selection within Word at the moment. If // a new document has just been created then this will be at // the top of the new doc Dispatch selection = Dispatch.get(MsWordApp,"Selection").toDispatch(); //Put the specified text at the insertion point Dispatch.put(selection,"Text",textToInsert); } public void saveFileAs(String filename) { Dispatch.call(document,"SaveAs",filename); } public void printFile() { //Just print the current document to the default printer Dispatch.call(document,"PrintOut"); } public void closeDocument() { // Close the document without saving changes // 0 = wdDoNotSaveChanges // -1 = wdSaveChanges // -2 = wdPromptToSaveChanges Dispatch.call(document, "Close", new Variant(0)); document = null; } public void closeWord() { Dispatch.call(MsWordApp,"Quit"); MsWordApp = null; document = null; } }
用java把html转成word文档,html中的图片怎么办????
Word2007中分栏的两种方法由于排版的需要,会在一张纸上写两列文字或多列文字,在页面上左右分开,这就是分栏。
常用有两种方法。
在Word中,一个页面通常作为一个整栏进行处理,也就是一段文字从左面页边距处一直排到右面页边距处再换行。
但有时由于排版的需要,会在一张纸上写两列文字或多列文字,在页面上左右分开,这就是分栏。
合理地对文档分栏既能方便读者阅读,又能梅花页面,有时还可以节约版面。
在Word中既可以容易地生成分栏,还可以在不同节中有不同的栏数和格式。
对版面进行分栏有两种方法:一是简单分栏,二是精确分栏。
单击“页面布局”选项卡,在“页面布局”功能区中单击“分栏”按钮,打开一个下拉菜单,如下图所示,从中选择相应的栏数即可。
各分栏意义如下:一栏:表示不对文档进行文档,或取消原来的文档。
二栏:以页面中线为基准,分为左右两栏。
三栏:将页面平均分为左、中、右三栏。
偏左:分成两栏,右面的分栏比左面的分栏要宽一些。
偏右:分成两栏,左面的分栏比右面的分栏要宽一些。
1、在“页面布局”功能区中单击“分栏”按钮,打开一个下拉菜单,从中选择“更多分栏”命令,打开如下图所示的“分栏”对话框。
2、在“预设”选项组中选择分栏的格式,有“一栏”、“两栏”、“三栏”、“左”和“右”五种分栏格式可以选择。
3、如果对“预设”选项组中的分栏格式不太满意,可以在“栏数”微调框中输入所要分割的栏数。
微调框中最大分栏数根据纸张的不同而不同。
4、如果要使各栏等宽,则选中“栏宽相等”。
如果不选中“栏宽相等”,可以在“宽度和间距”选项组中设置各栏的栏宽和间距。
5、如果要在各栏之间加入分隔线,需要选中“分隔线”复选框。
6、在“应用于”下拉列表中选择分栏的范围。
7、完成设置后,单击“确定”按钮即可。
CorelDRAW中的图可以插入word吗?如果可以又该怎么插入?
JAVA读取WORD,EXCEL,POWERPOINT,PDF文件的方法 OFFICE文档使用POI控件,PDF可以使用PDFBOX0.7.3控件,完全支持中文,用XPDF也行,不过感觉PDFBOX比较好,而且作者也在更新。
水平有限,万望各位指正 WORD: impot og.apache.lucene.document.Document; impot og.apache.lucene.document.Field; impot og.apache.poi.hwpf.extacto.WodExtacto; impot java.io.File; impot java.io.InputSteam; impot java.io.FileInputSteam; impot com.seach.code.Index; pulic Document getDocument(Index index, Sting ul, Sting title, InputSteam is) thows DocCenteException { Sting odyText = null; ty { WodExtacto ex = new WodExtacto(is);is是WORD文件的InputSteam odyText = ex.getText(); if(!odyText.equals("")){ index.AddIndex(ul, title, odyText); } }catch (DocCenteException e) { thow new DocCenteException("无法从该Mociosoft Wod文档中提取内容", e); }catch(Exception e){ e.pintStackTace(); } } etun null; } Excel: impot og.apache.lucene.document.Document; impot og.apache.lucene.document.Field; impot og.apache.poi.hwpf.extacto.WodExtacto; impot og.apache.poi.hssf.usemodel.HSSFWokook; impot og.apache.poi.hssf.usemodel.HSSFSheet; impot og.apache.poi.hssf.usemodel.HSSFRow; impot og.apache.poi.hssf.usemodel.HSSFCell; impot java.io.File; impot java.io.InputSteam; impot java.io.FileInputSteam; impot com.seach.code.Index; pulic Document getDocument(Index index, Sting ul, Sting title, InputSteam is) thows DocCenteException { StingBuffe content = new StingBuffe(); ty{
-
给我们打电话
7*24小时服务热线:1399999999
全国客服热线:400-0000-000 -
百度地图
福建省漳州市 -
给我们发邮件
E-mail:[email protected]
在线沟通