以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  异常来自 HRESULT:0x800AC472  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=47854)

--  作者:yankunhao
--  发布时间:2014/3/18 16:30:00
--  异常来自 HRESULT:0x800AC472

打印报表时,出现如下错误提示,请问这个是什么问题?

 

NET Framework 版本:2.0.50727.3053
Foxtable 版本:2014.3.8.1
错误所在事件:窗口,销售发票管理,Button08,Click
详细错误信息:
异常来自 HRESULT:0x800AC472


--  作者:Bin
--  发布时间:2014/3/18 16:46:00
--  
窗口,销售发票管理,Button08,Click

的代码发出来看看.

--  作者:yankunhao
--  发布时间:2014/3/18 16:53:00
--  

Dim btn As WinForm.Button = e.form.Controls("Button18")
    btn.PerformClick()


Dim Book As New XLS.Book(ProjectPath & "Attachments\\德国发票分组.xls")
Dim lastrow As Long
\'Book.Marks.Add("订单号",s)
Dim sm As String
Dim sms As List(Of String)
    sms = DataTables("Invoice3").GetValues("pksm")
       For i As Integer = 0 To sms.Count - 1
        sm = sm & chr(10) & sms(i)
    Next
   
    sm= sm.Trim(chr(10))
Book.Marks.Add("pksm",sm)
Book.Build()
Dim w As String = Tables("Invoice1").Current("Invoiceno")
w = w.Replace("/","-")

