You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to generate an excel from template. Currently I am using jxls-2.14.0, jxls-poi-2.14.0, jxls-reader-2.1.0, and commons-jexl3-3.3 as recommended in docs. Problem is I can't take a value directly by the field like ${employee.name} couse my fileds are stored in the array. And I can only call them by specific method that takes field's code as a param.
reportTable.getRows() retrieves LinkedList<ExcelReportDataRow>. And this is the POJO that I should use:
public final class ExcelReportDataRow {
private ExcelReportDataTable parent;
private String[] values;
public ExcelReportDataRow() {
}
public ExcelReportDataRow(ExcelReportDataTable dataTable) {
parent = dataTable;
values = new String[parent.getColumnCount()];
}
public String[] getRowValue() {
return values;
}
public String getValue(Integer index) {
return values[index];
}
public String getStringValue(String columnName) {
columnName = columnName.replace("_", ".").replace("+", "_");
int index = parent.getColumnIndex(columnName);
if (index != -1) {
String value = values[index];
if (value != null && !value.equals("")) {
return value;
}
}
return "n/a";
}
}
In Excel, I sat properties like ${report.getStringValue("t.employeename")}. Currently, it is generating an Excel with empty rows. Whether or not anybody faced such a problem? Any help or suggestions are appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I want to generate an excel from template. Currently I am using jxls-2.14.0, jxls-poi-2.14.0, jxls-reader-2.1.0, and commons-jexl3-3.3 as recommended in docs. Problem is I can't take a value directly by the field like ${employee.name} couse my fileds are stored in the array. And I can only call them by specific method that takes field's code as a param.
This is what did I so far:
this is my excel template
Code that generates excel:
reportTable.getRows()
retrievesLinkedList<ExcelReportDataRow>
. And this is the POJO that I should use:In Excel, I sat properties like ${report.getStringValue("t.employeename")}. Currently, it is generating an Excel with empty rows. Whether or not anybody faced such a problem? Any help or suggestions are appreciated.
Beta Was this translation helpful? Give feedback.
All reactions