1、准备软件:

powerdesigner165与postgresql的驱动:psqlodbc_11_01_0000

2、安装并破解完成powerdesigner165

参看链接:https://www.cnblogs.com/zksfyz/p/8966594.html

3、安装postgresql的驱动:psqlodbc_11_01_0000

参看链接:https://blog.51cto.com/fengyuzaitu/2438827

4、配置postgresql的驱动

搜索开始栏ODBC,用户DSN,添加驱动

参看链接:https://blog.51cto.com/fengyuzaitu/2438827

5、powerdesigner连接数据库

搜索关键词:

powerdesigner连接postgresql数据库生成pdm及word文档
powerdesigner导出word文档

(1)创建model

(2)连接数据库

第一步:

第二步:

第三步:

第四步:

第五步:

第六步:

(3)model连接数据库生成pdm

选中新创建的model,

Database–>Update Model from Database…

(4)创建word模板

一、创建导出模版

1.Report下点击Report Templates...

2.点击新建

3.配置模版:模版名,简体中文,物理模型

4.配置模版显示项

Available items -- List of Tables 双击移动至右侧,用于显示全部表信息

Available items -- Table -- List of Table Columns 双击移动至右侧,用于显示单表信息

List of Table Columns -- 右键 -- Layout... -- 自定义要显示的字段和宽度

一般选择以下几项:是否主键、字段名、数据类型、注释

5.配置模版显示风格

双击节点可以编辑中文描述

模版名称 -- 右键 -- Header/Footer... -- 自定义页眉页脚

这里不需要,直接删除

6.保存模版

建议将自己创建.rtp模版文件,保存到PowerDesigner默认模版目录中:PowerDesigner 16.5\Resource Files\Report Templates

二、根据模版生成数据库文档

1.导入sql反向生成物理模型

根据数据库选择,我用的是mysql

添加.sql文件,点击确定

成功反向生成物理模型

2.Report下点击Generate Report...

找到刚刚保存的模版,并生成RTF

3.rtf转doc或docx

打开生成rtf文件,点击另存为,选择文件类型*.doc或者*.docx

参看链接:

https://blog.csdn.net/move_on_on/article/details/89175490

https://blog.csdn.net/github_39325328/article/details/80902471

6、修改pdm文档的表name为中文名(均需要保证数据库有注释comment)

PowerDesigner中NAME和COMMENT的互相转换,需要执行语句

由于PDM 的表中 Name 会默认=Code 所以很不方便, 所以需要将 StereoType 显示到表的外面来

打开[工具]->[显示属性](英文:Display Preferences) ->Content->Table->右边面板Columns框中 勾选: StereoType ,这样再在 StereoType中填入code字段相同内容就会显示在图形界面上了

使用说明: 在【Tools】-【Execute Commands】-【Edit/Run Script】 下。输入下面你要选择的语句即可,也可以保存起来,以便下次使用,后缀为.vbs。

需要注意的问题是:运行语句时必须在Module模式下,如果是导出报表时执行会出现错误提示。

1.Name转到Comment注释字段。一般情况下只填写NAME,COMMENT可以运行语句自动生成。

将该语句保存为name2comment.vbs

'把pd中那么name想自动添加到comment里面
'如果comment为空,则填入name;如果不为空,则保留不变,这样可以避免已有的注释丢失. 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 ' This routine copy name into comment for each table, each column and each view
' of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
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 ' running column
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 'running view
for each view in folder.Views
if not view.isShortcut and trim(view.comment)="" then
view.comment = view.name
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

2.将Comment内容保存到NAME中,comment2name.vbs 实习互换。语句为:

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

3、执行效果

参看链接:

https://blog.csdn.net/weixin_50750933/article/details/108667494

https://www.cnblogs.com/happy2010/p/10882019.html

