PowerDesigner 表格导出为excel
PD菜单栏中,依次点击 Tools ->Excute Commands->Edit/Run Script..
填入
'******************************************************************************
Option Explicit
Dim rowsNum
rowsNum =
'-----------------------------------------------------------------------------
' 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, SHEET, SHEETLIST
set EXCEL = CREATEOBJECT("Excel.Application")
EXCEL.workbooks.add(-)'添加工作表
EXCEL.workbooks().sheets().name ="表结构"
set SHEET = EXCEL.workbooks().sheets("表结构") EXCEL.workbooks().sheets.add
EXCEL.workbooks().sheets().name ="目录"
set SHEETLIST = EXCEL.workbooks().sheets("目录")
ShowTableList Model,SHEETLIST ShowProperties Model, SHEET,SHEETLIST EXCEL.workbooks().Sheets().Select
EXCEL.visible = true
'设置列宽和自动换行
sheet.Columns().ColumnWidth =
sheet.Columns().ColumnWidth =
sheet.Columns().ColumnWidth =
sheet.Columns().ColumnWidth =
sheet.Columns().ColumnWidth =
sheet.Columns().ColumnWidth =
sheet.Columns().WrapText =true
sheet.Columns().WrapText =true
sheet.Columns().WrapText =true
'不显示网格线
EXCEL.ActiveWindow.DisplayGridlines = False End If
'-----------------------------------------------------------------------------
' Show properties of tables
'-----------------------------------------------------------------------------
Sub ShowProperties(mdl, sheet,SheetList)
' Show tables of the current model/package
rowsNum=
beginrow = rowsNum+
Dim rowIndex
rowIndex=
' For each table
output "begin"
Dim tab
For Each tab In mdl.tables
ShowTable tab,sheet,rowIndex,sheetList
rowIndex = rowIndex +
Next
if mdl.tables.count > then
sheet.Range("A" & beginrow + & ":A" & rowsNum).Rows.Group
end if
output "end"
End Sub
'-----------------------------------------------------------------------------
' Show table properties
'-----------------------------------------------------------------------------
Sub ShowTable(tab, sheet,rowIndex,sheetList)
If IsObject(tab) Then
Dim rangFlag
rowsNum = rowsNum +
' Show properties
Output "================================"
sheet.cells(rowsNum, ) =tab.name
sheet.cells(rowsNum, ).HorizontalAlignment=
sheet.cells(rowsNum, ) = tab.code
'sheet.cells(rowsNum, 5).HorizontalAlignment=3
'sheet.cells(rowsNum, 6) = ""
'sheet.cells(rowsNum, 7) = "表说明"
sheet.cells(rowsNum, ) = tab.comment
'sheet.cells(rowsNum, 8).HorizontalAlignment=3
sheet.Range(sheet.cells(rowsNum, ),sheet.cells(rowsNum, )).Merge
'设置超链接,从目录点击表名去查看表结构
'字段中文名 字段英文名 字段类型 注释 是否主键 是否非空 默认值
sheetList.Hyperlinks.Add sheetList.cells(rowIndex,), "","表结构"&"!B"&rowsNum
rowsNum = rowsNum +
sheet.cells(rowsNum, ) = "字段中文名"
sheet.cells(rowsNum, ) = "字段英文名"
sheet.cells(rowsNum, ) = "字段类型"
sheet.cells(rowsNum, ) = "注释"
sheet.cells(rowsNum, ) = "是否主键"
sheet.cells(rowsNum, ) = "是否非空"
sheet.cells(rowsNum, ) = "默认值"
'设置边框
sheet.Range(sheet.cells(rowsNum-, ),sheet.cells(rowsNum, )).Borders.LineStyle = ""
'sheet.Range(sheet.cells(rowsNum-1, 4),sheet.cells(rowsNum, 9)).Borders.LineStyle = "1"
'字体为10号
sheet.Range(sheet.cells(rowsNum-, ),sheet.cells(rowsNum, )).Font.Size=
Dim col ' running column
Dim colsNum
colsNum =
for each col in tab.columns
rowsNum = rowsNum +
colsNum = colsNum +
sheet.cells(rowsNum, ) = col.name
'sheet.cells(rowsNum, 3) = ""
'sheet.cells(rowsNum, 4) = col.name
sheet.cells(rowsNum, ) = col.code
sheet.cells(rowsNum, ) = col.datatype
sheet.cells(rowsNum, ) = col.comment
If col.Primary = true Then
sheet.cells(rowsNum, ) = "Y"
Else
sheet.cells(rowsNum, ) = " "
End If
If col.Mandatory = true Then
sheet.cells(rowsNum, ) = "Y"
Else
sheet.cells(rowsNum, ) = " "
End If
sheet.cells(rowsNum, ) = col.defaultvalue
next
sheet.Range(sheet.cells(rowsNum-colsNum+,),sheet.cells(rowsNum,)).Borders.LineStyle = ""
'sheet.Range(sheet.cells(rowsNum-colsNum+1,4),sheet.cells(rowsNum,9)).Borders.LineStyle = "3"
sheet.Range(sheet.cells(rowsNum-colsNum+,),sheet.cells(rowsNum,)).Font.Size =
rowsNum = rowsNum + Output "FullDescription: " + tab.Name
End If End Sub
'-----------------------------------------------------------------------------
' Show List Of Table
'-----------------------------------------------------------------------------
Sub ShowTableList(mdl, SheetList)
' Show tables of the current model/package
Dim rowsNo
rowsNo=
' For each table
output "begin"
SheetList.cells(rowsNo, ) = "主题"
SheetList.cells(rowsNo, ) = "表中文名"
SheetList.cells(rowsNo, ) = "表英文名"
SheetList.cells(rowsNo, ) = "表说明"
rowsNo = rowsNo +
SheetList.cells(rowsNo, ) = mdl.name
Dim tab
For Each tab In mdl.tables
If IsObject(tab) Then
rowsNo = rowsNo +
SheetList.cells(rowsNo, ) = ""
SheetList.cells(rowsNo, ) = tab.name
SheetList.cells(rowsNo, ) = tab.code
SheetList.cells(rowsNo, ) = tab.comment
End If
Next
SheetList.Columns().ColumnWidth =
SheetList.Columns().ColumnWidth =
SheetList.Columns().ColumnWidth =
SheetList.Columns().ColumnWidth =
output "end"
End Sub
PD会自动打开EXCEL,并导出到EXCEL中
PowerDesigner 表格导出为excel的更多相关文章
- 数据库表结构转成设计书,PowerDesigner 表格导出为excel
数据库中的表导入到PowerDesigner中并转为excel文档 1.打开PowerDesigner12,在菜单中按照如下方式进行操作 file->Reverse Engineer->D ...
- PowerDesigner 表格导出为excel(转载)
选中tablesctrl + shift +x 然后运行脚本 '******************************************************************** ...
- 纯JS 将table表格导出到excel
html <div > <button type="button" onclick="getXlsFromTbl('tableExcel','myDiv ...
- 将HTML表格导出到EXCEL,兼容Firefox,支持中文
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 使用JavaScript把页面上的表格导出为Excel文件
如果在页面上展示了一个数据表格,而用户想把这个表格导出为Excel文件,那么在要求不高的情况下,可以不通过服务器生成表格,而是直接利用JavaScript的Blob和Object URL特性将表格导出 ...
- 网站开发进阶(三十一)js如何将html表格导出为excel文件(后记)
js如何将html表格导出为excel文件(后记) 前言 项目前期做了个导出Excel表格的功能,但是经过测试发现只有在IE上才可以正确实现,在Chrome等浏览器中无法实现导出效果.经过上网搜索,尝 ...
- 网站开发进阶(二十五)js如何将html表格导出为excel文件
js如何将html表格导出为excel文件 赠人玫瑰,手留余香.若您感觉此篇博文对您有用,请花费2秒时间点个赞,您的鼓励是我不断前进的动力,共勉! jsp页面数据导出成excel的方法很 ...
- vue将表格导出为excel
vue将表格导出为excel 一:在项目中需要安装2个依赖项,如下命令: npm install --save file-saver xlsx 二:在vue文件中如下使用即可: <templat ...
- 表格导出到excel的样式消失该如何修改
工作中遇到一需求,要将后台的表格导出到excel后的表格样式该如何修改呢? 其实表格导出首先需要了解两个插件:jquery.table2excel.js和tableExport.js 1.第一步,写一 ...
随机推荐
- 墨菲定律:当你觉得一个地方可能有bug,那么这个地方就会有bug----顺带了解下Tomcat那少有人注意的localhost.log
一.问题概述 题目有点长,但应该值得后端java们了解下有点小坑的localhost.log,让我长话短说. 博主是搞java后端的.后台是很简单的spring mvc + spring框架. 今天测 ...
- cheerio ==> node中的jquery
三.cheerio ==> node中的jquery https://www.npmjs.com/package/cheerio $ npm install cheerio -- save 1 ...
- Maven Assembly插件介绍
转自:http://blueram.iteye.com/blog/1684070 已经写得挺好的,就不用重写了. 你是否想要创建一个包含脚本.配置文件以及所有运行时所依赖的元素(jar)Assembl ...
- Coding和Git的环境搭建
Github太慢了.打开网页慢,下载也只有几kb. 于是找了国内的Git,据说coding不错.就申请了个. 其实csdn也有...但是没人家的专业... 1 注册coding https://co ...
- C# XML对象序列化、反序列化
XML 序列化:可以将对象序列化为XML文件,或者将XML文件反序列化为对象还有种方法使用LINQ TO XML或者反序列化的方法从XML中读取数据. 最简单的方法就是.net framework提供 ...
- tomcat+redis会话共享
1.基础环境: jdk1. tomcat7 redis nginx 2.添加依赖的jar包到tomcat的lib目录(http://pan.baidu.com/s/1eRAwN0Q) 3.配置tomc ...
- UPUPW本地环境配置thinkphp5的问题
问题解决参考: https://blog.csdn.net/lengyue1084/article/details/80001625 看httpd-vhosts.conf的配置: <Virtua ...
- Spark2 Dataset统计指标:mean均值,variance方差,stddev标准差,corr(Pearson相关系数),skewness偏度,kurtosis峰度
val df4=spark.sql("SELECT mean(age),variance(age),stddev(age),corr(age,yearsmarried),skewness(a ...
- Linux磁盘处理
查看磁盘占用率 df -l 既然确定了哪块磁盘占用率高,那就切换到这块磁盘检查一下这块磁盘的哪个文件夹占用高,再逐层去查找 du -h --max-depth=1
- java 中方法的重写
方法的重写 1.在子类中可以根据需要对从基类中继承来的方法进行重写. 2.方法重写必须要和被重写方法具有相同方法名称.参数列表和返回类型. 3.重写方法不能使用比被重写方法更严格的访问权限 4.注意与 ...