diff --git a/CHANGELOG.md b/CHANGELOG.md index 96799434a..1cb8c085a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- [mod-fop] supporto for table cell back-color attribute - [playground-quarkus] quarkus-version set to 3.6.0 ## [3.2.1] - 2023-11-22 diff --git a/fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/macro/doc_element.ftl b/fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/macro/doc_element.ftl index ae334e26b..d46095bd2 100644 --- a/fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/macro/doc_element.ftl +++ b/fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/macro/doc_element.ftl @@ -88,7 +88,7 @@ <#list rowList as row> <#list row.elementList as cell> - <@addCssValue name='margin' value=docTable.padding def=0 unit='mm'/><@handleAlign alignValue=cell.align/><@handleVerticalAlign valignValue=cell.valign/><@handleBorders docBorders=cell.docBorders/><@handleCellSpan cell=cell/>> + background-color="${cell.backColor}" <@addCssValue name='padding' value=docTable.padding def=0 unit='mm'/><@addCssValue name='margin' value=docTable.padding def=0 unit='mm'/><@handleAlign alignValue=cell.align/><@handleVerticalAlign valignValue=cell.valign/><@handleBorders docBorders=cell.docBorders/><@handleCellSpan cell=cell/>> <#if (cell.elementList?size > 0)> <#list cell.elementList as cellElement> <@handleElement current=cellElement/> diff --git a/fj-doc-mod-fop/src/test/java/test/org/fugerit/java/doc/mod/fop/TestAlt.java b/fj-doc-mod-fop/src/test/java/test/org/fugerit/java/doc/mod/fop/TestAlt.java new file mode 100644 index 000000000..42f23d881 --- /dev/null +++ b/fj-doc-mod-fop/src/test/java/test/org/fugerit/java/doc/mod/fop/TestAlt.java @@ -0,0 +1,52 @@ +package test.org.fugerit.java.doc.mod.fop; + +import java.io.FileOutputStream; +import java.io.InputStreamReader; + +import org.fugerit.java.core.function.SafeFunction; +import org.fugerit.java.core.lang.helpers.ClassHelper; +import org.fugerit.java.doc.base.config.DocInput; +import org.fugerit.java.doc.base.config.DocOutput; +import org.fugerit.java.doc.base.config.DocTypeHandler; +import org.fugerit.java.doc.mod.fop.FreeMarkerFopTypeHandlerUTF8; +import org.fugerit.java.doc.mod.fop.InitFopHandler; +import org.fugerit.java.doc.mod.fop.PdfFopTypeHandler; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import lombok.extern.slf4j.Slf4j; +import test.org.fugerit.java.BasicTest; + +@Slf4j +public class TestAlt extends BasicTest { + + @BeforeClass + public static void init() { + SafeFunction.apply( () -> InitFopHandler.initDoc() ); + } + + private boolean testHelper( DocTypeHandler handler ) { + boolean ok = false; + try ( InputStreamReader reader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( "sample/doc_alt_01.xml" ) ); + FileOutputStream fos = new FileOutputStream( "target/test_alt_01."+handler.getType() ) ) { + handler.handle( DocInput.newInput( handler.getType(), reader ) , DocOutput.newOutput( fos ) ); + ok = true; + log.info( "result {}", ok ); + } catch (Exception e) { + this.failEx( e ); + } + return ok; + } + + private static final DocTypeHandler[] HANDLERS = { PdfFopTypeHandler.HANDLER, new FreeMarkerFopTypeHandlerUTF8() }; + + @Test + public void testAlt001Ok() { + for ( int k=0; k InitFopHandler.initDocAsync() ); + } + private boolean testHelper( DocTypeHandler handler ) { boolean ok = false; try ( InputStreamReader reader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( "sample/doc_test_01.xml" ) ); diff --git a/fj-doc-mod-fop/src/test/resources/sample/doc_alt_01.xml b/fj-doc-mod-fop/src/test/resources/sample/doc_alt_01.xml new file mode 100644 index 000000000..e0c004975 --- /dev/null +++ b/fj-doc-mod-fop/src/test/resources/sample/doc_alt_01.xml @@ -0,0 +1,49 @@ + + + 10;10;10;30 + excel-table=print + 450 + + Page ${currentPage} + + + + + + + Name + + + Surname + + + Title + + + + + Luthien + + + Tinuviel + + + Queen + + + + + Thorin + + + Oakshield + + + King + + +
+ +