First steps with KOffice: KWord - Part 1

From LXF Wiki

Word processing basics

Think of a Linux word processor and the chances are that will spring to mind, but Andy Channelle finds that there's now an excellent alternative available from the KDE project... is not the beginning and end of the Linux office suite market. While OOo may get most of the glory, Linux users have other avenues to explore when it comes to choosing their productivity software, and there are compelling reasons to shop around. Over the next few issues we'll delve into KOffice, the powerful and extensive suite that's associated with the KDE desktop. From the basics of word processing in KWord to the complexities of spreadsheet creation in KSpread, we'll look at each application in turn.

The latest version of KOffice is 1.3.4, and it is available as source or binaries for most popular distributions. An edition will almost certainly be available as part of your distribution, or you can get it from the project's website at The core of the suite consists of KWord, KSpread and KPresenter (all pretty self-explanatory), along with a number of accessory applications including KChart (charting), Kivio (flow chart editor) and Kugar (report generator) to cover more marginal jobs.

Table of contents


KWord's interface follows the conventions of most other office applications, with a menu bar and toolbars at the top of the main window, and a secondary toolbar on the far left. These are almost infinitely configurable via the Settings > Configure Toolbars menu entry. It's also possible, once toolbars have been edited to the user's requirements, to move them around the edges of the document window ­ just click and drag the handle on either the top or left edge of the toolbar, or turn it into a floating toolbar with a quick double-click. It can be reseated by double-clicking again. By default, the horizontal toolbars cover:

    Document options, including opening and saving, cutting, copying, pasting and printing, undoing, checking spelling and searching for specific text strings.
    Paragraph options such as alignment (left, centre, right, justify), list formats and indentation.
    Character options such as font face, size, format (bold, italic and so on), position (superscript and subscript) and colour.

These buttons will either enable or disable options, or open a menu for further selection. Clicking on the Text Colour icon, for example, will open a drop-down menu with a colour grid on it. Either choose one of these or select More Text Colours to launch the default KDE colour selector/mixer. Any colour you choose in this manner will be added to the bottom of the menu, offering consistent access to your bespoke hues.

Meanwhile, the left-hand vertical toolbar contains options to add other objects from within the suite, such as charts, drawings or spreadsheets, or extra frames for images and text.

