Package org.apache.poi.hssf.usermodel

Examples of org.apache.poi.hssf.usermodel.HSSFFont


            HSSFColor color = null;

            HSSFCellStyle style = pstyle.getStyle();
            //style.setFillForegroundColor(
            Workbook workbook = getWorkbook();
            HSSFFont font = workbook.createFont();
            style.setFont(font);
            font.setFontHeightInPoints((short)getUnit());
            //font.setFontName(getFont());
            font.setItalic(getItalic());
            if (getBold()) {
                font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
            } else {
                font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
            }
            font.setUnderline((byte)getUnderline());
            font.setStrikeout(getStrikeThrough());

            color = (HSSFColor)colorhash.get(
                    pstyle.getForegroundColor().toString());
            //System.out.println(pstyle.getForegroundColor().toString());
            if (color == null)
                color = new HSSFColor.BLACK();
            font.setColor(color.getIndex());
            hssfFont = font;
        }
    }
View Full Code Here


                attribute("Fore", workbook.getCustomPalette().getColor(style.getFillForegroundColor()).getHexString());
                attribute("Back", workbook.getCustomPalette().getColor(style.getFillBackgroundColor()).getHexString());
                attribute("PatternColor", Integer.toString(style.getFillPattern())); // TODO
                attribute("Format", "General"); // TODO
                start("Style");
                HSSFFont font = workbook.getFontAt(style.getFontIndex());
                attribute("Unit", Short.toString(font.getFontHeightInPoints()));
                attribute("Bold", Short.toString(font.getBoldweight()));
                attribute("Italic", ((font.getItalic()) ? "1" : "0"));
                attribute("Unterline", Integer.toString(font.getUnderline()));
                attribute("StrikeThrough", ((font.getStrikeout()) ? "1" : "0"));
                start("Font");
                data(font.getFontName());
                end("Font");
                end("Style");
                end("StyleRegion");
            }
        }
View Full Code Here

            }
        }
    }

    private boolean isBlank(HSSFCellStyle style) {
        HSSFFont font = null;
        if (style.getFontIndex() > 0) {
            font = (_workbook.getWorkbook().getFontAt(style.getFontIndex()));
        }
        if (style.getBorderBottom() == 0 && style.getBorderTop() == 0
            && style.getBorderRight() == 0 && style.getBorderLeft() == 0
            && style.getFillBackgroundColor() == HSSFColor.WHITE.index
            && style.getFillPattern() == 0 && (style.getFontIndex() == 0
                || ((font.getFontName().equals("Arial")
                    || font.getFontName().equals("Helvetica"))
                    && font.getFontHeightInPoints() > 8
                    && font.getFontHeightInPoints() < 12))) {
            return true;
        }
        return false;
    }
View Full Code Here

    sheet.setColumnWidth(6, 2400);
    sheet.setColumnWidth(7, 2400);
    sheet.setColumnWidth(8, 2400);
    HSSFRow row = sheet.createRow(0);
    HSSFCellStyle style = wb.createCellStyle();
    HSSFFont font = wb.createFont();
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    style.setFont(font);
    writeHeaderCell(row, 0, "Raw Long Bits A", style);
    writeHeaderCell(row, 1, "Raw Long Bits B", style);
    writeHeaderCell(row, 2, "Value A", style);
    writeHeaderCell(row, 3, "Value B", style);
View Full Code Here

        HSSFRow          r      = null;
        HSSFCell         c      = null;
        HSSFCellStyle    cs     = wb.createCellStyle();
        HSSFCellStyle    cs2    = wb.createCellStyle();
        HSSFCellStyle    cs3    = wb.createCellStyle();
        HSSFFont         f      = wb.createFont();
        HSSFFont         f2     = wb.createFont();

        f.setFontHeightInPoints(( short ) 12);
        f.setColor(( short ) 0xA);
        f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        f2.setFontHeightInPoints(( short ) 10);
        f2.setColor(( short ) 0xf);
        f2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        cs.setFont(f);
        cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
        cs2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        cs2.setFillPattern(( short ) 1);   // fill w fg
        cs2.setFillForegroundColor(( short ) 0xA);
View Full Code Here

    /**
     * create a font in the underlying HSSF model and return the reference
     */
    HSSFFont createFont() {
       
        HSSFFont font = _workbook.createFont();
      
        return font;
    }
View Full Code Here

    }

    protected HSSFCellStyle createHeaderStyle(HSSFSheet sheet) {
        HSSFCellStyle style = wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        HSSFFont font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        style.setFont(font);
        return style;
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    private HSSFWorkbook createWorkbook() {
        HSSFWorkbook wb = new HSSFWorkbook();

        HSSFFont font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        HSSFSheet worksheet = wb.createSheet("Customers");
        worksheet.setColumnWidth(0, (20 * 256));
        worksheet.setColumnWidth(1, (30 * 256));
        worksheet.setColumnWidth(4, (20 * 256));

        HSSFRow row = worksheet.createRow(0);

        HSSFRichTextString value = new HSSFRichTextString("Customers");
        value.applyFont(font);
        row.createCell(0).setCellValue(value);

        row = worksheet.createRow(1);
        row.createCell(0).setCellValue(new HSSFRichTextString("Customer Account Details"));

        worksheet.createRow(2);

        row = worksheet.createRow(3);

        HSSFCellStyle style = wb.createCellStyle();
        style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        font = wb.createFont();
        font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        value = new HSSFRichTextString("Name");
        value.applyFont(font);
        HSSFCell cell = row.createCell(0);
        cell.setCellValue(value);
View Full Code Here

                        + executionSemester.getSemester());
        HSSFCellStyle normalStyle = spreadsheet.getExcelStyle().getValueStyle();
        normalStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        HSSFWorkbook wb = spreadsheet.getWorkbook();
        HSSFFont font = wb.createFont();
        font.setColor(HSSFColor.BLACK.index);
        font.setFontHeightInPoints((short) 8);
        HSSFCellStyle redStyle = wb.createCellStyle();
        redStyle.setFont(font);
        redStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        redStyle.setFillForegroundColor(HSSFColor.ORANGE.index);
        redStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
View Full Code Here

  }
 
  private void appendWorkbook() {
    _html.append("<div>\n");
    for(short i = 0; i < _workbook.getNumberOfFonts(); i++) {
      HSSFFont font = _workbook.getFontAt(i);
      appendFont(font, i);
    }
    for(short i = 0; i < _workbook.getNumCellStyles(); i++) {
      HSSFCellStyle cellStyle = _workbook.getCellStyleAt(i);
      appendCellStyle(cellStyle, i);
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.usermodel.HSSFFont

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.