N
nitm
hi,
i stumbled upon a weird behavior while trying iterate over the pages of a
word document.
i have a word 2007 document (Microsoft.Office.Interop.Word.DocumentClass)
that i get from a dsoFramer (using frame.ActiveDocument).
when i check how many pages the document has i get 37 (using:
wordDocument.ActiveWindow.ActivePane.Pages.Count), but when i try to get a
page (using: wordDocument.ActiveWindow.ActivePane.Pages, while 0 <= i <
37) i get the following exception: The requested member of the collection
does not exist.
so, i decided to try another approach:
IEnumerator enumerator =
wordDocument.ActiveWindow.ActivePane.Pages.GetEnumerator();
while (enumerator.MoveNext())
....
this results with one iteration, though i have 37 pages...
what i'm trying to do is this:
in my application the user adds an existing word (2007) document.
the application then open this document in a dsoFramer and analyze this
document, an operation that takes a while.. so i want to show the user a
ProgressBar that show how many pages the application has already analyzed.
i thought that the problem might have to do with the fact the i'm using
threads, so the thread that is doing the analyzing cant access the pages of
the document, so i fixed that using delegates and BeginInvoke and now the
thread that is iterating over the pages is the same thread that started the
document.. still the same result.
the only thing left that i can think of that is causing this weird behavior
is that the dsoFramer is not visible, that is the UserControl that holds the
dsoFramer is already constructed but is not displayed (i want to display that
control only after the document is analyzed).
can anyone think of why this is happening and how to solve this?
thanks a lot, nitzan
i stumbled upon a weird behavior while trying iterate over the pages of a
word document.
i have a word 2007 document (Microsoft.Office.Interop.Word.DocumentClass)
that i get from a dsoFramer (using frame.ActiveDocument).
when i check how many pages the document has i get 37 (using:
wordDocument.ActiveWindow.ActivePane.Pages.Count), but when i try to get a
page (using: wordDocument.ActiveWindow.ActivePane.Pages, while 0 <= i <
37) i get the following exception: The requested member of the collection
does not exist.
so, i decided to try another approach:
IEnumerator enumerator =
wordDocument.ActiveWindow.ActivePane.Pages.GetEnumerator();
while (enumerator.MoveNext())
....
this results with one iteration, though i have 37 pages...
what i'm trying to do is this:
in my application the user adds an existing word (2007) document.
the application then open this document in a dsoFramer and analyze this
document, an operation that takes a while.. so i want to show the user a
ProgressBar that show how many pages the application has already analyzed.
i thought that the problem might have to do with the fact the i'm using
threads, so the thread that is doing the analyzing cant access the pages of
the document, so i fixed that using delegates and BeginInvoke and now the
thread that is iterating over the pages is the same thread that started the
document.. still the same result.
the only thing left that i can think of that is causing this weird behavior
is that the dsoFramer is not visible, that is the UserControl that holds the
dsoFramer is already constructed but is not displayed (i want to display that
control only after the document is analyzed).
can anyone think of why this is happening and how to solve this?
thanks a lot, nitzan