Esempio n. 1
0
  /**
   * @param tableMetadata TableMetadata
   * @param DOMeta DOMetaData
   */
  protected static void getColMetadata(
      JConnection conn, JParamObject PO, DictMetadata dictMetadata, DOMetaData DOMeta)
      throws Exception {
    if (DOMeta == null) return;
    TableMetadata tableMetadata = dictMetadata.getTableMetadata();
    if (tableMetadata.colList == null) tableMetadata.colList = new ArrayList();
    EFDataSet efds = DOMeta.getDOColumns();
    //        //获取自列表列与掩码Map
    //        java.util.Map map = getSelfEnumColViewMap(conn, PO, dictMetadata);
    //        //
    for (int i = 0; i < efds.getRowCount(); i++) {
      EFRowSet edrs = efds.getRowSet(i);
      ColumnMetaData colMetadata = ColumnMetaData.getInstance();
      colMetadata.setStubTable(new Hashtable());
      colMetadata.getStubTable().putAll(edrs.getDataMap());
      //			String colid = colMetadata.getString("COL_ID", "");
      String coledit = colMetadata.getString("COL_EDIT", "");
      //            if(map != null && coledit.equals("15")){
      //                String view = (String)map.get(colid);
      //                colMetadata.setString("COL_VIEW", view);
      //            }
      // 从DOMetaData中获取 gengeng 2011-11-21
      if (coledit.equals(ColumnMetaData.EL_SELFENUM))
        colMetadata.setString("COL_VIEW", edrs.getString("SYS_SELFENUM", ""));

      tableMetadata.colList.add(colMetadata);
      //            getColRefDictMetadata(conn, PO, dictMetadata, colMetadata);
    }
  }
  /**
   * 创建列
   *
   * @param workbook
   */
  private void exportData(XSSFWorkbook workbook, EFRowSet applyForm) {
    EFDataSet queryDS = applyForm.getDataSet("HYXMMX");
    EFRowSet queryRS = null;
    XSSFRow row = null;
    XSSFFont font = workbook.createFont(); // 创建字体对象
    XSSFCellStyle style = workbook.createCellStyle();
    int startRow = 6;
    List<String> colList = new ArrayList<String>();
    // 循环数据集中每行数据
    for (int i = 0; i < queryDS.getRowCount(); i++) {
      startRow += 1; // 获取行号
      row = workbook.getSheetAt(0).createRow(startRow); // 创建一个行对象
      queryRS = queryDS.getRowSet(i);

      style = workbook.createCellStyle();
      setColumnAlign(style, "LEFT"); // 设置列对齐方式
      setColumnBorder(style, 1); // 设置列边框		
      font.setFontHeightInPoints((short) 10); // 字号
      style.setFont(font); // 设置字体

      colList = new ArrayList<String>();
      colList.add("F_CLBH");
      colList.add("F_CLMC");
      colList.add("F_GGXH");
      colList.add("F_JLDW");

      createColumn(workbook, row, style, colList, 0, queryRS, "");

      style = workbook.createCellStyle();
      setColumnAlign(style, "RIGHT"); // 设置列对齐方式
      setColumnBorder(style, 1); // 设置列边框		
      font.setFontHeightInPoints((short) 10); // 字号
      style.setFont(font); // 设置字体

      colList = new ArrayList<String>();
      colList.add("F_SQSL");
      colList.add("F_RKSL");
      colList.add("F_ZCSL");
      colList.add("F_JDSL");
      colList.add("F_BJDSL");
      colList.add("F_CLTHSL");
      colList.add("F_CSTHSL");
      colList.add("F_DBSL");
      colList.add("F_KCSL");
      colList.add("F_LYSL");
      colList.add("F_CLZJ");

      createColumn(workbook, row, style, colList, 4, queryRS, "N");

      style = workbook.createCellStyle();
      setColumnAlign(style, "LEFT"); // 设置列对齐方式
      setColumnBorder(style, 1); // 设置列边框		
      font.setFontHeightInPoints((short) 10); // 字号
      style.setFont(font); // 设置字体

      colList = new ArrayList<String>();
      colList.add("F_KCQK");
      colList.add("F_BZ");

      createColumn(workbook, row, style, colList, 15, queryRS, "");
    }
  }