yzm115668(提问者)// 首先需要定义执行所在的环境,这样才能正确读取数据库信息
// 定义报表运行环境,用于执行报表
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new ResourceRepositoryActivator(),
new StandaloneModeActivator(),
new ModuleHealActivator(),
new StateServiceActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
// String envpath = \"//Applications//FineReport10_325//webapps//webroot//WEB-INF\";//工程路径
String envpath = \"D:\\\\FineReport_10.0\\\\webapps\\\\webroot\\\\WEB-INF\";//工程路径
SimpleWork.checkIn(envpath);
I18nResource.getInstance();
module.start();
File excelFile = new File(\"D:\\\\test\\\\test1.xls\"); // 获取EXCEL文件
FileInputStream a = new FileInputStream(excelFile);
TemplateWorkBook tpl = new Excel2007ReportImporter().generateWorkBookByStream(a);
OutputStream outputStream = new FileOutputStream(new File(\"D:\\\\test\\\\test2.cpt\")); // 转换成cpt模板
((WorkBook) tpl).export(outputStream);
outputStream.close();
// module.stop();