[VB.NET]转word问题

前端之家收集整理的这篇文章主要介绍了[VB.NET]转word问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
转word问题 转word问题代码如下: ''总是提示被呼叫方拒绝接收呼叫。 (异常来自 HRESULT:0x80010001 ''(RPC_E_CALL_REJECTED)) Dim wordApp As New Word.Application Dim myDoc As Word.Document Dim oTable As Word.Table Dim rowIndex,colIndex As Integer Dim leap_xlApp As New Excel.Application Dim li_rowIndex,li_colIndex As Integer Dim Lo_column As DataGridViewColumn Dim i,j As Integer rowIndex = 1 colIndex = 0 wordApp.Documents.Add() myDoc = wordApp.ActiveDocument ''Dim Table As New DataTable ''Table = CreaTable() ''myDoc.Tables.Add(Range:=Selection.Range,NumRows:=2,NumColumns:=5,DefaultTableBehavior:=wdWord9TableBehavior,AutoFitBehavior:=wdAutoFitFixed) System.Threading.Thread.Sleep(1000) oTable = myDoc.Tables.Add(Range:=myDoc.Range(Start:=0,End:=0),NumRows:=as_dgv.Rows.Count + 1,NumColumns:=as_dgv.Columns.Count) For Each Lo_column In as_dgv.Columns If Lo_column.Visible Then colIndex = colIndex + 1 oTable.Cell(1,colIndex).Range.InsertAfter(Lo_column.HeaderText) End If Next ''得到的表所有行,赋值给单元格 For i = 0 To as_dgv.Rows.Count - 1 li_rowIndex = li_rowIndex + 1 li_colIndex = 0 For j = 0 To as_dgv.Columns.Count - 1 If as_dgv.Rows(i).Cells(j).Visible Then li_colIndex = li_colIndex + 1 oTable.Cell(rowIndex,colIndex).Range.InsertAfter(as_dgv.Rows(i).Cells(j).Value.ToString) End If Next Next oTable.Borders.InsideLineStyle = 1 oTable.Borders.OutsideLineStyle = 1 wordApp.Visible = True __________________________________________________________________________ 怎么没人知道? __________________________________________________________________________ 继续郁闷!!!! __________________________________________________________________________ ??? __________________________________________________________________________ 原文链接:https://www.f2er.com/vb/263994.html

猜你在找的VB相关文章