F
fedebona
I'm experiencing some trouble to solve this issue:
I want to loop through a Word document and get for each page a range that
covers exactily the entire page.
I know that exists a goto method that lets to simply navigate through pages,
but the range that returns is an empty range that covers only the beginning
of a page. Here's some sample code in C#:
Word.Range wholeDocRange = activeDoc.Range(ref missing, ref missing);
int maxPage =
(int)wholeDocRange.get_Information(Word.WdInformation.wdNumberOfPagesInDocument);
// GoTo to navigate the pages
for (int page = 1; page <= maxPage; page++) {
object what = Word.WdGoToItem.wdGoToPage;
object which = Word.WdGoToDirection.wdGoToAbsolute;
object count = page;
Word.Range pageRange = wholeDocRange.GoTo(ref what, ref
which,
ref count, ref missing);
...............
}
}
In this sample pageRange doesn't represent the entire page, but only the
beginning.
I want to loop through a Word document and get for each page a range that
covers exactily the entire page.
I know that exists a goto method that lets to simply navigate through pages,
but the range that returns is an empty range that covers only the beginning
of a page. Here's some sample code in C#:
Word.Range wholeDocRange = activeDoc.Range(ref missing, ref missing);
int maxPage =
(int)wholeDocRange.get_Information(Word.WdInformation.wdNumberOfPagesInDocument);
// GoTo to navigate the pages
for (int page = 1; page <= maxPage; page++) {
object what = Word.WdGoToItem.wdGoToPage;
object which = Word.WdGoToDirection.wdGoToAbsolute;
object count = page;
Word.Range pageRange = wholeDocRange.GoTo(ref what, ref
which,
ref count, ref missing);
...............
}
}
In this sample pageRange doesn't represent the entire page, but only the
beginning.