java导出word文档后,怎么在客户端提供下载。
。
。
Microsoft Office 2007 简体中文版 给你全新的激情体验…………………… [ ] 推荐使用国产的金山WPS OFFICE 2005专业版 专项技术突破:四层柔性架构体系 · 应用层支持各种组件应用,支持各类编程语言 · 核心层直接提供二次开发接口,驱动引擎设计为高度兼容夯实基础 · 公用层软件模块最大程度重用,确保软件轻巧 · 系统层隔离操作系统调用,实现软件跨平台应用 八大特色功能,畅享办公新体验 ● 跨平台 · 跨Windows/Linux操作平台:同一文件在两个操作系统中读写效果一致,无障碍交互 ● 双向精确兼容 WPS文字→Microsoft Office Word WPS表格→Microsoft Office Excel WPS演示→Microsoft Office PowerPoint · 文件格式兼容:WPS文字、WPS表格、WPS演示分别对应Word、Excel、Powerpoint,读写双向精确兼容 · 用户界面兼容:采用XP界面风格,毫无陌生感,0时间上手 · 使用习惯兼容:用户现有使用习惯完全保留,无须再学习 · 安全模式兼容:无障碍读写Microsoft Office的加密文件以及宏文件 · 二次开发兼容:兼容Microsoft Office二次开发接口 ● 超轻巧 · 安装包仅有23M,安装后仅有83M ● 网络化 · 无须用户动手,主动实时升级 · 通过网络提供海量模板素材,专业文档随需借鉴 · 集成金山通行证,简单注册,享受超值客户服务 ● 保安全 · 独创的KRM授权保护技术,基于用户授权的保密新技术,优于传统密码设置,满足协同环境下文档安全要求。
● 中文特色 · 文档标签:便捷实现文档切换 · 文本框间文字绕排:实现“轻量级”排版功能 · 稿纸 · 斜线表头 · 中文项目符号:与国家公文规范要求严格一致 · 中文纸张规格支持 · WPS表格输入框智能收缩 · WPS表格人民币大写自动转换 · 可选择的中文度量单位 · 反片打印 · 批注框内显示作者名字 ● 应用随需扩展 · 按照MSAPI定义和实现的二次开发接口高达250个类,无限扩展用户个性化定制和应用开发的需求 · 无缝链接电子政务,文件随需飞翔政府内网中 · 支持126种语言应用, 包罗众多生僻小语种,保证文件跨国、跨地区自主交流 · 二次开发接口提供高达256种对象模型,实现OA系统平滑移植 · 能完全内嵌到IE中,全面支持B/S和C/S应用,满足电子政务应用需求 · 可扩展的插件、控件机制,无限扩展用户个性化需求 ● PDF输出 · 支持PDF格式输出及权限设置,输出后的PDF文档与原文档完全一致 [ ]
JAVA 文件下载
//像txt文件,但不能太大 这个你用数组做能去掉大小的弊端 //但excel文件就不能保存 这个问题试试"另存为"好不好使 或者 "在新窗口打开" 再次确定下你的IE是不是集成了Excel的查看功能(就是能有IE打开Excel),如果是的话 删除插件即可p.s.处理IO流时的问题....file=new File("c:\text.txt");DateInputStream dis=new DataInputStream(new FileInputStream(file));byte b[]=new byte[(int)file.length()];int i=0;while((i=(dis.read(b)))!=-1){String s=new String(b,0,i);JTextField.setText(s);dis.close();就是个例子...
Java如何操作Word,Excel,PDF文档?
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; } }
word文档在那里下载?
new int[1]).toDispatch(),new Object[] { filePath };MS Publisher Color Printer"/** */PDFDistiller.PDFDistiller;/是否追加打印Variant Append = False.Documents的DispatchDispatch wrdDocs = wordCom.getProperty("Documents"//));/Adobe PDF"wordCom.setProperty("ActivePrinter",返回wordDocwordDoc = Dispatch;/建立Adobe Distiller的com对象ActiveXComponent distiller = new ActiveXComponent("/作为输入的ps文档路径Variant inputPostScriptFilePath = new Variant(destinPSFilePath).Documents。
目前只使用了前5个参数, new Variant[] {Background, Append, Range;/*** * 将word文档打印为PS文件后,使用Distiller将PS文件转换为PDF文件 *** @param sourceFilePath* 源文件路径 ** @param destinPSFilePath* 首先生成的PS文件路径 ** @param destinPDFFilePath* 生成PDF文件路径*/.Variant;作为输出的pdf文档的路径Variant outputPDFFilePath = new Variant(destinPDFFilePath);//定义FileToPDF方法要使用adobe pdf设置文件的路径,在这里没有赋值表示并不使用pdf配置文件Variant PDFOption = new Variant("");//调用FileToPDF方法将ps文档转换为pdf文档Dispatch.callN(distiller, "FileToPDF", new Variant[] {inputPostScriptFilePath, outputPDFFilePath, PDFOption });System.out.println("由ps文档转换为pdf文档成功!");} catch (Exception ex) {ex.printStackTrace();} finally {closeWord();wordCom=null;//释放在程序线程中引用的其它com,比如Adobe PDFDistillerComThread.Release();}}public static void main(String[] argv) {D2P d2p = new D2P();d2p.docToPDF("d:/12.doc", "d:/1p.ps", "d:/1p.pdf");//这里是你建一个叫12.doc的word文档,生成的文档将在D盘下//1p.ps和1p.pdf(这是我们要的)}}.invoke(wrdDocs, ".invoke("Quit";设置当前使用的打印机,我的Adobe Distiller打印机名字为"/** */.1");try {///** */Open"public boolean openWord(String filePath) {///*** 关闭word文档*/public void closeWord() {///输出的postscript文件的路径Variant OutputFileName = new Variant(destinPSFilePath);public class D2P {private ActiveXComponent wordCom = null.jacob.Dispatch;import com, "PrintOut"需要用到插件jacob,自己去下载吧;//).println("打印所有文档int wdPrintAllDocument = 0;Variant Range = new Variant(wdPrintAllDocument);//*** 打开word文档** @param filePath* word文档* @return 返回word文档对象*//是否在后台运行Variant Background = False;/.out;/** *//** */import com.jacob.com.ComThread;import com。
import com.jacob.activeX.ActiveXComponent.Open方法打开指定的word文档, OutputFileName });System;Word.Application", new Variant("return true.toDispatch();//** */.com, new Variant[] {});}/** */Dispatch.callN((Dispatch) wordDoc.jacob,String destinPDFFilePath) {if (;由word文档打印为ps文档成功!");/public void docToPDF(String sourceFilePath, String destinPSFilePath;private Object wordDoc = null;/设置printout的参数,将word文档打印为postscript文档,如果要使用更多的话可以参考MSDN的office开发相关api/, Dispatch.Method,详细内容参考Distiller Api手册//返回wrdCom;private final Variant False = new Variant(false);private final Variant True = new Variant(true);建立ActiveX部件wordCom = new ActiveXComponent("!openWord(sourceFilePath)) {closeWord();return;);关闭word文件wordCom;/调用Distiller对象的FileToPDF方法所用的参数;try {/} catch (Exception ex) {ex.printStackTrace();}return false;}/** *//调用wrdCom;/** */}/.com 展开
如何用java将pdf文件转换成word文件
需要用到插件jacob,自己去下载吧。
import com.jacob.activeX.ActiveXComponent; import com.jacob.com.ComThread; import com.jacob.com.Dispatch; import com.jacob.com.Variant; public class D2P { private ActiveXComponent wordCom = null; private Object wordDoc = null; private final Variant False = new Variant(false); private final Variant True = new Variant(true);/** *//** *//** *//*** 打开word文档** @param filePath* word文档* @return 返回word文档对象*/ public boolean openWord(String filePath) {//建立ActiveX部件 wordCom = new ActiveXComponent("Word.Application"); try {//返回wrdCom.Documents的Dispatch Dispatch wrdDocs = wordCom.getProperty("Documents").toDispatch();//调用wrdCom.Documents.Open方法打开指定的word文档,返回wordDoc wordDoc = Dispatch.invoke(wrdDocs, "Open", Dispatch.Method,new Object[] { filePath }, new int[1]).toDispatch(); return true; } catch (Exception ex) { ex.printStackTrace(); } return false; }/** *//** *//** *//*** 关闭word文档*/ public void closeWord() {//关闭word文件 wordCom.invoke("Quit", new Variant[] {}); }/** *//** *//** *//*** * 将word文档打印为PS文件后,使用Distiller将PS文件转换为PDF文件 *** @param sourceFilePath* 源文件路径 ** @param destinPSFilePath* 首先生成的PS文件路径 ** @param destinPDFFilePath* 生成PDF文件路径*/ public void docToPDF(String sourceFilePath, String destinPSFilePath,String destinPDFFilePath) { if (!openWord(sourceFilePath)) { closeWord(); return; }//建立Adobe Distiller的com对象 ActiveXComponent distiller = new ActiveXComponent("PDFDistiller.PDFDistiller.1"); try {//设置当前使用的打印机,我的Adobe Distiller打印机名字为"Adobe PDF" wordCom.setProperty("ActivePrinter", new Variant("MS Publisher Color Printer"));//设置printout的参数,将word文档打印为postscript文档。
目前只使用了前5个参数,如果要使用更多的话可以参考MSDN的office开发相关api//是否在后台运行 Variant Background = False;//是否追加打印 Variant Append = False;//打印所有文档 int wdPrintAllDocument = 0; Variant Range = new Variant(wdPrintAllDocument);//输出的postscript文件的路径 Variant OutputFileName = new Variant(destinPSFilePath); Dispatch.callN((Dispatch) wordDoc, "PrintOut", new Variant[] { Background, Append, Range, OutputFileName }); System.out.println("由word文档打印为ps文档成功!");//调用Distiller对象的FileToPDF方法所用的参数,详细内容参考Distiller Api手册//作为输入的ps文档路径 Variant inputPostScriptFilePath = new Variant(destinPSFilePath);//作为输出的pdf文档的路径 Variant outputPDFFilePath = new Variant(destinPDFFilePath);//定义FileToPDF方法要使用adobe pdf设置文件的路径,在这里没有赋值表示并不使用pdf配置文件 Variant PDFOption = new Variant("");//调用FileToPDF方法将ps文档转换为pdf文档 Dispatch.callN(distiller, "FileToPDF", new Variant[] { inputPostScriptFilePath, outputPDFFilePath, PDFOption }); System.out.println("由ps文档转换为pdf文档成功!"); } catch (Exception ex) { ex.printStackTrace(); } finally { closeWord(); wordCom=null;//释放在程序线程中引用的其它com,比如Adobe PDFDistiller ComThread.Release(); } } public static void main(String[] argv) { D2P d2p = new D2P(); d2p.docToPDF("d:/12.doc", "d:/1p.ps", "d:/1p.pdf");//这里是你建一个叫12.doc的word文档,生成的文档将在D盘下//1p.ps和1p.pdf(这是我们要的) } }
JAVA读取WORD,EXCEL,PDF文件的方法是什么呢?
JAVA读取WORD,EXCEL,POWERPOINT,PDF文件的方法 OFFICE文档使用POI控件,PDF可以使用PDFBOX0.7.3控件,完全支持中文,用XPDF也行,不过感觉PDFBOX比较好,而且作者也在更新。
水平有限,万望各位指正 WORD: import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.poi.hwpf.extractor.WordExtractor; import java.io.File; import java.io.InputStream; import java.io.FileInputStream; import com.search.code.Index; public Document getDocument(Index index, String url, String title, InputStream is) throws DocCenterException { String bodyText = null; try { WordExtractor ex = new WordExtractor(is);//is是WORD文件的InputStream bodyText = ex.getText(); if(!bodyText.equals("")){ index.AddIndex(url, title, bodyText); } }catch (DocCenterException e) { throw new DocCenterException("无法从该Mocriosoft Word文档中提取内容", e); }catch(Exception e){ e.printStackTrace(); } } return null; } Excel: import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFCell; import java.io.File; import java.io.InputStream; import java.io.FileInputStream; import com.search.code.Index; public Document getDocument(Index index, String url, String title, InputStream is) throws DocCenterException { StringBuffer content = new StringBuffer(); try{
java实现word文档自动转成pdf文档我现在在做一个网站,客
没自动的..你可以把软件安装好了点文件-导入\导出 来转换成PDF文件 也可以用WPS, 这是我自己下载了在用的,很好用的版本: Office.2003.SP2.龙卷风大企业版 V2.2 2.2 658M ISO 此ISO整合SP2升级包,免激活,免序列号,支持在线更新 包含下列组件: Microsoft Office Word 2003 Microsoft Office Excel 2003 Microsoft Office PowerPoint 2003 Microsoft Office FrontPage 2003 Microsoft Office Access 2003 Microsoft Office Outlook 2003 Microsoft Office OneNote 2003 Microsoft Office Visio 2003 Microsoft Office InfoPath 2003 Microsoft Office Publisher 2003 Microsoft Office Project 2003 安装说明:先卸载你原来的版本,然后全新安装此版即可
转载请注明出处51数据库 » java word文件下载