Package org.apache.poi.hssf.usermodel

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


      OutputStream out) throws IOException
  {
    wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet(sheetName);
    // 创建第1行,也就是输出表头
    HSSFRow row = sheet.createRow(0);
    HSSFCell cell;
    for (int i = 0; i < columnNames.length; i++)
    {
      cell = row.createCell(i);
      cell.setCellValue(new HSSFRichTextString(columnNames[i]));
    }
    // 下面是输出各行的数据
    for (int i = 0; i < list.size(); i++)
    {
      row = sheet.createRow(i + 1);
      Object o = list.get(i);
      for (int j = 0; j < columnPropterties.length; j++)
      {
        cell = row.createCell(j);
        Object obj = ReflectionUtils.invokeGetterMethod(o, columnPropterties[j]);
        cell.setCellValue(obj == null ? "" : obj.toString());
      }
    }
    wb.write(out);
View Full Code Here


      // 表体
      String[] fieldNames = setInfo.getFieldNames().get(sheetNum);
      int rowNum = setInfo.getStartRowNums()[sheetNum];
      for (Object obj : objs)
      {
        HSSFRow contentRow = sheets[sheetNum].createRow(rowNum);
        contentRow.setHeight((short) 300);
        HSSFCell[] cells = createCellsForTemplate(contentRow, setInfo.getFieldNames().get(sheetNum).length);
        int cellNum = 0;
        if(fieldNames != null)
        {
          for (int num = 0; num < fieldNames.length; num++)
View Full Code Here

      // 表体
      String[] fieldNames = setInfo.getFieldNames().get(sheetNum);
      int rowNum = 3;
      for (Object obj : objs)
      {
        HSSFRow contentRow = sheets[sheetNum].createRow(rowNum);
        contentRow.setHeight((short) 300);
        HSSFCell[] cells = createCells(contentRow, setInfo.getFieldNames().get(sheetNum).length);
        int cellNum = 1;          // 去掉一列序号,因此从1开始
        if(fieldNames != null)
        {
          for (int num = 0; num < fieldNames.length; num++)
View Full Code Here

      HSSFSheet[] sheets, int sheetNum)
  {
    CellRangeAddress titleRange = new CellRangeAddress(0, 0, 0,
        setInfo.getFieldNames().get(sheetNum).length);
    sheets[sheetNum].addMergedRegion(titleRange);
    HSSFRow titleRow = sheets[sheetNum].createRow(0);
    titleRow.setHeight((short) 800);
    HSSFCell titleCell = titleRow.createCell(0);
    titleCell.setCellStyle(titleStyle);
    titleCell.setCellValue(setInfo.getTitles()[sheetNum]);
  }
View Full Code Here

      HSSFSheet[] sheets, int sheetNum)
  {
    CellRangeAddress dateRange = new CellRangeAddress(1, 1, 0,
        setInfo.getFieldNames().get(sheetNum).length);
    sheets[sheetNum].addMergedRegion(dateRange);
    HSSFRow dateRow = sheets[sheetNum].createRow(1);
    dateRow.setHeight((short) 350);
    HSSFCell dateCell = dateRow.createCell(0);
    dateCell.setCellStyle(dateStyle);
    dateCell.setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
  }
View Full Code Here

   */
  private static void creatTableHeadRow(ExportSetInfo setInfo,
      HSSFSheet[] sheets, int sheetNum)
  {
    // 表头
    HSSFRow headRow = sheets[sheetNum].createRow(2);
    headRow.setHeight((short) 350);
    // 序号列
    HSSFCell snCell = headRow.createCell(0);
    snCell.setCellStyle(headStyle);
    snCell.setCellValue("序号");
    // 列头名称
    for(int num = 1, len = setInfo.getHeadNames().get(sheetNum).length; num <= len; num++)
    {
      HSSFCell headCell = headRow.createCell(num);
      headCell.setCellStyle(headStyle);
      headCell.setCellValue(setInfo.getHeadNames().get(sheetNum)[num - 1]);
    }
  }
View Full Code Here

     
      wb.createSheet("NoQuotesNeeded");
      wb.createSheet("Quotes Needed Here &#$@");
     
      HSSFSheet sheet = wb.createSheet("Test");
      HSSFRow row = sheet.createRow(0);
      HSSFCell cell;
     
      cell = row.createCell((short)0);
      cell.setCellFormula("NoQuotesNeeded!A1");
     
      cell = row.createCell((short)1);
      cell.setCellFormula("'Quotes Needed Here &#$@'!A1");
    }
View Full Code Here

    HSSFWorkbook wb = new HSSFWorkbook();
     
      wb.createSheet("Cash_Flow");;
     
      HSSFSheet sheet = wb.createSheet("Test");
      HSSFRow row = sheet.createRow(0);
      HSSFCell cell;
     
      cell = row.createCell((short)0);
      cell.setCellFormula("Cash_Flow!A1");
   
  }
View Full Code Here

        HSSFWorkbook wb = new HSSFWorkbook();

        wb.createSheet("Cash_Flow");;

        HSSFSheet sheet = wb.createSheet("Test");
        HSSFRow row = sheet.createRow(0);
        HSSFCell cell = row.createCell((short)0);
        String formula = null;

        cell.setCellFormula("1.3E21/3");
        formula = cell.getCellFormula();
        assertEquals("Exponential formula string", "1.3E21/3", formula);
View Full Code Here

     * Sets up a test file
     */
    private ByteArrayOutputStream setupRunFile(HSSFWorkbook book) throws Exception {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        HSSFSheet sheet = book.createSheet("Test");
        HSSFRow   row   = sheet.createRow(0);
        HSSFCell  cell  = row.createCell((short)0);
        cell.setCellValue(10.5);
        book.write(stream);
        return stream;
    }
View Full Code Here

TOP

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

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.