加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

[VB.NET]转word问题

发布时间:2020-12-16 23:47:27 所属栏目:大数据 来源:网络整理
导读:转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
转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 __________________________________________________________________________ 怎么没人知道? __________________________________________________________________________ 继续郁闷!!!! __________________________________________________________________________ ??? __________________________________________________________________________

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读