ExportAsFixedFormat having MS Office 2003 and Compatibility pack

I

Indian Ocean

Hi,
I have MS Office 2003 and Microsoft Office Compatibility Pack for Word,
Excel, and PowerPoint 2007 File Formats installed on my machine.
I have Word 2003 PIAs and Word 2007 PIAs installed on this machine too
(VS2005 with VSTO and VS 2008 is installed).
Note: This machine has not MS Office 2007 installed.

Now, I am trying to use ExportAsFixedFormat method to generate PDF from one
docx document on above machine.
I am referring sample from
http://msdn.microsoft.com/en-us/library/bb412305.aspx
The program compiles fine and recongnises the APIs in this machine because
of Office 2007 PIAs installed on this machine.
When I run this program, it gives the following exception,

System.AccessViolationException: Attempted to read or write protected
memory. This is often an indication that other memory is corrupt

for this, I referred,
http://social.msdn.microsoft.com/Fo...l/thread/ce805536-0871-4dea-8f22-1094d1887df2
Which says, its not possible for MS Office 2003 but as I have installed
Compatibility pack too which should allow me to do that.

Can anyone please guide on this?
 
P

Peter

Hi

I think you have run into a version issue here.
AFAIK the MS Word Object/class you would be
starting against is MS Word 2003.
Check that you are starting against the
MS Word 2007 Libraries.

Not that I have an exact way of doing this but

You may have to use the exact version
or even GUID when starting so instead of

my_Word.CreateDispatch("Word.Application");

you will need

my_Word.CreateDispatch("Word.Application.12");

I think that 2007 is version 12 you will need to
check this.

or maybe this might help
http://www.mvps.org/access/api/api0065.htm
Peter
 
S

Steve Rindsberg

As I understand it, the PIAs tell the IDE and your app what the Office
2007 apps are capable of ... what methods/properties it supports.
Think of it as a book that tells you how to program against Office 2007
apps.

In order actually to make use of these methods and properties you must
have the Office 2007 you're trying to automate. You can't automate the
book. ;-)

The compatibility pack allows you to open/save to the new office 2007
formats (via a conversion process). It doesn't convert 2003 into 2007
or give the older apps the new features introduced in 2007. In other
words, no PDF save.
 

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