Forum Replies Created
-
AuthorPosts
-
mutsop
MemberK weirdly enough, when I open powerpoint before using my program it does work.
So on the other computer it doesnt seem to work when running in the background.mutsop
MemberWell both are PowerPoint 2007.
I checked the other pc for installed components like Form 2.0 support but unfortunately it is installed 😀
else I would know where the problem would be.I tried everything and am just stuck…
One thing I might suspect is the copy local of the libraries, problem is I’m working in an n-tier project so the libraries aren’t copied in my starter project but in the business (domain) project. So can I just copy it to the debug folder of the starter project?mutsop
MemberHey Alain,
Im not sure if you are still active (cross fingers)…. But here goes my problem:
I created a script which:
1- opens up a powerpoint file
2- adds a textbox with client informations
3- saves as pdfPublic Function PrintPowerpoint(ByVal klant As Klant, ByVal mainFolder As String) As Boolean
Dim PdfName As String = klant.Naam + " - " + _File.Name
Dim FullPath As String = mainFolder + "\" + directory + "\" + PdfName
pptPres = ppt.Presentations.Open(_File.FullName, , , MsoTriState.msoFalse)AddClient(klant)
Try
pptPres.SaveAs(FullPath, PowerPoint.PpSaveAsFileType.ppSaveAsPDF)
Return True
Catch ex As Exception
MsgBox(ex.ToString)
Return False
Finally
pptPres.Close()
ppt.Quit()
End Try
End FunctionPrivate Sub AddClient(ByVal klant As Klant)
pptSlide = pptPres.Slides(1)
pptSlide.Shapes.AddTextbox(1, 290, 108, 165, 100)
pptSlide.Shapes(pptSlide.Shapes.Count).TextFrame.TextRange.Text = klant.Gegevens
End Subnow on my computer it works like a charm but when i try it on another computer it doesn’t.
I get following error:
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at Microsoft.Office.Interop.PowerPoint._Presentation.SaveAs(….) at Bollaert.Business.PowerpointHelper.PrintPowerpoint(Client client, String mainFolder) in…..rule 38Now to be certain I ran your program a few posts back and both have the same output:
output:
Check CURRENT_USER…
Found nothing
Check LOCAL_MACHINE…
Found something: C:\PROGRA~1\MICROS~2\Office12\POWERPNT.EXE
Check if file exists
Found.
Check version
major: 12
minor: 0
Connect to PPT DLL
Connected to PPT DLL
Presentation Opened
Slide Number: 3
Slide Index: 0
Shape Count: 3
Shape Index: 0
Shape Is Text
Text is:tralala
Slide Index: 1
Shape Count: 3
Shape Index: 0
Shape Is Text
Text is:Title.
Shape Index: 1
Shape Is Text
Text is:Pouet
pouet
Slide Index: 2
Shape Count: 3
Shape Index: 0
Shape Is Text
Text is:zomg
Shape Index: 1
Shape Is Text
Text is:It is not working
So as you can see also on the computer where my program isn’t able to pdf, it is able to open it.
weirdly enough I can saveAs pdf manually but not programmaticly. -
AuthorPosts