diff --git a/JSD-9277-增补需求确认书V1.docx b/JSD-9277-增补需求确认书V1.docx new file mode 100644 index 0000000..f0c2490 Binary files /dev/null and b/JSD-9277-增补需求确认书V1.docx differ diff --git a/JSD-9277-需求确认书V1.docx b/JSD-9277-需求确认书V1.docx new file mode 100644 index 0000000..d2f4144 Binary files /dev/null and b/JSD-9277-需求确认书V1.docx differ diff --git a/JSD-9277配置使用文档.pdf b/JSD-9277配置使用文档.pdf new file mode 100644 index 0000000..44831fd Binary files /dev/null and b/JSD-9277配置使用文档.pdf differ diff --git a/README.md b/README.md index a93ddaa..ecaedf7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # open-JSD-9277 -JSD-9277 导出excel文件属性自定义 \ No newline at end of file +JSD-9277 导出excel文件属性自定义\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 \ No newline at end of file diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar new file mode 100644 index 0000000..f4482fc Binary files /dev/null and b/lib/finekit-10.0.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..04e23b5 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,35 @@ + + + com.fr.plugin.ibgq.excel + + yes + 1.2 + 10.0~10.0 + 2018-07-31 + fr.open + + 导出Excel文档属性自定义

+ ]]>
+ com.fr.plugin.ibgq + + com.fanruan.api + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/LocaleFinder.java b/src/main/java/com/fr/plugin/ibgq/LocaleFinder.java new file mode 100644 index 0000000..6ab929c --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/LocaleFinder.java @@ -0,0 +1,40 @@ + /* + * Copyright (C), 2018-2020 + * Project: starter + * FileName: LocaleFinder + * Author: Louis + * Date: 2020/8/31 22:19 + */ + package com.fr.plugin.ibgq; + + import com.fr.intelli.record.Focus; + import com.fr.intelli.record.Original; + import com.fr.record.analyzer.EnableMetrics; + import com.fr.stable.fun.Authorize; + import com.fr.stable.fun.impl.AbstractLocaleFinder; + + import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + @EnableMetrics + @Authorize(callSignKey = PLUGIN_ID) + public class LocaleFinder extends AbstractLocaleFinder { + public static final String PLUGIN_ID = "com.fr.plugin.ibgq.excel"; + + @Override + @Focus(id = PLUGIN_ID, text = "Plugin-ibgq", source = Original.PLUGIN) + public String find() { + return "com/fr/plugin/ibgq/locale/lang"; + } + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/LayerExcelExportApp.java b/src/main/java/com/fr/plugin/ibgq/excel/LayerExcelExportApp.java new file mode 100644 index 0000000..b3b1621 --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/LayerExcelExportApp.java @@ -0,0 +1,68 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: LayerExcelExportApp + * Author: Louis + * Date: 2021/12/3 9:22 + */ + package com.fr.plugin.ibgq.excel; + + import com.fr.general.DeclareRecordType; + import com.fr.io.collection.ExportCollection; + import com.fr.io.exporter.ExcelExportType; + import com.fr.plugin.ExtraClassManager; + import com.fr.plugin.ibgq.export.StreamExcel2007Exporter4LayerPlus; + import com.fr.report.core.ReportUtils; + import com.fr.report.fun.impl.AbstractExcelExportAppProvider; + import com.fr.stable.ExportConstants; + import com.fr.stable.fun.Authorize; + import com.fr.stable.fun.FunctionProcessor; + import com.fr.web.core.ReportSessionIDInfor; + import com.fr.web.core.utils.ExportUtils; + + import javax.servlet.http.HttpServletRequest; + import javax.servlet.http.HttpServletResponse; + + import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + @Authorize(callSignKey = PLUGIN_ID) + public class LayerExcelExportApp extends AbstractExcelExportAppProvider { + public LayerExcelExportApp() { + } + + private static void recordFunction() { + FunctionProcessor var0 = ExtraClassManager.getInstance().getFunctionProcessor(); + if (var0 != null) { + var0.recordFunction(LayerStreamExportFunctionProcessor.getInstance()); + } + + } + + public int currentAPILevel() { + return super.currentAPILevel(); + } + + public String exportType() { + return ExportConstants.TYPE_LARGEDATA_PAGE; + } + + public ExportCollection createLargeDataExportCollection(HttpServletRequest var1, HttpServletResponse var2, ReportSessionIDInfor var3, String var4, ExcelExportType var5) { + ExportCollection var6 = ExportCollection.create(); + if (var2 != null) { + ExportUtils.setExcel2007Content(var2, var4); + } + + StreamExcel2007Exporter4LayerPlus var7 = new StreamExcel2007Exporter4LayerPlus(ReportUtils.getPaperSettingListFromWorkBook(var3.getContextBook()), var5.isPage()); + var6.setExporter(var7); + var6.setRecordType(DeclareRecordType.EXPORT_TYPE_EXCEL_ORIGINAL); + recordFunction(); + return var6; + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/LayerStreamExportFunctionProcessor.java b/src/main/java/com/fr/plugin/ibgq/excel/LayerStreamExportFunctionProcessor.java new file mode 100644 index 0000000..958ca66 --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/LayerStreamExportFunctionProcessor.java @@ -0,0 +1,39 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: LayerStreamExportFunctionProcessor + * Author: Louis + * Date: 2021/12/3 9:23 + */ + package com.fr.plugin.ibgq.excel; + + import com.fr.stable.fun.FunctionHelper; + import com.fr.stable.fun.impl.AbstractFunctionProcessor; + + import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + public class LayerStreamExportFunctionProcessor extends AbstractFunctionProcessor { + private static LayerStreamExportFunctionProcessor instance = new LayerStreamExportFunctionProcessor(); + + public LayerStreamExportFunctionProcessor() { + } + + public static LayerStreamExportFunctionProcessor getInstance() { + return instance; + } + + public int getId() { + return FunctionHelper.generateFunctionID(PLUGIN_ID); + } + + public String getLocaleKey() { + return "Plugin-ibgq_Excel_Stream_Export_Layer"; + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExportApp.java b/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExportApp.java new file mode 100644 index 0000000..a89de3b --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExportApp.java @@ -0,0 +1,49 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: StreamExcelExportApp + * Author: Louis + * Date: 2021/12/3 9:24 + */ + package com.fr.plugin.ibgq.excel; + + import com.fr.general.DeclareRecordType; + import com.fr.io.collection.ExportCollection; + import com.fr.io.exporter.AppExporter; + import com.fr.io.exporter.ExcelExportType; + import com.fr.plugin.ibgq.excel.exporter.StreamExcelExporter; + import com.fr.report.core.ReportUtils; + import com.fr.report.fun.impl.AbstractExcelExportAppProvider; + import com.fr.stable.ExportConstants; + import com.fr.stable.fun.Authorize; + import com.fr.web.core.ReportSessionIDInfor; + + import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + @Authorize(callSignKey = PLUGIN_ID) + public class StreamExcelExportApp extends AbstractExcelExportAppProvider { + public StreamExcelExportApp() { + } + + public int currentAPILevel() { + return super.currentAPILevel(); + } + + public String exportType() { + return ExportConstants.TYPE_STREAM; + } + + public AppExporter createAppExporter(ExportCollection var1, ExcelExportType var2, ReportSessionIDInfor var3) { + StreamExcelExporter var4 = new StreamExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(var3.getContextBook())); + var1.setExporter(var4); + var1.setRecordType(DeclareRecordType.EXPORT_TYPE_EXCEL_ORIGINAL); + return var4; + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExtensionButton.java b/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExtensionButton.java new file mode 100644 index 0000000..8553487 --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/StreamExcelExtensionButton.java @@ -0,0 +1,68 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: StreamExcelExtensionButton + * Author: Louis + * Date: 2021/12/3 9:24 + */ + package com.fr.plugin.ibgq.excel; + + import com.fr.base.IconManager; + import com.fr.form.ui.WebContentUtils; + import com.fr.form.ui.Widget; + import com.fr.general.Inter; + import com.fr.js.JavaScriptImpl; + import com.fr.report.fun.impl.AbstractExtensionButton; + import com.fr.stable.web.Repository; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + public class StreamExcelExtensionButton extends AbstractExtensionButton { + public StreamExcelExtensionButton() { + super(Inter.getLocText("Plugin-ibgq_Excel_Stream_Export"), IconManager.EXCEL.getName()); + } + + public StreamExcelExtensionButton(String var1) { + super(var1); + } + + public StreamExcelExtensionButton(String var1, String var2) { + super(var1, var2); + } + + public int currentAPILevel() { + return 2; + } + + public Class classForDirectoryButton() { + return this.getClass(); + } + + public String getParentDirectory() { + return null; + } + + public String getType() { + return "StreamExcelExport.class"; + } + + public String getRelatedCheckBoxTitle() { + return null; + } + + public boolean isSelected() { + return false; + } + + public void setSelected(boolean var1) { + } + + protected JavaScriptImpl clickAction(Repository var1) { + return new JavaScriptImpl(WebContentUtils.getExcelExportAction(var1, "stream")); + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcel2007Exporter4Layer.java b/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcel2007Exporter4Layer.java new file mode 100644 index 0000000..13c1b3b --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcel2007Exporter4Layer.java @@ -0,0 +1,117 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: StreamExcel2007Exporter4Layer + * Author: Louis + * Date: 2021/12/3 9:28 + */ + package com.fr.plugin.ibgq.excel.exporter; + + import com.fr.general.FRLogger; + import com.fr.general.Inter; + import com.fr.io.core.LargeDataExcelExporterReport; + import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; + import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; + import com.fr.io.exporter.poi.wrapper.XssfCellWrapper; + import com.fr.io.exporter.poi.wrapper.XssfWorkbookWrapper; + import com.fr.main.workbook.PageRWorkBook; + import com.fr.main.workbook.ResultWorkBook; + import com.fr.page.PageSetProvider; + import com.fr.page.PaperSettingProvider; + import com.fr.report.report.Report; + import com.fr.report.report.ResultECReport; + import com.fr.report.stable.ReportSettings; + import com.fr.stable.ExportConstants; + import com.fr.stable.FT; + import com.fr.third.v2.org.apache.poi.ss.usermodel.Cell; + import com.fr.third.v2.org.apache.poi.xssf.streaming.SXSSFWorkbook; + + import java.io.OutputStream; + import java.util.ArrayList; + import java.util.List; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + public class StreamExcel2007Exporter4Layer extends StreamExcel2007Exporter { + private boolean isPage = false; + + public StreamExcel2007Exporter4Layer(List var1, boolean var2) { + super(var1); + this.isPage = var2; + } + + public void export(OutputStream var1, ResultWorkBook var2, boolean var3) throws Exception { + this.defaultXSSFCellStyle = null; + this.hssfFontHash.clear(); + this.hssfCellStyleHash.clear(); + this.format = null; + SXSSFWorkbook var4 = new SXSSFWorkbook(10000); + ArrayList var5 = new ArrayList(); + ArrayList var6 = new ArrayList(); + XssfWorkbookWrapper var7 = new XssfWorkbookWrapper(var4); + this.setDefaultFont(var7); + + for (int var8 = 0; var8 < var2.getReportCount(); ++var8) { + ResultECReport var9 = (ResultECReport) var2.getResultReport(var8); + if (var9 != null) { + if (var9.getReportSettings() == null) { + var9.setReportSettings(new ReportSettings()); + } + + var9.getReportSettings().setPageOrder(1); + PaperSettingProvider var10 = this.paperSettingList == null ? null : (PaperSettingProvider) this.paperSettingList.get(var8); + PageSetProvider var11 = var9.generateReportPageSet(var10); + var11 = this.isPage ? var11.traverse4Export() : var11.traverse4SimpleExport(); + FT var12 = new FT(0, 0); + + while (var12.to != -1) { + var12.from = var12.to; + PageRWorkBook var13 = new PageRWorkBook(); + String var14 = var2.getReportName(var8); + var13.addReport(var14, new LargeDataExcelExporterReport(var9, var11, var12, false, ExportConstants.MAX_ROWS_2007)); + this.exportBook(var13, var7, var5, var6, new ArrayList(), var3); + FRLogger.getLogger().info(var14 + Inter.getLocText("Plugin-ibgq_Engine_Finish_Export")); + } + + if (!var3 && !var11.isPageCached()) { + var11.release(); + } + } + } + + this.dealWithFormula(var5, var6); + var4.write(var1); + var1.flush(); + var4.dispose(); + } + + private void dealWithFormula(List var1, List var2) { + int var3 = 0; + + for (int var4 = var1.size(); var3 < var4; ++var3) { + Cell var5 = (Cell) var1.get(var3); + this.dealWithFormula(new XssfCellWrapper(var5), (String) var2.get(var3)); + } + + } + + protected void exportBook(ResultWorkBook var1, POIWorkbookAction var2, List var3, List var4, List var5, boolean var6) throws Exception { + int var7; + Report var8; + for (var7 = 0; var7 < var1.getReportCount(); ++var7) { + var8 = var1.getReport(var7); + var5.add(var8); + } + + for (var7 = 0; var7 < var1.getReportCount(); ++var7) { + var8 = (Report) var5.get(var7); + this.innerExportReport(var8, var1.getReportExportAttr(), var1.getReportName(var7), (SXSSFWorkbook) var2.getWorkbook(), var3, var4, var7); + } + + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcelExporter.java b/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcelExporter.java new file mode 100644 index 0000000..f30ed91 --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/exporter/StreamExcelExporter.java @@ -0,0 +1,39 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: StreamExcelExporter + * Author: Louis + * Date: 2021/12/3 9:27 + */ + package com.fr.plugin.ibgq.excel.exporter; + + import com.fr.general.FRLogger; + import com.fr.io.exporter.AppExporter; + import com.fr.io.exporter.ExcelExporter; + import com.fr.main.workbook.ResultWorkBook; + import com.fr.page.PaperSettingProvider; + import com.fr.plugin.ibgq.export.StreamExcel2007PlusExporter; + + import java.io.OutputStream; + import java.util.List; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + public class StreamExcelExporter extends ExcelExporter { + public StreamExcelExporter(List var1) { + super(var1); + } + + protected void exportFor2003(OutputStream var1, ResultWorkBook var2, boolean var3) throws Exception { + FRLogger.getLogger().error("StreamExcelExporter for 2003 is not supported"); + } + + protected AppExporter getExporterFor2007(List var1) throws ClassNotFoundException { + return new StreamExcel2007PlusExporter(var1); + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/excel/ui/StreamExcelExportToolbarUI.java b/src/main/java/com/fr/plugin/ibgq/excel/ui/StreamExcelExportToolbarUI.java new file mode 100644 index 0000000..ff2e95b --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/excel/ui/StreamExcelExportToolbarUI.java @@ -0,0 +1,41 @@ + /* + * Copyright (C), 2018-2021 + * Project: starter + * FileName: StreamExcelExportToolbarUI + * Author: Louis + * Date: 2021/12/3 9:26 + */ + package com.fr.plugin.ibgq.excel.ui; + + import com.fanruan.api.design.DesignKit; + import com.fr.design.fun.impl.AbstractToolbarItem; + import com.fr.form.ui.Widget; + import com.fr.plugin.ibgq.excel.StreamExcelExtensionButton; + + /** + *
+ * + * + * @author fr.open + * @since 1.0.0 + */ + public class StreamExcelExportToolbarUI extends AbstractToolbarItem { + public StreamExcelExportToolbarUI() { + } + + public int currentAPILevel() { + return 1; + } + + public Class classForWidget() { + return StreamExcelExtensionButton.class; + } + + public String iconPathForWidget() { + return "/com/fr/plugin/ibgq/excel/images/excel.png"; + } + + public String nameForWidget() { + return DesignKit.i18nText("Plugin-ibgq_Excel_Stream_Export"); + } + } \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/ibgq/export/ExcelPlusExporter.java b/src/main/java/com/fr/plugin/ibgq/export/ExcelPlusExporter.java new file mode 100644 index 0000000..dc9a14f --- /dev/null +++ b/src/main/java/com/fr/plugin/ibgq/export/ExcelPlusExporter.java @@ -0,0 +1,58 @@ +/** + * Copyright (C), 2015-2020 + * FileName: ExcelPlusExporter + * Author: Louis + * Date: 2020/3/17 11:50 + * Description: ExcelPlusExporter + * History: + *