Package jxl.write

Examples of jxl.write.WritableSheet.addCell()


            
           }      
          
          
           try {
            sheet.addCell(cell);
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
         }
         currentColumn++;
View Full Code Here


        WritableSheet ws = workbook.createSheet(sheetName, index)// 创建可写入的Excel工作表
        int cols = contents.length / rows;              // 根据行数得出列数,在数据库里比较容易得到行数
        for (int row = 0; row < rows; row++) {
          for (int col = 0; col < cols; col++) {
            Label label = new Label(col, row,contents[col + row * cols]);
            ws.addCell(label); // 添加Label对象,单元格内容
          }
        }
        workbook.write(); // 写入excel
        workbook.close(); // 关闭对象,释放资源
      } catch (FileNotFoundException e) {
View Full Code Here

      WritableSheet ws = workbook.createSheet("Sheet1", 0)// 创建可写入的Excel工作表
      int cols = datas.size() / rows;              // 根据行数得出列数,在数据库里比较容易得到行数
      for (int row = 0; row < rows; row++) {
        for (int col = 0; col < cols; col++) {
          Label label = new Label(col, row,(String) datas.get(col + row * cols));
          ws.addCell(label); // 添加Label对象,单元格内容
        }
      }
      workbook.write(); // 写入excel
      workbook.close(); // 关闭对象,释放资源
    } catch (IOException e) {
View Full Code Here

    newFormat.setBackground(Colour.RED);
    c.setCellFormat(newFormat);

    // Modify the contents of the merged cell
    l = new Label(0, 49, "Modified merged cells");
    sheet.addCell(l);

    // Modify the chart data
    Number n = (Number) sheet.getWritableCell(0, 70);
    n.setValue(9);
   
View Full Code Here

    n = (Number) sheet.getWritableCell(0, 73);
    n.setValue(4);

    // Add in a cross sheet formula
    Formula f = new Formula(1, 80, "ROUND(COS(original!B10),2)");
    sheet.addCell(f);

    // Add in a formula from the named cells
    f = new Formula(1, 83, "value1+value2");
    sheet.addCell(f);
View Full Code Here

    Formula f = new Formula(1, 80, "ROUND(COS(original!B10),2)");
    sheet.addCell(f);

    // Add in a formula from the named cells
    f = new Formula(1, 83, "value1+value2");
    sheet.addCell(f);

    // Add in a function formula using named cells
    f = new Formula(1, 84, "AVERAGE(value1,value1*4,value2)");
    sheet.addCell(f);

View Full Code Here

    f = new Formula(1, 83, "value1+value2");
    sheet.addCell(f);

    // Add in a function formula using named cells
    f = new Formula(1, 84, "AVERAGE(value1,value1*4,value2)");
    sheet.addCell(f);

    // Copy sheet 1 to sheet 3
    //     w.copySheet(0, "copy", 2);

    // Use the cell deep copy feature
View Full Code Here

    // Copy sheet 1 to sheet 3
    //     w.copySheet(0, "copy", 2);

    // Use the cell deep copy feature
    Label label = new Label(0, 88, "Some copied cells", cf);
    sheet.addCell(label);

    label = new Label(0,89, "Number from B9");
    sheet.addCell(label);

    WritableCell wc = sheet.getWritableCell(1, 9).copyTo(1,89);
View Full Code Here

    // Use the cell deep copy feature
    Label label = new Label(0, 88, "Some copied cells", cf);
    sheet.addCell(label);

    label = new Label(0,89, "Number from B9");
    sheet.addCell(label);

    WritableCell wc = sheet.getWritableCell(1, 9).copyTo(1,89);
    sheet.addCell(wc);

    label = new Label(0, 90, "Label from B4 (modified format)");
View Full Code Here

    label = new Label(0,89, "Number from B9");
    sheet.addCell(label);

    WritableCell wc = sheet.getWritableCell(1, 9).copyTo(1,89);
    sheet.addCell(wc);

    label = new Label(0, 90, "Label from B4 (modified format)");
    sheet.addCell(label);

    wc = sheet.getWritableCell(1, 3).copyTo(1,90);
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.