LAPTOP-SB56SG4Q\86185
3 years ago
33 changed files with 1393 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +1,6 @@
|
||||
# open-JSD-9277 |
||||
|
||||
JSD-9277 导出excel文件属性自定义 |
||||
JSD-9277 导出excel文件属性自定义\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 |
Binary file not shown.
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.ibgq.excel</id> |
||||
<name><![CDATA[导出Excel文档属性自定义]]></name> |
||||
<active>yes</active> |
||||
<version>1.2</version> |
||||
<env-version>10.0~10.0</env-version> |
||||
<jartime>2018-07-31</jartime> |
||||
<vendor>fr.open</vendor> |
||||
<description><![CDATA[导出Excel文档属性自定义]]></description> |
||||
<change-notes><![CDATA[ |
||||
<p>导出Excel文档属性自定义</p> |
||||
]]></change-notes> |
||||
<main-package>com.fr.plugin.ibgq</main-package> |
||||
<prefer-packages> |
||||
<prefer-package>com.fanruan.api</prefer-package> |
||||
</prefer-packages> |
||||
<extra-core> |
||||
<LocaleFinder class="com.fr.plugin.ibgq.LocaleFinder"/> |
||||
<IOFileAttrMark class="com.fr.plugin.ibgq.provider.DocSummaryAttr"/> |
||||
</extra-core> |
||||
<extra-report> |
||||
<ExcelExportAppProvider class="com.fr.plugin.ibgq.provider.SimpleExcelExportApp"/> |
||||
<ExcelExportAppProvider class="com.fr.plugin.ibgq.provider.SheetExcelExportApp"/> |
||||
<ExcelExportAppProvider class="com.fr.plugin.ibgq.provider.PageExcelExportApp"/> |
||||
<ExtensionButtonProvider class="com.fr.plugin.ibgq.excel.StreamExcelExtensionButton"/> |
||||
<ExcelExportAppProvider class="com.fr.plugin.ibgq.excel.StreamExcelExportApp"/> |
||||
<ExcelExportAppProvider class="com.fr.plugin.ibgq.excel.LayerExcelExportApp"/> |
||||
</extra-report> |
||||
<extra-designer> |
||||
<ToolbarItemProvider class="com.fr.plugin.ibgq.excel.ui.StreamExcelExportToolbarUI"/> |
||||
<ExportAttrTabProvider class="com.fr.plugin.ibgq.provider.DocSummaryTab"/> |
||||
</extra-designer> |
||||
<function-recorder class="com.fr.plugin.ibgq.LocaleFinder"/> |
||||
</plugin> |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LocaleFinder> |
||||
* |
||||
* @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; |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LayerExcelExportApp> |
||||
* |
||||
* @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; |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <LayerStreamExportFunctionProcessor> |
||||
* |
||||
* @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"; |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcelExportApp> |
||||
* |
||||
* @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<Boolean> 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; |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcelExtensionButton> |
||||
* |
||||
* @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<? extends Widget> 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")); |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcel2007Exporter4Layer> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class StreamExcel2007Exporter4Layer<T> extends StreamExcel2007Exporter<T> { |
||||
private boolean isPage = false; |
||||
|
||||
public StreamExcel2007Exporter4Layer(List<PaperSettingProvider> 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<Cell> var1, List<String> 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<String> var4, List<Report> 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); |
||||
} |
||||
|
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcelExporter> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class StreamExcelExporter extends ExcelExporter { |
||||
public StreamExcelExporter(List<PaperSettingProvider> 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<PaperSettingProvider> var1) throws ClassNotFoundException { |
||||
return new StreamExcel2007PlusExporter(var1); |
||||
} |
||||
} |
@ -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; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcelExportToolbarUI> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class StreamExcelExportToolbarUI extends AbstractToolbarItem { |
||||
public StreamExcelExportToolbarUI() { |
||||
} |
||||
|
||||
public int currentAPILevel() { |
||||
return 1; |
||||
} |
||||
|
||||
public Class<? extends Widget> 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"); |
||||
} |
||||
} |
@ -0,0 +1,58 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: ExcelPlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/17 11:50 |
||||
* Description: ExcelPlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
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.utils.ExcelHandler; |
||||
import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.OutputStream; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈ExcelPlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class ExcelPlusExporter extends ExcelExporter { |
||||
|
||||
public ExcelPlusExporter() { |
||||
} |
||||
|
||||
public ExcelPlusExporter(List list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportFor2003(OutputStream outputStream, ResultWorkBook resultWorkBook, boolean b, boolean b1) throws Exception { |
||||
File file = File.createTempFile("ibgq", ".xls"); |
||||
FileOutputStream fileOutputStream = new FileOutputStream(file); |
||||
super.exportFor2003(fileOutputStream, resultWorkBook, b, b1); |
||||
fileOutputStream.close(); |
||||
FileInputStream fileInputStream = new FileInputStream(file); |
||||
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, workbook); |
||||
workbook.write(outputStream); |
||||
outputStream.flush(); |
||||
} |
||||
|
||||
@Override |
||||
protected AppExporter getExporterFor2007(List<PaperSettingProvider> list) { |
||||
return new StreamExcel2007PlusExporter(list); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: LargeDataPageExcelPlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/23 17:01 |
||||
* Description: LargeDataPageExcelPlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.LargeDataPageExcelExporter; |
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.report.report.Report; |
||||
import com.fr.report.report.ResultECReport; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈LargeDataPageExcelPlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class LargeDataPageExcelPlusExporter extends LargeDataPageExcelExporter { |
||||
|
||||
public LargeDataPageExcelPlusExporter(List list, boolean b) { |
||||
super(list, b); |
||||
} |
||||
|
||||
@Override |
||||
protected AppExporter getExporterFor2007(List<PaperSettingProvider> list) { |
||||
return new StreamExcel2007PlusExporter(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void innerExportReports(ResultECReport resultECReport, ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction, List list, List<String> list1, List<Report> list2, int i) { |
||||
super.innerExportReports(resultECReport, resultWorkBook, poiWorkbookAction, list, list1, list2, i); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, poiWorkbookAction); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: PageExcel2007PlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/22 20:39 |
||||
* Description: PageExcel2007PlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.PageExcel2007Exporter; |
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.report.report.Report; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈PageExcel2007PlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class PageExcel2007PlusExporter<T> extends PageExcel2007Exporter<T> { |
||||
|
||||
public PageExcel2007PlusExporter(List<PaperSettingProvider> list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportBook(ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction, List list, List<String> list1, List<Report> list2, boolean b) throws Exception { |
||||
super.exportBook(resultWorkBook, poiWorkbookAction, list, list1, list2, b); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, poiWorkbookAction); |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: PageExcelPlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/22 20:36 |
||||
* Description: PageExcelPlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.PageExcelExporter; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.OutputStream; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈PageExcelPlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class PageExcelPlusExporter extends PageExcelExporter { |
||||
|
||||
public PageExcelPlusExporter(List list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportFor2003(OutputStream outputStream, ResultWorkBook resultWorkBook, boolean b, boolean b1) throws Exception { |
||||
File file = File.createTempFile("ibgq", ".xls"); |
||||
FileOutputStream fileOutputStream = new FileOutputStream(file); |
||||
super.exportFor2003(fileOutputStream, resultWorkBook, b, b1); |
||||
fileOutputStream.close(); |
||||
FileInputStream fileInputStream = new FileInputStream(file); |
||||
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, workbook); |
||||
workbook.write(outputStream); |
||||
outputStream.flush(); |
||||
} |
||||
|
||||
@Override |
||||
protected AppExporter getExporterFor2007(List<PaperSettingProvider> list) throws ClassNotFoundException { |
||||
return new PageExcel2007PlusExporter(list); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: PageToSheetExcel2007PlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/22 15:12 |
||||
* Description: PageToSheetExcel2007PlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.PageToSheetExcel2007Exporter; |
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.report.report.Report; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈PageToSheetExcel2007PlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class PageToSheetExcel2007PlusExporter<T> extends PageToSheetExcel2007Exporter<T> { |
||||
|
||||
public PageToSheetExcel2007PlusExporter(List list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportBook(ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction, List list, List<String> list1, List<Report> list2, boolean b) throws Exception { |
||||
super.exportBook(resultWorkBook, poiWorkbookAction, list, list1, list2, b); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, poiWorkbookAction); |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: PageToSheetExcelPlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/22 15:07 |
||||
* Description: PageToSheetExcelPlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.PageToSheetExcelExporter; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.FileOutputStream; |
||||
import java.io.OutputStream; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈PageToSheetExcelPlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class PageToSheetExcelPlusExporter extends PageToSheetExcelExporter { |
||||
|
||||
public PageToSheetExcelPlusExporter(List<PaperSettingProvider> list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportFor2003(OutputStream outputStream, ResultWorkBook resultWorkBook, boolean b, boolean b1) throws Exception { |
||||
File file = File.createTempFile("ibgq", ".xls"); |
||||
FileOutputStream fileOutputStream = new FileOutputStream(file); |
||||
super.exportFor2003(fileOutputStream, resultWorkBook, b, b1); |
||||
fileOutputStream.close(); |
||||
FileInputStream fileInputStream = new FileInputStream(file); |
||||
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, workbook); |
||||
workbook.write(outputStream); |
||||
outputStream.flush(); |
||||
} |
||||
|
||||
@Override |
||||
protected AppExporter getExporterFor2007(List<PaperSettingProvider> list) { |
||||
return new PageToSheetExcel2007PlusExporter(list); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: StreamExcel2007Exporter4LayerPlus |
||||
* Author: Louis |
||||
* Date: 2021/12/3 11:55 |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.excel.exporter.StreamExcel2007Exporter4Layer; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.report.report.Report; |
||||
|
||||
import java.io.OutputStream; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <StreamExcel2007Exporter4LayerPlus> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class StreamExcel2007Exporter4LayerPlus<T> extends StreamExcel2007Exporter4Layer<T> { |
||||
private ResultWorkBook resultWorkBook; |
||||
|
||||
public StreamExcel2007Exporter4LayerPlus(List<PaperSettingProvider> paperSettingProviders, boolean b) { |
||||
super(paperSettingProviders, b); |
||||
} |
||||
|
||||
@Override |
||||
public void export(OutputStream outputStream, ResultWorkBook resultWorkBook, boolean b) throws Exception { |
||||
this.resultWorkBook = resultWorkBook; |
||||
super.export(outputStream, resultWorkBook, b); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportBook(ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction, List list, List<String> list1, List<Report> reports, boolean b) throws Exception { |
||||
super.exportBook(resultWorkBook, poiWorkbookAction, list, list1, reports, b); |
||||
ExcelHandler.setCustomProperties(this.resultWorkBook, poiWorkbookAction); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/** |
||||
* Copyright (C), 2015-2020 |
||||
* FileName: StreamExcel2007PlusExporter |
||||
* Author: Louis |
||||
* Date: 2020/3/17 16:18 |
||||
* Description: StreamExcel2007PlusExporter |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.export; |
||||
|
||||
import com.fr.io.exporter.excel.stream.StreamExcel2007Exporter; |
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.page.PaperSettingProvider; |
||||
import com.fr.plugin.ibgq.utils.ExcelHandler; |
||||
import com.fr.report.report.Report; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 〈Function Description〉<br> |
||||
* 〈StreamExcel2007PlusExporter〉 |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class StreamExcel2007PlusExporter<T> extends StreamExcel2007Exporter<T> { |
||||
|
||||
public StreamExcel2007PlusExporter() { |
||||
} |
||||
|
||||
public StreamExcel2007PlusExporter(List<PaperSettingProvider> list) { |
||||
super(list); |
||||
} |
||||
|
||||
@Override |
||||
protected void exportBook(ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction, List list, List<String> list1, List<Report> list2, boolean b) throws Exception { |
||||
super.exportBook(resultWorkBook, poiWorkbookAction, list, list1, list2, b); |
||||
ExcelHandler.setCustomProperties(resultWorkBook, poiWorkbookAction); |
||||
} |
||||
} |
@ -0,0 +1,102 @@
|
||||
/* |
||||
* Copyright (C), 2018-2022 |
||||
* Project: starter |
||||
* FileName: DocSummaryAttr |
||||
* Author: Louis |
||||
* Date: 2022/1/4 13:58 |
||||
*/ |
||||
package com.fr.plugin.ibgq.provider; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fanruan.api.xml.XmlKit; |
||||
import com.fr.config.holder.factory.Holders; |
||||
import com.fr.config.holder.impl.ColConf; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.ParameterProvider; |
||||
import com.fr.stable.fun.impl.AbstractIOFileAttrMark; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLReadable; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Collection; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DocSummaryAttr> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DocSummaryAttr extends AbstractIOFileAttrMark { |
||||
public final static String XML_TAG = "DocumentSummaryAttr"; |
||||
private static final long serialVersionUID = 6037990832141495913L; |
||||
private ColConf<Collection<ParameterProvider>> parameters = Holders.collection(new ArrayList<>(), ParameterProvider.class); |
||||
|
||||
@Override |
||||
public String xmlTag() { |
||||
return XML_TAG; |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader reader) { |
||||
if (reader.isChildNode()) { |
||||
String tag = reader.getTagName(); |
||||
if (StringKit.equals(tag, "Parameters")) { |
||||
final ArrayList<ParameterProvider> parameterProviders = new ArrayList<>(); |
||||
reader.readXMLObject(new XMLReadable() { |
||||
public void readXML(XMLableReader xmLableReader) { |
||||
if ("Parameter".equals(xmLableReader.getTagName())) { |
||||
parameterProviders.add(XmlKit.readParameter(xmLableReader)); |
||||
} |
||||
} |
||||
}); |
||||
if (!parameterProviders.isEmpty()) { |
||||
this.parameters.set(parameterProviders); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
Collection<ParameterProvider> parameterProviders = this.parameters.get(); |
||||
XmlKit.writeParameters(writer, parameterProviders.toArray(new ParameterProvider[0])); |
||||
} |
||||
|
||||
@Override |
||||
public DocSummaryAttr clone() { |
||||
DocSummaryAttr docSummaryAttr = (DocSummaryAttr) super.clone(); |
||||
try { |
||||
docSummaryAttr.parameters = (ColConf) this.parameters.clone(); |
||||
} catch (CloneNotSupportedException e) { |
||||
LogKit.error(e.getMessage(), e); |
||||
} |
||||
return docSummaryAttr; |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject createJSONConfig() throws JSONException { |
||||
JSONObject json = super.createJSONConfig(); |
||||
json.put("parameters", this.parameters.toString()); |
||||
return json; |
||||
} |
||||
|
||||
public ParameterProvider[] getParameters(Calculator calculator) { |
||||
Collection<ParameterProvider> parameterProviders = (Collection) this.parameters.get(); |
||||
return parameterProviders.size() == 0 ? this.processParameters(calculator) : parameterProviders.toArray(new ParameterProvider[0]); |
||||
} |
||||
|
||||
public void setParameters(ParameterProvider[] parameterProviders) { |
||||
this.parameters.set(ArrayUtils.toList(parameterProviders)); |
||||
} |
||||
|
||||
protected ParameterProvider[] processParameters(Calculator calculator) { |
||||
Collection<ParameterProvider> parameterProviders = this.parameters.get(); |
||||
return Calculator.processParameters(calculator, parameterProviders.toArray(new ParameterProvider[0])); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
/* |
||||
* Copyright (C), 2018-2022 |
||||
* Project: starter |
||||
* FileName: DocSummaryTab |
||||
* Author: Louis |
||||
* Date: 2022/1/4 13:55 |
||||
*/ |
||||
package com.fr.plugin.ibgq.provider; |
||||
|
||||
import com.fr.design.beans.BasicStorePane; |
||||
import com.fr.design.fun.impl.AbstractExportAttrTabProvider; |
||||
import com.fr.plugin.ibgq.ui.DocSummaryPane; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DocSummaryTab> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DocSummaryTab extends AbstractExportAttrTabProvider { |
||||
@Override |
||||
public BasicStorePane<?> toServiceComponent() { |
||||
return new DocSummaryPane(); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: PageExcelExportApp |
||||
* Author: Louis |
||||
* Date: 2021/12/6 9:07 |
||||
*/ |
||||
package com.fr.plugin.ibgq.provider; |
||||
|
||||
import com.fr.general.ReportDeclareRecordType; |
||||
import com.fr.io.collection.ExportCollection; |
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.ExcelExportType; |
||||
import com.fr.plugin.ibgq.export.PageExcelPlusExporter; |
||||
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.web.SessionProvider; |
||||
|
||||
import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <分页导出PageExcelExportApp> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Authorize(callSignKey = PLUGIN_ID) |
||||
public class PageExcelExportApp extends AbstractExcelExportAppProvider { |
||||
|
||||
@Override |
||||
public String exportType() { |
||||
return ExportConstants.TYPE_PAGE; |
||||
} |
||||
|
||||
@Override |
||||
public AppExporter<Boolean> newAppExporter(ExportCollection collection, ExcelExportType exportType, SessionProvider sessionIDInfor) { |
||||
AppExporter<Boolean> exporter = new PageExcelPlusExporter(ReportUtils.getPaperSettingListFromWorkBook(sessionIDInfor.getOriginalObject())); |
||||
collection.setExporter(exporter); |
||||
collection.setRecordType(ReportDeclareRecordType.EXPORT_TYPE_EXCEL_PAGE); |
||||
return exporter; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: SheetExcelExportApp |
||||
* Author: Louis |
||||
* Date: 2021/12/6 8:44 |
||||
*/ |
||||
package com.fr.plugin.ibgq.provider; |
||||
|
||||
import com.fr.general.ReportDeclareRecordType; |
||||
import com.fr.io.collection.ExportCollection; |
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.ExcelExportType; |
||||
import com.fr.plugin.ibgq.export.PageToSheetExcelPlusExporter; |
||||
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.web.SessionProvider; |
||||
|
||||
import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <分页分sheet导出SheetExcelExportApp> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Authorize(callSignKey = PLUGIN_ID) |
||||
public class SheetExcelExportApp extends AbstractExcelExportAppProvider { |
||||
|
||||
@Override |
||||
public String exportType() { |
||||
return ExportConstants.TYPE_PAGETOSHETT; |
||||
} |
||||
|
||||
@Override |
||||
public AppExporter<Boolean> newAppExporter(ExportCollection collection, ExcelExportType exportType, SessionProvider sessionIDInfor) { |
||||
AppExporter<Boolean> exporter = new PageToSheetExcelPlusExporter(ReportUtils.getPaperSettingListFromWorkBook(sessionIDInfor.getOriginalObject())); |
||||
collection.setExporter(exporter); |
||||
collection.setRecordType(ReportDeclareRecordType.EXPORT_TYPE_EXCEL_PAGESHEET); |
||||
return exporter; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright (C), 2018-2021 |
||||
* Project: starter |
||||
* FileName: SimpleExcelExportApp |
||||
* Author: Louis |
||||
* Date: 2021/12/6 8:27 |
||||
*/ |
||||
package com.fr.plugin.ibgq.provider; |
||||
|
||||
import com.fr.general.ReportDeclareRecordType; |
||||
import com.fr.io.collection.ExportCollection; |
||||
import com.fr.io.exporter.AppExporter; |
||||
import com.fr.io.exporter.ExcelExportType; |
||||
import com.fr.plugin.ibgq.export.ExcelPlusExporter; |
||||
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.web.SessionProvider; |
||||
|
||||
import static com.fr.plugin.ibgq.LocaleFinder.PLUGIN_ID; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <原样导出SimpleExcelExportApp> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
@Authorize(callSignKey = PLUGIN_ID) |
||||
public class SimpleExcelExportApp extends AbstractExcelExportAppProvider { |
||||
|
||||
@Override |
||||
public String exportType() { |
||||
return ExportConstants.TYPE_SIMPLE; |
||||
} |
||||
|
||||
@Override |
||||
public AppExporter<Boolean> newAppExporter(ExportCollection collection, ExcelExportType exportType, SessionProvider sessionIDInfor) { |
||||
AppExporter<Boolean> exporter = new ExcelPlusExporter(ReportUtils.getPaperSettingListFromWorkBook(sessionIDInfor.getOriginalObject())); |
||||
collection.setExporter(exporter); |
||||
collection.setRecordType(ReportDeclareRecordType.EXPORT_TYPE_EXCEL_ORIGINAL); |
||||
return exporter; |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
/* |
||||
* Copyright (C), 2018-2022 |
||||
* Project: starter |
||||
* FileName: DocSummaryPane |
||||
* Author: Louis |
||||
* Date: 2022/1/4 13:59 |
||||
*/ |
||||
package com.fr.plugin.ibgq.ui; |
||||
|
||||
import com.fanruan.api.design.DesignKit; |
||||
import com.fanruan.api.design.ui.component.table.UITableEditorPane; |
||||
import com.fanruan.api.design.ui.component.table.model.ParameterTableModel; |
||||
import com.fanruan.api.design.ui.component.table.model.UITableModelAdapter; |
||||
import com.fr.base.io.BaseBook; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.report.AbstractExportPane; |
||||
import com.fr.plugin.ibgq.provider.DocSummaryAttr; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ParameterProvider; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* <Function Description><br> |
||||
* <DocSummaryPane> |
||||
* |
||||
* @author fr.open |
||||
* @since 1.0.0 |
||||
*/ |
||||
public class DocSummaryPane extends AbstractExportPane { |
||||
private static final long serialVersionUID = -3364831983419854602L; |
||||
protected UITableEditorPane<ParameterProvider> editorPane; |
||||
|
||||
public DocSummaryPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); |
||||
UITableModelAdapter<ParameterProvider> model = new ParameterTableModel(); |
||||
this.editorPane = new UITableEditorPane<>(model); |
||||
JPanel customPropertiesPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||
customPropertiesPane.add(editorPane, BorderLayout.CENTER); |
||||
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(DesignKit.i18nText("Plugin-ibgq_Custom_Properties_Title")); |
||||
centerPane.add(customPropertiesPane, BorderLayout.CENTER); |
||||
this.add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void populate(Object attr) { |
||||
populateBean(attr); |
||||
} |
||||
|
||||
@Override |
||||
public void update(Object attr) { |
||||
updateBean(attr); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(Object attr) { |
||||
BaseBook target = DesignerContext.getDesignerFrame().getSelectedJTemplate().getTarget(); |
||||
DocSummaryAttr docSummaryAttr = target.getAttrMark(DocSummaryAttr.XML_TAG); |
||||
if (null != docSummaryAttr) { |
||||
Calculator c = Calculator.createCalculator(); |
||||
this.editorPane.populate(docSummaryAttr.getParameters(c)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(Object attr) { |
||||
BaseBook target = DesignerContext.getDesignerFrame().getSelectedJTemplate().getTarget(); |
||||
DocSummaryAttr docSummaryAttr = target.getAttrMark(DocSummaryAttr.XML_TAG); |
||||
if (null == docSummaryAttr) { |
||||
docSummaryAttr = new DocSummaryAttr(); |
||||
target.addAttrMark(docSummaryAttr); |
||||
} |
||||
List<ParameterProvider> parameterProviderList = this.editorPane.update(); |
||||
ParameterProvider[] parameters = parameterProviderList.toArray(new ParameterProvider[0]); |
||||
docSummaryAttr.setParameters(parameters); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return DesignKit.i18nText("Plugin-ibgq_Document_Summary_Information"); |
||||
} |
||||
} |
@ -0,0 +1,145 @@
|
||||
/** |
||||
* Copyright (C), 2015-2021 |
||||
* FileName: ExcelHandler |
||||
* Author: Louis |
||||
* Date: 2020/3/16 21:55 |
||||
* Description: ExcelHandler |
||||
* History: |
||||
* <author> <time> <version> <desc> |
||||
*/ |
||||
package com.fr.plugin.ibgq.utils; |
||||
|
||||
import com.fanruan.api.i18n.I18nKit; |
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fr.io.exporter.poi.wrapper.POIWorkbookAction; |
||||
import com.fr.main.workbook.ResultWorkBook; |
||||
import com.fr.plugin.context.PluginContexts; |
||||
import com.fr.plugin.ibgq.provider.DocSummaryAttr; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.ParameterProvider; |
||||
import com.fr.third.v2.org.apache.poi.POIXMLProperties; |
||||
import com.fr.third.v2.org.apache.poi.hpsf.CustomProperties; |
||||
import com.fr.third.v2.org.apache.poi.hpsf.DocumentSummaryInformation; |
||||
import com.fr.third.v2.org.apache.poi.hpsf.SummaryInformation; |
||||
import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFSheet; |
||||
import com.fr.third.v2.org.apache.poi.hssf.usermodel.HSSFWorkbook; |
||||
import com.fr.third.v2.org.apache.poi.xssf.streaming.SXSSFWorkbook; |
||||
import com.fr.third.v2.org.apache.poi.xssf.usermodel.XSSFWorkbook; |
||||
|
||||
import java.io.File; |
||||
import java.io.FileOutputStream; |
||||
import java.io.IOException; |
||||
import java.util.Date; |
||||
|
||||
public class ExcelHandler { |
||||
|
||||
public ExcelHandler() { |
||||
} |
||||
|
||||
public static void main(String[] args) throws IOException { |
||||
FileOutputStream fileOutputStream = new FileOutputStream(new File("D:\\aa.xls")); |
||||
HSSFWorkbook workbook = new HSSFWorkbook(); |
||||
workbook.createInformationProperties(); |
||||
SummaryInformation summaryInformation = workbook.getSummaryInformation(); |
||||
DocumentSummaryInformation documentSummaryInformation = workbook.getDocumentSummaryInformation(); |
||||
// 添加备注信息
|
||||
summaryInformation.setComments("TTTTTTT"); |
||||
summaryInformation.setAuthor("ssss"); |
||||
// 添加自定义属性
|
||||
CustomProperties customProperties = new CustomProperties(); |
||||
customProperties.put("repId", "33"); |
||||
customProperties.put("ver", "211"); |
||||
customProperties.put("KSOProductBuildVer", "2052-1-.8.0.630"); |
||||
HSSFSheet sheet = workbook.createSheet();//创建工作表(Sheet)
|
||||
sheet = workbook.createSheet("Test");//创建工作表(Sheet)
|
||||
documentSummaryInformation.setCustomProperties(customProperties); |
||||
|
||||
workbook.write(fileOutputStream); |
||||
fileOutputStream.close(); |
||||
} |
||||
|
||||
public static void setCustomProperties(ResultWorkBook resultWorkBook, POIWorkbookAction poiWorkbookAction) { |
||||
if (!PluginContexts.currentContext().isAvailable()) { |
||||
LogKit.error(I18nKit.getLocText("Plugin-ibgq_Licence_Expired")); |
||||
return; |
||||
} |
||||
DocSummaryAttr docSummaryAttr = resultWorkBook.getAttrMark(DocSummaryAttr.XML_TAG); |
||||
if (null == docSummaryAttr) { |
||||
return; |
||||
} |
||||
ParameterProvider[] parameterProviders = docSummaryAttr.getParameters(Calculator.createCalculator()); |
||||
if (ArrayUtils.isEmpty(parameterProviders)) { |
||||
return; |
||||
} |
||||
Object workbook = poiWorkbookAction.getWorkbook(); |
||||
if (workbook instanceof SXSSFWorkbook) { |
||||
SXSSFWorkbook sxssfWorkbook = (SXSSFWorkbook) workbook; |
||||
XSSFWorkbook xssfWorkbook = sxssfWorkbook.getXSSFWorkbook(); |
||||
POIXMLProperties.CustomProperties customProperties = xssfWorkbook.getProperties().getCustomProperties(); |
||||
for (ParameterProvider parameter : parameterProviders) { |
||||
addCustomProperties(customProperties, parameter); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Excel2003自定义属性 |
||||
* |
||||
* @param resultWorkBook |
||||
* @param workbook |
||||
*/ |
||||
public static void setCustomProperties(ResultWorkBook resultWorkBook, HSSFWorkbook workbook) { |
||||
if (!PluginContexts.currentContext().isAvailable()) { |
||||
LogKit.error(I18nKit.getLocText("Plugin-ibgq_Licence_Expired")); |
||||
return; |
||||
} |
||||
DocSummaryAttr docSummaryAttr = resultWorkBook.getAttrMark(DocSummaryAttr.XML_TAG); |
||||
if (null == docSummaryAttr) { |
||||
return; |
||||
} |
||||
ParameterProvider[] parameterProviders = docSummaryAttr.getParameters(Calculator.createCalculator()); |
||||
if (ArrayUtils.isEmpty(parameterProviders)) { |
||||
return; |
||||
} |
||||
workbook.createInformationProperties(); |
||||
DocumentSummaryInformation documentSummaryInformation = workbook.getDocumentSummaryInformation(); |
||||
CustomProperties customProperties = new CustomProperties(); |
||||
for (ParameterProvider parameter : parameterProviders) { |
||||
addCustomProperties(customProperties, parameter); |
||||
} |
||||
documentSummaryInformation.setCustomProperties(customProperties); |
||||
} |
||||
|
||||
private static void addCustomProperties(POIXMLProperties.CustomProperties customProperties, ParameterProvider parameter) { |
||||
if (parameter.getValue() instanceof String) { |
||||
customProperties.addProperty(parameter.getName(), (String) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Double) { |
||||
customProperties.addProperty(parameter.getName(), (Double) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Integer) { |
||||
customProperties.addProperty(parameter.getName(), (Integer) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Boolean) { |
||||
customProperties.addProperty(parameter.getName(), (Boolean) parameter.getValue()); |
||||
} else { |
||||
customProperties.addProperty(parameter.getName(), parameter.valueToString()); |
||||
} |
||||
} |
||||
|
||||
private static void addCustomProperties(CustomProperties customProperties, ParameterProvider parameter) { |
||||
if (parameter.getValue() instanceof String) { |
||||
customProperties.put(parameter.getName(), (String) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Long) { |
||||
customProperties.put(parameter.getName(), (Long) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Double) { |
||||
customProperties.put(parameter.getName(), (Double) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Integer) { |
||||
customProperties.put(parameter.getName(), (Integer) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Boolean) { |
||||
customProperties.put(parameter.getName(), (Boolean) parameter.getValue()); |
||||
} else if (parameter.getValue() instanceof Date) { |
||||
customProperties.put(parameter.getName(), (Date) parameter.getValue()); |
||||
} else { |
||||
customProperties.put(parameter.getName(), parameter.valueToString()); |
||||
} |
||||
} |
||||
} |
After Width: | Height: | Size: 328 B |
@ -0,0 +1,7 @@
|
||||
Plugin-ibgq=Excel Custom Properties Plugin |
||||
Plugin-ibgq_Licence_Expired=Excel Custom Properties Plugin Licence Expired |
||||
Plugin-ibgq_Engine_Finish_Export=Has been exported |
||||
Plugin-ibgq_Excel_Stream_Export=Excel streaming export |
||||
Plugin-ibgq_Excel_Stream_Export_Layer=Streaming export supports line engine |
||||
Plugin-ibgq_Document_Summary_Information=Excel Summary Information |
||||
Plugin-ibgq_Custom_Properties_Title=Excel Export Custom Properties |
@ -0,0 +1,7 @@
|
||||
Plugin-ibgq=Excel Custom Properties Plugin |
||||
Plugin-ibgq_Licence_Expired=Excel Custom Properties Plugin Licence Expired |
||||
Plugin-ibgq_Engine_Finish_Export=Has been exported |
||||
Plugin-ibgq_Excel_Stream_Export=Excel streaming export |
||||
Plugin-ibgq_Excel_Stream_Export_Layer=Streaming export supports line engine |
||||
Plugin-ibgq_Document_Summary_Information=Excel Summary Information |
||||
Plugin-ibgq_Custom_Properties_Title=Excel Export Custom Properties |
@ -0,0 +1,7 @@
|
||||
Plugin-ibgq=\u5BFC\u51FAExcel\u6587\u6863\u5C5E\u6027\u81EA\u5B9A\u4E49\u63D2\u4EF6 |
||||
Plugin-ibgq_Licence_Expired=\u5BFC\u51FAExcel\u6587\u6863\u5C5E\u6027\u81EA\u5B9A\u4E49\u63D2\u4EF6\u8BB8\u53EF\u8FC7\u671F |
||||
Plugin-ibgq_Engine_Finish_Export=\u5DF2\u7ECF\u5BFC\u51FA\u7ED3\u675F |
||||
Plugin-ibgq_Excel_Stream_Export=Excel\u6D41\u5F0F\u5BFC\u51FA |
||||
Plugin-ibgq_Excel_Stream_Export_Layer=\u6D41\u5F0F\u5BFC\u51FA\u652F\u6301\u884C\u5F0F\u5F15\u64CE |
||||
Plugin-ibgq_Document_Summary_Information=Excel\u5C5E\u6027\u4FE1\u606F |
||||
Plugin-ibgq_Custom_Properties_Title=Excel\u5BFC\u51FA\u81EA\u5B9A\u4E49\u5C5E\u6027 |
Loading…
Reference in new issue