V
Victor
hi guys
i have a part of code to find out how many pages in a word document.
actually most of part of the code is from the msdn.
but it didnt work properly. i already load the doc before i excuted the
code.
can anyone tell me why?
private ApplicationClass wd;
wd.ActiveDocument.Repaginate ();
int nStartPg;
int nEndpg;
int nSecpages;
int NumSections;
int total = 0;
NumSections = wd.ActiveDocument.Sections.Count ;
nStartPg = 1;
foreach(Microsoft.Office.Interop.Word.Section oSec in
wd.ActiveDocument.Sections)
{
nEndpg =
(int)oSec.Range.get_Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndPageNumber)
-1;
//if (NumSections == oSec.Index)
{
nEndpg ++;
}
nSecpages = nEndpg - nStartPg + 1;
nStartPg = nEndpg + 1;
total += nSecpages;
}
cheers
i have a part of code to find out how many pages in a word document.
actually most of part of the code is from the msdn.
but it didnt work properly. i already load the doc before i excuted the
code.
can anyone tell me why?
private ApplicationClass wd;
wd.ActiveDocument.Repaginate ();
int nStartPg;
int nEndpg;
int nSecpages;
int NumSections;
int total = 0;
NumSections = wd.ActiveDocument.Sections.Count ;
nStartPg = 1;
foreach(Microsoft.Office.Interop.Word.Section oSec in
wd.ActiveDocument.Sections)
{
nEndpg =
(int)oSec.Range.get_Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndPageNumber)
-1;
//if (NumSections == oSec.Index)
{
nEndpg ++;
}
nSecpages = nEndpg - nStartPg + 1;
nStartPg = nEndpg + 1;
total += nSecpages;
}
cheers