• powerdesigner导出excel数据字典


    执行方法:Tools -> Execute COmmands -> Edit/Run Script 或者用快捷键也可以:ctr+shift+X

    '******************************************************************************  
    Option Explicit  
       Dim rowsNum  
       rowsNum = 2
    
    Dim Model  
    Set Model = ActiveModel  
    If (Model Is Nothing) Or (Not Model.IsKindOf(PdPDM.cls_Model)) Then  
      Debug.print "null"
    Else  
        ' Get the tables collection  
        '创建EXCEL APP  
        dim beginrow  
        DIM EXCEL, SHEET  
        set EXCEL = CREATEOBJECT("Excel.Application")  
        EXCEL.workbooks.add  '添加工作表  
        SET sheet = EXCEL.workbooks(1).sheets(1)  
        sheet.name ="数据字典"  
       
       sheet.Range(sheet.cells(1, 1),sheet.cells(1, 9)).Merge
       sheet.cells(1, 1) ="淘宝服装店地址:http://52sunan.taobao.com"
       sheet.Range(sheet.cells(1, 1),sheet.cells(1, 9)).Interior.Color=rgb(146,208,80)
       
       rowsNum=2  
       beginrow = rowsNum+1  
    
       Dim tab  
       For Each tab In Model.tables  
          TableLoop tab,SHEET  
       Next
        
        
        EXCEL.visible = true  
        '设置列宽和自动换行  
        sheet.Columns(1).ColumnWidth  =10
        sheet.Columns(2).ColumnWidth  =15
        sheet.Columns(4).ColumnWidth  =20
        sheet.Columns(5).ColumnWidth  =15
        sheet.Columns(6).ColumnWidth  =15
        
        sheet.Columns("C:C").EntireColumn.AutoFit
        sheet.Columns("i:i").EntireColumn.AutoFit    
     End If  
    
    Sub TableLoop(tab, sheet)  
       If IsObject(tab) Then  
          Dim rangFlag  
          rowsNum = rowsNum + 1  
          
          sheet.cells(rowsNum, 1) = "表名"  
          sheet.Range(sheet.cells(rowsNum, 2),sheet.cells(rowsNum, 9)).Merge
          sheet.cells(rowsNum, 2)=tab.code
          sheet.Range(sheet.cells(rowsNum, 1),sheet.cells(rowsNum, 9)).Borders.LineStyle = "1"
          sheet.Range(sheet.cells(rowsNum, 1),sheet.cells(rowsNum, 9)).Interior.Color=rgb(141,180,226)
          sheet.Range(sheet.cells(rowsNum, 1),sheet.cells(rowsNum, 9)).Borders.Weight ="3"
          
          rowsNum = rowsNum + 2
          sheet.cells(rowsNum, 1) = "中文名"  
          sheet.cells(rowsNum, 2) = "字段名"  
          sheet.cells(rowsNum, 3) = "类型"  
          sheet.cells(rowsNum, 4) = "长度"  
          sheet.cells(rowsNum, 5) = "主键"  
          sheet.cells(rowsNum, 6) = "索引"  
          sheet.cells(rowsNum, 7) = "不可空"  
          sheet.cells(rowsNum, 8) = "默认值"  
          sheet.cells(rowsNum, 9) = "说明"  
          sheet.Range(sheet.cells(rowsNum,1),sheet.cells(rowsNum,9)).Interior.Color=rgb(166,166,166)
          
          Dim col ' running column 
          Dim colsNum  
          colsNum = 0  
          for each col in tab.columns  
             rowsNum = rowsNum + 1  
             colsNum = colsNum + 1  
             sheet.cells(rowsNum, 1) = col.name 
             sheet.cells(rowsNum, 2) = col.code
             sheet.cells(rowsNum, 3) = col.datatype
             sheet.cells(rowsNum, 4) = IIF(col.Length<>0,col.Length,"")
             sheet.cells(rowsNum, 5) = IIF(col.Primary,"","")
             sheet.cells(rowsNum, 6) = IIF(col.Primary,"","")
             sheet.cells(rowsNum, 7) = IIF(col.Mandatory,"","")
             sheet.cells(rowsNum, 8) = ""
             sheet.cells(rowsNum, 9) = col.comment 
          next  
    
          '设置边框  
          DIM RanagBorder
          SET RanagBorder =sheet.Range(sheet.cells(rowsNum-colsNum,1),sheet.cells(rowsNum,9))
          RanagBorder.Borders.LineStyle = "1"
          'RaneBorderFun RanagBorder  
          
          rowsNum = rowsNum + 1  
          
       End If  
    End Sub  
    
    function IIF(flg,tstr,fstr)
       if flg then
          IIF= tstr
       else
          IIF= fstr
       end if
    End function
  • 相关阅读:
    linux时间同步ntp服务的安装与配置
    linux系统的初化始配置
    透明手机
    linux桌面的安装
    Linux中FTP服务器的搭建教程
    Linux怎样创建FTP服务器--修改用户默认目录-完美解决
    linux下vsftpd的安装及配置
    vsftpd快速部署_2018_lcf
    史上最详细的vsftpd配置文件详解2
    史上最详细的vsftpd配置文件讲解
  • 原文地址:https://www.cnblogs.com/linyijia/p/15193257.html
Copyright © 2020-2023  润新知