oracle导出表结构到excel_.pdm文件打开,将.pdm表结构批量导出到excel,PowerDesigner...

你是不是从客户那儿收到了几个xxx.pdm的文件,不要萌,这是 PowerDesigner 文件,里面就是你要看到的数据库表结构。

赶快去下载 PowerDesigner (如果你还没有的话)http://soft.onlinedown.net/soft/577763.htm

下载好,安装!打开pdm文件,File > Open > 选择文件

44a5d54836f203c765e2681570c7536d.png

ctrl+shift+x,粘贴下面代码,Run

ac24f64589f2fb114a6246d067d1fcb9.png
Option Explicit Dim rowsNum rowsNum = 0'-----------------------------------------------------------------------------' Main function'-----------------------------------------------------------------------------' Get the current active model Dim Model Set Model = ActiveModel If (Model Is Nothing) Or (Not Model.IsKindOf(PdPDM.cls_Model)) Then MsgBox "The current model is not an PDM model." Else ' Get the tables collection ' 创建EXCEL APP dim beginrow DIM EXCEL, BOOK, SHEETLIST set EXCEL = CREATEOBJECT("Excel.Application") set BOOK = EXCEL.workbooks.add(-4167) ' 创建工作簿 BOOK.sheets(1).name ="目录" 'Sheet名称 set SHEETLIST = BOOK.sheets("目录") 'Sheet对象 output "[line(21) info]: book.Sheet: " + BOOK.Sheets(1).Name  BOOK.sheets.add ' 添加工作表Sheet output "[line(24) info]: book.Sheet: " + BOOK.Sheets(1).Name 'EXCEL.workbooks(1).sheets(1).name ="表结构" 'Sheet1名称 'set SHEET = EXCEL.workbooks(1).sheets("表结构") 'Sheet1对象  ShowTableList Model, SHEETLIST  ShowProperties Model, BOOK  output "[line(32) info]: Select: " + BOOK.Sheets(BOOK.Sheets.count).name  BOOK.Sheets(BOOK.Sheets.count).Select '选择默认打开的工作表 EXCEL.visible = true ' 弹出Excel工作簿 '不显示网格线 'EXCEL.ActiveWindow.DisplayGridlines = TrueEnd If '-----------------------------------------------------------------------------' Show properties of tables'-----------------------------------------------------------------------------Sub ShowProperties(mdl, book) ' Show tables of the current model/package rowsNum=0 beginrow = rowsNum+1 output "[line(46) info]: tables count : " &mdl.tables.count  Dim rowIndex ' 为目录Sheet设置链接位置 rowIndex=3 output "[line(50) info]: 表结构 begin ========================" ' For each table Dim tab ' Power Tables For Each tab In mdl.tables ShowTable mdl,tab,book,rowIndex rowIndex = rowIndex +1 Next  output "[line(58) info]: 表结构 end !Sheet totals is : " & book.Sheets.countEnd Sub'-----------------------------------------------------------------------------' Show table properties'-----------------------------------------------------------------------------Sub ShowTable(mdl, tab, book,rowIndex) If IsObject(tab) Then rowsNum = 0 rowsNum = rowsNum + 1 'rowsNum=1,工作表第一行 Dim sheet set sheet = book.Sheets(1) ' Show properties Output "[line(72) info]: " & book.Sheets.count &":" + sheet.name + ":" + tab.name ' 设置列宽 sheet.Columns(1).ColumnWidth = 20 sheet.Columns(2).ColumnWidth = 20 sheet.Columns(3).ColumnWidth = 20 sheet.Columns(4).ColumnWidth = 40 '根据需要添加列数,这里是4列,接着是自动换行 sheet.Columns(1).WrapText =true sheet.Columns(2).WrapText =true sheet.Columns(4).WrapText =true  Dim list set list = book.Sheets(book.Sheets.count) output "[line(85) info]:llist:为工作表"+ list.name +"工作表中的单元格设置超链接,对应1个表结构" list.Hyperlinks.Add list.cells(rowIndex,2), 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值