2011-10-24 2 views
0

오픈 오피스에서 문서 인쇄용 매크로를 만들었습니다. 가끔 선 "Doc.Close (참)"에 도달하고 매크로 오류가 프로그램 할 때까지 컴퓨터를 잠금 그러나OpenOffice "인쇄"닫을 때 매크로 오류

sub printDoc(FileName) 
Dim Url as String 
Url = convertToUrl(FileName) 

Dim Doc as variant 
Doc = starDeskTop.loadComponentFromUrl(Url, "_hidden", 0, Array()) 
Doc.Print(Array()) 
Doc.Close(True) 
End Sub 

나는 내 C# 프로그램, 매크로 보트 및 문서 인쇄에서이 매크로를 호출 작업 관리자를 통해 종료됩니다. 내가해야 할 일이 다르게 있습니까? 추가 정보가 필요하면 알려주십시오. 확실히 우리가 문서를 닫으려고하지 않는

Dim opts(0) As New com.sun.star.beans.PropertyValue 
opts(0).Name = "Wait" 
opts(0).Value = True 
thisComponent.Print (opts()) 

이 있습니다 : 고마워요

다음

답변

0

sub printDoc(FileName) 
    openDoc(FileName) 

Dim opts(0) As New com.sun.star.beans.PropertyValue 
opts(0).Name = "Wait" 
opts(0).Value = True 
thisComponent.Print (opts()) 
If HasUnoInterfaces(ThisComponent, "com.sun.star.util.XCloseable") Then 
    ThisComponent.close(true) 
Else 
    ThisComponent.dispose 
End If 

End Sub 

중요한 부분이다 (나는 열려있는 문서 기능이) 일 것입니다 우리가 그것을 인쇄하려고하는 동안.

출처 : http://user.services.openoffice.org/en/forum/viewtopic.php?f=5&t=40719