Book.Save(ProjectPath & "Reports\\发票1\\" & w & ".xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
\'Dim sm As String = Tables("pkl1").Current("pksm")
\'If Tables("pkl1").Current.Isnull("pksm") =True Then
\'Sheet.Rows(12).Visible = False
\'End If
\'If Tables("pkl1").Current.Isnull("rem") =True Then
\'Sheet.Rows(Sheet.Rows.Count-4).Visible = False
\'End If

\'With Sheet.PrintSetting
    \'.Footer = "&R( 文件:&f )...Page &P Of &N"
\'End With

\'With Sheet.PrintSetting
    \'.Footer = "&LP.&P Of &N"
\'End With
With Sheet.PrintSetting
    .Header = "&C&U&""Arial Narrow""&14 INVOICE NO. " & w & ""
End With

Book.Save(ProjectPath & "Reports\\发票1\\" & w & ".xls")

Dim App As New MSExcel.Application
App.Visible = True
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(ProjectPath & "Reports\\发票1\\" & w & ".xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim range As MSExcel.Range

\'Wb.Save
\'\'Dim rng As Integer
lastrow = Ws.usedrange.rows.count
\'If Tables("pkl1").Current.Isnull("pksm") =False Then
\'range = Ws.Range("B13")
\'range.EntireRow.AutoFit
\'End If
\'\'Dim dt As Table = Tables("Invoice2")

\'\'If dt.rows(0).Isnull("pksm") = False Then
\'\'Ws.Range("B" & 14).EntireRow.Insert(MSExcel.XlInsertShiftDirection.xlShiftDown)\'在基准单元格上面插入一行
\'\'Ws.Range("B" & 14).Value =dt.rows(0)("pksm")
\'\'Ws.Range("B" & 14).HorizontalAlignment = MSExcel.Constants.xlLeft
\'\'End If
Dim n1 As Integer = lastrow
Dim n2 As Integer = 0
\'MessageBox.Show("od:" & n1)
\'\'Dim c As Integer = 0
For i As Integer = 21 To n1
If Ws.Range("F" & i).Value Like "ORDER*" Then
n2 = n2 +1
End If
Next
For i As Integer = 22 To n1+n2
   
    \'\'If dt.rows(i-14).Isnull("pksm") = False Then
    \'\'c=c+1
    \'\' Ws.Range("B" & i+c).EntireRow.Insert(MSExcel.XlInsertShiftDirection.xlShiftDown)\'在基准单元格上面插入一行
    \'\' Ws.Range("B" & i+c).Value =dt.rows(i-14)("pksm")
    \'\'Ws.Range("B" & i+c).HorizontalAlignment = MSExcel.Constants.xlLeft
    \'\' End If
    If Ws.Range("F" & i).Value Like "ORDER*" Then
        \'c=c-1
        Ws.Range("C" & i).EntireRow.Insert(MSExcel.XlInsertShiftDirection.xlShiftDown)\'在基准单元格上面插入一行
        i = i+1
    End If
    \'\'n1 = n1+1
Next
lastrow = Ws.usedrange.rows.count - 1
\'MessageBox.Show("od:" & lastrow)
range = Ws.Range("A"& lastrow)
Dim rs As String = Range.Value
Dim Values() As String
Values = rs.split(chr(13) & chr(10))
\'MessageBox.Show("od:" & Values.Length)
range.EntireRow.RowHeight = Values.Length*18

\'\'MessageBox.Show("od:" & n1)
\'\'lastrow = Ws.usedrange.rows.count-3

\'\'rng = ws.range(Ws.cells(14,1),Ws.cells(lastrow-1,1)).entirerow.autofit

\'\'If Tables("pkl1").Current.Isnull("rem") =False Then
\'\'range = Ws.Range("A"& lastrow)
\'range.EntireRow.AutoFit
\'\'Dim rs As String =Ws.Range("A"& lastrow).Value
\'\'Dim Values() As String

\'\'Values = rs.split(chr(13) & chr(10))
\'\'range.EntireRow.RowHeight=Values.Length*18

\'Ws.Range("Q"& lastrow).Value = Values.Length
\'\'End If

\'\'Dim n As Integer = lastrow-1
\'\'For i As Integer = 14 To n
\'\'range = Ws.Range("A"& i)
\'\'Dim Chr As MSExcel.Characters = range.Characters(5,15)
\'\'With Chr.Font
\'\'.Name = "Calibri" \'字体
\'\' .Size = 7 \'字号
\'\' \'.Bold = True   \'加粗
\'\'  \'.Italic = True \'斜体
\'\'  \'.ColorIndex = 3\'颜色
\'\'End With
\'\'Next

With Ws.PageSetup
    .PrintTitleRows = Ws.Rows("1:19").Address
    \'.CenterHeader = "&20"
End With

\'Dim TotalPages As Integer
\'TotalPages = App.ExecuteExcel4Macro("Get.Document(50)")
\'Ws.Range("M7").Value = TotalPages
\'\'Dim PageCount As Integer
\'\'PageCount = (Ws.HPageBreaks.Count + 1)
\'PageCount = (Ws.HPageBreaks.Count + 1) * (Ws.VPageBreaks.Count + 1)
\'\'Ws.Range("M7").Value = PageCount
\'页面总数等于每个表格书的加和,
\'每个表格里的数量等于(横向页面分割线+1)*(纵向分割线+1)
Wb.Save
ShowAppWindow(w,2)


--  作者:Bin
--  发布时间:2014/3/18 17:01:00
--  
试试

 

 开始----运行----粘贴:

 

winword.exe /regserver

 

在运行一下:

 

excel.exe /regserver


--  作者:yankunhao
--  发布时间:2014/3/18 17:10:00
--  

C:\\Documents and Settings\\Administrator>winword.exe /r
\'winword.exe\' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\\Documents and Settings\\Administrator>c:

C:\\Documents and Settings\\Administrator>cd..

C:\\Documents and Settings>cd..

C:\\>winword.exe /regserver
\'winword.exe\' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\\>excel.exe /regserver
\'excel.exe\' 不是内部或外部命令,也不是可运行的程序
或批处理文件。


--  作者:Bin
--  发布时间:2014/3/18 17:15:00
--  
是在运行里输入哦,不是在CMD里输入.
--  作者:yankunhao
--  发布时间:2014/3/18 17:23:00
--  
好像可以了,谢谢你!请问这个命令是什么意思?
--  作者:Bin
--  发布时间:2014/3/18 17:28:00
--  
注册一下OFFICE组件.