一、下载
链接: https://pan.baidu.com/s/18uSydllkZKHEZVTaVZV31w 提取码: p3fe
二、显示注释列及注释name相互替换
2.1显示注释列
2.2从comment替换name
执行前
运行ctrl+shinft+x或者调出执行命令窗口tools-executecommands-Edit/Run Script..
执行命令
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
执行后截图
可以看到,name列已经被comment列替换了。
name复制到comment列
替换前
替换后
执行命令
'如果comment为空,则填入name;如果不为空,则保留不变,避免已有的注释丢失.
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
Dim Tab
for each Tab in folder.tables
if not tab.isShortcut then
if trim(tab.comment)="" then '如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
tab.comment = tab.name
end if
Dim col
for each col in tab.columns
if trim(col.comment)="" then '如果col的comment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
col.comment= col.name
end if
next
end if
next
Dim view
for each view in folder.Views
if not view.isShortcut and trim(view.comment)="" then
view.comment = view.name
end if
next
Dim f
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
powerdesigner导出word
1.导入powerdesiner模板。见下面模板,下载地址:
powerdesiner导出word模板-Java工具类资源-CSDN下载
2.生成报告:
报告-生成报告…
导入模板:
1 将模板导入:打开模型以后上面会出现报告
点击报告下的 report templates
点击会出现,
参考:
PowerDesigner导出表到word - 一万年以前 - 博客园
pd导出word表跟一般软件的导出功能类似,通过模版定义格式和样式,然后导出自定义格式的word。我用PowerDesigner15,导出功能用起来比较方便容易,唯一不爽的就是title page和前两页的Header and Footer取不掉。
下面记下简单操作过程以备以后使用,点击下载通用模版
一:基本使用介绍
1. 在工具栏中选择【Report -->Reports】,如下图
2. 点击第二个图标创建一个Report,如下图
该wizard中有三个信息
Report name Report : Report名字,也是导出word的文件名
Language :语言,有中文汉化包选择Simplified Chinese
Report template : Report模版,如果所示软件本身自带了几个模版,在安装目录Resource Files\Report Templates下
3. 选一个默认模版Standard Physical Report,确认后会发现多了两个区Available items和Report items
Available items :软件提供的可用模块,是导出word模版的一个小组件,双击就会添加到Report items区域
Report items : 我选中的模版小组件
4. 根据模版导出word,在工作空间区域,右键Reports下我们建的Report,如下图点击生产RTF格式
以为系统模版要导出的数据比较多会很慢,导出的word格式如下图所示
二 : 定制导出模版
当然这不是我们想要的word,下面看如何做一个自定义模版
1. 在工具栏中选择【Report -->Reports】,如下图
点击第二个图标创建一个Template,如下图
2. 选中Physical Data Model,OK确认
在Available items区域找到List of Tables和List of Table Columns,双击添加到Template items区域
一般导出word也就只需要这两个
List of Tables :所有表的清单,默认显示表名和中文描述,一般不需要改动
List of Table Columns :表的列信息
3. 右键List of Table Columns,如下图所示
Format:字体设置,一般用默认的
Layout:需要显示的属性和显示的宽度
Selection:排序和属性过滤,一般用默认的
4. 设置导出word文档的页眉和页脚,右键模版如下图,不爽的是第一和第二页的页眉页脚这个设置不了
5. 设置title page,右键report如下图
选了no title page竟然没效果,郁闷
6. 做了一个通用的模版,显示表清单和表列清单,需要下载点击这里,下面是导出后的效果图
文档结构图:
首页:
表清单:
表列清单: