Skip to content

Commit

Permalink
Merge branch 'bug-JSS-2946-excel-da-guess-types'
Browse files Browse the repository at this point in the history
  • Loading branch information
teodord committed Mar 1, 2021
2 parents bc5a0dc + aa4c050 commit 545ac42
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,34 @@ public String getStringFieldValue(JRField jrField) throws JRException
new Object[]{jrField.getName(), String.class.getName()},
e);
}
}
}

// only used in JSS, to guess field types
public String getFieldFormatPattern(JRField jrField) throws JRException
{
try
{
Integer columnIndex = getColumnIndex(jrField);
Sheet sheet = workbook.getSheetAt(sheetIndex);
Cell cell = sheet.getRow(recordIndex).getCell(columnIndex);
if (cell == null)
{
return null;
}
else
{
return cell.getCellStyle().getDataFormatString();
}
}
catch (Exception e)
{
throw
new JRException(
EXCEPTION_MESSAGE_KEY_XLS_FIELD_VALUE_NOT_RETRIEVED,
new Object[]{jrField.getName(), String.class.getName()},
e);
}
}

}

Expand Down

0 comments on commit 545ac42

Please sign in to comment.