diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index b7a3442..6d6441c 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -1,22 +1,21 @@
4.0.0
- de.cimt.talendcomp
- cimt-talendcomp-excel
- Excel Output POI
- 7.4
+ de.jlo.talendcomp
+ jlo-talendcomp-excel
+ Talend Excel Components
+ 13.8
Jan Lolling
- http://www.jan-lolling.de
maven-compiler-plugin
- 3.3
+ 3.8.1
-
- 1.6
+
+ 1.8
@@ -27,10 +26,122 @@
shade
+
+
+
+
+
+
+
+
+
+ de.cimt.talendcomp
+ cimt-talendcomp-maven-plugin
+ 3.1
+
+
+ tFileExcelWorkbookOpen
+
+ component
+
+
+ tFileExcelWorkbookOpen
+
+
+
+ tFileExcelWorkbookSave
+
+ component
+
+
+ tFileExcelWorkbookSave
+ true
+
+
+
+ tFileExcelSheetInput
+
+ component
+
+
+ tFileExcelSheetInput
+ true
+
+
+
+ tFileExcelSheetInputUnpivot
+
+ component
+
+
+ tFileExcelSheetInputUnpivot
+ true
+
+
+
+ tFileExcelSheetOutput
+
+ component
+
+
+ tFileExcelSheetOutput
+ true
+
+
+
+ tFileExcelSheetList
+
+ component
+
+
+ tFileExcelSheetList
+ true
+
+
+
+ tFileExcelReferencedCellInput
+
+ component
+
+
+ tFileExcelReferencedCellInput
+ true
+
+
+
+ tFileExcelReferencedCellOutput
+
+ component
+
+
+ tFileExcelReferencedCellOutput
+ true
+
+
+
+ tFileExcelNamedCellInput
+
+ component
+
+
+ tFileExcelNamedCellInput
+ true
+
+
+
+ tFileExcelNamedCellOutput
+
+ component
+
+
+ tFileExcelNamedCellOutput
+ true
+
- ${artifactId}-${version}
+ ${custom_component_folder}
+ false
@@ -39,7 +150,7 @@
junit
junit
- 4.12
+ 4.13.1
test
@@ -48,12 +159,6 @@
-
- log4j
- log4j
- 1.2.17
- provided
-
diff --git a/pom.xml b/pom.xml
index 2b79305..c1ba183 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.apache.poi
poi-ooxml
- 5.2.3
+ 5.2.3-patched
stax-api
diff --git a/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_de.properties b/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_de.properties
index 6718326..339eb74 100644
--- a/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_de.properties
+++ b/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_de.properties
@@ -32,4 +32,5 @@ REUSE_FIRST_ROW_HEIGHT.NAME=Zeilenh
GROUP_COLS.NAME=Gruppiere Spalten (z.B. "A-G,Z-AA")
EXTEND_TABLE_CELL_RANGE.NAME=Erweitere Zellenbereich für beschriebene Tabellen
REUSE_STYLES_FOR_ALL.NAME=Kopiere Stile für alle Spalten
-EXTEND_DATA_VALIDATIONS.NAME=Erweitere Datenvalidierungen um die neuen Zeilen
\ No newline at end of file
+EXTEND_DATA_VALIDATIONS.NAME=Erweitere Datenvalidierungen um die neuen Zeilen
+ROW_START_INDEX_LABEL=Aus diese Zeile werden die Formatinformationen für die nächsten Zeilen verwendet
\ No newline at end of file
diff --git a/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_fr.properties b/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_fr.properties
index 8bd6df5..01ffbd4 100755
--- a/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_fr.properties
+++ b/src/main/components/tFileExcelSheetOutput/tFileExcelSheetOutput_messages_fr.properties
@@ -33,4 +33,5 @@ REUSE_FIRST_ROW_HEIGHT.NAME=Utiliser hauteur de 1
GROUP_COLS.NAME=Rassembler colonnes (p.ex. "A-G,Z-AA")
EXTEND_TABLE_CELL_RANGE.NAME=Augmenter taille de tableau pour tableaux remplis
REUSE_STYLES_FOR_ALL.NAME=Copier styles pour toutes les colonnes
-EXTEND_DATA_VALIDATIONS.NAME=Etendre les validations de dates pour les nouvelles lignes
\ No newline at end of file
+EXTEND_DATA_VALIDATIONS.NAME=Etendre les validations de dates pour les nouvelles lignes
+ROW_START_INDEX_LABEL=Les informations de formatage pour les lignes suivantes sont utilisées à partir de cette ligne
\ No newline at end of file
diff --git a/src/main/components/tFileExcelWorkbookSave/tFileExcelWorkbookSave_messages_de.properties b/src/main/components/tFileExcelWorkbookSave/tFileExcelWorkbookSave_messages_de.properties
index 73c5cf4..b8bb9e4 100644
--- a/src/main/components/tFileExcelWorkbookSave/tFileExcelWorkbookSave_messages_de.properties
+++ b/src/main/components/tFileExcelWorkbookSave/tFileExcelWorkbookSave_messages_de.properties
@@ -9,6 +9,6 @@ TEMPLATE_SHEETS.NAME=Tabellenbl
TEMPLATE_SHEETS.ITEM.SHEET=Blatt Name oder Index
OPTIMZE_HSSF_WB_STYLES.NAME=Optimiere Stile (kann Dateigrösse reduzieren für xls)
OPTIMZE_HSSF_WB_FONTS.NAME=Optimiere Schriftarten (kann Dateigrösse reduzieren für xls)
-EVALUATE_ALL_FORMULAS.NAME=Berechne all Formeln
+EVALUATE_ALL_FORMULAS.NAME=Berechne alle Formeln
ENCRYPT_FILE.NAME=Schütze Datei (Liest die Ausgabedatei erneut ein und setzt ein Passwort)
PASSWORD.NAME=Passwort
diff --git a/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
index ddfd82d..d8cbb74 100644
--- a/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
+++ b/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
@@ -143,7 +143,7 @@ public SXSSFRow createRow(int rownum) {
if(_sh.getPhysicalNumberOfRows() > 0 && rownum <= _sh.getLastRowNum() ) {
throw new IllegalArgumentException(
"Attempting to write a row["+rownum+"] " +
- "in the range [0," + _sh.getLastRowNum() + "] that is already written to disk.");
+ "in the range [0," + _sh.getLastRowNum() + "] that is already written to disk. Eventually already existing rows are ignored?");
}
SXSSFRow newRow = new SXSSFRow(this);
@@ -231,7 +231,8 @@ public int getFirstRowNum() {
*/
@Override
public int getLastRowNum() {
- return _rows.isEmpty() ? -1 : _rows.lastKey();
+ // jlolling allow append
+ return _rows.isEmpty() ? _sh.getLastRowNum() : _rows.lastKey();
}
/**
diff --git a/src/test/java/de/jlo/talendcomp/excel/TestExcelOutputStreaming.java b/src/test/java/de/jlo/talendcomp/excel/TestExcelOutputStreaming.java
new file mode 100644
index 0000000..a6f0425
--- /dev/null
+++ b/src/test/java/de/jlo/talendcomp/excel/TestExcelOutputStreaming.java
@@ -0,0 +1,146 @@
+package de.jlo.talendcomp.excel;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestExcelOutputStreaming {
+
+ public static Map globalMap = new HashMap<>();
+
+ public static class row2Struct {
+
+ public String newColumn;
+
+ public String getNewColumn() {
+ return this.newColumn;
+ }
+
+ public String newColumn1;
+
+ public String getNewColumn1() {
+ return this.newColumn1;
+ }
+
+ public String newColumn2;
+
+ public String getNewColumn2() {
+ return this.newColumn2;
+ }
+
+ public String newColumn3;
+
+ public String getNewColumn3() {
+ return this.newColumn3;
+ }
+
+ }
+
+
+ public void testAppend() throws Exception {
+
+ de.jlo.talendcomp.excel.SpreadsheetFile tFileExcelWorkbookOpen_2 = new de.jlo.talendcomp.excel.SpreadsheetFile();
+ tFileExcelWorkbookOpen_2.setZipBombWarningThreshold(0.005d);
+ tFileExcelWorkbookOpen_2.setCreateStreamingXMLWorkbook(true);
+ try {
+ // read a excel file as template
+ // this file file will not used as output file
+ tFileExcelWorkbookOpen_2.setInputFile("/var/testdata/excel/test_streaming.xlsx",
+ true);
+ tFileExcelWorkbookOpen_2.initializeWorkbook();
+ } catch (Exception e) {
+ tFileExcelWorkbookOpen_2.error("Intialize workbook from file failed: " + e.getMessage(), e);
+ globalMap.put("tFileExcelWorkbookOpen_2_ERROR_MESSAGE", e.getMessage());
+ throw e;
+ }
+
+ globalMap.put("workbook_tFileExcelWorkbookOpen_2", tFileExcelWorkbookOpen_2.getWorkbook());
+ globalMap.put("tFileExcelWorkbookOpen_2_COUNT_SHEETS",
+ tFileExcelWorkbookOpen_2.getWorkbook().getNumberOfSheets());
+
+
+ final de.jlo.talendcomp.excel.SpreadsheetOutput tFileExcelSheetOutput_2 = new de.jlo.talendcomp.excel.SpreadsheetOutput();
+ tFileExcelSheetOutput_2.setWorkbook(
+ (org.apache.poi.ss.usermodel.Workbook) globalMap.get("workbook_tFileExcelWorkbookOpen_2"));
+ tFileExcelSheetOutput_2.setTargetSheetName("sheet");
+ globalMap.put("tFileExcelSheetOutput_2_SHEET_NAME", tFileExcelSheetOutput_2.getTargetSheetName());
+ tFileExcelSheetOutput_2.resetCache();
+ int startRowIndex_tFileExcelSheetOutput_2 = 5 - 1;
+ int currentSheetLastRowIndex_tFileExcelSheetOutput_2 = tFileExcelSheetOutput_2
+ .detectCurrentSheetLastNoneEmptyRowIndex() + 1;
+ tFileExcelSheetOutput_2.setRowStartIndex(
+ startRowIndex_tFileExcelSheetOutput_2 > currentSheetLastRowIndex_tFileExcelSheetOutput_2
+ ? startRowIndex_tFileExcelSheetOutput_2
+ : currentSheetLastRowIndex_tFileExcelSheetOutput_2);
+ tFileExcelSheetOutput_2.setTemplateRowIndexForStyles(startRowIndex_tFileExcelSheetOutput_2);
+ tFileExcelSheetOutput_2.setFirstRowIsHeader(false);
+ // configure cell positions
+ tFileExcelSheetOutput_2.setColumnStart("C");
+ tFileExcelSheetOutput_2.setAppend(true);
+ tFileExcelSheetOutput_2.setReuseExistingStylesFromFirstWrittenRow(false);
+ tFileExcelSheetOutput_2.setSetupCellStylesForAllColumns(false);
+ tFileExcelSheetOutput_2.setReuseFirstRowHeight(false);
+ // configure cell formats
+ // columnIndex: 0, name: newColumn, format: , talendType: String
+ // columnIndex: 1, name: newColumn1, format: , talendType: String
+ // columnIndex: 2, name: newColumn2, format: , talendType: String
+ // columnIndex: 3, name: newColumn3, format: , talendType: String
+ tFileExcelSheetOutput_2.setWriteNullValues(false);
+ tFileExcelSheetOutput_2.setWriteZeroDateAsNull(true);
+ tFileExcelSheetOutput_2.setForbidWritingInProtectedCells(false);
+ // configure auto size columns and group rows by and comments
+ // config column 0
+ // config column 1
+ // config column 2
+ // config column 3
+ // row counter
+ int nb_line_tFileExcelSheetOutput_2 = 0;
+
+
+ row2Struct row2 = new row2Struct();
+ // fill schema data into the object array
+ Object[] dataset_tFileExcelSheetOutput_2 = new Object[4];
+ dataset_tFileExcelSheetOutput_2[0] = row2.newColumn;
+ dataset_tFileExcelSheetOutput_2[1] = row2.newColumn1;
+ dataset_tFileExcelSheetOutput_2[2] = row2.newColumn2;
+ dataset_tFileExcelSheetOutput_2[3] = row2.newColumn3;
+ // write dataset
+ try {
+ tFileExcelSheetOutput_2.writeRow(dataset_tFileExcelSheetOutput_2);
+ nb_line_tFileExcelSheetOutput_2++;
+ } catch (Exception e) {
+ tFileExcelSheetOutput_2.error("Write data row in line: " + nb_line_tFileExcelSheetOutput_2
+ + " failed: " + e.getMessage(), e);
+ globalMap.put("tFileExcelSheetOutput_2_ERROR_MESSAGE", "Write data row in line: "
+ + nb_line_tFileExcelSheetOutput_2 + " failed: " + e.getMessage());
+ throw e;
+ }
+
+ tFileExcelSheetOutput_2.setupColumnSize();
+ tFileExcelSheetOutput_2.closeLastGroup();
+ globalMap.put("tFileExcelSheetOutput_2_NB_LINE", nb_line_tFileExcelSheetOutput_2);
+ globalMap.put("tFileExcelSheetOutput_2_LAST_ROW_INDEX",
+ tFileExcelSheetOutput_2.detectCurrentSheetLastNoneEmptyRowIndex() + 1);
+
+ de.jlo.talendcomp.excel.SpreadsheetFile tFileExcelWorkbookSave_2 = new de.jlo.talendcomp.excel.SpreadsheetFile();
+ // set the workbook
+ tFileExcelWorkbookSave_2.setWorkbook(
+ (org.apache.poi.ss.usermodel.Workbook) globalMap.get("workbook_tFileExcelWorkbookOpen_2"));
+ // delete template sheets if needed
+ // persist workbook
+ try {
+ tFileExcelWorkbookSave_2.setOutputFile("/var/testdata/excel/test_streaming2");
+ tFileExcelWorkbookSave_2.createDirs();
+ globalMap.put("tFileExcelWorkbookSave_2_COUNT_SHEETS",
+ tFileExcelWorkbookSave_2.getWorkbook().getNumberOfSheets());
+ tFileExcelWorkbookSave_2.writeWorkbook();
+ // release the memory
+ globalMap.put("tFileExcelWorkbookSave_2_FILENAME", tFileExcelWorkbookSave_2.getOutputFile());
+ globalMap.remove("workbook_tFileExcelWorkbookOpen_2");
+ } catch (Exception e) {
+ globalMap.put("tFileExcelWorkbookSave_2_ERROR_MESSAGE", e.getMessage());
+ throw e;
+ }
+
+ }
+
+}