如何用powerdesigner 将表结构导出到Excel?
主要是把字段说名的中文描述导出来,比如CustomerIDint客户编号CustomerNamenvarchar(20)客户姓名等等。。知道的朋友告诉我一下,谢谢!...
主要是把字段说名的中文描述导出来,比如
CustomerID int 客户编号
CustomerName nvarchar(20) 客户姓名
等等。。知道的朋友告诉我一下,谢谢! 展开
CustomerID int 客户编号
CustomerName nvarchar(20) 客户姓名
等等。。知道的朋友告诉我一下,谢谢! 展开
2个回答
展开全部
1. 编写测试excel文件
2. 打开pd脚本编辑器
PD菜单栏中,依次点击“Tools ->Excute Commands->Edit/Run Script..”
3. 编写脚本
' Open & Create Excel Document Dim x1 '
Set x1 = CreateObject("Excel.Application") x1.Workbooks.Open "D:/荷露叮咚.xlsx" x1.Workbooks(1).Worksheets("Sheet1").Activate Else
HaveExcel = False End If
a x1, mdl
sub a(x1, mdl) dim rwIndex dim tableName dim colname dim table dim col dim count
'on error Resume Next For rwIndex = 1 To 4 step 1
With x1.Workbooks(1).Worksheets("Sheet1")
'MsgBox "生成数据表结构共计1 ="+CStr(.Cells(2,2).Value ), vbOK + vbInformation, "表" If .Cells(rwIndex, 1).Value = "" Then Exit For End If
If .Cells(rwIndex, 3).Value = "" Then set table = mdl.Tables.CreateNew table.Name = .Cells(rwIndex , 1).Value table.Code = .Cells(rwIndex , 2).Value count = count + 1 Else
colName = .Cells(rwIndex, 1).Value set col = table.Columns.CreateNew
'MsgBox .Cells(rwIndex, 1).Value, vbOK + vbInformation, "列" col.Name = .Cells(rwIndex, 1).Value
'MsgBox col.Name, vbOK + vbInformation, "列" col.Code = .Cells(rwIndex, 2).Value
col.Comment = .Cells(rwIndex,1).Value col.DataType = .Cells(rwIndex, 3).Value
4. 测试
第一步:把excel模板文件(例如荷露叮咚.xlsx)拷贝到 D盘根目录下(这里的路径需与脚本中标红的地方匹配。)
第二步:运行脚本
第三步:检查导入效果
2. 打开pd脚本编辑器
PD菜单栏中,依次点击“Tools ->Excute Commands->Edit/Run Script..”
3. 编写脚本
' Open & Create Excel Document Dim x1 '
Set x1 = CreateObject("Excel.Application") x1.Workbooks.Open "D:/荷露叮咚.xlsx" x1.Workbooks(1).Worksheets("Sheet1").Activate Else
HaveExcel = False End If
a x1, mdl
sub a(x1, mdl) dim rwIndex dim tableName dim colname dim table dim col dim count
'on error Resume Next For rwIndex = 1 To 4 step 1
With x1.Workbooks(1).Worksheets("Sheet1")
'MsgBox "生成数据表结构共计1 ="+CStr(.Cells(2,2).Value ), vbOK + vbInformation, "表" If .Cells(rwIndex, 1).Value = "" Then Exit For End If
If .Cells(rwIndex, 3).Value = "" Then set table = mdl.Tables.CreateNew table.Name = .Cells(rwIndex , 1).Value table.Code = .Cells(rwIndex , 2).Value count = count + 1 Else
colName = .Cells(rwIndex, 1).Value set col = table.Columns.CreateNew
'MsgBox .Cells(rwIndex, 1).Value, vbOK + vbInformation, "列" col.Name = .Cells(rwIndex, 1).Value
'MsgBox col.Name, vbOK + vbInformation, "列" col.Code = .Cells(rwIndex, 2).Value
col.Comment = .Cells(rwIndex,1).Value col.DataType = .Cells(rwIndex, 3).Value
4. 测试
第一步:把excel模板文件(例如荷露叮咚.xlsx)拷贝到 D盘根目录下(这里的路径需与脚本中标红的地方匹配。)
第二步:运行脚本
第三步:检查导入效果
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Response.Buffer = true;
Response.Charset = "gb2312";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode(DateTime.Now.ToString("yyyy-MM-dd"), System.Text.Encoding.UTF8) + ".xls\"");
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.AllowPaging = false;
BindData();
GridView1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
GridView1.AllowPaging = true;
BindData();
Response.Charset = "gb2312";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode(DateTime.Now.ToString("yyyy-MM-dd"), System.Text.Encoding.UTF8) + ".xls\"");
Response.ContentType = "application/ms-excel";
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.AllowPaging = false;
BindData();
GridView1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
GridView1.AllowPaging = true;
BindData();
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询