Word ComputeStatistics and late binding

R

Robin Harmsen

in Early binding someone does something like this:

using Word = Microsoft.Office.Interop.Word;
Word.Application wordApp;
wordApp = new Word.Application();
Word.Document wordDoc = wordApp.Documents.Open( ..... )
wordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages,true);

how can I translate this to early binding?
I got the folowing code

object[] Parameters = new Object[2];
Parameters[0] = ???;
Parameters[1] = true;

wordDoc.GetType().InvokeMember(
"ComputeStatistics",BindingFlags.InvokeMethod,null,wordTemplate,
Parameters);

but I am not able to build the first parameter
(Word.WdStatistic.wdStatisticPages)

Robin Harmsen
 
C

Cindy M -WordMVP-

Hi Robin,

If C# is accepting Word.wdStatistic.wdStatisticPages, rather than
forcing you to create an object to pass as the variable, I'd try
using the numeric value of the wdStatisticPages enum. Most of Word's
enums correspond to long (in .NET integer) values. Try passing
an integer value of 2.
Early binding someone does something like this:

using Word = Microsoft.Office.Interop.Word;
Word.Application wordApp;
wordApp = new Word.Application();
Word.Document wordDoc = wordApp.Documents.Open( ..... )
wordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages,true);

how can I translate this to early binding?
I got the folowing code

object[] Parameters = new Object[2];
Parameters[0] = ???;
Parameters[1] = true;

wordDoc.GetType().InvokeMember(
"ComputeStatistics",BindingFlags.InvokeMethod,null,wordTemplate,
Parameters);

but I am not able to build the first parameter
(Word.WdStatistic.wdStatisticPages)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 
R

Robin Harmsen

Seems to work fine :D

thanx

Robin Harmsen
HIO-Student HoogeSchool van Utrecht - Netherlands


Cindy M -WordMVP- said:
Hi Robin,

If C# is accepting Word.wdStatistic.wdStatisticPages, rather than
forcing you to create an object to pass as the variable, I'd try
using the numeric value of the wdStatisticPages enum. Most of Word's
enums correspond to long (in .NET integer) values. Try passing
an integer value of 2.
Early binding someone does something like this:

using Word = Microsoft.Office.Interop.Word;
Word.Application wordApp;
wordApp = new Word.Application();
Word.Document wordDoc = wordApp.Documents.Open( ..... )
wordDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages,true);

how can I translate this to early binding?
I got the folowing code

object[] Parameters = new Object[2];
Parameters[0] = ???;
Parameters[1] = true;

wordDoc.GetType().InvokeMember(
"ComputeStatistics",BindingFlags.InvokeMethod,null,wordTemplate,
Parameters);

but I am not able to build the first parameter
(Word.WdStatistic.wdStatisticPages)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)


This reply is posted in the Newsgroup; please post any follow
question or reply in the newsgroup and not by e-mail :)
 

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