Skip to content

Commit 7c96da2

Browse files
committed
Added support for maximum table width in simpletable module
1 parent e9a0e5a commit 7c96da2

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

docgen/release-notes.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
0.5.9 (2022-12-11)
1+
0.5.9 (2022-12-12)
2+
------------------
3+
+ Added support for maximum table width in simpletable module
4+
5+
0.5.9 (2022-12-11)
26
------------------
37
+ Added support for style and align in simpletable module
48

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# Changelog for module fj-doc-lib-simpletable
22

3+
## version 0.5.10 - 2022-12-12
4+
* Added maximum table width
5+
36
## version 0.5.9 - 2022-12-11
47
* Added support for cell style and align

fj-doc-lib-simpletable/src/main/java/org/fugerit/java/doc/lib/simpletable/model/SimpleTable.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ public class SimpleTable {
1212

1313
public static final String DEFAULT_SHEET_NAME = "Table";
1414

15+
public static final String DEFAULT_TABLE_WIDTH = "100";
16+
1517
public static final int DEFAULT_BORDER_WIDTH = 0;
1618

19+
private String tableWidth;
20+
1721
private String columns;
1822

1923
private String sheetName;
@@ -41,6 +45,7 @@ public SimpleTable( String colwidths ) {
4145
this.colwidths = colwidths;
4246
this.sheetName = DEFAULT_SHEET_NAME;
4347
this.defaultBorderWidth = DEFAULT_BORDER_WIDTH;
48+
this.tableWidth = DEFAULT_TABLE_WIDTH;
4449
}
4550

4651
public void addRow( SimpleRow row ) {
@@ -79,4 +84,18 @@ public void setDefaultBorderWidth(int defaultBorderWidth) {
7984
this.defaultBorderWidth = defaultBorderWidth;
8085
}
8186

87+
public String getTableWidth() {
88+
return tableWidth;
89+
}
90+
91+
public SimpleTable withTableWidth( String tableWidth ) {
92+
this.tableWidth = tableWidth;
93+
return this;
94+
}
95+
96+
public SimpleTable withSheetName( String tableWidth ) {
97+
this.tableWidth = tableWidth;
98+
return this;
99+
}
100+
82101
}

fj-doc-lib-simpletable/src/main/resources/fj_doc_lib_simpletable/template/simple_table.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
<metadata>
77
<info name="default-font-size">10</info>
88
<!-- for xlsx format -->
9-
<info name="excel-table-id">excel-table=${simpleTableModel.sheetName}</info>
9+
<info name="excel-table-id">simple-table=${simpleTableModel.sheetName}</info>
1010
<info name="excel-try-autoresize">true</info>
1111
<!-- for cvs format -->
12-
<info name="csv-table-id">excel-table</info>
12+
<info name="csv-table-id">simple-table</info>
1313
<!-- for fixed size formats, like pdf -->
1414
<info name="page-width">29.7cm</info>
1515
<info name="page-height">21cm</info>
1616
</metadata>
1717
<body>
1818

19-
<table columns="${simpleTableModel.columns}" colwidths="${simpleTableModel.colwidths}" width="100" id="excel-table" padding="2">
19+
<table columns="${simpleTableModel.columns}" colwidths="${simpleTableModel.colwidths}" width="${simpleTableModel.tableWidth}" id="simple-table" padding="2">
2020
<#list simpleTableModel.rows as simpleRow>
2121
<row header="${simpleRow.head}">
2222
<#list simpleRow.cells as simpleCell>

0 commit comments

Comments
 (0)