zoukankan      html  css  js  c++  java
  • powerdesign扫描excel表生成概念模型

    打开powerdesign


    新建 conceptual data model (CDM) 


    此脚本只试用于 CDM图


    打开菜单栏 Tool -> execute command ->Edit/Run Script


    脚本如下:

    On Error Resume Next 

    dim excelPath
    excelPath="c:/a.xls"
    dim sheetCount
    Dim model ' the current model
    Set model = ActiveModel
    If (model Is Nothing) Then  
     MsgBox "There is no Active Model"
    End If


    Dim RQ 
    RQ=MsgBox ("是否安装excel?",vbYesNo + vbInformation,"Confirmation")
    if RQ = vbyes then


    Set x=createobject("Excel.Application")
    x.workbooks.open excelPath
    x.workbooks(1).worksheets(1).activate
    sheetCount=x.workbooks(1).worksheets.count
    '开始处理多个sheet
    for each tmpSheet in x.workbooks(1).worksheets




       if tmpSheet.cells(1,1)<>"" then
         '获取到总行数
         dim rowCount
         rowCount=tmpSheet.usedrange.rows.count
         '获取到总列树
         dim colCount
         colCount=tmpSheet.usedrange.columns.count
      
         '首先获取表名称 第一列是表名称
         tableName=tmpSheet.cells(1,1).value
      
         set newEntity=Activemodel.entities.createnew
         newEntity.name=tableName
         newEntity.code=tableName
         
         for rowIndex=2 to rowCount
           set newColumn=newEntity.attributes.createnew
           'msgbox rowIndex
           'msgbox tmpSheet.cells(rowIndex,1)
           if tmpSheet.cells(rowIndex,1) <>"" then
           newColumn.name=tmpSheet.cells(rowIndex,1)  
           newColumn.code=tmpSheet.cells(rowIndex,1)
           newColumn.datatype="Variable characters (60)"
           end if


         next
      
       end if 
      
      
      
    next 
    msgbox "生成完成"
    x.workbooks.close()
    x.quit
    end if


    If Err.Number <> 0 Then 
       x.workbooks.close()
       x.quit
    end if 




    excel 格式:

    

  • 相关阅读:
    typescript-泛型-类型检查
    typescript-class-interface
    typescript-类class
    typescript-接口interface
    Oracle 密码过期
    VMware Redhat虚拟机扩容硬盘
    华硕 U系列电脑拆后盖注意事项
    VS + QT 出现 LNK2001 无法解析的外部符号 QMetaObject 的问题
    c++ _pFirstBlock == pHead
    c++ 套路多
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331416.html
Copyright © 2011-2022 走看看