powerdesigner--Export into Excel

Source: Internet
Author: User

PowerDesigner Export Excel script:

'******************************************************************************'* File:pdm2excel.txt'* TITLE:PDM Export to Excel'* purpose:to Export the tables and columns to Excel'* model:physical Data Model'* objects:table, Column, View'* Author:ziyan'* created:2012-05-03'* version:1.0'******************************************************************************Option Explicit   DimRowsnum Rowsnum=0'-----------------------------------------------------------------------------'Main function'-----------------------------------------------------------------------------'Get The current active modelDimModelSetModel =ActivemodelIf(Model is  Nothing)Or( notModel.iskindof (Pdpdm.cls_model)) Then  MsgBox "The current model isn't an PDM model."Else 'Get the Tables collection 'Create an EXCEL APP DimBeginrowDIMEXCEL, SHEETSetEXCEL =CreateObject("Excel.Application") EXCEL.workbooks.add (-4167)'Add a worksheetExcel.Workbooks (1). Sheets (1). Name ="Test" SetSheet = excel.workbooks (1). Sheets ("Test") showproperties Model, SHEET excel.visible=true 'set column widths and wrap linessheet. Columns (1). ColumnWidth = -sheet. Columns (2). ColumnWidth = +sheet. Columns (4). ColumnWidth = -sheet. Columns (5). ColumnWidth = -sheet. Columns (6). ColumnWidth = thesheet. Columns (1). WrapText =truesheet. Columns (2). WrapText =truesheet. Columns (4). WrapText =true End If'-----------------------------------------------------------------------------'Show Properties of Tables'-----------------------------------------------------------------------------Subshowproperties (MDL, sheet)'Show Tables of the current model/packageRowsnum=0Beginrow= rowsnum+1   'For each tableOutput"begin"   Dim Tab    for  each Tab inchmdl.tables showtableTab, SheetNext   ifMdl.tables.count >0  Thensheet. Range ("A"& Beginrow +1&": A"&rowsnum). Rows.groupEnd ifOutput"End"End Sub'-----------------------------------------------------------------------------'Show Table Properties'-----------------------------------------------------------------------------SubShowtable (Tab, sheet)IfIsObject (Tab) Then     DimRangflag Rowsnum= Rowsnum +1      'Show PropertiesOutput"================================"sheet.cells (Rowsnum,1) ="Entity name"sheet.cells (Rowsnum,2) =Tab. Name Sheet.cells (Rowsnum,3) =""sheet.cells (Rowsnum,4) ="Table name"sheet.cells (Rowsnum,5) =Tab. Code sheet. Range (Sheet.cells (Rowsnum,5), Sheet.cells (Rowsnum,6)). Merge Rowsnum= Rowsnum +1sheet.cells (Rowsnum,1) ="Property name"sheet.cells (Rowsnum,2) ="Description"sheet.cells (Rowsnum,3) =""sheet.cells (Rowsnum,4) ="Field Chinese name"sheet.cells (Rowsnum,5) ="Field name"sheet.cells (Rowsnum,6) ="field Type"      'Set Bordersheet. Range (Sheet.cells (Rowsnum-1,1), Sheet.cells (Rowsnum,2)). Borders.LineStyle ="1"sheet. Range (Sheet.cells (Rowsnum-1,4), Sheet.cells (Rowsnum,6)). Borders.LineStyle ="1"DimCol'Running ColumnDimColsnumcolsnum=0       for  eachColinch Tab. Columns Rowsnum= Rowsnum +1Colsnum= Colsnum +1sheet.cells (Rowsnum,1) =col.name sheet.cells (Rowsnum,2) =col.comment sheet.cells (Rowsnum,3) =""sheet.cells (Rowsnum,4) =col.name sheet.cells (Rowsnum,5) =Col.code sheet.cells (Rowsnum,6) =Col.datatypeNextsheet. Range (Sheet.cells (Rowsnum-colsnum+1,1), Sheet.cells (Rowsnum,2)). Borders.LineStyle ="2"sheet. Range (Sheet.cells (Rowsnum-colsnum+1,4), Sheet.cells (Rowsnum,6)). Borders.LineStyle ="2"Rowsnum= Rowsnum +1Output"fulldescription:"+Tab. NameEnd IfEnd Sub

powerdesigner--Export to Excel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.