Browse Source

Merge pull request #11 in PG/plugin-report-doc-demo from ~ZACK/plugin-report-doc-demo:release/10.0 to release/10.0

* commit 'fd21d7c3bb49d300e55d29af38cc06138a6059c9':
  REPORT-21133 导出excel数据不对
pull/2/head
zack 5 years ago
parent
commit
3df1638ac1
  1. 4
      src/main/java/com/fr/demo/SaveReportToDatabase.java
  2. 4
      src/main/java/com/fr/function/ReportCheck.java
  3. 4
      src/main/java/com/fr/io/CreateGenericTemplate.java
  4. 4
      src/main/java/com/fr/io/ExcelToCpt.java
  5. 4
      src/main/java/com/fr/io/ExcuteDemo.java
  6. 99
      src/main/java/com/fr/io/ExportApi.java
  7. 4
      src/main/java/com/fr/io/ExportBatch.java
  8. 4
      src/main/java/com/fr/io/ExportExcel.java
  9. 4
      src/main/java/com/fr/io/ExportReports.java
  10. 4
      src/main/java/com/fr/io/JavaPrint.java
  11. 4
      src/main/java/com/fr/io/SaveReportToDatabase.java
  12. 4
      src/main/java/com/fr/io/SetParameterWindow.java
  13. 4
      src/main/java/com/fr/io/SimpleDemo.java
  14. 0
      src/test/main/java/WEB-INF/assist/phantomjs/lib/format.js
  15. 0
      src/test/main/java/WEB-INF/assist/phantomjs/lib/van-convert.js
  16. 0
      src/test/main/java/WEB-INF/assist/phantomjs/lib/vancharts-all.js
  17. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/ChangeLog
  18. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/LICENSE.BSD
  19. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/README.md
  20. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/bin/phantomjs
  21. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/third-party.txt
  22. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/ChangeLog
  23. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/LICENSE.BSD
  24. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/README.md
  25. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/bin/phantomjs
  26. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/third-party.txt
  27. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/ChangeLog
  28. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/LICENSE.BSD
  29. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/README.md
  30. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/bin/phantomjs
  31. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/third-party.txt
  32. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/ChangeLog
  33. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/LICENSE.BSD
  34. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/README.md
  35. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/bin/phantomjs.exe
  36. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/third-party.txt
  37. 0
      src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-winxp/bin/phantomjs.exe
  38. 0
      src/test/main/java/WEB-INF/reportlets/demo.cpt
  39. 51
      src/test/main/java/WEB-INF/reportlets/sumtest.cpt
  40. 85
      src/test/main/java/com/fr/demo/ExportApiTest.java
  41. 5
      src/test/main/java/com/fr/demo/ModuleStartTest.java
  42. 0
      src/test/main/java/com/fr/demo/TestLogAppender.java

4
src/main/java/com/fr/demo/SaveReportToDatabase.java

