zoukankan      html  css  js  c++  java
  • 利用VBA把PowerDesigner的name复制到comment

    代码如下:

    Option   Explicit 
    '-------------------------------------------------------------------------------
    '作用:PowerDesigner物理模型复制name到comment
    '
    '作者: Lio5n
    '时间: 2015-12-18
    '
    '版本: V1.0
    '
    '说明:如果comment有值,不会覆盖;可以重复执行,不会多次复制
    '-------------------------------------------------------------------------------
    
     ValidationMode   =   True 
     InteractiveMode   =   im_Batch
    
    Dim   mdl   '当前模型
    
    '获取当前活动的模型
     Set   mdl   =   ActiveModel 
     If   (mdl   Is   Nothing)   Then 
           MsgBox   "未找到活动的模型!" 
     ElseIf   Not   mdl.IsKindOf(PdPDM.cls_Model)   Then 
           MsgBox   "当前模型不是物理模型!" 
     Else 
           ProcessFolder   mdl 
           msgbox "执行完成!"
     End   If
    
    '复制 name 到 comment 的函数
     Private   sub   ProcessFolder(folder) 
           Dim   Tab   '表处理
           for   each   Tab   in   folder.tables 
                 if   not   tab.isShortcut   then
                     
                          if left(trim(tab.comment),len(trim(tab.name ))) <> trim(tab.name) then
                       tab.comment   =   trim(tab.name) + " " + trim(tab.comment)
                       tab.comment   =   trim(tab.comment)
                    end if
                       
                       Dim   col   '字段处理
                       for   each   col   in   tab.columns 
                               if left(trim(col.comment),len(trim(col.name ))) <> trim(col.name) then
                             col.comment=   trim(col.name) + " " + trim(col.comment)
                             col.comment=   trim(col.comment)
                          end if
                       next 
                 end   if 
           next
    
          Dim   view   '视图处理
           for   each   view   in   folder.Views 
                 if   not   view.isShortcut   then 
                     if left(trim(view.comment),len(trim(view.name ))) <> trim(view.name) then
                       view.comment   =   trim(view.name) + " " + trim(view.comment)
                       view.comment   =   trim(view.comment)
                  end if
                 end   if 
           next
    
          '进入子floder
           Dim   f   '子folder 
           For   Each   f   In   folder.Packages 
                 if   not   f.IsShortcut   then 
                       ProcessFolder   f 
                 end   if 
           Next 
     end   sub
  • 相关阅读:
    MVVM
    vue-cli初始化项目2.x|3.x
    逻辑覆盖
    white box白盒测试
    black box黑盒测试
    总结回顾js arr的常见方法以及相关的使用场景(一)
    js 原生功底 (一)
    markdown 语法总结(一)
    阿里一面,面试官想看到的究竟是什么,带你揭秘!!!!
    关于Axios 源码你想了解的 在这儿
  • 原文地址:https://www.cnblogs.com/wanggs/p/5056913.html
Copyright © 2011-2022 走看看