Include a word-document in a report
Wim Ardon
Hi Philipp,Is it possible to include a word-document in a report?
If so, please tell me how...
Many thanks,
Wim
Philipp Knecht
Hi WimIncluding not but printing in parallel.
If this could be a solution dearch for "print pdf" in the coresuite designer forum.
hth
Wim Ardon
Hello Philipp,I've found a topic of Manuel, but it is in German, which I don't understand totally...
Is this the one you had in mind? If so, I'll ask somebody to translate it into English.
Thanks!
Wim
Philipp Knecht
Hi WimTo print a document in parallel after successful rendering of the layout:
In the Imports Property of the template
[quote]LayoutHelper
System.Windows.Forms
System.Diagnostics
CommonScript:
[quote]Private Sub LD_AfterPrint(company As SAPbobsCOM.Company , sendToPrintDriver As Boolean)
' Mache PDF direkt nach dem Druck
If GetData("LD.Par.PrintMode")="N" And GetData("LD.Par.Preview")="N" Then
'Print Document
Dim MyProcess As New Process
MyProcess.StartInfo.CreateNoWindow = False
MyProcess.StartInfo.Verb = "print"
' Here you can enter dynamic path
MyProcess.StartInfo.FileName = "C:TempServiceabruf.pdf"
MyProcess.Start()
MyProcess.WaitForExit(10000)
MyProcess.CloseMainWindow()
MyProcess.Close()
End If
End Sub
GenerateScript:
[quote]' Handler für die Nach Print Aktion registireren
If Engine.IsDoublePass And Not handlerAdded Then
AddHandler LayoutHelper.LD.AfterPrint,AddressOf LD_AfterPrint
End If
hth
Wim Ardon
Hi Philipp,This is great! I'm gonna try it!
Is it allowed to put the filename of the worddocument in a variable?
Many thanks!
WIm
Philipp Knecht
Hi WimYes just take the path from wherever you want (Database field,UDF, Parameter)
Greets
Teun Aben
Hello Philipp,One of our customers wants to print a drawing and/or a manual (both on itemlevel) when the item is on a order invoice etc.
Everything works fine if I attach these files on an email but when i print the quotation I get only one attachment and a errormessage: "Print error: No process is associated with this object."
Private Sub LD_AfterPrint(company As SAPbobsCOM.Company , sendToPrintDriver As Boolean)
' Mache PDF direkt nach dem Druck
If GetData("LD.Par.PrintMode")="N" And GetData("LD.Par.Preview")="N" Then
'Print Document
Dim i As Integer
Dim attachCount As Integer = ld.AddAttachmentList.Count
For i = 0 To attachCount
Dim MyProcess As New Process
MyProcess.StartInfo.CreateNoWindow = False
MyProcess.StartInfo.Verb = "print"
MyProcess.StartInfo.FileName = Ld.AddAttachmentList.item(i)
MyProcess.WaitForExit(10000)
MyProcess.CloseMainWindow()
MyProcess.Close()
Next i
End If
End Sub
Could someone help me?
Thank you,
Greetings Teun
Philipp Knecht
Hi TeunMaybe it's just a filetype which has no application assigned in windows?
Please check that first.
hth
Teun Aben
No, if I put only one file (word document) in the attachment this file is printed but the error occured.Now I get an other error when I print two attachments, only one attachment is printed.
This error is: "Print error: Process, has exited, so the request information is not available "
It's an error in the System.Diagnostics.Process...
Update:
Okay I can print the attachments. The next problem is that it prints the attachments two times.
Philipp Knecht
Hi TeunThis is because your deocument is et to doublepass = true.
You can add an If Not Engine.IsDoublePass Then
..
..
..
End If
and then it should work.
(at the part were you add the items to the attachments list)
hth
Teun Aben
[quote]"Philipp"]This is because your deocument is et to doublepass = true.
You can add an If Not Engine.IsDoublePass Then
..
..
..
End If
and then it should work.
(at the part were you add the items to the attachments list)
hth
[/quote]
Hello Philipp,
This don't work. When I add an attachment I already check if the attachment exist and I tried your suggestion above.
Is it possible that the LD_afterprint exist two times (maybe because I print 1 document but 2 pages...)
I'm glad that I can print the attachment without an error but if the customer prints a manual of 150 pages and he always print it two times, they would not be happy.
Grtz Teun
Philipp Knecht
Hi TeunYes this is the other possibility. Please check that you register the afterprint event only in one pass.
hth
0
Please sign in to leave a comment.
Comments
0 comments