@ -12,6 +12,7 @@ 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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -35,11 +36,12 @@ public class SaveReportToDatabase {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/function/ReportCheck.java

@ -21,6 +21,7 @@ import com.fr.report.RestrictionActivator;
import com.fr.report.cell.CellElement;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.report.ResultReport;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.script.AbstractFunction;
import com.fr.stable.WriteActor;
@ -45,11 +46,12 @@ public class ReportCheck extends AbstractFunction {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/CreateGenericTemplate.java

@ -21,6 +21,7 @@ import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.worksheet.WorkSheet;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -37,11 +38,12 @@ public class CreateGenericTemplate {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/ExcelToCpt.java

@ -15,6 +15,7 @@ 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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -32,11 +33,12 @@ public class ExcelToCpt {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/ExcuteDemo.java

@ -15,6 +15,7 @@ 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;
@ -33,11 +34,12 @@ public class ExcuteDemo {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

99
src/main/java/com/fr/io/ExportApi.java

@ -1,6 +1,5 @@
package com.fr.io;
import com.fr.base.Parameter;
import com.fr.base.operator.common.CommonOperator;
import com.fr.chart.activator.ChartBaseActivator;
import com.fr.cluster.engine.activator.standalone.StandaloneModeActivator;
@ -8,14 +7,6 @@ import com.fr.config.activator.BaseDBActivator;
import com.fr.config.activator.ConfigurationActivator;
import com.fr.env.operator.CommonOperatorImpl;
import com.fr.general.I18nResource;
import com.fr.io.exporter.CSVExporter;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.io.exporter.ExcelExporter;
import com.fr.io.exporter.ImageExporter;
import com.fr.io.exporter.PDFExporter;
import com.fr.io.exporter.SVGExporter;
import com.fr.io.exporter.TextExporter;
import com.fr.io.exporter.WordExporter;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.main.impl.WorkBook;
import com.fr.main.workbook.ResultWorkBook;
@ -24,6 +15,7 @@ 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;
@ -44,9 +36,10 @@ public class ExportApi {
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WriteActivator(),
new ChartBaseActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
String envpath = "E:\\默认工程\\webroot\\WEB-INF\\";//工程路径
SimpleWork.checkIn(envpath);
I18nResource.getInstance();
module.start();
@ -56,57 +49,57 @@ public class ExportApi {
try {
// 未执行模板工作薄
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook("//doc//Primary//Parameter//Parameter.cpt");
.readTemplateWorkBook("test.cpt");
// 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集
Parameter[] parameters = workbook.getParameters();
parameters[0].setValue("华东");
// Parameter[] parameters = workbook.getParameters();
// parameters[0].setValue("华东");
// 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook
java.util.Map parameterMap = new java.util.HashMap();
for (int i = 0; i < parameters.length; i++) {
parameterMap.put(parameters[i].getName(), parameters[i]
.getValue());
}
// for (int i = 0; i < parameters.length; i++) {
// parameterMap.put(parameters[i].getName(), parameters[i]
// .getValue());
// }
// 定义输出流
FileOutputStream outputStream;
// 将未执行模板工作薄导出为内置数据集模板
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//EmbExport.cpt"));
EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter();
templateExporter.export(outputStream, workbook);
// 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TmpExport.cpt"));
((WorkBook) workbook).export(outputStream);
// 将结果工作薄导出为2003Excel文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xls"));
ExcelExporter ExcelExport = new ExcelExporter();
ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // 将未执行模板工作薄导出为内置数据集模板
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//EmbExport.cpt"));
// EmbeddedTableDataExporter templateExporter = new EmbeddedTableDataExporter();
// templateExporter.export(outputStream, workbook);
// // 将模板工作薄导出模板文件,在导出前您可以编辑导入的模板工作薄,可参考报表调用章节
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TmpExport.cpt"));
// ((WorkBook) workbook).export(outputStream);
// // 将结果工作薄导出为2003Excel文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xls"));
// ExcelExporter ExcelExport = new ExcelExporter();
// ExcelExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Excel文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//ExcelExport.xlsx"));
outputStream = new FileOutputStream(new File("D://tttt//1528.xlsx"));
StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter();
ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Word文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//WordExport.doc"));
WordExporter WordExport = new WordExporter();
WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Pdf文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PdfExport.pdf"));
PDFExporter PdfExport = new PDFExporter();
PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表)
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TxtExport.txt"));
TextExporter TxtExport = new TextExporter();
TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// 将结果工作薄导出为Csv文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//CsvExport.csv"));
CSVExporter CsvExport = new CSVExporter();
CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//将结果工作薄导出为SVG文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//SvgExport.svg"));
SVGExporter SvgExport = new SVGExporter();
SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
//将结果工作薄导出为image文件
outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PngExport.png"));
ImageExporter ImageExport = new ImageExporter();
ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // 将结果工作薄导出为Word文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//WordExport.doc"));
// WordExporter WordExport = new WordExporter();
// WordExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // 将结果工作薄导出为Pdf文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PdfExport.pdf"));
// PDFExporter PdfExport = new PDFExporter();
// PdfExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // 将结果工作薄导出为Txt文件(txt文件本身不支持表格、图表等,被导出模板一般为明细表)
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//TxtExport.txt"));
// TextExporter TxtExport = new TextExporter();
// TxtExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// // 将结果工作薄导出为Csv文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//CsvExport.csv"));
// CSVExporter CsvExport = new CSVExporter();
// CsvExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// //将结果工作薄导出为SVG文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//SvgExport.svg"));
// SVGExporter SvgExport = new SVGExporter();
// SvgExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
// //将结果工作薄导出为image文件
// outputStream = new FileOutputStream(new File("/Users//susie//Downloads//PngExport.png"));
// ImageExporter ImageExport = new ImageExporter();
// ImageExport.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
outputStream.close();
module.stop();
} catch (Exception e) {

4
src/main/java/com/fr/io/ExportBatch.java

@ -15,6 +15,7 @@ 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.StableUtils;
import com.fr.stable.WriteActor;
@ -38,11 +39,12 @@ public class ExportBatch {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/ExportExcel.java

@ -23,6 +23,7 @@ import com.fr.report.ReportActivator;
import com.fr.report.RestrictionActivator;
import com.fr.report.core.ReportUtils;
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;
@ -40,11 +41,12 @@ public class ExportExcel {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/ExportReports.java

@ -18,6 +18,7 @@ import com.fr.report.RestrictionActivator;
import com.fr.report.core.ReportUtils;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.report.PageReport;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.stable.PageActor;
import com.fr.store.StateServerActivator;
@ -35,11 +36,12 @@ public class ExportReports {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/JavaPrint.java

@ -15,6 +15,7 @@ import com.fr.print.PrintUtils;
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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -29,11 +30,12 @@ public class JavaPrint {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/SaveReportToDatabase.java

@ -12,6 +12,7 @@ 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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -45,11 +46,12 @@ public class SaveReportToDatabase {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/SetParameterWindow.java

@ -17,6 +17,7 @@ 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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -33,11 +34,12 @@ public class SetParameterWindow {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

4
src/main/java/com/fr/io/SimpleDemo.java

@ -17,6 +17,7 @@ import com.fr.report.RestrictionActivator;
import com.fr.report.cell.CellElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.module.ReportBaseActivator;
import com.fr.report.write.WriteActivator;
import com.fr.scheduler.SchedulerActivator;
import com.fr.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -33,11 +34,12 @@ public class SimpleDemo {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
String envpath = "//Applications//FineReport10_325//webapps//webroot//WEB-INF";//工程路径
SimpleWork.checkIn(envpath);

0
src/test/java/WEB-INF/assist/phantomjs/lib/format.js → src/test/main/java/WEB-INF/assist/phantomjs/lib/format.js

0
src/test/java/WEB-INF/assist/phantomjs/lib/van-convert.js → src/test/main/java/WEB-INF/assist/phantomjs/lib/van-convert.js

0
src/test/java/WEB-INF/assist/phantomjs/lib/vancharts-all.js → src/test/main/java/WEB-INF/assist/phantomjs/lib/vancharts-all.js

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux32/ChangeLog → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/ChangeLog

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux32/LICENSE.BSD → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/LICENSE.BSD

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux32/README.md → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/README.md

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux32/bin/phantomjs → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/bin/phantomjs

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux32/third-party.txt → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux32/third-party.txt

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux64/ChangeLog → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/ChangeLog

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux64/LICENSE.BSD → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/LICENSE.BSD

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux64/README.md → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/README.md

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux64/bin/phantomjs → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/bin/phantomjs

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-linux64/third-party.txt → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-linux64/third-party.txt

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-macos/ChangeLog → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/ChangeLog

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-macos/LICENSE.BSD → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/LICENSE.BSD

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-macos/README.md → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/README.md

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-macos/bin/phantomjs → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/bin/phantomjs

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-macos/third-party.txt → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-macos/third-party.txt

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-windows/ChangeLog → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/ChangeLog

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-windows/LICENSE.BSD → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/LICENSE.BSD

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-windows/README.md → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/README.md

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-windows/bin/phantomjs.exe → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/bin/phantomjs.exe

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-windows/third-party.txt → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-windows/third-party.txt

0
src/test/java/WEB-INF/assist/phantomjs/phantomjs-winxp/bin/phantomjs.exe → src/test/main/java/WEB-INF/assist/phantomjs/phantomjs-winxp/bin/phantomjs.exe

0
src/test/java/WEB-INF/reportlets/demo.cpt → src/test/main/java/WEB-INF/reportlets/demo.cpt

51
src/test/main/java/WEB-INF/reportlets/sumtest.cpt

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<WorkBook xmlVersion="20170720" releaseVersion="10.0.0">
<Report class="com.fr.report.worksheet.WorkSheet" name="sheet1">
<ReportPageAttr>
<HR/>
<FR/>
<HC/>
<FC/>
</ReportPageAttr>
<ColumnPrivilegeControl/>
<RowPrivilegeControl/>
<RowHeight defaultValue="723900">
<![CDATA[723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900,723900]]></RowHeight>
<ColumnWidth defaultValue="2743200">
<![CDATA[2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200,2743200]]></ColumnWidth>
<CellElementList>
<C c="0" r="0">
<O t="XMLable" class="com.fr.base.Formula">
<Attributes>
<![CDATA[=SUM(B1,B1)]]></Attributes>
</O>
<PrivilegeControl/>
<Expand/>
</C>
<C c="1" r="0">
<O t="I">
<![CDATA[3]]></O>
<PrivilegeControl/>
<Expand/>
</C>
</CellElementList>
<ReportAttrSet>
<ReportSettings headerHeight="0" footerHeight="0">
<PaperSetting/>
<Background name="ColorBackground" color="-1"/>
</ReportSettings>
</ReportAttrSet>
<PrivilegeControl/>
</Report>
<ReportParameterAttr>
<Attributes showWindow="true" delayPlaying="true" windowPosition="1" align="0" useParamsTemplate="true"/>
<PWTitle>
<![CDATA[参数]]></PWTitle>
</ReportParameterAttr>
<StyleList/>
<DesignerVersion DesignerVersion="KAA"/>
<PreviewType PreviewType="0"/>
<TemplateIdAttMark class="com.fr.base.iofile.attr.TemplateIdAttrMark">
<TemplateIdAttMark TemplateId="56859b48-9102-476b-a84f-09ff9b64e606"/>
</TemplateIdAttMark>
</WorkBook>

85
src/test/main/java/com/fr/demo/ExportApiTest.java

@ -0,0 +1,85 @@
package com.fr.demo;
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.general.I18nResource;
import com.fr.io.TemplateWorkBookIO;
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter;
import com.fr.log.FineLoggerFactory;
import com.fr.main.TemplateWorkBook;
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.worksheet.WorkSheet;
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 com.fr.write.web.excel.ExcelImportPlusProcessor;
import junit.framework.TestCase;
import org.junit.Assert;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.HashMap;
/**
* @author zack
* @version 10.0
* @date 2019/8/27
*/
public class ExportApiTest extends TestCase {
public void testExport() {
Module module = ActivatorToolBox.simpleLink(new BaseDBActivator(),
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new WriteActivator());
SimpleWork.supply(CommonOperator.class, new CommonOperatorImpl());
SimpleWork.checkIn(ExportApiTest.class.getResource("../../../WEB-INF").getPath());
I18nResource.getInstance();
module.start();
ResultWorkBook rworkbook = null;
try {
// 未执行模板工作薄
WorkBook workbook = (WorkBook) TemplateWorkBookIO
.readTemplateWorkBook("//sumtest.cpt");
// 获取报表参数并设置值,导出内置数据集时数据集会根据参数值查询出结果从而转为内置数据集
// 定义parametermap用于执行报表,将执行后的结果工作薄保存为rworkBook
java.util.Map parameterMap = new java.util.HashMap();
// 定义输出流
ByteArrayOutputStream outputStream;
// 将结果工作薄导出为Excel文件
outputStream = new ByteArrayOutputStream();
StreamExcel2007Exporter ExcelExport1 = new StreamExcel2007Exporter();
ExcelExport1.export(outputStream, workbook.execute(parameterMap, new WriteActor()));
outputStream.close();
InputStream in = new ByteArrayInputStream(outputStream.toByteArray());
TemplateWorkBook workBook = new ExcelImportPlusProcessor().generateWorkBookByStream(in, "111.xlsx", new HashMap());
Assert.assertEquals(6, ((WorkSheet) workBook.getReport(0)).getCellElement(0, 0).getValue());
Assert.assertEquals(3, ((WorkSheet) workBook.getReport(0)).getCellElement(1, 0).getValue());
module.stop();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
SimpleWork.checkOut();
}
}
}

5
src/test/java/com/fr/demo/ModuleStartTest.java → src/test/main/java/com/fr/demo/ModuleStartTest.java

@ -17,6 +17,7 @@ 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.store.StateServerActivator;
import com.fr.workspace.simple.SimpleWork;
@ -65,11 +66,13 @@ public class ModuleStartTest extends TestCase {
new ConfigurationActivator(),
new StandaloneModeActivator(),
new StateServerActivator(),
new ChartBaseActivator(),
new SchedulerActivator(),
new ReportBaseActivator(),
new RestrictionActivator(),
new ReportActivator(),
new ChartBaseActivator());
new WriteActivator()
);
return module;
}

0
src/test/java/com/fr/demo/TestLogAppender.java → src/test/main/java/com/fr/demo/TestLogAppender.java

Loading…
Cancel
Save