diff --git a/README.md b/README.md
index 00dbf11aa..20a05c6a6 100644
--- a/README.md
+++ b/README.md
@@ -19,6 +19,8 @@ There are five kinds of components (each components README.md contains module st
* [FreeMarker template, (fj-doc-freemarker)](fj-doc-freemarker/README.md) (contains a simple renderer for [HTML](fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/html/FreeMarkerHtmlTypeHandler.java) and [HTML FRAGMENT](fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/html/FreeMarkerHtmlFragmentTypeHandler.java))
* [Apache POI Module (fj-doc-mod-poi)](fj-doc-mod-poi/README.md) ([XLS](fj-doc-mod-poi/src/main/java/org/fugerit/java/doc/mod/poi/XlsPoiTypeHandler.java)/[XLSX](fj-doc-mod-poi/src/main/java/org/fugerit/java/doc/mod/poi/XlsPoiTypeHandler.java))
* [Apache FOP Module (fj-doc-mod-fop)](fj-doc-mod-fop/README.md) ([PDF](fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/PdfFopTypeHandler.java)/[FO](fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/FreeMarkerFopTypeHandler.java))
+* [OpenCSV Module (fj-doc-mod-opencsv)](fj-doc-mod-opencsv/README.md) ([CSV](fj-doc-mod-opencsv/src/main/java/org/fugerit/java/doc/mod/opencsv/OpenCSVTypeHandler.java))
+
### 3. Available type handlers :
* [MD BASIC](fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehandler/markdown/SimpleMarkdownBasicTypeHandler.java) - (fj-doc-core) output as Markdown basic language
@@ -29,6 +31,7 @@ There are five kinds of components (each components README.md contains module st
* [XLSX](fj-doc-mod-poi/src/main/java/org/fugerit/java/doc/mod/poi/XlsPoiTypeHandler.java) - (fj-doc-mod-poi) output as Microsoft XLSX using Apache POI
* [PDF](fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/PdfFopTypeHandler.java) - (fj-doc-mod-fop) - output as PDF using Apache FOP
* [FO](fj-doc-mod-fop/src/main/java/org/fugerit/java/doc/mod/fop/FreeMarkerFopTypeHandler.java) - (fj-doc-mod-fop) - output as FO using Apache FOP
+* [CSV](fj-doc-mod-opencsv/src/main/java/org/fugerit/java/doc/mod/opencsv/OpenCSVTypeHandler.java) - (fj-doc-mod-opencsv) - output as CSV using OpenCSV
### 4. Tutorial :
* [Samples and Quickstart (fj-doc-sample)](fj-doc-sample/README.md)
diff --git a/docgen/parameters.json b/docgen/parameters.json
index 0b71502dc..b9673f542 100644
--- a/docgen/parameters.json
+++ b/docgen/parameters.json
@@ -1,8 +1,8 @@
{
"title" : "Venus (Fugerit Document Generation Framework)",
"name": "Venus",
- "version" : "0.5.3",
- "date" : "21/11/2022",
+ "version" : "0.5.4",
+ "date" : "24/11/2022",
"organization" : {
"name" : "Fugerit Org",
"url" : "https://www.fugerit.org"
diff --git a/docgen/release-notes.txt b/docgen/release-notes.txt
index cf43d6c25..2e46728d4 100644
--- a/docgen/release-notes.txt
+++ b/docgen/release-notes.txt
@@ -1,4 +1,8 @@
-0.5.3 (2022-11-21)
+0.5.4 (2022-11-24)
+------------------
++ fj-doc-mod-opencsv, added module for handling CSV format [CSV format](https://github.com/fugerit-org/fj-doc/issues/8)
+
+0.5.3 (2022-11-21)
------------------
+ fj-doc-base fixed xsd version comparison (before was a normal string comparison)
+ fj-doc-mod-fop Fixed legacy compatibility of FopConfigClassLoader see [0.5.2](https://github.com/fugerit-org/fj-doc/issues/7)
diff --git a/fj-doc-base/pom.xml b/fj-doc-base/pom.xml
index 158b7615f..d60a0da1e 100644
--- a/fj-doc-base/pom.xml
+++ b/fj-doc-base/pom.xml
@@ -7,11 +7,11 @@
org.fugerit.java
fj-doc
- 0.5.3
+ 0.5.4
fj-doc-base
-
+ Basic Framework functionalities (including a simple Renderer for Markdown)
diff --git a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocConfig.java b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocConfig.java
index 2924a9cd4..40e23ea12 100644
--- a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocConfig.java
+++ b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocConfig.java
@@ -2,7 +2,7 @@
public class DocConfig {
- public static final String VERSION = " FUGERIT DOC Version 0.1 (2019-11-06) ";
+ public static final String VERSION = " FUGERIT DOC Version 0.5 (2022-11-24) ";
public static final String TYPE_XML = "xml";
@@ -22,4 +22,6 @@ public class DocConfig {
public static final String TYPE_MD = "md";
+ public static final String TYPE_CSV = "csv";
+
}
diff --git a/fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehelper/csv/CsvHelperConsts.java b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehelper/csv/CsvHelperConsts.java
new file mode 100644
index 000000000..6dbf74950
--- /dev/null
+++ b/fj-doc-base/src/main/java/org/fugerit/java/doc/base/typehelper/csv/CsvHelperConsts.java
@@ -0,0 +1,7 @@
+package org.fugerit.java.doc.base.typehelper.csv;
+
+public class CsvHelperConsts {
+
+ public final static String PROP_CSV_TABLE_ID = "csv-table-id";
+
+}
diff --git a/fj-doc-freemarker/pom.xml b/fj-doc-freemarker/pom.xml
index e29ebae4a..b5445396e 100644
--- a/fj-doc-freemarker/pom.xml
+++ b/fj-doc-freemarker/pom.xml
@@ -7,11 +7,11 @@
org.fugerit.java
fj-doc
- 0.5.3
+ 0.5.4
fj-doc-freemarker
-
+ Common freemarker functionalities and Renderer for HTML using Freemarker
diff --git a/fj-doc-mod-fop/pom.xml b/fj-doc-mod-fop/pom.xml
index b3285e292..d43325d92 100644
--- a/fj-doc-mod-fop/pom.xml
+++ b/fj-doc-mod-fop/pom.xml
@@ -7,11 +7,11 @@
org.fugerit.java
fj-doc
- 0.5.3
+ 0.5.4
fj-doc-mod-fop
-
+ Rendered for PDF using Apache FOP
diff --git a/fj-doc-mod-opencsv/README.md b/fj-doc-mod-opencsv/README.md
new file mode 100644
index 000000000..50e48fb85
--- /dev/null
+++ b/fj-doc-mod-opencsv/README.md
@@ -0,0 +1,13 @@
+# Fugerit Document Generation Framework (fj-doc)
+
+## OpenCSV Render (CSV)(fj-doc-mod-opencsv)
+
+[back to fj-doc index](../README.md)
+
+*Status* :
+Basic features implemented. (Sample JUnit [TestFreeMarker01](../fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java) is now working).
+For the intrinsic limitations of the CSV format, is possibile to choose a sinlge table in the document and outputs it as CSV.
+
+*Quickstart* :
+Basically this is only a type handler, see core library [fj-doc-base](../fj-doc-base/README.md).
+NOTE: If you have any special need you can open a pull request or create your own handler based on this.
\ No newline at end of file
diff --git a/fj-doc-mod-opencsv/pom.xml b/fj-doc-mod-opencsv/pom.xml
new file mode 100644
index 000000000..c36f834ca
--- /dev/null
+++ b/fj-doc-mod-opencsv/pom.xml
@@ -0,0 +1,98 @@
+
+ 4.0.0
+
+ fj-doc-mod-opencsv
+
+
+ org.fugerit.java
+ fj-doc
+ 0.5.4
+
+
+ fj-doc-mod-opencsv
+ Rendere for CSV using OpenCSV
+
+
+
+ Apache License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ 5.7.1
+
+
+
+
+
+
+
+
+
+ com.opencsv
+ opencsv
+ ${opencsv-version}
+
+
+
+ org.fugerit.java
+ fj-core
+
+
+
+ org.fugerit.java
+ fj-doc-base
+
+
+
+
+
+ https://www.fugerit.org
+ Fugerit
+
+
+ https://www.fugerit.org/perm/venus/
+
+
+
+
+ full
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ src/main/javadoc/stylesheet.css
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
+
+
+
diff --git a/fj-doc-mod-opencsv/src/main/java/org/fugerit/java/doc/mod/opencsv/OpenCSVTypeHandler.java b/fj-doc-mod-opencsv/src/main/java/org/fugerit/java/doc/mod/opencsv/OpenCSVTypeHandler.java
new file mode 100644
index 000000000..5388a5953
--- /dev/null
+++ b/fj-doc-mod-opencsv/src/main/java/org/fugerit/java/doc/mod/opencsv/OpenCSVTypeHandler.java
@@ -0,0 +1,75 @@
+package org.fugerit.java.doc.mod.opencsv;
+
+import java.io.OutputStreamWriter;
+
+import org.fugerit.java.doc.base.config.DocInput;
+import org.fugerit.java.doc.base.config.DocOutput;
+import org.fugerit.java.doc.base.config.DocTypeHandlerDefault;
+import org.fugerit.java.doc.base.model.DocBase;
+import org.fugerit.java.doc.base.model.DocCell;
+import org.fugerit.java.doc.base.model.DocElement;
+import org.fugerit.java.doc.base.model.DocPara;
+import org.fugerit.java.doc.base.model.DocPhrase;
+import org.fugerit.java.doc.base.model.DocRow;
+import org.fugerit.java.doc.base.model.DocTable;
+import org.fugerit.java.doc.base.typehelper.csv.CsvHelperConsts;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.opencsv.CSVWriter;
+
+public class OpenCSVTypeHandler extends DocTypeHandlerDefault {
+
+ private static final Logger log = LoggerFactory.getLogger( OpenCSVTypeHandler.class );
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1832379566311585295L;
+
+ public static final String TYPE_CSV = "csv";
+ public static final String MODULE = "csv";
+ public static final String MIME = "text/csv";
+
+ public static final OpenCSVTypeHandler HANDLER = new OpenCSVTypeHandler();
+
+ public OpenCSVTypeHandler() {
+ super(TYPE_CSV, MODULE, MIME);
+ }
+
+ @Override
+ public void handle(DocInput docInput, DocOutput docOutput) throws Exception {
+ DocBase docBase = docInput.getDoc();
+ CSVWriter writer = new CSVWriter( new OutputStreamWriter( docOutput.getOs() ) );
+ String csvTableId = docBase.getInfo().getProperty( CsvHelperConsts.PROP_CSV_TABLE_ID );
+ DocTable table = (DocTable)docBase.getElementById( csvTableId );
+ if ( table == null ) {
+ log.warn( "table id {} not found!", csvTableId );
+ } else {
+ log.info( "handling table id {}", csvTableId );
+ String[] currentRow = new String[ table.getColumns() ];
+ for ( DocElement currentElement : table.getElementList() ) {
+ DocRow row = (DocRow) currentElement;
+ int count = 0;
+ for ( DocElement currentCell : row.getElementList() ) {
+ DocCell cell = (DocCell) currentCell;
+ StringBuilder currentContent = new StringBuilder();
+ for ( DocElement contentElement : cell.getElementList() ) {
+ if ( contentElement instanceof DocPara ) {
+ DocPara para = (DocPara) contentElement;
+ currentContent.append( para.getText() );
+ } else if ( contentElement instanceof DocPhrase ) {
+ DocPhrase para = (DocPhrase) contentElement;
+ currentContent.append( para.getText() );
+ }
+ }
+ currentRow[count] = currentContent.toString();
+ count++;
+ }
+ writer.writeNext( currentRow );
+ }
+ writer.flush();
+ }
+ }
+
+}
diff --git a/fj-doc-mod-poi/README.md b/fj-doc-mod-poi/README.md
index 3bd729cd9..8a5e4659b 100644
--- a/fj-doc-mod-poi/README.md
+++ b/fj-doc-mod-poi/README.md
@@ -5,7 +5,8 @@
[back to fj-doc index](../README.md)
*Status* :
-Most basic features implemented. (proper color and font handling missing).
+Most basic features implemented. (proper color and font handling missing).
+For the intrinsic limitations of the XLS/XLSX format, it is possibile to choose a some tables in the document and output it as excel sheets.
*Quickstart* :
Basically this is only a type handler, see core library [fj-doc-base](../fj-doc-base/README.md).
diff --git a/fj-doc-mod-poi/pom.xml b/fj-doc-mod-poi/pom.xml
index aac4437b1..053d8ccd3 100644
--- a/fj-doc-mod-poi/pom.xml
+++ b/fj-doc-mod-poi/pom.xml
@@ -7,11 +7,11 @@
org.fugerit.java
fj-doc
- 0.5.3
+ 0.5.4
fj-doc-mod-poi
-
+ Renderer for XLS/XLSX using Apache POI
diff --git a/fj-doc-sample/pom.xml b/fj-doc-sample/pom.xml
index c4ed2f254..bbe9369b2 100644
--- a/fj-doc-sample/pom.xml
+++ b/fj-doc-sample/pom.xml
@@ -7,7 +7,7 @@
org.fugerit.java
fj-doc
- 0.5.3
+ 0.5.4
fj-doc-sample
@@ -52,6 +52,11 @@
fj-doc-mod-poi
+
+ org.fugerit.java
+ fj-doc-mod-opencsv
+
+
diff --git a/fj-doc-sample/src/main/resources/config/doc-handler-sample.xml b/fj-doc-sample/src/main/resources/config/doc-handler-sample.xml
index f0e8b7d93..d0dc299a7 100644
--- a/fj-doc-sample/src/main/resources/config/doc-handler-sample.xml
+++ b/fj-doc-sample/src/main/resources/config/doc-handler-sample.xml
@@ -27,7 +27,8 @@
-
+
+
\ No newline at end of file
diff --git a/fj-doc-sample/src/main/resources/free_marker/basic.ftl b/fj-doc-sample/src/main/resources/free_marker/basic.ftl
index 77c8fe947..7c0be3578 100644
--- a/fj-doc-sample/src/main/resources/free_marker/basic.ftl
+++ b/fj-doc-sample/src/main/resources/free_marker/basic.ftl
@@ -11,8 +11,11 @@
-->
+
excel-table=print
- 450
+ 450
+
+ excel-table
diff --git a/fj-doc-sample/src/main/resources/free_marker/test_01.ftl b/fj-doc-sample/src/main/resources/free_marker/test_01.ftl
index 0a8c6ecd7..c2b148345 100644
--- a/fj-doc-sample/src/main/resources/free_marker/test_01.ftl
+++ b/fj-doc-sample/src/main/resources/free_marker/test_01.ftl
@@ -15,8 +15,11 @@
10;10;10;30
+
excel-table=print
450
+
+ excel-table
diff --git a/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/BasicFreeMarkerTest.java b/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/BasicFreeMarkerTest.java
index db4843119..60bd53740 100644
--- a/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/BasicFreeMarkerTest.java
+++ b/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/BasicFreeMarkerTest.java
@@ -16,7 +16,7 @@
public class BasicFreeMarkerTest extends BasicFacadeTest {
public BasicFreeMarkerTest() {
- this( "basic", DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML );
+ this( "basic", DocConfig.TYPE_PDF, DocConfig.TYPE_XLS, DocConfig.TYPE_HTML, DocConfig.TYPE_CSV );
}
protected BasicFreeMarkerTest(String nameBase, String... typeList) {
diff --git a/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java b/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java
index 75094cc10..cd165caad 100644
--- a/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java
+++ b/fj-doc-sample/src/test/java/test/org/fugerit/java/doc/sample/freemarker/TestFreeMarker01.java
@@ -7,7 +7,7 @@ public class TestFreeMarker01 extends BasicFreeMarkerTest {
public TestFreeMarker01() {
super( "free-marker-01", DocConfig.TYPE_FO,
DocConfig.TYPE_XML, DocConfig.TYPE_PDF, DocConfig.TYPE_XLS,
- DocConfig.TYPE_HTML, DocConfig.TYPE_XLSX );
+ DocConfig.TYPE_HTML, DocConfig.TYPE_XLSX, DocConfig.TYPE_CSV );
}
diff --git a/pom.xml b/pom.xml
index 4261ca2a5..3fb8a665c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
fj-doc
- 0.5.3
+ 0.5.4
pom
fj-doc
@@ -69,6 +69,7 @@
fj-doc-freemarker
fj-doc-mod-poi
fj-doc-mod-fop
+ fj-doc-mod-opencsv
fj-doc-sample
@@ -106,6 +107,12 @@
${project.version}
+
+ org.fugerit.java
+ fj-doc-mod-opencsv
+ ${project.version}
+
+
org.fugerit.java
fj-doc-sample