帆软帮助文档代码合集。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
6.3 KiB

package com.fr.io;
import com.fr.base.operator.common.CommonOperator;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.cluster.engine.activator.standalone.StandaloneModeActivator;
import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.form.export.FormToWBExecutor;
import com.fr.general.I18nResource;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.ImageExporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.main.impl.WorkBook;
import com.fr.main.workbook.ResultWorkBook;
import com.fr.module.Module;
import com.fr.module.tool.ActivatorToolBox;
import com.fr.report.ReportActivator;
import com.fr.report.RestrictionActivator;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.stable.WriteActor;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
import java.io.File;
import java.io.FileOutputStream;
public class ExportApi_frm {
public static void main(String[] args) {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WriteActivator(),
new ChartBaseActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "C:\\Users\\hipsh\\Desktop\\apache-tomcat-8.5.38-10.0\\webapps\\webroot\\WEB-INF\\";//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>
SimpleWork.checkIn(envpath);
I18nResource.getInstance();
module.start();
// ResultWorkBook rworkbook = null;
try {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>cpt<EFBFBD><EFBFBD>δִ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// WorkBook workbook = (WorkBook) TemplateWorkBookIO
// .readTemplateWorkBook("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>.frm");
// <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>תΪ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>
// Parameter[] parameters = workbook.getParameters();
// parameters[0].setValue("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>parametermap<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>к<EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪrworkBook
java.util.Map parameterMap = new java.util.HashMap();
parameterMap.put("aa", "1");
// for (int i = 0; i < parameters.length; i++) {
// parameterMap.put(parameters[i].getName(), parameters[i]
// .getValue());
// }
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>frmʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ResultWorkBook re = FormToWBExecutor.executeForm("test.frm",parameterMap);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FileOutputStream outputStream;
// // <EFBFBD><EFBFBD>δִ<EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ģ<EFBFBD><EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//EmbExport.cpt"));
// EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter();
// templateExporter.export(outputStream, workbook);
// // <EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա༭<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɲο<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TmpExport.cpt"));
// ((WorkBook) workbook).export(outputStream);
// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ2003Excel<EFBFBD>ļ<EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xls"));
// ExcelExporter ExcelExport = new ExcelExporter();
// ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪExcel<EFBFBD>ļ<EFBFBD>
outputStream = new FileOutputStream(new File("C:\\FTPServer\\1528.xlsx"));
StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter();
//ResultWorkBook re = FSFormletHandler.executeForm("calendar.frm",parameterMap);
//ResultWorkBook re = FSFormletHandler.executeForm("test.frm",parameterMap);
// ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
ExcelExport1.export(outputStream,re);
// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪWord<EFBFBD>ļ<EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//WordExport.doc"));
// WordExporter WordExport = new WordExporter();
// WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪPdf<EFBFBD>ļ<EFBFBD>
outputStream = new FileOutputStream(new File("C:\\FTPServer\\PdfExport.pdf"));
PDFExporter PdfExport = new PDFExporter();
PdfExport.export(outputStream, re);
// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪTxt<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>txt<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TxtExport.txt"));
// TextExporter TxtExport = new TextExporter();
// TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪCsv<EFBFBD>ļ<EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//CsvExport.csv"));
// CSVExporter CsvExport = new CSVExporter();
// CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΪSVG<EFBFBD>ļ<EFBFBD>
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//SvgExport.svg"));
// SVGExporter SvgExport = new SVGExporter();
// SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊimage<EFBFBD>ļ<EFBFBD>
outputStream = new FileOutputStream(new File("C:\\FTPServer\\PngExport.png"));
ImageExporter ImageExport = new ImageExporter();
ImageExport.export(outputStream, re);
outputStream.close();
module.stop();
} catch (Exception e) {
e.printStackTrace();
} finally {
SimpleWork.checkOut();
}
}
}