ComException whit SaveAs method (-2147467259)

N

N@poleone

Hi,
I'm using Office 2003 Interop (PowerPoint) in C#, but it's the same in
vb.
When I call the Presentation.SaveAs method, I get this exception:


Error HRESULT E_FAIL has been returned from a call to a COM component.
at
Microsoft.Office.Interop.PowerPoint.PresentationClass.SaveAs(String
FileName, PpSaveAsFileType FileFormat, MsoTriState EmbedTrueTypeFonts)
at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,
SignerInfoHelper[] firmatari, Int32 afterSlide, String titoloSlide,
Boolean savePPS, Boolean password)

The error number is that in the thread title.

The strange is: this exception raise for some users and not for other
users... but all has the same permission, either on the local folder,
either on accessing and using the com component...

Any suggestion?
 
S

Steve Rindsberg

Hi,
I'm using Office 2003 Interop (PowerPoint) in C#, but it's the same in
vb.
When I call the Presentation.SaveAs method, I get this exception:

Error HRESULT E_FAIL has been returned from a call to a COM component.
at
Microsoft.Office.Interop.PowerPoint.PresentationClass.SaveAs(String
FileName, PpSaveAsFileType FileFormat, MsoTriState EmbedTrueTypeFonts)
at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,
SignerInfoHelper[] firmatari, Int32 afterSlide, String titoloSlide,
Boolean savePPS, Boolean password)

What are you passing as parameters?

Apart from obvious stuff that you'll have tested already (does the directory
exist, is it a legal filename, etc), the save might fail or error if:

- ppSaveAsFileType points to an export filter that's not installed

- possibly if EmbedTrueTypeFonts is true but the presentation contains a font
that's not embeddable
 
N

N@poleone

N@poleone said:
Hi,
I'm using Office 2003 Interop (PowerPoint) in C#, but it's the same in
vb.
When I call the Presentation.SaveAs method, I get this exception:
Error HRESULT E_FAIL has been returned from a call to a COM component.
at
Microsoft.Office.Interop.PowerPoint.PresentationClass.SaveAs(String
FileName, PpSaveAsFileType FileFormat, MsoTriState EmbedTrueTypeFonts)
at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,
SignerInfoHelper[] firmatari, Int32 afterSlide, String titoloSlide,
Boolean savePPS, Boolean password)

What are you passing as parameters?

I'm passing a path constructed with Path.Combine and
Path.GetRandomFileName (or something like this);
PpSaveAsFileType.PresentationShow (or something like this, now I don't
remember) and I tried MsoTriState.True and False at TrueType...
nothing change...
Apart from obvious stuff that you'll have tested already (does the directory
exist, is it a legal filename, etc), the save might fail or error if:

- ppSaveAsFileType points to an export filter that's not installed

- possibly if EmbedTrueTypeFonts is true but the presentation contains a font
that's not embeddable

The problem is that with some user it goes all ok and with other users
I received that error. And I'm sure that users have the same
permission either on the local folder in which I'll create the file
and on the DCOM component of Microsoft...

I don't know how to isolate this error... I'm in panic!

Greetings,
N@poleone
 
S

Steve Rindsberg

N@poleone said:
Hi,
I'm using Office 2003 Interop (PowerPoint) in C#, but it's the same in
vb.
When I call the Presentation.SaveAs method, I get this exception:
Error HRESULT E_FAIL has been returned from a call to a COM component.
at
Microsoft.Office.Interop.PowerPoint.PresentationClass.SaveAs(String
FileName, PpSaveAsFileType FileFormat, MsoTriState EmbedTrueTypeFonts)
at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,
SignerInfoHelper[] firmatari, Int32 afterSlide, String titoloSlide,
Boolean savePPS, Boolean password)

What are you passing as parameters?

I'm passing a path constructed with Path.Combine and
Path.GetRandomFileName (or something like this);
PpSaveAsFileType.PresentationShow (or something like this, now I don't
remember)

OK, so you're saving as a PPS and not one of the export file types.
That means it won't be a missing or corrupt filter problem.

What's PPTHelper?

at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,
SignerInfoHelper[] firmatari, Int32 afterSlide, String titoloSlide,
Boolean savePPS, Boolean password)
 
N

N@poleone

I'm passing a path constructed with Path.Combine and
Path.GetRandomFileName (or something like this);
PpSaveAsFileType.PresentationShow (or something like this, now I don't
remember)

OK, so you're saving as a PPS and not one of the export file types.
That means it won't be a missing or corrupt filter problem.

What's PPTHelper?

at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,

Well, it's my helper class to work with Office Interop, but I think it
doesn't matter, cause the exceptio is on the SaveAs line... maybe some
permission on the com object?
 
S

Steve Rindsberg

What's PPTHelper?

at PPTHelper.PPTHelper.AddSignaturesSlide(Byte[] pptDoc,

Well, it's my helper class to work with Office Interop, but I think it
doesn't matter, cause the exceptio is on the SaveAs line... maybe some
permission on the com object?

I'm afraid I'm at a loss, except for one other thought ... in at least some
versions of PPT, when you automate it from an external app, you may not get a
valid app object when you start it up.

Try testing the app object to see if it's null or whether you get errors when you
attempt to query any of its properties. If so, try instantiating it again. If
you still get nothing after three or so attempts, there's something else wrong.
 
N

N@poleone

I'm afraid I'm at a loss, except for one other thought ... in at least some
versions of PPT, when you automate it from an external app, you may not get a
valid app object when you start it up.

Try testing the app object to see if it's null or whether you get errors when you
attempt to query any of its properties. If so, try instantiating it again. If
you still get nothing after three or so attempts, there's something else wrong.

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Before of the error line with the saveas method, I add some slide,
some table and some shape, and all seem to go ok. This test is
sufficient to say that the application object is ok?
 
S

Steve Rindsberg

Before of the error line with the saveas method, I add some slide,
some table and some shape, and all seem to go ok. This test is
sufficient to say that the application object is ok?

Yes, most certainly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top