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. linux远程和软件包的管理

    远程管理 ssh   用户名@对方IP地址 -X   在本地可以运行对方的图形程序 端口 22 [root@room9pc01 ~]# ssh root@172.25.0.11 [root@serve ...

  2. 02:HTML

    HTML介绍 Web服务本质 import socket sk = socket.socket() sk.bind(("127.0.0.1", 8080)) sk.listen(5 ...

  3. ANDROID开发 Fatal signal 11(SIGSEGV) at 0x问题解决方案

    最近做ANDROID开发,也遇到了很多程序员遇到的一个问题:FATAL SIGNAL 11(SIGSEGV) at 0xxxxx,自然是各种搜索是否有人已然解决,虽然搜索出来的已有案例不少,基本都是内 ...

  4. 有趣的开源项目集结完毕,HelloGitHub 月刊第 63 期发布啦!

    兴趣是最好的老师,HelloGitHub 让你对编程感兴趣! 简介 分享 GitHub 上有趣.入门级的开源项目. 这里有实战项目.入门教程.黑科技.开源书籍.大厂开源项目等,涵盖多种编程语言 Pyt ...

  5. unity调用安卓方法实现安装apk文件(androidx)

    原文链接:点击打开 unity想要实现安装apk文件需要与安卓通讯,所以需要自己来实现安卓代码. 第一步先要新建一个安卓项目提供给unity来使用,我这里使用的工具是android studio4.1 ...

  6. Unity3D-UI--Layout组件

    Layout组件 自动排版 Layout Group Vertical Layout Group 垂直布局 [垂直布局组]组件将其子布局元素彼此重叠.它们的高度由各自的最小高度,首选高度和柔性高度决定 ...

  7. 温故知新,DotNet Core SDK和.Net CLI十八般武艺

    简介 .NET命令行接口 (CLI) 工具是用于开发.生成.运行和发布.NET应用程序的跨平台工具链. https://docs.microsoft.com/zh-cn/dotnet/core/too ...

  8. 9、make和make install的区别

    简单来说,make 是编译,make install 是安装. 9.1.configure: 这一步一般用来生成 Makefile,为下一步的编译做准备,你可以通过在 configure 后加上参数来 ...

  9. SQL 清除数据库日志

    exec sp_detach_db 'MCS4WLSQM','true' --运行上一个命令. --改名LOG文件后再关闭上一行代码,然后再运行下一行代码 exec sp_attach_single_ ...

  10. Docker:Docker部署postgresql数据库

    环境 Centos-7  Postgresql-10 docker-19 yum加载Postgresql yum install https://download.postgresql.org/pub ...