In this lesson, you will become familiar with special design features such as tables, graphics, and numbered lists.
In this lesson, you'll add the following elements to the letter you created in Lessons 2 and 3:
a table
a graphic
a bulleted list
You'll need about 50 minutes to complete this lesson.
Adding table declarations to the DTD
Before you can insert a table into the letter, you must modify the document type definition by adding a PUBLIC identifier that references a DTD with table support, in this case CALS_XML.dtd. This DTD has been created to represent WordPerfect CALS support. You can use Notepad to modify the DTD.
To add table declarations to the DTD
1. In Notepad, open the letter.dtd file located in the XML\Tutorial folder.
2. Position the cursor on the first blank line after the last element (<!ELEMENT ENC) in the letter.dtd file.
3. Type the following text:
<!ENTITY % calsXML PUBLIC "-//COREL//DTD WordPerfect XML CALS table support//EN"
"cals_xml.dtd">
4. On the next blank line, type %calsXML;.
5. Click the File menu, Save to save the letter.dtd file.
Note
XML is case sensitive. Make sure you type the text exactly as printed, including uppercase and lowercase letters.
Creating an entry in your catalog file
Catalog files provide a method for locating external information referenced from a DTD or document. DTDs reference information such as markup declarations for elements, entities, attributes, etc. Documents often reference external blocks of text, or non-textual information such as graphics and sound. Two catalog files are supplied with WordPerfect: Compile.cat and Import.cat.
Compile.cat is the file that the DTD Compiler will try to use if the user does not supply a different one.
Catalog.cat is the default catalog file used when importing SGML/XML documents. It contains entries that match up a DTD's PUBLIC/SYSTEM identifiers and/or root element name to the appropriate WordPerfect Template file.
For more information about catalogs, see Working with catalog files .
After you add the appropriate table commands to your DTD, you usually need to create an entry in the catalog file that indicates the table model for your XML document. However, when you compiled the letter.dtd in Lesson 2, the default catalog file (Compile.cat) was used. Compile.cat already contains the required catalog entries for tables.
The following entity declarations appear in Compile.cat:
PUBLIC "-//COREL//DTD WordPerfect CALS table support//EN"
".\cals_tbl.dtd"
PUBLIC "-//COREL//DTD WordPerfect XML CALS table support//EN"
".\cals_xml.dtd"
PUBLIC "-//COREL//DTD WP 6.0 Minimal Table Declarations//EN"
".\wp60min.dtd"
PUBLIC "-//COREL//DTD WP 6.0 Table Declarations//EN"
".\wp60tbl.dtd"
PUBLIC "-//COREL//DTD WP 5.1 Table Declarations//EN"
".\wptable.dtd"
Recompiling letter.dtd
After adding the necessary commands for creating graphics and tables in your DTD, you need to recompile letter.dtd.
To recompile the letter.dtd
1. On the Windows taskbar, click the Start button, then click WordPerfect Office 2000, Utilities, WordPerfect XML Project Designer.
2. Click the File menu, DTD Compile.
3. Click the folder icon next to the DTD (Input) File box, then locate letter.dtd.
4. Click the folder icon next to the WP Template (Output) File box, then locate letter.wpt.
5. Enable the Compile DTD As XML check box.
6. Click the Compile button to recompile letter.dtd.
7. Click the Close button, then click the File menu, Exit.
Tip
You can also access the WordPerfect XML Project Designer from within the WordPerfect XML editing environment by clicking File, Edit Layout.
Inserting a table
After modifying and recompiling the DTD, you can insert a table into the letter and tag it appropriately.
To insert a table
1. In WordPerfect, click the File menu, then choose letter.xml from the Recently Used File List.
2. Position the cursor after the text "We received payment in the amount of 275 for the following items."
3. Click the Insert menu, Table.
4. In the Columns box, type 2, and in the Rows box, type 5.
5. Click the Create button.
6. Type the following text and numbers in the table cells:
Items returned Quantity
keyboard trays 10
mouse pads 10
white boards 5
dry erase markers 10 packages
7. Position the cursor in the table, then click the XML menu, Tag Tables.
8. Click the Tag Current button, then click the Close button.
9. Click anywhere outside the table.
Tip
Click the XML Tree button on the toolbar to see the Table element in the structured view of the document.
Adding a graphic
In the letter.dtd, the Logo element is defined as an empty element with the attribute graphic associated with it. The graphic attribute is defined as an entity. When you insert a graphic into an XML document, WordPerfect automatically creates a file reference that defines the location and format of the graphic entity.
To add a graphic, you must first associate the element attributes defined for the Logo element with WordPerfect functionality. In doing so, you ensure that changes you make in WordPerfect to the horizontal position, the vertical position, the width, and the height of the graphic are reflected in the attribute values associated with the Logo element.
To associate element attributes with WordPerfect functionality
1. On the Property Bar, click the XML button, then choose Edit Layout.
2. From the Element Rule List box, choose the Logo element.
3. Click the Edit menu, Element Associate, then from the Element box, choose Logo.
4. From the Association box, choose Image Box and from the Graphic Reference box, choose graphic.
5. From the Horizontal Position box, chose horzpos.
6. From the Vertical Position box, choose vertpos.
7. From the Height box, choose height.
8. From the Width box, choose width.
9. Click the OK button, save the document layout, then exit the WordPerfect XML Project Designer.
To define the file reference
1. On the Property Bar, click the XML button, then choose File References.
2. Click the New button, then type "Logo" in the Name box.
3. Click the folder icon next to the File Path box and locate the corelsym.bmp stored in the XML/Tutorial folder.
4. Choose NDATA from the Data Type list box, then choose bmp from the Notation list box.
5. Click the OK button.
6. Enable the User Declared option button, then choose Logo in the File Reference box.
7. Click the Close button.
To add a graphic
1. On the Property Bar, click the XML button, then choose Layouts.
2. From the Layouts box, choose "letter", then click the Select button.
3. Position the cursor before the Company Name start tag.
4. From the Valid Elements list box on the XML Property bar, choose Logo.
5. Click the folder icon next to the Look In list box, then locate the corelsym.bmp in the XML\Tutorial folder.
6. From the Look In list box, choose corelsym.bmp, then click the Insert button.
7. With the graphic selected, click the XML menu, Tag Box.
Tip
You can see the tags surrounding the graphic in Reveal Codes.
To size and position the graphic
1. Select the graphic.
2. Right-click, then choose Size.
3. In the Width section, enable the Set option button, then type 0.6 in the Width box.
4. In the Height section, enable the Set option button, then type 0.6 in the Height box.
5. Click the OK button.
6. Right-click the graphic, then choose Position.
7. In the Attach Box To box, choose Page.
8. In the Horizontal section, type -0.8, then choose from Left Margin.
9. With the graphic selected, click the XML menu, Tag Box.
Notes
Do not drag the graphic to a new position. Dragging the graphic moves the box tag and results in a validation error.
Every time you make changes to the size or position of the graphic, you must retag it.
Click here to see what the document should look like at this point.
Creating a bulleted list
Creating a bulleted list is a two step process. First, create a style just as you would when doing word processing. Then, associate that style to an element that is defined in the associated DTD.
To create a style for bulleted lists
1. In WordPerfect, click the Format menu, Styles.
2. Click the Create button.
3. In the Style Name box, type "bulleted list."
4. Click in the Contents box.
5. Click the Insert menu, Outline/Bullets and Numbering.
6. Click the Bullets tab, then click the OK button to accept the default bullet style.
7. In the Styles Editor dialog box, click the OK button.
8. In the Styles dialog box, click the Close button.
To associate a style with an element
1. On the Property bar, click the XML button, then choose Edit Layout.
2. From the Element Rule List box, choose ListItem, then click the Edit menu, Edit Rule.
3. Click the Format menu, Styles.
4. In the Available Styles box, choose bulleted list, then click the OK button.
Note that the rule STYLE=bulleted list appears in the Rule Entry For Start Tag box.
5. Click the OK button.
6. Click the File menu, Exit, then click Yes to save changes to the layout.
To insert the bulleted list
1. Position the cursor after the table end tag.
2. On the Property bar, choose BulletList from the Valid Elements list box.
3. Position the cursor before the BulletList start tag, then type "When you return items, please include:".
4. Position the cursor before the ListItem end tag, then type "the original bill of sale."
5. Position the cursor before the BulletList end tag.
6. On the Property bar, choose ListItem from the Valid Elements list box, then type "all the original packaging."
7. Click File, Save to save letter.xml.
Click here to see what the letter should look like at this point.
Summary of Lesson 5
In this lesson, you learned how to
add a table
insert a graphic
add a bulleted list
In Lesson 6, you'll learn how to create a table of contents and cross-references.