PowerDesigner数据库设计PDM基于Excel的导入导出总结
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 beginrowDim EXCEL, BOOK, SHEETSet EXCEL = CreateObject("Excel.Application")EXCEL.Visible = TrueSet BOOK = EXCEL.Workbooks.Add(-4167) '新建工作簿BOOK.Sheets(1).Name = "数据库表结构"Set SHEET = EXCEL.workbooks(1).sheets("数据库表结构")ShowProperties Model, SHEETEXCEL.visible = true '设置列宽和自动换行 SHEET.Columns(1).ColumnWidth = 10 SHEET.Columns(2).ColumnWidth = 30 SHEET.Columns(3).ColumnWidth = 20 SHEET.Columns(1).WrapText =true SHEET.Columns(2).WrapText =true SHEET.Columns(3).WrapText =true End If'----------------------------------------------------------------------------- ' Show properties of tables '----------------------------------------------------------------------------- Sub ShowProperties(mdl, sheet) ' Show tables of the current model/package rowsNum=0 beginrow = rowsNum+1 ' For each table output "begin" Dim tab For Each tab In mdl.tables ShowTable tab,sheet Next if mdl.tables.count > 0 then sheet.Range("A" & beginrow + 1 & ":A" & rowsNum).Rows.Group end if output "end" End Sub'----------------------------------------------------------------------------- ' 数据表查询 '----------------------------------------------------------------------------- Sub ShowTable(tab, sheet) If IsObject(tab) Then Dim rangFlagsheet.cells(1, 1) = "序号" sheet.cells(1, 2) = "表名"sheet.cells(1, 3) = "实体名"'设置边框 sheet.Range(sheet.cells(1, 1),sheet.cells(1, 3)).Borders.LineStyle = "1"'设置背景颜色sheet.Range(sheet.cells(1, 1),sheet.cells(1, 3)).Interior.ColorIndex = "19"rowsNum = rowsNum + 1sheet.cells(rowsNum+1, 1) = rowsNum sheet.cells(rowsNum+1, 2) = tab.codesheet.cells(rowsNum+1, 3) = tab.name'设置边框sheet.Range(sheet.cells(rowsNum+1,1),sheet.cells(rowsNum+1,3)).Borders.LineStyle = "2"'增加SheetBOOK.Sheets.Add , BOOK.Sheets(BOOK.Sheets.count)BOOK.Sheets(rowsNum+1).Name = tab.code Dim shtnSet shtn = EXCEL.workbooks(1).sheets(tab.code)'设置列宽和换行shtn.Columns(1).ColumnWidth = 30 shtn.Columns(2).ColumnWidth = 20 shtn.Columns(3).ColumnWidth = 20shtn.Columns(5).ColumnWidth = 30 shtn.Columns(6).ColumnWidth = 20 shtn.Columns(1).WrapText =true shtn.Columns(2).WrapText =true shtn.Columns(3).WrapText =trueshtn.Columns(5).WrapText =true shtn.Columns(6).WrapText =true'设置列标题shtn.cells(1, 1) = "字段中文名" shtn.cells(1, 2) = "字段名"shtn.cells(1, 3) = "字段类型"shtn.cells(1, 5) = tab.codeshtn.cells(1, 6) = tab.Name'设置边框 shtn.Range(shtn.cells(1, 1),shtn.cells(1, 3)).Borders.LineStyle = "1"shtn.Range(shtn.cells(1, 5),shtn.cells(1, 6)).Borders.LineStyle = "1"'设置背景颜色shtn.Range(shtn.cells(1, 1),shtn.cells(1, 3)).Interior.ColorIndex = "19"shtn.Range(shtn.cells(1, 5),shtn.cells(1, 6)).Interior.ColorIndex = "19"Dim col ' running column Dim colsNumDim rNum colsNum = 0rNum = 0 for each col in tab.columns rNum = rNum + 1 colsNum = colsNum + 1 shtn.cells(rNum+1, 1) = col.name shtn.cells(rNum+1, 2) = col.code shtn.cells(rNum+1, 3) = col.datatype next shtn.Range(shtn.cells(rNum-colsNum+2,1),shtn.cells(rNum+1,3)).Borders.LineStyle = "2" rNum = rNum + 1 Output "FullDescription: " + tab.NameEnd If End Sub
'****************************************************************************** '* 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 ExplicitDim rowsNumrowsNum = 0 '----------------------------------------------------------------------------- ' Main function '----------------------------------------------------------------------------- ' Get the current active model Dim Model Set Model = ActiveModel If (Model Is Nothing) Or (Not Model.IsKindOf(PdPDM.cls_Model)) ThenMsgBox "The current model is not an PDM model." Else' Get the tables collection'创建EXCEL APPdim beginrowDIM EXCEL, SHEETset EXCEL = CREATEOBJECT("Excel.Application")EXCEL.workbooks.add(-4167)'添加工作表EXCEL.workbooks(1).sheets(1).name ="test"set sheet = EXCEL.workbooks(1).sheets("test")ShowProperties Model, SHEETEXCEL.visible = true'设置列宽和自动换行sheet.Columns(1).ColumnWidth = 20 sheet.Columns(2).ColumnWidth = 40 sheet.Columns(4).ColumnWidth = 20 sheet.Columns(5).ColumnWidth = 20 sheet.Columns(6).ColumnWidth = 15 sheet.Columns(1).WrapText =truesheet.Columns(2).WrapText =truesheet.Columns(4).WrapText =trueEnd If '----------------------------------------------------------------------------- ' Show properties of tables '----------------------------------------------------------------------------- Sub ShowProperties(mdl, sheet)' Show tables of the current model/packagerowsNum=0beginrow = rowsNum+1' For each tableoutput "begin"Dim tabFor Each tab In mdl.tablesShowTable tab,sheetNextif mdl.tables.count > 0 thensheet.Range("A" & beginrow + 1 & ":A" & rowsNum).Rows.Groupend ifoutput "end" End Sub '----------------------------------------------------------------------------- ' Show table properties '----------------------------------------------------------------------------- Sub ShowTable(tab, sheet)If IsObject(tab) ThenDim rangFlagrowsNum = rowsNum + 1' Show propertiesOutput "================================"sheet.cells(rowsNum, 1) = "实体名"sheet.cells(rowsNum, 2) =tab.namesheet.cells(rowsNum, 3) = ""sheet.cells(rowsNum, 4) = "表名"sheet.cells(rowsNum, 5) = tab.codesheet.Range(sheet.cells(rowsNum, 5),sheet.cells(rowsNum, 6)).MergerowsNum = rowsNum + 1sheet.cells(rowsNum, 1) = "属性名"sheet.cells(rowsNum, 2) = "说明"sheet.cells(rowsNum, 3) = ""sheet.cells(rowsNum, 4) = "字段中文名"sheet.cells(rowsNum, 5) = "字段名"sheet.cells(rowsNum, 6) = "字段类型"'设置边框sheet.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" Dim col ' running column Dim colsNum colsNum = 0for each col in tab.columnsrowsNum = rowsNum + 1colsNum = colsNum + 1sheet.cells(rowsNum, 1) = col.namesheet.cells(rowsNum, 2) = col.commentsheet.cells(rowsNum, 3) = ""sheet.cells(rowsNum, 4) = col.namesheet.cells(rowsNum, 5) = col.codesheet.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 If End Sub
代码二(来源于网络):每个表都会新建一个 Sheet 页,第一个 Sheet 页上是所有表的列表
'****************************************************************************** '* 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: Chirs '* Created: 2015-01-28 '* Version: 1.0 '****************************************************************************** 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 beginrowDim EXCEL, BOOK, SHEETSet EXCEL = CreateObject("Excel.Application")EXCEL.Visible = TrueSet BOOK = EXCEL.Workbooks.Add(-4167) '新建工作簿BOOK.Sheets(1).Name = "数据库表结构"Set SHEET = EXCEL.workbooks(1).sheets("数据库表结构")ShowProperties Model, SHEETEXCEL.visible = true '设置列宽和自动换行 SHEET.Columns(1).ColumnWidth = 10 SHEET.Columns(2).ColumnWidth = 30 SHEET.Columns(3).ColumnWidth = 20 SHEET.Columns(1).WrapText =true SHEET.Columns(2).WrapText =true SHEET.Columns(3).WrapText =true End If'----------------------------------------------------------------------------- ' Show properties of tables '----------------------------------------------------------------------------- Sub ShowProperties(mdl, sheet) ' Show tables of the current model/package rowsNum=0 beginrow = rowsNum+1 ' For each table output "begin" Dim tab For Each tab In mdl.tables ShowTable tab,sheet Next if mdl.tables.count > 0 then sheet.Range("A" & beginrow + 1 & ":A" & rowsNum).Rows.Group end if output "end" End Sub'----------------------------------------------------------------------------- ' 数据表查询 '----------------------------------------------------------------------------- Sub ShowTable(tab, sheet) If IsObject(tab) Then Dim rangFlagsheet.cells(1, 1) = "序号" sheet.cells(1, 2) = "表名"sheet.cells(1, 3) = "实体名"'设置边框 sheet.Range(sheet.cells(1, 1),sheet.cells(1, 3)).Borders.LineStyle = "1"'设置背景颜色sheet.Range(sheet.cells(1, 1),sheet.cells(1, 3)).Interior.ColorIndex = "19"rowsNum = rowsNum + 1sheet.cells(rowsNum+1, 1) = rowsNum sheet.cells(rowsNum+1, 2) = tab.codesheet.cells(rowsNum+1, 3) = tab.name'设置边框sheet.Range(sheet.cells(rowsNum+1,1),sheet.cells(rowsNum+1,3)).Borders.LineStyle = "2"'增加SheetBOOK.Sheets.Add , BOOK.Sheets(BOOK.Sheets.count)BOOK.Sheets(rowsNum+1).Name = tab.code Dim shtnSet shtn = EXCEL.workbooks(1).sheets(tab.code)'设置列宽和换行shtn.Columns(1).ColumnWidth = 30 shtn.Columns(2).ColumnWidth = 20 shtn.Columns(3).ColumnWidth = 20shtn.Columns(5).ColumnWidth = 30 shtn.Columns(6).ColumnWidth = 20 shtn.Columns(1).WrapText =true shtn.Columns(2).WrapText =true shtn.Columns(3).WrapText =trueshtn.Columns(5).WrapText =true shtn.Columns(6).WrapText =true'设置列标题shtn.cells(1, 1) = "字段中文名" shtn.cells(1, 2) = "字段名"shtn.cells(1, 3) = "字段类型"shtn.cells(1, 5) = tab.codeshtn.cells(1, 6) = tab.Name'设置边框 shtn.Range(shtn.cells(1, 1),shtn.cells(1, 3)).Borders.LineStyle = "1"shtn.Range(shtn.cells(1, 5),shtn.cells(1, 6)).Borders.LineStyle = "1"'设置背景颜色shtn.Range(shtn.cells(1, 1),shtn.cells(1, 3)).Interior.ColorIndex = "19"shtn.Range(shtn.cells(1, 5),shtn.cells(1, 6)).Interior.ColorIndex = "19"Dim col ' running column Dim colsNumDim rNum colsNum = 0rNum = 0 for each col in tab.columns rNum = rNum + 1 colsNum = colsNum + 1 shtn.cells(rNum+1, 1) = col.name shtn.cells(rNum+1, 2) = col.code shtn.cells(rNum+1, 3) = col.datatype next shtn.Range(shtn.cells(rNum-colsNum+2,1),shtn.cells(rNum+1,3)).Borders.LineStyle = "2" rNum = rNum + 1 Output "FullDescription: " + tab.NameEnd If End Sub
(推荐)代码三(基于网络版本修改改造,新增超链接等内容,更加友好):第一个 Sheet 页上是所有表的目录列表,每个表都会新建一个 Sheet 页
'****************************************************************************** Option ExplicitDim rowsNum,tablesNumrowsNum = 0tablesNum = 0 '----------------------------------------------------------------------------- ' Main function '----------------------------------------------------------------------------- ' Get the current active modelDim ModelSet Model = ActiveModelIf (Model Is Nothing) Or (Not Model.IsKindOf(PdPDM.cls_Model)) ThenMsgBox "The current model is not an PDM model."Else' Get the tables collection'创建EXCEL APPdim beginrowDIM EXCEL,BOOK,SHEETLISTset EXCEL = CREATEOBJECT("Excel.Application")Set BOOK = EXCEL.Workbooks.Add(-4167) '新建工作簿BOOK.sheets(1).name ="目录"set SHEETLIST = BOOK.sheets("目录")ShowTableList Model,SHEETLISTShowProperties Model,BOOK,SHEETLISTMsgBox "导出完成!"End If '----------------------------------------------------------------------------- ' Show properties of tables '----------------------------------------------------------------------------- Sub ShowProperties(mdl,BOOK,SheetList)' Show tables of the current model/packagerowsNum=0beginrow = rowsNum+1Dim rowIndex rowIndex=3' For each tableoutput "begin"Dim tabFor Each tab In mdl.tablestablesNum = tablesNum +1ShowTable tab,BOOK,rowIndex,sheetList,tablesNumrowIndex = rowIndex +1Nextif mdl.tables.count > 0 thenBOOK.Sheets(BOOK.Sheets.count).Range("A" & beginrow + 1 & ":A" & rowsNum).Rows.Groupend ifoutput "end" End Sub '----------------------------------------------------------------------------- ' Show table properties '----------------------------------------------------------------------------- Sub ShowTable(tab, BOOK,rowIndex,sheetList,tablesNum)If IsObject(tab) ThenDim rangFlag,SHEET'EXCEL.workbooks.add(-4167)'添加工作表 BOOK.Sheets.Add , BOOK.Sheets(BOOK.Sheets.count)BOOK.Sheets(BOOK.Sheets.count).Name = tab.codeset SHEET = BOOK.sheets(tab.code)'EXCEL.workbooks(1).sheets.add(-4167)EXCEL.workbooks(1).Sheets(tablesNum).SelectEXCEL.visible = true'设置列宽和自动换行sheet.Columns(1).ColumnWidth = 20 sheet.Columns(2).ColumnWidth = 20 sheet.Columns(3).ColumnWidth = 20 sheet.Columns(4).ColumnWidth = 40 sheet.Columns(5).ColumnWidth = 10 sheet.Columns(6).ColumnWidth = 10 sheet.Columns(1).WrapText =truesheet.Columns(2).WrapText =truesheet.Columns(4).WrapText =true'不显示网格线EXCEL.ActiveWindow.DisplayGridlines = FalserowsNum = 0rowsNum = rowsNum + 1' Show propertiesOutput "================================"sheet.cells(rowsNum, 1) ="返回目录"sheet.cells(rowsNum, 2) =tab.namesheet.cells(rowsNum, 2).HorizontalAlignment=3sheet.cells(rowsNum, 3) = tab.code'sheet.cells(rowsNum, 5).HorizontalAlignment=3'sheet.cells(rowsNum, 6) = ""'sheet.cells(rowsNum, 7) = "表说明"sheet.cells(rowsNum, 4) = tab.comment'sheet.cells(rowsNum, 8).HorizontalAlignment=3sheet.Range(sheet.cells(rowsNum, 4),sheet.cells(rowsNum, 7)).Merge'设置超链接,从目录点击表名去查看表结构'字段中文名 字段英文名 字段类型 注释 是否主键 是否非空 默认值sheetList.Hyperlinks.Add sheetList.cells(rowIndex,2), "",tab.code&"!B"&rowsNumsheet.Hyperlinks.Add sheet.cells(rowsNum,1), "","目录"&"!B"&rowIndexrowsNum = rowsNum + 1sheet.cells(rowsNum, 1) = "字段中文名"sheet.cells(rowsNum, 2) = "字段英文名"sheet.cells(rowsNum, 3) = "字段类型"sheet.cells(rowsNum, 4) = "注释"sheet.cells(rowsNum, 5) = "是否主键"sheet.cells(rowsNum, 6) = "是否非空"sheet.cells(rowsNum, 7) = "默认值"'设置边框sheet.Range(sheet.cells(rowsNum-1, 1),sheet.cells(rowsNum, 7)).Borders.LineStyle = "1"'sheet.Range(sheet.cells(rowsNum-1, 4),sheet.cells(rowsNum, 9)).Borders.LineStyle = "1"'字体为10号sheet.Range(sheet.cells(rowsNum-1, 1),sheet.cells(rowsNum, 7)).Font.Size=10Dim col ' running columnDim colsNumcolsNum = 0for each col in tab.columnsrowsNum = rowsNum + 1colsNum = colsNum + 1sheet.cells(rowsNum, 1) = col.name'sheet.cells(rowsNum, 3) = ""'sheet.cells(rowsNum, 4) = col.namesheet.cells(rowsNum, 2) = col.codesheet.cells(rowsNum, 3) = col.datatypesheet.cells(rowsNum, 4) = col.commentIf col.Primary = true Thensheet.cells(rowsNum, 5) = "Y" Elsesheet.cells(rowsNum, 5) = " " End IfIf col.Mandatory = true Thensheet.cells(rowsNum, 6) = "Y" Elsesheet.cells(rowsNum, 6) = " " End Ifsheet.cells(rowsNum, 7) = col.defaultvaluenextsheet.Range(sheet.cells(rowsNum-colsNum+1,1),sheet.cells(rowsNum,7)).Borders.LineStyle = "3" 'sheet.Range(sheet.cells(rowsNum-colsNum+1,4),sheet.cells(rowsNum,9)).Borders.LineStyle = "3"sheet.Range(sheet.cells(rowsNum-colsNum+1,1),sheet.cells(rowsNum,7)).Font.Size = 10rowsNum = rowsNum + 2Output "FullDescription: " + tab.NameEnd IfEnd Sub '----------------------------------------------------------------------------- ' Show List Of Table '----------------------------------------------------------------------------- Sub ShowTableList(mdl, SheetList)' Show tables of the current model/packageDim rowsNorowsNo=1' For each tableoutput "begin"SheetList.cells(rowsNo, 1) = "主题"SheetList.cells(rowsNo, 2) = "表中文名"SheetList.cells(rowsNo, 3) = "表英文名"SheetList.cells(rowsNo, 4) = "表说明"rowsNo = rowsNo + 1SheetList.cells(rowsNo, 1) = mdl.nameDim tabFor Each tab In mdl.tablesIf IsObject(tab) ThenrowsNo = rowsNo + 1SheetList.cells(rowsNo, 1) = ""SheetList.cells(rowsNo, 2) = tab.nameSheetList.cells(rowsNo, 3) = tab.codeSheetList.cells(rowsNo, 4) = tab.commentEnd IfNextSheetList.Columns(1).ColumnWidth = 20 SheetList.Columns(2).ColumnWidth = 20 SheetList.Columns(3).ColumnWidth = 30 SheetList.Columns(4).ColumnWidth = 60 output "end" End Sub
代码四(基于网络版本修改改造,还有提升空间)Excel导入:
'============================================================ '从Excel文件中导入PowerDesigner 物理数据模型 ' '注意:1,Excel表格中不能有合并的单元格 ' 2,列之间不能有空行 '============================================================Option Explicit'============================================================ '私有全局变量。 '============================================================ Private CURRENT_MODEL_NAME Private CURRENT_MODEL Private TABLES Private EXCEL_APP Private FILE_PATHCURRENT_MODEL_NAME = "Excel" Set EXCEL_APP = CreateObject("Excel.Application") FILE_PATH="C:\Users\Dell\Desktop\worknew\模板.xlsx" '文件的绝对路径'检查文件是否存在 If CheckFileExsistence() Then'检查当前是否有已经打开的物理图Call GetModelByName(CURRENT_MODEL)If CURRENT_MODEL Is Nothing ThenMsgBox("请先打开一个名称为“" & CURRENT_MODEL_NAME & "”的物理数据模型(Physical Data Model),然后再进执行导入!")ElseSet TABLES = CURRENT_MODEL.Tables'根据EXCEL表格创建模型 ImportModels()End If ElseMsgBox "文件" + FILE_PATH + "不存在!" End If'============================================================ '导入模型 '============================================================ Sub ImportModels'打开Excel文件Dim FilenameDim ReadOnlyEXCEL_APP.Workbooks.Open FILE_PATHDim worksheetsDim worksheetCountSet worksheets = EXCEL_APP.WorksheetsworksheetCount = worksheets.CountIf worksheetCount <= 0 ThenExit SubEnd IfDim indexDim currentSheetFor index = 1 to worksheetCountSet currentSheet = worksheets(index)Call CreateTable(currentSheet)Next'关闭Excel文件 EXCEL_APP.Workbooks.CloseMsgBox "导入完成!" End Sub'============================================================ '创建表 '============================================================ Sub CreateTable(ByRef worksheet)Dim cellsSet cells = worksheet.CellsDim table'检查具有相同名称的表是否已经存在Call GetTableByName(table, worksheet.Name)If table Is Nothing ThenSet table = TABLES.CreateNew'Set table = TABLES.CreateNew'table.Name = cells(1, 1).Value'table.Code = cells(2, 1).Value'table.Comment = cells(3, 1).Valuetable.Name = worksheet.Nametable.Code = worksheet.Nametable.Comment = worksheet.NameEnd IfDim indexDim rowsDim colSet rows = worksheet.RowsFor index = 3 to 512If EXCEL_APP.WorksheetFunction.CountA(rows(index)) <= 0 ThenExit ForEnd IfIf ((cells(index,1).Value = "") or (cells(index,2).Value = "Name" ))Then '第二列为空的都可以忽略'MsgBox "值2"'continue '这里忽略空行和表名行、表头行Else set col =table.Columns.CreateNew '创建一列/字段col.Code = cells(index, 1).Value '指定列code'MsgBox "值3"col.DataType = cells(index, 3).Value '指定列数据类型If cells(index, 4).Value = "Y" Then'指定主键col.Primary =trueElseIf cells(index, 5).Value = "否" Then'指定列是否可空 true 为不可空col.Mandatory =trueEnd IfEnd Ifcol.Name = cells(index, 2).Value '指定列name col.Comment = cells(index, 2).Value '指定列说明'count = count + 1End If Next End Sub'============================================================ '检查文件是否存在 '============================================================ Function CheckFileExsistenceDim fsoSet fso = CreateObject("Scripting.FileSystemObject")CheckFileExsistence = fso.FileExists(FILE_PATH) End Function'============================================================ '根据数据类型名称,精度和刻度生成数据类型 '============================================================ Function GenerateDataType(dataTypeName, precision, scale)Select Case Ucase(dataTypeName)Case EmptyGenerateDataType = EmptyCase "NUMBER"GenerateDataType = "NUMBER(" & precision & "," & scale & ")"End Select End Function'============================================================ '获取指定指定名称的数据模型 '============================================================ Sub GetModelByName(ByRef model)Dim mdFor Each md in ModelsIf StrComp(md.Name, CURRENT_MODEL_NAME) = 0 ThenSet model = mdExit SubEnd IfNextSet model = Nothing End Sub'============================================================ '根据表名称获取对应的表 '============================================================ Sub GetTableByName(ByRef table, tableName)Dim tbFor Each tb in TABLESIf StrComp(tb.Name, tableName) = 0 ThenSet table = tbExit SubEnd IfNextSet table = Nothing End Sub'============================================================ '检查字段是否已经存在 '============================================================ Function ColumnExists(ByRef table, columnName)Dim colFor Each col in table.ColumnsIf StrComp(col.Name, columnName) = 0 ThenColumnExists = TrueExit FunctionEnd IfNextColumnExists = False End Function
Excel导入模板
转载于:https://www.cnblogs.com/jym-sunshine/p/10484620.html
PowerDesigner数据库设计PDM基于Excel的导入导出总结相关推荐
- [Java中实现Excel表导入导出]基于easy-poi和EasyExcel两种方式实现
第一种:基于easy-poi实现Excel导入导出 1.导出Excel表格 第一步:在pom文件中导入依赖 <!--基于easy-poi实现Excel导入导出--><dependen ...
- PowerDesigner数据库设计与建模。数据库中设计一对一、一对多、多对多、依赖关系、继承关系。
我们平时开发一个互联网项目的流程是:需求设计.数据库设计.功能设计.项目架构.技术选型.项目开发.数据库设计是我们项目的基石,一个中大型项目,要有一个良好的数据库设计,才能走得更远.一个项目如果数据库 ...
- 基于delphi的excel数据导入导出
因为淘宝客户的一个小需求,写了一个"基于delphi 7的excel数据导入导出"小工具.为了抛砖引玉,将这个小工具分享出来.希望对初学者和用得到的朋友有点点小小的帮助.oracl ...
- 基于vue3+ts+scss的后台管理系统(二)----excel的导入导出
excel的导入导出 官网地址 https://docs.sheetjs.com/docs/getting-started/installation/standalone 安装XLSX插件:npm i ...
- EasyPoi实现excel文件导入导出
EasyPoi学习实践 1 简介 easypoi功能如同名字easy,主打的功能就是容易,让一个没见接触过poi的人员 就可以方便的写出Excel导出,Excel模板导出,Excel导入,Word模板 ...
- EasyExcel实现Excel文件导入导出
1 EasyExcel简介 EasyExcel是一个基于Java的简单.省内存的读写Excel的开源项目.在尽可能节约内存的情况下支持读写百M的Excel. github地址: https://git ...
- 蓄力-利用POI进行excel的导入导出(包含图片)
这里写自定义目录标题 利用POI进行excel的导入导出 引入的jar包 excel导入 主方法: 将excel里面的图片转成数据 xls格式 xlsx格式 将图片数据转成字节流的方式传输到FTP服务 ...
- Java EXCEL 表格导入导出(带下拉选-带VLOOKUP函数封装)
Java EXCEL 表格导入导出(带下拉选-带VLOOKUP函数封装) 对于excel Java POI 使用 目前简单导出导入功能网上很多,但是对于有下拉选,样式等缺点却是最大硬伤,故此封装一个通 ...
- sqlserver 与access,excel互相导入导出代码
sqlserver 与access,excel互相导入导出代码 [转]http://hi.baidu.com/jiangfeng1225/blog/item/62c0e6088b30fbdb63d98 ...
- 手摸手教学-利用原生POI对excel的导入导出以及阿里的easyexcel的基本操作
文章目录 原生POI对excel的导入导出以及阿里的easyexcel的基本操作 首先是最原始的POI操作excel 其次是POI操作excel对数据库的导入导出 最后是阿里的easyexcel的简单 ...
最新文章
- eclipse new server Cannot create a server using the selected type 网上有两种办法,其实原理一样...
- 英飞凌单片机TC264实战攻略
- 数据库事务的悲观锁和乐观锁
- Vim编程之:tags,cscope,taglist
- MYsql优化where子句
- 复合索引的列顺序判断
- Juniper SRX防火墙系统会话链接的清除
- WebCrack:网站后台弱口令批量检测工具
- oracle创建表空间和用户授权
- apache服务器详细配置
- DB2造数据存储过程
- 在ie6下文字颜色不兼容的解决方法
- Redis主从配置,哨兵,集群的设计原理
- LINUX获取当前窗口的ID
- 关于BD文件的一些操作
- Prometheus监控告警
- css 里面写响应式布局,CSS3怎么做出响应式布局
- 捷信2020年亏45亿元:CEO称今年肯定盈利 在华两高管离职 近半年投诉激增万条
- Initializing Spring FrameworkServlet ‘uaa‘
- 云栖大会人脸识别闸机【技术亮点篇5】--人脸识别闸机采用海康威视摄像头
热门文章
- 分时操作系统和多道程序操作系统的区别
- 习惯性的对自己没信心,其实没想到自己已经变强大了。
- regsvr32.exe是什么东西
- LocalBroadcastManager 的实现原理,还是 Binder?
- 凸包+旋转卡壳模板——kuangbin版
- hibernateTemplate.find或hibernateTemplate.save()执行操作没有反应,但是有sql语句
- 文强+光裕+唐骏,告诉我们什么?
- mysql子查询的语法,MySQL语法------13-----子查询(三)
- vs2010创建动态库(亲测可行)
- Linux网络编程——多播