L
ljacomet
Hello,
I have an issue with programmatic printing of a word document.
The document is mainly data presented in a table. This table has a style
applied to it, that does the table formatting.
The problem is that this formatting happens 'some time' after opening the
document. The net result with programmatic printing is that the unformatted
table is printed.
I found no function to determine if some formatting was taking place or when
it is over. I tried going to the last page of the document, recovering the
page number, etc but had no success.
The current solution I have is a sleep of a few seconds to allow the
formatting to take place. This is not a long time solution as this time may
vary depending on the document size.
Here is some code showing my problem (VB .Net):
pageCount = oDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages)
System.Threading.Thread.Sleep(5000)
System.Console.WriteLine(pageCount & " pages before sleep, " &
oDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages) & " after")
oDoc.PrintOut(True)
This prints out the correct document, and outputs the line
9 pages before sleep, 5 after (as an example)
If I remove all code except the printout command, then the unformatted table
is printed.
Anyone has come across this problem and found a solution ?
Thanks you
Louis
I have an issue with programmatic printing of a word document.
The document is mainly data presented in a table. This table has a style
applied to it, that does the table formatting.
The problem is that this formatting happens 'some time' after opening the
document. The net result with programmatic printing is that the unformatted
table is printed.
I found no function to determine if some formatting was taking place or when
it is over. I tried going to the last page of the document, recovering the
page number, etc but had no success.
The current solution I have is a sleep of a few seconds to allow the
formatting to take place. This is not a long time solution as this time may
vary depending on the document size.
Here is some code showing my problem (VB .Net):
pageCount = oDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages)
System.Threading.Thread.Sleep(5000)
System.Console.WriteLine(pageCount & " pages before sleep, " &
oDoc.ComputeStatistics(Word.WdStatistic.wdStatisticPages) & " after")
oDoc.PrintOut(True)
This prints out the correct document, and outputs the line
9 pages before sleep, 5 after (as an example)
If I remove all code except the printout command, then the unformatted table
is printed.
Anyone has come across this problem and found a solution ?
Thanks you
Louis