Chuck
Tue Apr 05 10:53:09 CDT 2005
If you post the code it might be easier to help?
"shripathikamath@hotmail.com" wrote:
>
> Jean-Guy Marcil wrote:
> > shripathikamath@hotmail.com was telling us:
> > shripathikamath@hotmail.com nous racontait que :
> >
> > > Here is the problem in a nutshell:
> > >
> > > I launch Word thru automation.
> > > I then populate tabular data into a document that I obtain from a
> > > database
> > > I format the data using the AutoFormat property off the table
> object
> > > I save the document as an HTML file.
> > >
> > >> From what I can see, the HTML file is saved, but the data looks to
> > >> be missing.
> > >
> > > So, instead of saving it to an HTML file, I saved it to a DOC file.
> > >
> > > Then, I see what the problem is -- the formatting has not been
> applied
> > > (or completed) prior to saving the document. If I format it, or
> > > change the formatting, I find that the data is correct.
> > >
> > > I try this without automation, and what I find is that for a large
> > > table, the data is populated first, and the formatting takes place
> > > (likely) in the background, and takes some time to finish.
> >
> > Not likely, formatting is fairly fast, unless you have a huge table
> and are
> > applying many formatting operation. But with Auto it is usually
> fairly
> > quick.
> >
>
> I can only describe what I see. I can see that the table is drawn, but
> empty, and then it finishes formatting a little while later.
>
> > > What is likely happening is that the save occurs before the
> formatting
> > > has completed.
> >
> > I do not think this is possible. If you apply formatting, then Word
> will
> > complete the event before moving on to the next one (I mean it cannot
> save
> > while it is formatting, either it is formatting or it is saving).
> >
>
> So I thought. Until I put a Beep following the AutoFormat method
> invocation, and I heard the Beep *long* before the table finished
> formatting.
>
> > There maybe something else going on here.
> > How are you automating Word?
> >
>
> Actually, in this test, I am simply opening Word, and running a macro
> from my add-in.
>
> The addin reads a table of data from a database, and puts it into an
> open document, and applies a known format (Colorful 1).
>
> The table has approximately 500 rows. The formatting finishes within a
> couple of seconds, but definitely there is a noticeable pause prior to
> the table appearing in its full format.
>
> WHen I run it in automation, I launch Word, open a document, and run
> the macro from within the addin.
>
> What gets saved appears very much like what I see just prior to the
> data appearing fully formatted as described above.
>
> If I select the table, because of the selection colors, I do see that
> data is indeed (correctly) saved in the document. Just the format is
> missing, and I see blank rows.
>
>
>
> > In any case, have you tried with a Do Events in your code?
> >
> > Or, Save it twice before closing it?
> >
>
> Thanks, I have not, so I'll try that.
>
>
> >From the mvps site, I see a suggestion for using one of the dialogs.
> DO you know if something like that is faster.
>
> Actually speed is not an issue, the 2 to 5 seconds it takes is
> perfectly fine, I just need the formatting to be complete before I save
> it.
>
> I'll try your suggestions.
>
> Thanks
>
>
>
> > --
> > Salut!
> > _______________________________________
> > Jean-Guy Marcil - Word MVP
> > jmarcilREMOVE@CAPSsympatico.caTHISTOO
> > Word MVP site:
http://www.word.mvps.org
>
>