powerdesigner连接postgresql数据库生成pdm及word文档的更多相关文章

  1. 使用 powerdesigner 将数据库表结构逆向工程生成对应的word文档

    本机系统win10 + mysql 5.7.17 + powerDesigner 16.5 + mysql-connector-odbc-5.3.9-winx32.msi 1 使用 PowerDesi ...

  2. PowerDesigner连接mysql逆向生成pdm

    常用的建模工具有:PowerDesigner和ERWin,后者已快被淘汰,但前者依然活跃.相信大家都遇到过项目组已经运营很很久,但是竟然连一个ER图都没有,今天就讲解一下PowerDesigner连接 ...

  3. PowerDesigner导出word,PowerDesigner把表导出到word,PDM导出word文档

    PowerDesigner导出word,PowerDesigner把表导出到word,PDM导出word文档 >>>>>>>>>>>& ...

  4. 自动生成并导出word文档

    今天很荣幸又破解一现实难题:自动生成并导出word文档 先看页面效果: word效果: 代码: 先搭建struts2项目 创建action,并在struts.xml完成注册 <?xml vers ...

  5. C# WebForm 使用NPOI 2 生成简单的word文档(.docx)

    使用NPOI可以方便的实现服务端对Word.Excel的读写.要实现对Word的读写操作,需要引用NPOI.OOXML.dll,应用命名空间XWPF. 本文使用NPOI 2.0实现对Word的基本生成 ...

  6. PowerDesigner连接Oracle数据库生成数据模型【本地连接方式】

    步骤1:选择数据库     步骤2:选择要连接的数据库的版本   步骤3:新建数据库连接   步骤4:提供3种连接数据库方式(在此选择第3种),并且点击配置按钮,进行下一步   步骤5:点击此按钮,填 ...

  7. Java中用Apache POI生成excel和word文档

    概述: 近期在做项目的过程中遇到了excel的数据导出和word的图文表报告的导出功能.最后决定用Apache POI来完毕该项功能.本文就项目实现过程中的一些思路与代码与大家共享.同一时候.也作为自 ...

  8. PowerDesigner连接Oracle数据库生成数据模型【数据源连接方式】

    1.进入操作系统的管理工具 2.选择ODBC数据源[32位或64位] 3.列表中是当前数据库已有的数据源,右侧点击添加按钮,添加适合自己的数据源 4.在列表中选择索要连接数据库的ODBC驱动[这里我要 ...

  9. 根据Excel的内容和word模板生成对应的word文档

    Sub setname() Dim I As Integer Dim pspname As String Dim pspnumber As String Dim path As String Dim ...

随机推荐

  1. 狂神说JUC学习笔记(一)

    狂神说JUC的原版笔记: 链接:https://pan.baidu.com/s/12zrGI4JyZhmkQh0cqEO4BA 提取码:d65c 我的笔记在狂神的笔记上增加了一些知识点或者做了些许修改 ...

  2. vulhub-struts2-s2-007

    0x00 漏洞原理   当配置了验证规则 <ActionName>-validation.xml 时,若类型验证转换出错,后端默认会将用户提交的表单值通过字符串拼接,然后执行一次 OGNL ...

  3. 三、DNS子域授权

    前提:准备两台虚拟机:父域: www.tedu.cn(虚拟机A)子域:www.bj.tedu.cn(虚拟机B) 一.在两台虚拟机上安装域名解析软件 root@pc207 ~]# yum -y inst ...

  4. BIM,PIM接入GIS 需要解决的关键技术问题

    随着技术发展,跨界融合已经不是新鲜事物,近两年BIM.PIM+GIS一张图的提出,给行业注入了一股清流. 为GIS行业发展带来了新的契机,同时也带来了一些新的挑战.面对挑战,本文将剖析BIM.PIM+ ...

  5. IPVS的ICMP报文处理-由内到外

    这里主要明与NAT/Masq转发模式相关的ICMP报文处理,但也会提及由于出错引发的IPVS系统主动发送的ICMP报文. 1.ICMP由外到内处理流程入口 入口函数ip_vs_in实质上挂载在netf ...

  6. 配置Oracle遇到问题<一>

    1, 将D:\app\product\11.2.0\dbhome_1\NETWORK复制到D:\app\product\instantclient_11_2.为了处理: 12154错误,不过没有解决. ...

  7. Redis 底层数据结构之跳跃表

    文章参考 <Redis 设计与实现>黄建宏 Redis(2) 跳跃表 跳跃表 跳跃表 skiplist 是一种有序数据结构,它通过在每个节点中维持多个指向其他节点的指针,从而达到快速访问节 ...

  8. 12.5finally子句

    要点提示:无论异常是否产生,finally子句总是会执行的. 有时候无论异常是否出现或者是否被捕获,都希望执行某些代码.java有一个finally子句,可以用来达到这个目的. 注意:使用finall ...

  9. 【网络编程】HTTP简介&URL

    目录 前言 1. http 简介 1.1 概念 1.2 原理 1.3 特点 2. URL 简介 2.1 概念 2.2 URL 通用格式 2.3 网页地址 实例说明 3. HTTP 消息结构 3.1 客 ...

  10. Spring:Spring注解大全

    @Controller 标识一个该类是Spring MVC controller处理器,用来创建处理http请求的对象. @Controller public class TestController ...