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

  1. '把pd中那么name想自动添加到comment里面
  2. '如果comment为空,则填入name;如果不为空,则保留不变,这样可以避免已有的注释丢失.
  3.  
  4. Option Explicit
  5. ValidationMode = True
  6. InteractiveMode = im_Batch
  7.  
  8. Dim mdl ' the current model
  9.  
  10. ' get the current active model
  11. Set mdl = ActiveModel
  12. If (mdl Is Nothing) Then
  13. MsgBox "There is no current Model "
  14. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  15. MsgBox "The current model is not an Physical Data model. "
  16. Else
  17. ProcessFolder mdl
  18. End If
  19.  
  20. ' This routine copy name into comment for each table, each column and each view
  21. ' of the current folder
  22. Private sub ProcessFolder(folder)
  23. Dim Tab 'running table
  24. for each Tab in folder.tables
  25. if not tab.isShortcut then
  26. if trim(tab.comment)="" then'如果有表的注释,则不改变它.如果没有表注释.则把name添加到注释里面.
  27. tab.comment = tab.name
  28. end if
  29. Dim col ' running column
  30. for each col in tab.columns
  31. if trim(col.comment)="" then '如果colcomment为空,则填入name,如果已有注释,则不添加;这样可以避免已有注释丢失.
  32. col.comment= col.name
  33. end if
  34. next
  35. end if
  36. next
  37.  
  38. Dim view 'running view
  39. for each view in folder.Views
  40. if not view.isShortcut and trim(view.comment)="" then
  41. view.comment = view.name
  42. end if
  43. next
  44.  
  45. ' go into the sub-packages
  46. Dim f ' running folder
  47. For Each f In folder.Packages
  48. if not f.IsShortcut then
  49. ProcessFolder f
  50. end if
  51. Next
  52. end sub

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

  1. Option Explicit
  2. ValidationMode = True
  3. InteractiveMode = im_Batch
  4.  
  5. Dim mdl ' the current model
  6.  
  7. ' get the current active model
  8. Set mdl = ActiveModel
  9. If (mdl Is Nothing) Then
  10. MsgBox "There is no current Model "
  11. ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
  12. MsgBox "The current model is not an Physical Data model. "
  13. Else
  14. ProcessFolder mdl
  15. End If
  16.  
  17. Private sub ProcessFolder(folder)
  18. On Error Resume Next
  19. Dim Tab 'running table
  20. for each Tab in folder.tables
  21. if not tab.isShortcut then
  22. tab.name = tab.comment
  23. Dim col ' running column
  24. for each col in tab.columns
  25. if col.comment="" then
  26. else
  27. col.name= col.comment
  28. end if
  29. next
  30. end if
  31. next
  32.  
  33. Dim view 'running view
  34. for each view in folder.Views
  35. if not view.isShortcut then
  36. view.name = view.comment
  37. end if
  38. next
  39.  
  40. ' go into the sub-packages
  41. Dim f ' running folder
  42. For Each f In folder.Packages
  43. if not f.IsShortcut then
  44. ProcessFolder f
  45. end if
  46. Next
  47. 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. PageHelper--Mybatis分页插件(ssm框架下的使用)

    1.导入PageHelper依赖 <!-- MyBatis 分页插件 --> <dependency> <groupId>com.github.pagehelper ...

  2. C语言数组初始化方式

    //一维数组初始化//初始化方法1 int arr[5] = {3,7,2,1,9}; //定义了一个长度是5的数组,并给每个元素赋值 //初始化方法2 int arr[5] = {3,7}; //给 ...

  3. Spring Boot WebFlux-06——WebFlux 整合 Redis

    第06课:WebFlux 整合 Redis 前言 上一篇内容讲了如何整合 MongoDB,这里继续讲如何操作 Redis 这个数据源,那什么是 Reids? Redis 是一个高性能的 key-val ...

  4. OpenCV随笔

    创建一个窗口#zeros(shape,dtype=float,order='C')#shape:形状,dtype:数据类型,可选参数,默认numpy.float64img = np.zeros((50 ...

  5. 题解 P5318 【【深基18.例3】查找文献】

    题目传送门 根据本蒟蒻细致粗略的分析 这明显是一道水题模(du)板(liu)题 可我竟然没有一遍AC; 为更好地食用本题解需要了解以下内容 1.dfs(大法师深搜) 2.bfs(冰法师广搜)/dij最 ...

  6. csp-s模拟测试58「Divisors」·「Market」·「Dash Speed」

    A. Divisors   大概平均下来每个数也就几千约数吧....,直接筛 B. Market 可以把时间离线下来, 考试没有想到将询问离线,用数组存算了算只能过200的点,拿了70 事实上背包后直 ...

  7. 01 Linux系统配置初始化

    #/bin/bash export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin # 更改主机名 # hostnam ...

  8. 7.1、controller节点配置

    0.配置openstack版本yum源: yum install centos-release-openstack-rocky 1.安装 OpenStack 客户端: yum install pyth ...

  9. 10、修改windows编码集

    10.1.查看Windows的字符集编码: 1.方法一: (1) 同时按住"windows"徽标键和"r"键,在弹出的"运行"框中输入&qu ...

  10. POJ 3984 迷宫(BFS)

    入门BFS,第一次做,部分借鉴了大牛的 #include <iostream> #include <cstdio> #include <queue> using n ...