Value to Reference in C++ for a Word Interop


G

Guest

Using C++ .NET 2003 and the Office XP PIA (Primary Interop Assemblies) I am
trying
to manipulate word documents. My attempt to print from a
Interop::Word::_Document in C++ .NET looks as follows...


Object * background = Reflection::Missing::Value;
Object * append = Reflection::Missing::Value;
Object * range = Reflection::Missing::Value;
Object * outputFileName = Reflection::Missing::Value;
Object * from = Reflection::Missing::Value;
Object * to = Reflection::Missing::Value;
Object * item = Reflection::Missing::Value;
Object * copies = Reflection::Missing::Value;
Object * pages = Reflection::Missing::Value;
Object * pageType = Reflection::Missing::Value;
Object * printToFile = Reflection::Missing::Value;
Object * collate = Reflection::Missing::Value;
Object * fileName = Reflection::Missing::Value;
Object * activePrinterMacGX = Reflection::Missing::Value;
Object * manualDuplexPrint = Reflection::Missing::Value;
Object * printZoomColumn = Reflection::Missing::Value;
Object * printZoomRow = Reflection::Missing::Value;
Object * printZoomPaperWidth = Reflection::Missing::Value;
Object * printZoomPaperHeight = Reflection::Missing::Value;


DataDoc->PrintOut(&background, &append, &range, &outputFileName,
&from, &to, &item, &copies,
&pages, &pageType,
&printToFile, &collate,
&activePrinterMacGX,
&manualDuplexPrint,
&printZoomColumn,
&printZoomRow,
&printZoomPaperWidth,
&printZoomPaperHeight);



With all the Objects set to Reflection::Missing::Value the document DOES
print to my default printer. If I put in a file name to
send the printout to a
file that also works. Object * fileName = S"C:\\Output";

However, whenever I try to change the 'copies' Object pointer from
Reflection::Missing::Value to printout 2 copies, it fails. I
usually
get some sort of "Type Mismatch"

Or if I want to set any other appropriate variable to true, it also fails.
How do I get a '2' or a 'true' to an Object reference so
that this method
works. How do you send a value to the Interop in C++ .NET?
I believe I
am missing something simple. Thanks in advance for any ideas!
 
Ad

Advertisements

G

Guest

The __box(true) will convert the Value to and Object where it can be
referenced.
 

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

Similar Threads

C++ Interop 0
C++ Interop Memory 1
C++ interop help 4
managed c++ and native c++ interop 4
C++ interop & P/Invoke 1
C++ interop /CLR confusion 3
C++ interop & reliability contracts 0
MC++ interop with C# error 0

Top