bboss 文件下载插件和wordpdfswf转换插件完善
改进bboss mvc wordpdf插件
增加工具类/bboss-plugin-wordpdf/src/org/frameworkset/http/converter/wordpdf/FileConvertor.java
可以方便第实现word模板书签和值合并功能
方便地借助Flashprinter实现word向pdf,swf的转换
o 文件下载插件增加对FileBlob的支持
FileBlob增加构造函数:
public FileBlob( File data,int rendtype)
public FileBlob( String file,int rendtype)
两个构造函数含义是一致的,参数说明:
第一个参数:下载或者浏览的文件对象或者文件路径
第二个参数:标识文件是用来下载还是用来浏览,对应于FileBlob中的两个常量:FileBlob.BROWSER,FileBlob.DOWNLOAD,默认值为FileBlob.DOWNLOAD
使用实例一,控制器下载文件方法:
public @ResponseBody FileBlob downWordTemp() throws Exception {System.out.println("--------------程序执行到此处------------------");String[] bookMarks = new String[] { "DealerName", "Name", "CgName","TypeName", "OrderQty", "CoolCode", "ChassisCode", "CustPrice","CustAmt", "sumall", "EarnestPayDays", "EarnestAmt","StageDate", "FirstAmt", "DepositPercent", "Deposit","ServiceChargePercent", "ServiceCharge", "NotarizationFee","InsuranceTerm", "Insurance", "ReinsuranceDeposit","FinanceAmt", "FinanceFC", "LackAmtPayDate","LackAmtFinalPayDate", "ReceiverName", "ReceiverID", "ReceiverTel", "Insurer","authoriate" };String[] mapValue = new String[] { "工程机械有限公司", "工程机械有限公司","六桥车", "xxx52E(6)", "2", "风冷", "V09660ffff", "300.00","600.00", "陆万元整", "7", "100", "2000年8月31日", "60", "5", "3","10", "6", "10", "5", "10", "21", "540", "10", "2000年8月31日","2000年8月31日", "xxx", "430111199910102121", "13800138200", "xxxxx","bboss" };String wordtemplate = "D:\\workspace\\microcredit\\plugin\\wordpdf\\anjie.doc";String wordfile = "d:\\anjie_test.doc";FileConvertor.getRealWord(wordtemplate, wordfile, bookMarks,mapValue);FileBlob fileblob = new FileBlob(wordfile,FileBlob.DOWNLOAD);return fileblob;}
public @ResponseBody FileBlob downWordTemp() throws Exception {System.out.println("--------------程序执行到此处------------------");String[] bookMarks = new String[] { "DealerName", "Name", "CgName","TypeName", "OrderQty", "CoolCode", "ChassisCode", "CustPrice","CustAmt", "sumall", "EarnestPayDays", "EarnestAmt","StageDate", "FirstAmt", "DepositPercent", "Deposit","ServiceChargePercent", "ServiceCharge", "NotarizationFee","InsuranceTerm", "Insurance", "ReinsuranceDeposit","FinanceAmt", "FinanceFC", "LackAmtPayDate","LackAmtFinalPayDate", "ReceiverName", "ReceiverID", "ReceiverTel", "Insurer","authoriate" };String[] mapValue = new String[] { "工程机械有限公司", "工程机械有限公司","六桥车", "xxx52E(6)", "2", "风冷", "V09660ffff", "300.00","600.00", "陆万元整", "7", "100", "2000年8月31日", "60", "5", "3","10", "6", "10", "5", "10", "21", "540", "10", "2000年8月31日","2000年8月31日", "xxx", "430111199910102121", "13800138200", "xxxxx","bboss" };String wordtemplate = "D:\\workspace\\microcredit\\plugin\\wordpdf\\anjie.doc";String wordfile = "d:\\anjie_test.doc";FileConvertor.getRealWord(wordtemplate, wordfile, bookMarks,mapValue);FileBlob fileblob = new FileBlob(wordfile,FileBlob.BROWSER);return fileblob;}
public @ResponseBody FileBlob getSWFTemp() throws Exception {System.out.println("--------------程序执行到此处------------------");String[] bookMarks = new String[] { "DealerName", "Name", "CgName","TypeName", "OrderQty", "CoolCode", "ChassisCode", "CustPrice","CustAmt", "sumall", "EarnestPayDays", "EarnestAmt","StageDate", "FirstAmt", "DepositPercent", "Deposit","ServiceChargePercent", "ServiceCharge", "NotarizationFee","InsuranceTerm", "Insurance", "ReinsuranceDeposit","FinanceAmt", "FinanceFC", "LackAmtPayDate","LackAmtFinalPayDate", "ReceiverName", "ReceiverID", "ReceiverTel", "Insurer","authoriate" };String[] mapValue = new String[] { "工程机械有限公司", "工程机械有限公司","六桥车", "xxx", "2", "风冷", "V09660", "300.00","600.00", "陆万元整", "7", "100", "2000年8月31日", "60", "5", "3","10", "6", "10", "5", "10", "21", "540", "10", "2000年8月31日","2000年8月31日", "xxx", "430111199910102121", "13800138200", "xxx","bboss" };String hetongbianhao="20121222";String wordtemplate = "D:\\workspace\\microcredit\\plugin\\wordpdf\\anjie.doc";String wordfile = "d:\\anjie_test.doc";String toswfpath = "d:\\contract_"+hetongbianhao+".swf";File f = new File(toswfpath);if(!f.exists()){long waittimes = 1000;FileConvertor.realWordConvertor(flashpaperWorkDir, wordtemplate, wordfile, bookMarks, mapValue,toswfpath, waittimes);}FileBlob fileblob = new FileBlob(toswfpath,FileBlob.BROWSER);return fileblob;}
<%@ page contentType="text/html; charset=utf-8"%><html><head><title></title></head><body marginwidth="0" marginheight="0"><embed height="100%" width="100%" name="plugin" src="getSWFTemp.page"type="application/x-shockwave-flash"></body></html>