Examples of HSSFSheet


Examples of com.dotcms.repackage.org.apache.poi.hssf.usermodel.HSSFSheet

      HSSFWorkbook workbook = new HSSFWorkbook(fis);

      int numOfSheets = workbook.getNumberOfSheets();

      for(int i = 0; i < numOfSheets; i++) {
        HSSFSheet sheet = workbook.getSheetAt(i);

        Iterator rowIterator = sheet.rowIterator();

        while (rowIterator.hasNext()) {
          HSSFRow row = (HSSFRow)rowIterator.next();

          Iterator cellIterator = row.cellIterator();
View Full Code Here

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

    {

      protected void buildExcelDocument(Map model, HSSFWorkbook workbook, HttpServletRequest request,
          HttpServletResponse response) throws Exception
      {
        HSSFSheet sheet = workbook.createSheet("Spring Excel View");
        sheet.setDefaultColumnWidth((short) 12);

        // Write a text at A1.
        HSSFCell cell = getCell(sheet, 0, 0);
        setText(cell, "Spring Excel View Via Strecks");
View Full Code Here

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

         if(hssf != null && hssf2 != null) {
           // Check if the sheet count is same for both books
           if(hssf.getNumberOfSheets() == hssf2.getNumberOfSheets()) {
             // Iterate through the sheets
             for(int i=0;i<hssf.getNumberOfSheets();i++) {
               HSSFSheet sheet1 = hssf.getSheetAt(i);
               HSSFSheet sheet2 = hssf2.getSheetAt(i);
               // check if the sheet is not null
               if(sheet1 != null && sheet2 != null) {
                 int rowCount1 = sheet1.getLastRowNum();
                 int rowCount2 = sheet2.getLastRowNum();
                 // check if rows are the same for both books
                 if(rowCount1 == rowCount2) {
                   // iterate through the rows
                   for(int j=sheet1.getFirstRowNum();j<=rowCount1;j++) {
                     HSSFRow row1 = sheet1.getRow(j);
                     HSSFRow row2 = sheet2.getRow(j);
                     // check if the rows are not null
                     if(row1 != null && row2 != null) {
                         Iterator it1 = row1.cellIterator();
                         Iterator it2 = row2.cellIterator();
                         while(it1.hasNext() && it2.hasNext()) {
View Full Code Here

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

      }

      // Iterate through the sheets
      for (int i = 0; i < hssf.getNumberOfSheets(); i++)
      {
        HSSFSheet sheet1 = hssf.getSheetAt(i);
        HSSFSheet sheet2 = hssf2.getSheetAt(i);
        // check if the sheet is not null
        if (sheet1 == null || sheet2 == null)
        {
          equal = false;
          String dataToWrite = "One of the sheet is null" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
          outputStream.write(dataToWrite.getBytes());
          continue;
        }

        int rowCount1 = sheet1.getLastRowNum();
        int rowCount2 = sheet2.getLastRowNum();
        // check if rows are the same for both books
        if (rowCount1 != rowCount2)
        {
          equal = false;
          continue;
View Full Code Here

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

    }

  if (oFile.getName().endsWith(".xls")) {
    FileInputStream oFistrm = new FileInputStream(oFile);
    HSSFWorkbook oWrkb = new HSSFWorkbook(oFistrm);
    HSSFSheet oSheet = oWrkb.getSheetAt(0);
    oFistrm.close();
    parseSheet(oSheet, sFileDescriptor);
  } else {

      cBuffer = new char[iBuffer];
View Full Code Here

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

    POIFSFileSystem poiFS = new POIFSFileSystem(new FileInputStream(new File(ifile)));
    HSSFWorkbook cworkBook = new HSSFWorkbook(poiFS);

    //*-- loop through the individual sheets and parse each one
    for (int i = 0; i < cworkBook.getNumberOfSheets(); i++)
    { HSSFSheet cSheet = cworkBook.getSheetAt(i);
    if (cSheet != null) { sheetText.append(" "); sheetText.append(extractText(cSheet)); }
    }
   } //*-- end of try block
   catch (OutOfMemoryError exc)
   { logger.error("Ran out of memory for " + ifile + " or could be corrupt file " + exc.getMessage()); }
View Full Code Here

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

   */
  public String[] readDescription() {
    if (workbook.getNumberOfSheets() < 1) {
      return new String[0];
    } else {
      HSSFSheet sheet = workbook.getSheetAt(0);
      return readLine(sheet, 0);
    }
  }
View Full Code Here

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

  public String[] readTitle() {
    if (workbook.getNumberOfSheets() < 1) {
      return new String[0];
    } else {
      HSSFSheet sheet = workbook.getSheetAt(0);
      String[] attrs = readLine(sheet, headIndex);
      attrCount = attrs.length;
      return attrs;
    }
  }
View Full Code Here

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

    logger.debug("has attrs {}", attrs);
    return attrs;
  }

  public Object read() {
    HSSFSheet sheet = workbook.getSheetAt(sheetNum);
    if (indexInSheet > sheet.getLastRowNum()) { return null; }
    HSSFRow row = sheet.getRow(indexInSheet);
    indexInSheet++;
    // 如果是个空行,返回空记录
    if (row == null) {
      return new Object[attrCount];
    } else {
View Full Code Here

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

import org.apache.poi.ss.usermodel.DataFormat;

public class PoiTest {
  public static void main(String[] args) throws IOException {
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet("new sheet");

    // Create a row and put some cells in it. Rows are 0 based.
    HSSFRow row = sheet.createRow(0);

    // Create a cell and put a date value in it. The first cell is not
    // styled as a date.
    HSSFCell cell = row.createCell(0);
    cell.setCellValue(new Date());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.