How to Create a UML Class Diagram Using MS Word
Although Microsoft Word is not a full-featured diagramming application like Visio, it has the tools you need to create UML or Unified Modeling Language models for your software projects. Word text boxes can be used to hold the name, attributes and operations for each class in your program. Unlike normal word processor text, information within text boxes can be precisely placed anywhere within your document. You can also use Word's Shape Tools to draw connecting lines between two classes to show their association or relationship.
Open a blank Word document to contain your UML diagram.
Insert a simple text box into the document to hold your first class. Click "Insert," "Text Box" and then "Simple Text Box." Delete the default text within the new text box.
Enter the name of your first class and then press "Enter." For example, if you are designing a clothing store inventory program, you could have a class named “Pants.”
Add a horizontal line to separate the name from the rest of the class components. Press the "-" key several times and then "Enter."
Add all the attributes belonging to the first class beneath the horizontal border. For example, if you are creating a class for a clothing store inventory program, the “Pants” class could have variables for style, material, length, season and gender.
Create another horizontal line beneath the last attribute by pressing "-" several times and then "Enter."
Add all class operations beneath the new horizontal line. For example, the “Pants” class may have a method "ShowStyles" that returns the number of pant styles in inventory.
Add standard notation in front of each class attribute and operation to denote its visibility to the rest of the application. Type "+" for public, "-" for private, "#" for protected or "~" for package in front of the class component name. For example, type "-ShowStyles" to designate this method as private.
Create additional text boxes to contain the rest of the classes your program will need.
Move the class text boxes in their proper location within your diagram. Click and hold down the mouse button on a text box border, drag the box to its desired location and then release the mouse button.
Draw lines or connectors to show the relationship between your classes. Click "Insert," "Shapes" and then the type of line you need. For example, a line with a single arrow head shows a directed or unidirectional association between two classes. A plain line with no arrow heads depicts a bidirectional relationship between classes.
Tips & Warnings
- Use the first class you created as a template for additional classes. Click the text box border and then press "Ctrl-C" to copy it to the clipboard. Click an empty spot of the page and then press "Ctrl-V" to paste a copy of the text box. Click and hold down the mouse on the border of the text box, drag it to its correct position in the diagram and then release the mouse. Replace the old class name, attributes and operations with the new class information.
- Information in this article applies to Word 2013. It may vary slightly or significantly with other versions of Word.