Unusually, the main window is split, with a small pane offering a view of the document structure (which I'll come to later), while the main pane contains a representation of your document. This is where you type, edit and revise the text.

Start typing and you soon see that incorrectly spelled words will be underlined with a jagged red line. Right-click on an underlined word and you'll notice an addition to the context-sensitive menu called Spellcheck Result. Select this and the correct spelling, or a collection of close matches, will pop up. Click one of these to insert it in place of the error. If you find this more irritating than useful, you can switch it off by selecting Tools > Spellcheck> Autospellcheck.

Autospellcheck can be configured to ignore specific words or letter combinations. If you go to Settings > Configure KWord > Spelling, you can instruct the program to ignore UPPERCASE words, or those containing numerals, or words with accents. You can even create a list of specific words that should be completely ignored. When writing about Linux, for instance, it makes sense to add words such as distro, SUSE and Linux.

The alternative to this ­ and it's recommended if these words aren't likely to be confused with other `proper' words ­ is to add extra words to the dictionary. Simply find an example of the word you want to add, right-click and select Add Word to Dictionary. I've experienced an occasional, seemingly random bug, which freezes the right-click menu sometimes, but hitting the Alt key sorts it out.

There are three views available in the content pane. Page mode shows a view of single pages, complete with margins and other page furniture. Preview mode does the same, but will show opposing pages side by side on multi-page documents, which is obviously ideal for longer documents. In addition, the Text mode is the traditional WP mode for people who consider the WYSIWYG idea a bit frivolous. These modes are accessible via the View menu. It's also possible to zoom in and out of documents with the View drop-down menu that can be found on the main toolbar.

The document layout is quite useful in the creation of complex documents, and we'll return to this in the near future, but for basic tasks it can be a little superfluous, and it takes up valuable screen space. To remove it, go to View > Show Doc Structure. For general letter writing, or other tasks where visual elements aren't of paramount importance, I also find it useful to remove the rulers and page borders.

Missing image
KWord's main configuration options are all in one box.
Missing image
Styles make light work of mass formatting jobs.

A simple job

It would be fair to say that most desktop users are most concerned with writing letters, so we'll start with that. This job will also demonstrate some of the labour-saving devices that have been built into KWord.

1 Start a new document. The File > New command will open a dialog, allowing the selection of a page size or template. It's usual to print on A4 paper in the UK, so makes sure Text Orientated is selected, and A4 highlighted. You can also hit the 'Always start KWord with the selected template' radio button to save a bit of time in everyday use. Once OK has been hit, you'll be presented with a blank page.

2 Create a letterhead. A letterhead usually consists of your name and contact details. There are various formatting options available, but I'm going for a big name followed by address, phone and email details below. Remember not to go mad with fonts ­ just because you have a thousand on your PC, that doesn't mean you should use them all. Type the name and address, then highlight the first part. Now choose a font and type size using the drop-down menu. Once that's done, highlight it again and do Format > Create Style from Selection, give the Style a name and hit OK. A style is simply a way of adding a number of format options to any piece of text in one fell swoop. If you now do Format > Style, a fly-out menu will be displayed, showing the predefined styles, complete with your new addition. You can highlight any text, select your new style and all of the options you selected will be applied. You can edit styles by opening the Style Manager (Format > Style Manager) and working through the options.

Missing image
Personal Expressions can reduce the need for typing.

There are tons of options in here, and we'll revisit this dialog box for a more detailed look very soon. We can now add the other details, but as this is the type of information that gets added quite often, it's a good idea to set up an Expression. This is a stored text string that can be added to a document with a few clicks, which is a great shortcut for inserting things such as your address. To create an Expression, click on Tools > Edit Personal Expressions. In this dialog box, there are groups and entries. Hit New in the left section to create and name a new Group section, then hit New on the right side to add a new entry, and finally select OK. Now, to insert an expression in the letter, we select Insert > Expression > Groupname > Expressionname. Expressions will inherit the style of text under the cursor. Under the Expression menu, you may notice a selection of typical bits of text, such as salutations and closings.

3 Save as a template. We can avoid all the hassle of steps 1 and 2 next time we write a letter if at this stage we turn this file into a template. Select File > Create Template from Document, supply a name, choose where the template will go and hit OK. This will now be available next time you attempt to create a new document. Just select it and the letterhead will appear.

4 Add recipient data. This is just a case of typing in the name and address of the person receiving the letter. It's also possible to send a standard letter to a number of recipients using a mail merge (see below).

5 Insert the date. You could type the date, but sometimes it's nice to let the computer take the strain. Click on Insert > Variable > Date > Option. The latter could be the current date (either static or dynamic) or some other options. Variables inserted into Template pages can also be saved, which helps you avoid even more work.

6 Type the letter.

Missing image
It's easy to make templates of the documents you use most often.

7 Sign it. Usually you would simply print out your letter, sign it and stick it in an envelope. However, in order to demonstrate a feature, I'm going to insert a graphic of my signature. If you already have a digital signature handy, do Insert > Picture and navigate to the correct location. The picture comes into the document as a floating frame that can be positioned anywhere on the page, and text will flow around it if necessary. In the Insert dialog, you can opt to pull the image in as an inline graphic, which means it will become part of the text string it's added to. A floating image can be converted into an inline graphic by right-clicking the image and selecting Inline Frame. The picture will be anchored to the nearest piece of text. Reverse it by doing the same move. You can resize images in the same way you would any graphics package, with the handles on each corner, and they can be saved out of KWord using the Save Picture option in the right-click menu. It's also possible to scan directly into the document (if you have the correct plug-in installed), simply by selecting Insert > Scan Image.

More complex documents

Letters, while a common job, are very simple, but KWord is capable of so much more, including some pretty sophisticated DTP-style functions. For example, it's possible to create a two-column newsletter for your school, church, LUG or whatever.

Missing image
Image options, though not up to Scribus standard, are nonetheless comprehensive.

Like a traditional DTP application, KWord uses a frames metaphor for more complex design tasks. For a newsletter, we might choose a two-column layout ­ KWord ships with just such a template ­ with a separate text frame (Insert > Text Frame) across the top for the masthead, and image frames for the pictures (and further text frames for picture captions).

The text runaround options in KWord aren't extensive, and if your ambitions extend beyond the basic tools, we recommend that you take a look at Scribus instead. However, if you're happy with square runarounds, you can access the tools by right-clicking a text or image frame and selecting Frame/Frameset Properties. There are a number of options here. You can choose whether the text will run through the space where the image is (for instance, in a background image or watermark), run around it in the usual fashion, or behave as though the image (whatever its actual size) takes up the entire width of the column. You can also define the distance that the text should be set out from the image frame.

By right-clicking on a frame (of whatever content) it's possible to add a border of varying thickness or colour, and also to create Border Styles in the way we did with text earlier.

Another staple device of newsletters and other long documents, such as essays and reports, is automatic page numbers. These are simple and usually go in the footer space. Select Format > Show Footer, click inside the resulting text box and then insert the page number by clicking Insert > Variable > Page > Page Number. You could also put the author's name or document title (or anything else) in here, or in the header space at the top of the page.

There are many other dynamic options available here, which we'll cover in future tutorials, but now it's time to print out some of our work.

Printing pages

Because of the integrated nature of KDE, KWord uses the standard print dialogue, which, on first viewing, looks a little underwhelming. Underneath the surface, however, there are plenty of options to make sure you get perfect prints.

Missing image
Use the Expand button to get to all of the print options.

One difficult project to get right is something like a multi-page report that needs to be printed on both sides of the paper for binding. The first thing to do is make sure the document's margins are set correctly. Go into Format > Page Layout and check that the margins (including headers and footers) fit within the confines of your printer's useable area. A way of checking this is to do a quick Print Preview under the file menu. This attempts to render the page as you'll finally see it, and is a good place to look for problems.

Now go into the Print dialogue (File > Print) and make sure you can see all the options by clicking on the Expand button. As we're printing a double-sided multi-page document, the first thing is to select Odd Pages in the Page Set drop-down. Obviously this will print page 1,3,5, and so on, but it's important to remember not to hit the Reverse option in the Copies section. Once the odd pages are printed, it should be possible to just put the whole stack of paper (make sure it is the right way up) back into the printer tray and print the Even Pages.

KWord's mail merge

Mail merge is the term used to describe the process of setting up a document, usually a letter, and then defining specific fields such as name, address and reference number that can be filled with data from a database. Modern commerce relies to a great extent on this technology.

KWord is capable of using either an external database or an internal dataset to create a mail merge. I'm going to concentrate on the latter, because setting up and managing an SQL database is well outside the scope of this short tutorial.

Using the application's internal merge system makes setting up and executing a merge a three-stage process. First we set up the data source and then create the template letter, inserting fields as appropriate. Finally, we set the merge to work.

Missing image
Use the Expand button to get to all of the print options.

To start, open a document and then select Tools > Configure Mail Merge, and choose Create New from the source dialog. If you had an external database of names, this is where you would select it. To start from scratch, choose Internal Storage from the next dialog to open the data definition window. To begin with, only one button will be available to create a new entry. Click on it to start the process of creating records.

Missing image
The form letter is where the bare content goes.

Mail merges work by having Names associated with a range of Values, and KWord makes building this list quite easy. The first record is your template and it needs some entries, so click on the only icon available ­ Add Entry ­ and give the first entry a name. In this case, the first one might be Initial.

Press OK, then click the Add Entry icon again and input all the usual address details. Once these are configured, you can begin associating real information with the fields, so you end up with an entry like this:

   Name                 Value
   Postcode             CC1 1CC
   Town                 Bridgetown
   Address 2            Smirkland
   Address 1            17 Sesame Street
   Surname              Hooper
   Initial              I
   Salutation           Mr

This is the first entry, and once it's complete you can add more by clicking the Add Record icon and filling in the details.

The second stage of this process is to create the form letter, a `skeleton' that will take in the data from the mail merge file. To insert a field in the letter, select Insert > Variable > Mail Merge and click on the appropriate field. This needs to be done for each element of the address.

Missing image
The Mail Merge dialog box doesn't have too many options, which means there's less to go wrong.

Once the form letter is completed, print the merge. You can check things have worked before committing to a 1,000-sheet print run by using the Print Preview option under the File menu, which shows you a high-quality WYSIWYG view. If all has gone well, the fields inserted at the start of the letter should now be substituted with the details from the mail merge list.

Once that's done, you can do the same job on envelopes using the same data. Just go into the form letter file, change the paper size (Format > Page Layout) to the appropriate size, load up your printer with media and set it to work. The limitation of this is that the data stays attached to the file containing your form letter, so you'd need to use this as a base for subsequent mailings. This can be overcome by using any SQL database and the SQLsource option in KWord's Mail Merge tool though. LXF