hide comments by default

This commit is contained in:
2019-02-17 17:45:56 +01:00
parent d76154e279
commit 70bebd4ef8

View File

@ -82,6 +82,10 @@ public abstract class PoiUtil {
}
public static void addCellComment(XSSFWorkbook wb, Row row, int cellNumber, String cellComment, int rowCount, int columnCount) {
addCellComment(wb, row, cellNumber, cellComment, rowCount, columnCount, false);
}
public static void addCellComment(XSSFWorkbook wb, Row row, int cellNumber, String cellComment, int rowCount, int columnCount, boolean commentVisible) {
Drawing drawing = row.getSheet().createDrawingPatriarch();
CreationHelper factory = wb.getCreationHelper();
@ -99,9 +103,11 @@ public abstract class PoiUtil {
RichTextString str = factory.createRichTextString(cellComment);
comment.setString(str);
comment.setAuthor("PCD");
comment.setVisible(commentVisible);
// Assign the comment to the cell
cell.setCellComment(comment);
}
public static void setDateValue(Row row, int cellNumber, Date date, CellStyle cellStyle) {
@ -233,7 +239,9 @@ public abstract class PoiUtil {
}
/**
* remove charecters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically
* remove charecters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel
* automatically
*
* @param sourceValue the input string to execute the replacement
* @return sourceValue with replaced characters
*/