Example usage for org.apache.poi.xssf.usermodel XSSFRichTextString setString

List of usage examples for org.apache.poi.xssf.usermodel XSSFRichTextString setString

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFRichTextString setString.

Prototype

public void setString(String s) 

Source Link

Document

Removes any formatting and sets new string value

Usage

From source file:se.inera.intyg.rehabstod.service.export.xlsx.XlsxExportServiceImpl.java

License:Open Source License

private XSSFRichTextString diagnosKapitelFormat(String diagnosKapitelId) {

    StringBuilder buf = new StringBuilder();

    buf.append(diagnosKapitelId).append(StringUtils.isNotEmpty(diagnosKapitelId) ? ": " : "");
    // Add the description text for the code
    buf.append(diagnosKapitelService.getDiagnosKapitel(diagnosKapitelId).getName());

    XSSFRichTextString richTextString = new XSSFRichTextString();
    richTextString.setString(buf.toString());
    richTextString.applyFont(defaultFont12);

    richTextString.applyFont(0, diagnosKapitelId.length(), boldFont12);
    return richTextString;
}

From source file:se.inera.intyg.rehabstod.service.export.xlsx.XlsxExportServiceImpl.java

License:Open Source License

private XSSFRichTextString buildPersonnummerRichText(Patient patient) {
    String value = patient.getId();
    XSSFRichTextString richTextString = new XSSFRichTextString();
    richTextString.setString(value);
    richTextString.applyFont(defaultFont11);

    return richTextString;
}

From source file:se.inera.intyg.rehabstod.service.export.xlsx.XlsxExportServiceImpl.java

License:Open Source License

private XSSFRichTextString buildGraderRichText(SjukfallEnhet sf) {

    if (sf.getGrader() == null || sf.getGrader().isEmpty()) {
        return new XSSFRichTextString();
    }/*from   w ww . jav  a2  s .  c  om*/

    StringBuilder buf = new StringBuilder();
    Pair aktivIndicies = null;
    boolean first = true;
    for (Integer grad : sf.getGrader()) {

        if (!first) {
            buf.append(UNICODE_RIGHT_ARROW_SYMBOL).append(" ");
        }

        int currentIndex = buf.length();
        // Store indicies for the aktiv grad so we can make its text bold later.
        if (grad == sf.getAktivGrad()) {
            aktivIndicies = new Pair(currentIndex, currentIndex + ("" + grad + "%").length());
        }
        buf.append("").append(grad).append("% ");

        first = false;
    }
    buf.setLength(buf.length() - 1);

    XSSFRichTextString richTextString = new XSSFRichTextString();
    richTextString.setString(buf.toString());
    richTextString.applyFont(defaultFont11);

    // Uses stored indicies to make the correct part of the rich string bold.
    if (aktivIndicies != null) {
        richTextString.applyFont(aktivIndicies.getI1(), aktivIndicies.getI2(), boldFont11);
    }
    return richTextString;
}