user8847697
user8847697

Reputation:

How to add QuotePrefix in Apache poi version 4.0.1 hssf

I'm using Apache POI version 4.0.1. I want to set setQuotePrefixed(true) for my cell style. But I couldn't find this method in Hssf workbook cellstyle. Is there a way to do this?

CellStyle style = setStyle(workbook, font);

private CellStyle setStyle(XSSFWorkbook workbook, Font font) {
    XSSFCellStyle wrapBorderedCellStyle = workbook.createCellStyle();
    wrapBorderedCellStyle.getCoreXf().setQuotePrefix(true);
    wrapBorderedCellStyle.setWrapText(true);
    wrapBorderedCellStyle.setAlignment(CellStyle.ALIGN_CENTER);
    wrapBorderedCellStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
    wrapBorderedCellStyle.setFont(font);
    wrapBorderedCellStyle.setBorderTop(CellStyle.BORDER_THIN);
    wrapBorderedCellStyle.setBorderLeft(CellStyle.BORDER_THIN);
    wrapBorderedCellStyle.setBorderRight(CellStyle.BORDER_THIN);
    return wrapBorderedCellStyle;
}

setUpTextCell(style, row, 9, record.getInvoiceNumber().replace(" ", "'"));

Upvotes: 0

Views: 575

Answers (0)

Related Questions