|
热门文章 |
|
|
|
相关文章 |
|
没有相关文章 |
|
|
ASP将数据导出到Word的方法 |
来源:360个人图书馆 更新时间:2010/9/12 9:17:52 阅读次数:
字体:[大 中 小大 中 小大 中 小] 我要投稿 |
<script language="vbscript"> Sub buildDoc set table = document.all.data row = table.rows.length column = table.rows(1).cells.length Set objWordDoc = CreateObject("Word.Document") objWordDoc.Application.Documents.Add theTemplate, False objWordDoc.Application.Visible=True Dim theArray(20,10000) for i=0 to row-1 for j=0 to column-1 theArray(j+1,i+1) = table.rows(i).cells(j).innerTEXT next next objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("综合查询结果集") //显示表格标题 objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("") Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range With rngPara .Bold = True //将标题设为粗体 .ParagraphFormat.Alignment = 1 //将标题居中 .Font.Name = "隶书" //设定标题字体 .Font.Size = 18 //设定标题字体大小 End With Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,row,column) for i = 1 to column objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1) objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1 next For i =1 to column For j = 2 to row objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.InsertAfter theArray(i,j) objWordDoc.Application.ActiveDocument.Tables(1).Rows(j).Cells(i).Range.ParagraphFormat.alignment=1 Next Next End Sub </SCRIPT> |
上一篇文章: ASP将数据导出到EXCEL的通用方法下一篇文章: ASP对XML文档进行增加、删除、修改、查看操作 |
|
|