Search in sources :

Example 6 with Triplet

use of org.apache.poi.hwpf.converter.FontReplacer.Triplet in project poi by apache.

the class ExcelToFoConverter method processCellStyleFont.

protected void processCellStyleFont(HSSFWorkbook workbook, Element blockTarget, HSSFFont font) {
    Triplet triplet = new Triplet();
    triplet.fontName = font.getFontName();
    switch(font.getBoldweight()) {
        case HSSFFont.BOLDWEIGHT_BOLD:
            triplet.bold = true;
            break;
        case HSSFFont.BOLDWEIGHT_NORMAL:
        default:
            triplet.bold = false;
            break;
    }
    if (font.getItalic()) {
        triplet.italic = true;
    }
    getFontReplacer().update(triplet);
    setBlockProperties(blockTarget, triplet);
    final HSSFColor fontColor = workbook.getCustomPalette().getColor(font.getColor());
    if (fontColor != null)
        blockTarget.setAttribute("color", ExcelToHtmlUtils.getColor(fontColor));
    if (font.getFontHeightInPoints() != 0)
        blockTarget.setAttribute("font-size", font.getFontHeightInPoints() + "pt");
}
Also used : Triplet(org.apache.poi.hwpf.converter.FontReplacer.Triplet) HSSFColor(org.apache.poi.hssf.util.HSSFColor)

Aggregations

Triplet (org.apache.poi.hwpf.converter.FontReplacer.Triplet)6 Element (org.w3c.dom.Element)4 Text (org.w3c.dom.Text)3 HSSFColor (org.apache.poi.hssf.util.HSSFColor)1 CharacterRun (org.apache.poi.hwpf.usermodel.CharacterRun)1