Possible Word 2003 bug

G

Garrett Manahan

I am Running into a problem in Word 2003 where certain internal properties in
Word don't seem to be updating properly. Specifically, this problem is
occuring when I programmatically insert a table or paragraph into a Word
document and it happens to cause a soft page break. I use the ".information"
method to determine if the the ending page number is different then before
the range was inserted. In some cases, Word does not return the correct
result. In some instances I have tried using the document range object and
the ".computestatistics(wdstatisticpages)" method to determine if a new page
has been added. That seemed to work, until now. I have just run into
another instance where neither the ".information" method on the inserted
range, nor the ".computestatistics" method on the document range report the
new page as being there. But, if I use the ".computestatistics" method off
of just the document object, it seems to report correctly. Sorry that was
long winded, but here is an example.

using vb, I programmatically insert a table from file into the Word
document starting on the last page which is currently 9. The inserted table
causes as soft page in the Word document. Using the following methods
produces different results. The correct result should be 10.

myRange.information(wdactivepagenumber) = 9
mydocument.range.information(wdactivepagenumber) = 9
mydocument.range.computestatistics(wdstatisticpages) = 9
mydocument.computestatistics(wdstatisticpages) = 10

Again, sometimes the mydocument.range.computestatistics(wdstatisticpages)
returns correctly, but sometimes it doesn't. I have tried repaginating the
document but that doesn't help. The only thing that does seem to work is to
save the document. While saving generally isn't a problem, it doesn't seem
like that should be necessary. Anybody else run into this problem?

Garrett
 
W

Word Heretic

G'day Garrett Manahan <[email protected]>,

Some suggestions in the order I would try:

Use the collapsed range of the last cell's content as your test range
(different from the range for the end of the table)

Force a document repagination first

Only use .info etc off a selection object


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Garrett Manahan reckoned:
 
G

Garrett Manahan

Thanks for the suggestions Mr./Mrs. Word Heretic. I have tried the
repagination before hand and that doesn't work. I have also tried collapsing
the range and checking just the end point of the inserted range. That does
work. I haven't tried the selection method yet. Some times just calling a
doevents does the trick, but it's a rarity. As I said before, the only other
method I have used to get it to work properly is to save the document before
calling .Information.

What is the best way to submit a bug report to MS? This is something that
obviously isn't working correctly. It has worked fine in every other version
of Word going back to 97. Of course, this is the first time I have worked
off of an XP Pro SP2 platform, so I wonder if that could be an issue.
Normally I am developing on a Win2k platform. At any rate, thanks again for
the suggestions.

Garrett
 
W

Word Heretic

G'day Garrett Manahan <[email protected]>,

I wouldn't go so far as to call this a bug. Word isn't really a DTP,
so we are pushing its envelope way past its specs when we do automated
typesetting.

Something else to try might be to try flipping the view of the
document to normal then print layout. This sometimes triggers etc
refresh stuff too.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Garrett Manahan reckoned:
 
G

Garrett Manahan

I have tried switching back and forth with the views as well. It has worked
for other problems, but not for this one.

I would have to say that I disagree with your assessment on this. Microsoft
provides it's Word object model specifically for the purpose of automation.
Therefore, the properties and methods provided should be expected to perform
as they were intended. It is obvious, in several situations, that they do
not. I hardly think that adding a paragraph and expecting the the correct
ending page number to be returned is pushing the envelope. Quite the
contrary. It is a simple task that, as I said before, has worked on each
previous version of Word. To me, as a programmer, I would most certainly
consider this bug, because it does not work as it is supposed to.

Overall, I am reaching a frustration level at this point where I probably
will not upgrade our automation software to 2003. This inconsistency with
the reporting of ending page numbers would render my software pretty much
useless. I generate huge documents by automation and most of the solutions
to this problem add too much time to the process and would increase the total
generation times to well beyond what the customer would accept. I thank you
for you help again.
 

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