[VB.NET]转word问题

VB.NET源码-156个实用实例哦…… <script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
转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
__________________________________________________________________________
怎么没人知道?
__________________________________________________________________________
继续郁闷!!!!
__________________________________________________________________________
???
__________________________________________________________________________
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值