Hi Mystery,
> The version of Word is 2000 and above.
>
That precludes using Table Styles, then.
> How can I compare the settings of these two tables programmatically.
> If I had access to these properties, then all would be solved.
>
You have the original table you want to match; you have the second
table formatted with the "default" AutoFormat. You compare each of the
possible things that could be affected and see if they match. If they
don't, the option was different.
If the borders are different, then ApplyBorders must have been "false"
when the original table was formatted. If the font formatting of the
first columns is different (bold vs. non-bold, usually), then
ApplyFirstColumn was "false" for the original table. Etc.
> No, the user does not modify the document. This happens all behinds
> the scene. The user is simply presented with the end result.
If that's the case, then why don't you already know what AutoFormat
was used on the original table?
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
Mystery Man - 10 Jul 2004 14:04 GMT
Thanks Cindy
> You have the original table you want to match; you have the second
> table formatted with the "default" AutoFormat. You compare each of the
> possible things that could be affected and see if they match. If they
> don't, the option was different.
I apolgise if its a really dumb question, but how do I programatically
get access to the following properties in the original table:
ApplyBorders
ApplyShading
ApplyFont
ApplyColor
ApplyHeadingRows
ApplyLastRow
ApplyFirstColumn
ApplyLastColumn
AutoFit
I have checked the object model and no property is obvious to me.
The property AutoFormatType simply returns a WdTableFormat. This would
only be the first parameter in the call to the AutoFormat method when
setting up the new table.
Thanks for your patience
> Hi Mystery,
>
[quoted text clipped - 28 lines]
> This reply is posted in the Newsgroup; please post any follow question
> or reply in the newsgroup and not by e-mail :-)
Mystery Man - 25 Jul 2004 12:06 GMT
Hi Cindy (or anyone else)
Sorry to keep asking, but how do I programatically get access to the
following properties in a table:
ApplyBorders
ApplyShading
ApplyFont
ApplyColor
ApplyHeadingRows
ApplyLastRow
ApplyFirstColumn
ApplyLastColumn
AutoFit
I have checked the object model and no property is obvious to me.
Thanks
> Thanks Cindy
>
[quoted text clipped - 56 lines]
> > This reply is posted in the Newsgroup; please post any follow question
> > or reply in the newsgroup and not by e-mail :-)
Shauna Kelly - 25 Jul 2004 13:16 GMT
Hi Mystery Man
The macro recorder is very useful for learning about this kind of thing.
Tools > Macros > Record New Macro. Try inserting and formatting a table, and
then inspect the code that Word creates.
In particular, look for code like the following:
With Selection.Tables(1)
With .Borders(wdBorderLeft)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = wdColorAutomatic
End With
End With
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
> Hi Cindy (or anyone else)
>
[quoted text clipped - 75 lines]
> > > This reply is posted in the Newsgroup; please post any follow question
> > > or reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 18 Aug 2004 11:12 GMT
Hi Mystery,
> Sorry to keep asking
I apologize: "real life" took me away from the groups for
quite a while...
> do I programatically get access to the
> following properties in a table:
You can't access what was applied or not applied using
AutoFormat (although I'd think that, since you
programmatically insert all the tables you'd KNOW that, and
could save the information somewhere to look up later).
But what you can do is compare the actual formatting of the
existing table and see if it matches the formatting of a
table inserted with all the defaults. Does it have the same
border colors? Same shading? Same font formattting? If not,
then the first was inserted with that aspect set to
"False".
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)