mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Bug fix for dates in Excel file
This commit is contained in:
parent
da1ec9bef6
commit
1a9f8bd888
@ -15,4 +15,3 @@ ExportRecentFiles_col_header_path=Path
|
||||
ExportRecentFiles_col_header_sender=Sender
|
||||
ExportRecentFiles_docsTable_tabName=Recently Opened Documents
|
||||
ExportRecentFiles_downloadsTable_tabName=Recently Downloads
|
||||
ExportRecentFiles_emailParserModuleName=Email Parser
|
||||
|
@ -82,4 +82,10 @@ interface CellModel {
|
||||
* @return The horizontal alignment for the text in the cell.
|
||||
*/
|
||||
HorizontalAlign getHorizontalAlignment();
|
||||
|
||||
/**
|
||||
* @return The format string to be used with Apache POI during excel
|
||||
* export or null if none necessary.
|
||||
*/
|
||||
String getExcelFormatString();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ class DefaultCellModel<T> implements CellModel {
|
||||
private final T data;
|
||||
private final String text;
|
||||
private CellModel.HorizontalAlign horizontalAlignment;
|
||||
private final String excelFormatString;
|
||||
|
||||
/**
|
||||
* Main constructor.
|
||||
@ -62,6 +63,7 @@ class DefaultCellModel<T> implements CellModel {
|
||||
*/
|
||||
DefaultCellModel(T data, Function<T, String> stringConverter, String excelFormatString) {
|
||||
this.data = data;
|
||||
this.excelFormatString = excelFormatString;
|
||||
|
||||
if (stringConverter == null) {
|
||||
text = this.data == null ? "" : this.data.toString();
|
||||
@ -84,6 +86,11 @@ class DefaultCellModel<T> implements CellModel {
|
||||
public HorizontalAlign getHorizontalAlignment() {
|
||||
return horizontalAlignment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExcelFormatString() {
|
||||
return this.excelFormatString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal alignment for this cell model.
|
||||
|
@ -324,8 +324,8 @@ class ExcelExport {
|
||||
static Cell createCell(WorksheetEnv env, Row row, int colNum, CellModel cellModel, Optional<CellStyle> cellStyle) {
|
||||
CellStyle cellStyleToUse = cellStyle.orElse(env.getDefaultCellStyle());
|
||||
|
||||
if (cellModel.getText() != null || cellModel.getHorizontalAlignment() != null) {
|
||||
cellStyleToUse = env.getCellStyle(new CellStyleKey(cellModel.getText(), cellStyleToUse, cellModel.getHorizontalAlignment()));
|
||||
if (cellModel.getExcelFormatString() != null || cellModel.getHorizontalAlignment() != null) {
|
||||
cellStyleToUse = env.getCellStyle(new CellStyleKey(cellModel.getExcelFormatString(), cellStyleToUse, cellModel.getHorizontalAlignment()));
|
||||
}
|
||||
|
||||
Object cellData = cellModel.getData();
|
||||
|
@ -44,8 +44,7 @@ import org.sleuthkit.datamodel.DataSource;
|
||||
"ExportRecentFiles_col_head_date=Date",
|
||||
"ExportRecentFiles_col_header_domain=Domain",
|
||||
"ExportRecentFiles_col_header_path=Path",
|
||||
"ExportRecentFiles_col_header_sender=Sender",
|
||||
"ExportRecentFiles_emailParserModuleName=Email Parser"
|
||||
"ExportRecentFiles_col_header_sender=Sender"
|
||||
})
|
||||
final class ExportRecentFiles {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user