Package org.apache.poi.hssf.usermodel

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


  public ExcelTools() {
  }

  public HSSFWorkbook toExcel(Collection<Object[]> datas, String propertyShowKeys) throws Exception {
    // 建立新HSSFWorkbook对象
    HSSFWorkbook wb = new HSSFWorkbook();
    return toExcel(wb, "export data", datas, propertyShowKeys);
  }
View Full Code Here


   * @return 返回�?个HSSFWorkbook(excel)类型数�?.
   * @throws Exception
   */
  public <T> HSSFWorkbook object2Excel(Collection<T> list, String propertyKeys, String propertyShowKeys,
      PropertyExtractor exporter) throws Exception {
    HSSFWorkbook wb = new HSSFWorkbook(); // 建立新HSSFWorkbook对象
    object2Excel(wb, "export result", list, propertyKeys, propertyShowKeys, exporter);
    return wb;
  }
View Full Code Here

  }


  protected void openWorkbook(OutputStream os)
  {
    workbook = new HSSFWorkbook();
    emptyCellStyle = workbook.createCellStyle();
    emptyCellStyle.setFillForegroundColor((new HSSFColor.WHITE()).getIndex());
    emptyCellStyle.setFillPattern(backgroundMode);
    dataFormat = workbook.createDataFormat();
    createHelper = workbook.getCreationHelper();
View Full Code Here

  private HSSFRow excelRow = null;
  private int row = 0;
  private int col = 0;

  public CsvBuilder() {
    excelWorkbook = new HSSFWorkbook();
    excelSheet = excelWorkbook.createSheet();
    excelRow = excelSheet.createRow(0);
  }
View Full Code Here

    try {
      bis = new BufferedInputStream(leaf.getInputStream());
      StringBuilder content = new StringBuilder(bis.available());
      POIFSFileSystem fs = new POIFSFileSystem(bis);
      HSSFWorkbook workbook = new HSSFWorkbook(fs);

      for (int sheetNumber = 0; sheetNumber < workbook.getNumberOfSheets(); sheetNumber++) {
        HSSFSheet sheet = workbook.getSheetAt(sheetNumber);
        if (sheet != null) {
          for (int rowNumber = sheet.getFirstRowNum(); rowNumber <= sheet.getLastRowNum(); rowNumber++) {
            HSSFRow row = sheet.getRow(rowNumber);
            if (row != null) {
              for (int cellNumber = row.getFirstCellNum(); cellNumber <= row.getLastCellNum(); cellNumber++) {
View Full Code Here

        try
        {
            poifs = new POIFSFileSystem( inStream );
           
            // Get the workbook for further references
            _workbook = new HSSFWorkbook(poifs);          
           
            // get the Workbook (excel part) stream in a InputStream
            din = poifs.createDocumentInputStream( WORKBOOK );
            HSSFRequest req = new HSSFRequest( );
            // lazy listen for ALL records with the listener shown above
View Full Code Here

    XSSFCellStyle style1 = wb1.createCellStyle();
        assertEquals(IndexedColors.AUTOMATIC.getIndex(), style1.getFillBackgroundColor());
        assertNull(style1.getFillBackgroundXSSFColor());

        //compatibility with HSSF
        HSSFWorkbook wb2 = new HSSFWorkbook();
        HSSFCellStyle style2 = wb2.createCellStyle();
        assertEquals(style2.getFillBackgroundColor(), style1.getFillBackgroundColor());
        assertEquals(style2.getFillForegroundColor(), style1.getFillForegroundColor());
        assertEquals(style2.getFillPattern(), style1.getFillPattern());

        assertEquals(style2.getLeftBorderColor(), style1.getLeftBorderColor());
View Full Code Here

     */
    public void test48718() throws Exception {
       // Verify the HSSF behaviour
       // Then ensure the same for XSSF
       Workbook[] wbs = new Workbook[] {
             new HSSFWorkbook(),
             new XSSFWorkbook()
       };
       int[] initialFonts = new int[] { 4, 1 };
       for(int i=0; i<wbs.length; i++) {
          Workbook wb = wbs[i];
View Full Code Here

     *  and with the docs on when fetching the wrong
     *  kind of value from a Formula cell
     */
    public void test47815() {
       Workbook[] wbs = new Workbook[] {
             new HSSFWorkbook(),
             new XSSFWorkbook()
       };
       for(Workbook wb : wbs) {
          Sheet s = wb.createSheet();
          Row r = s.createRow(0);
View Full Code Here

   
    /**
     * CreateFreezePane column/row order check
     */
    public void test49381() throws Exception {
       Workbook[] wbs = new Workbook[] { new HSSFWorkbook(), new XSSFWorkbook() };
       int colSplit = 1;
       int rowSplit = 2;
       int leftmostColumn = 3;
       int topRow = 4;

View Full Code Here

TOP

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

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.