Using Style Sheets with MS Word

Posted on 2012-12-27
Medium Priority
Last Modified: 2013-02-27
Hi All

Seasons greetings :-D  

I'm trying to make a template (.dotm) and anticipate a need for future customization and tweaking... I figured with Word 2010 that I should be looking at using style sheets and XML... I have close to zero experience with either...  a bit of searching on google and EE has not helped much.

I'd like my template to reference an external style sheet (or similar) so that text attributes and page layouts can be specified...

For example I have some data laid out in tables and might wish to change fill colors of the tables, table width, row breaking properties etc.  

Is this possible with Word 2010?

Would love some pointers to get me started...  failing this I guess I'll be creating an .ini file that contains my specifications and using VBA to apply all my formatting (so would appreciate thoughts on the best way forward too....)

Cheers, S
Question by:DrTribos
  • 3
  • 2
LVL 21

Accepted Solution

Eric Fletcher earned 2000 total points
ID: 38727189
A template with defined styles will do most of what you want. Certainly anything to do with text attributes is very easily managed by just modifying a style's definition. Page layouts and table row/column dimensions are not managed by styles, but if you have used styles, getting at parts to be modified (either manually, with VBA, or a combination of both) is much simpler.

If you are completely new to Word styles, I'd recommend reviewing Shauna Kelly's excellent tutorials first.

What you will want to do is establish a minimal set of styles to use to tag the different structures within your document. Typically, any document will be made up of headings, variations of a body paragraph (indented, not indented), lists (bulleted, numbered), and, in your case, parts within tables. Consider what attributes are common to the different elements so you can define the styles so that a change to a "master" element can use Word's style "based on" attribute to inherit the common parts. For example, say you set the Body Text style to be 12pt Helvetica, and had a Numbered List style based on it. If you change the Body Text style's definition to use 11pt Garamond, the Numbered List style would automatically change too.

To make changes to table dimensions, you can use Word's Find feature: click the small round button in the lower part of the vertical scrollbar to access the "Select Browser Object" flyout (or press Alt-Ctrl-Home), and choose the Browse by Table icon. This will bring you to the next table in the document, and you can make whatever changes you want. Click the double-down button below the browser object icon to skip to the next table.

The same method can be used to move from one scetion to another to make alterations to the page setup (since this is a section-related function).

Hope this helps get you on the right track...
LVL 15

Author Comment

ID: 38728488
Hi Eric

Thanks for your reply. I'm reasonably good with styles (and have gotten much out of Shauna's tutorials).  I've just started reading up on XML and CSS and doing tutorials at w3schools.com...

For practical reasons I don't really want to modify my template for each different user preference... too much work.  Ideally I would have a CSS (or CSS like file) that specifies styles, table borders, table backgrounds etc.. and any change made to the "file" would be reflected in the document next time it was opened.

I'm aware that there is an issue with MS using custom XML in documents but not sure how this relates to CSS...

At this stage I am thinking that I will need to use bookmarks for tagging...

   [tableTypeA_001], [tableTypeA_002], ... , [tableTypeA_00n]

   [tableTypeB_001], [tableTypeB_002], ... , [tableTypeB_00n]

And use VBA to apply specific formatting to my tables... etc.

Are you aware of any good tutorials out there for starting out with MS Word XML Schemas and/or XML Expansion Packs?  

LVL 21

Expert Comment

by:Eric Fletcher
ID: 38728787
Interesting idea... No, I'm not aware of any tutorials, but will certainly follow this thread to learn about them if they are available.

I don't use the built-in themes in Word, but perhaps they may use some sort of CSS to manage the various effects.
LVL 15

Author Comment

ID: 38729860
Thanks Eric - will be interested myself  ;-)
LVL 15

Author Closing Comment

ID: 38936880
Hi Eric,

Closing this... thanks for your comments :-)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question