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 格式:

    

  • 相关阅读:
    HUB_mysql学习笔记
    SQL学习笔记
    java_cmd_命令行
    JavaScript_2016_8_28
    linux mysql 安装配置
    solr 添加索引
    solr 查询 实例分析
    solr update接口常用方法
    solr schema.xml文档节点配置
    solr4.5安装配置 linux+tomcat6.0+mmseg4j-1.9.1分词
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331416.html
Copyright © 2011-2022 走看看