|
|
|
 |
Is there a way to add custom table formats to the Table Autoformat list?
|
Article contributed by Dave Rado
In Word 2002, you can use (the somewhat ironically named) Table Styles.
Unfortunately, if you do so, they do not apply paragraph styles to the text
within your tables; they apply manual formatting instead which defeats the
object of using styles. I would therefore not use this feature in documents of any importance.
The simplest method of applying your own table formats when creating new tables is
to create AutoText entries for each of your frequently used formats
(Titles in top row, Left column, Both, etc.). And this is the only
solution if you don't want to write macros.
But that won't help you to format pre-existing tables (so won't help when
pasting other people's tables into your documents). There is no solution to
this that doesn't involve writing macros.
The simplest way of addressing this in Word 2002 may be to define Table
Styles via the user interface (may be, because the dialog may or may not allow you to define the format
you want); then write a macro that offers the user a list of
your corporate table styles to choose from, applies the one they chose, and then formats the
text in the table using the appropriate paragraph styles. If you call your macro
TableAutoFormat, it will intercept the built-in command, so that when the
user selects Table + Table AutoFormat, your macro will automatically run.
In Word 97 and 2000, if (and its a massive if) your company's standard table formats
closely resemble one of the built-in ones, you can use a similar approach, with the addition of
whatever code is needed to tweak the built-in format so that it conforms with
your standard format.
But most companies' table formats that I come across don't bear any resemblance to the Microsoft
ones, so for most companies, the only really satisfactory way of addressing this
is to write your own
TableAutoFormat macro from scratch (again, call your macro
TableAutoFormat, so that it intercepts the built-in command), and install it as
an add-in. You will need to use all the tricks covered in: Maximising the performance of Word tables,
in order to ensure that your code runs quickly. Also, keep your user dialog as simple
as possible for instance, this is an example of one I've created in the past:

As an aside, Romke Soldaat's article Table
Styles is sometimes linked to from the newsgroups when this question is
asked; but in fact that article does not cover how to create your own
table formats; instead, it covers how to assign meaningful names to Microsoft's
built-in table formats.
|