First steps with KOffice: KWord - Part 2

From LXF Wiki

We've already covered the basics. Now Andy Channelle explores some of the sophisticated desktop publishing operations you can carry out in KWord, a challenger to's Writer.

Last issue we looked at how KWord could be used for completing basic word processing jobs and as one way of creating mail merges. This application, however, is capable of much more than mere text editing, so we'll look at som e of the advanced functionality available and conclude with a brief sojourn into the `Document Structure' tools.

Unlike the word processor in, KWord is a frames-based affair, meaning that each element, be it graphic, line or text, is housed within a frame. This is even the case with the basic single page layout, which by default consists of a single frame set to the margins of the page. You can change this set-up within the page format menu (Format > Page Layout), most obviously by adding columns under the Columns tab. If, for example, you set the page to three columns with a 4mm gap (gutter) the result will be a page with three frames that can be independently formatted.

To set the colour of an individual frame, select it by clicking on one of the edges then right-click and select `Frame/Frameset Properties....'. Within this dialog box you can select a colour and fill style and also define the frame's `geometry' which, on a text frame, is what KWord calls the process of setting the margins for each one. In the screenshot below, the far-left blue column has a text inset of two millimetres all round so that the words don't butt against the edges of the frame.

Missing image
Using frames means each column can be configured individually.

The frames/columns set up in the page layout dialog box are pretty much immovable, so are best used as a guide for creating bespoke frames and framesets (the latter is simply a collection of frames) which can be moved around freely.

Missing image
1/ The result of our work so far: a nice picture and some empty boxes.

Frames come in four flavours: picture, text, formula and object. Object is used to insert documents created elsewhere within the office suite into the page. For instance, a live spreadsheet could be incorporated into a business proposal, allowing the document to reflect the latest changes in the financial data, or a Kugar report could be added to the document. Once it's inserted, double clicking on an object will launch the application associated with it for further editing.

Missing image
Use Frame Style Manager to alter background and borders of text boxes.

Frames provide a certain flexibility when it comes to laying out pages. A basic layout can be built before any content is added and then tweaked, or completely reworked, once the text and images have been introduced to the page.

To add a frame, simply click the corresponding icon on the vertical toolbar to the left of the screen. Selecting the Text icon will allow you to draw the frame directly on to the page and the Formula option will create an inline frame and display a selection of mathematical characters along the bottom of the screen. The Picture icon will launch the normal file selector, enabling you to choose the image to import, while the Object icon will open a dialog showing the available formats.

Missing image
2/ With text added, the page begins to look like a proper layout.

Frames can be layered, just like images in Gimp, but for design-intensive jobs that will require extensive layering, you're better off with a dedicated desktop publishing or illustration package such as Scribus or Inkscape.

Table of contents

Set up your page

In this demonstration we've started out on a standard A4 page with a two-column layout. We're using the column frames as guides, and the frames themselves won't have any content; so the first job is to create a text frame one column wide and about half a page in depth. Once this is done, select the frame by clicking on one of the edges and open the properties dialog. Give the frame a name in the `Connect Text Frames' tab (we've gone for `quotation'). Halfway down the page is a shorter text box (called `title') covering the entire width of the page, and below that and to the right is a shallow one-column text box (named `born/died').

One thing to note is that the placing of these boxes is not as easy as it could be thanks to some odd snap setting, but more precise movements are possible using the right-click menu to open the `Frame/Frameset Properties...' dialog, in which you can change the position and location of boxes numerically. For more precise tools, again we'd suggest you try a real DTP package.

Below the title box we have created a single-column text box filling the rest of the page (which we've called `body'). We then add a similar text box on the right hand side of the page, but when the `Connect Text Frame' dialogue opens, select the `body' frame. This will ensure that text overflowing from the first column will end up in the second one.

To add a picture in KWord we hit the Insert Picture icon, find and select an image and then draw a frame on the top right of our layout (see Fig 1).

At present all of these boxes will be endowed with the basic KWord style ­ that is with no borders, runaround on, and a white background with black text. These defaults will mess with the design. Better to start with nothing, so select any of the text frames and open the properties dialog.

In the `Text Run Around' tab, select `Text will run through this frame'. In the `Background' tab, select `No Background Fill' in the Background drop down list and hit the `OK' button. Now reselect the frame and, in the right-click menu, select `Create Framestyle from frame' and give the new style a name ­ we've chosen `Basic'. We can give each frame in turn the same style via `Frames > Framestyle > Basic'.

Just as with the text styles we looked at in LXF63, it's possible to edit frame styles after they have been used and see the changes reflected in every box set with that style. To edit a frame style, go through `Frames > Frame Style Manager' and use the three tabs to configure background and border elements. You will notice in the style manager a number of readymade frame styles, which can be used as a basis for your own creations.

We now proceed to insert text into the various boxes, formatting as required (see Fig 2). To get a better idea of what the printout will look like, go into the `View' menu and switch of the `Frame Borders' option. Note that we will need to add a page number (`Insert > Variable > Page > Page Number' in the page footer) and other document information.

Missing image
Once you've created a table it's easy to format it.

Easy text navigation

For this tutorial, we're using a short text biography about philosopher Walter Benjamin, with a quotation from a major work and an image. As it's part of a much longer document on modern Western philosophy, this page will be saved as a template for later recall and customisation. We also need to revisit the Text Styles manager to sort out one detail which will save a lot of work later on.

In the text Style Manager (`Format > Style Manager'), select the style associated with the author's name, which we put in the text box called `name'. Under the `General' tab, we simply click on the radio button marked `Include in table of contents'.

On subsequent pages we can make sure author names are formatted with this style to have them automatically included in the table of contents. To create the table of contents (TOC) itself (and this is where forward planning comes into its own, as the TOC usually occurs near the front of a document) draw a text box, select it and go to `Insert > Table of Contents'. KWord will comb through the document finding a paragraph style with the `add to toc' option selected, and then add each piece of text along with its corresponding page number. By default, anything formatted with the Head1 style will be added to the TOC, as well as those styles defined by you.

As the table of contents is not strictly dynamic, it remains the same until it is updated with a quick call to `Insert > Update table of contents', when KWord will redo the document scan and add/update changes to the document.

Along with the creation of the TOC, KWord will also add a number of text styles to the Style Manager (depending on the extent of your original formatting) to cover headings and subheadings. By altering these styles it is possible to format the TOC to remain in keeping with the rest of the document.

In practice we found the table of contents features were a little flaky, but for long documents well worth persevering with.

Top tables

Tables have become an integral part of general document preparation, so it's lucky that KWord is pretty adept at creating them. Like the other jobs we've looked at, the application comes with a selection of pre-built templates which, if they don't fit the bill completely, can at least be used as a starting point for your customisations.

KWord is capable of generating tables of up to 128 x 128 cells. For anything larger, you will probably find it more productive to fire up KSpread, and if you need the facilities of a spreadsheet within KWord, you can embed a sheet using the `Insert > Object Frame > Spreadsheets' option.

Inserting a table can be accomplished in three ways. Either hit <F5>, select the appropriate icon from the vertical toolbar on the left of the screen or via `Insert > Table'. Whichever way you choose to do it, a table dialogue box will be launched. In here we can select the number of rows (top to bottom) and

columns (left to right) which will make up the table.

Tables can be inserted either `inline' or `framed'. With `inline', the table will be anchored to its place in the text and is useful when a table relates specifically to a part of a document (adding lines of text above the table will cause it to flow with the rest of the document). Choose `framed' and it will be free floating like any other frame and can be moved around, though in practice we found moving framed tables around a little frustrating.

We're creating a five by five magic square so we start by setting both rows and columns to `5'. For framed tables there are a couple of options available: cell height and width can be either `manual' or `automatic'.

If automatic width is selected, the table will cover the entire area between the page margins regardless of how you `draw' the table. Select `manual' for more control of the width of the table. If you select automatic height, each cell will be set by the size of the currently defined text. Again, use manual for better control over the depth of each row.

Using an inline frame reduces the options to one (automatic on both row and column) but these can be altered on the fly by clicking and dragging the grid lines around.

Once the table is to your liking, you can click into any cell and begin typing; cells are currently restricted to handling text and KWord doesn't appear to be able to handle nested tables (tables within tables), so it's not a good choice if you want to create a tables-based web page.

Cells can be edited individually or by row or column. To change the background of an entire row ­ useful for table headings ­ hover the mouse over the leftmost border of the row you'd like to change, and click when the hand icon presents itself. Now right-click inside any of the highlighted cells and

select `Frameset/Frame Properties'. In the background tab, choose the colour you want and hit `OK'. It's also possible to reduce this selection to an individual frame, but it's very fiddly and involves <Shift>+Click often and, it seems, at random. It's better to use Table Styles (see below)

Once selected, rows and columns can also be formatted (in terms of text) as a group. It's possible, for example, to set the text in our top row to `centred' and `bold' using the normal options. However, before going to town on the formatting options, it's worth looking at the included templates, which

cover most uses.

Navigating between cells can be accomplished with the <tab> key, in which case the cursor will move left­right/top­bottom; <Shift>+<tab> (right­left/bottom­top) or with the cursor keys.

KWord allows you to alter the structure of tables (by changing the number of rows and columns) after they have been introduced into the text.. Rows and columns can be inserted or deleted by right-clicking on the appropriate column or row and choosing the right option from the menu. It should go without saying that deleting a row or column will remove its content so think before deleting. On inserting a new row or column you will be asked whether it should go before or after the one which you have selected at the time.

Note that cells added after you've generated the table will not automatically take the format of your table template. To ensure that subsequently-added cells have the parameters you want, ensure that you've selected the `Reapply template to table option in the template dialogue.

Finally, in terms of tables, you can edit or define Table Styles, which can then be applied to rows, columns or individual cells. The Table Style Manager follows the conventions of the other KWord `Managers' we've already looked at and should present no problems. Applying a style simply involves placing the cursor in a cell (or selecting a row or column as described above) and then selecting `Table > Tablestyle > Style name'.

Document structure

Once you start adding pictures, frames, tables and other content, documents quickly become unwieldy to manage, especially when it comes to selecting frames that may be placed underneath other frames. The Document Structure window (`View > Doc Structure' if the pane isn't visible just to the left of the main editing window) can be a life-saver in this situation.

In order to demonstrate the usefulness of this tool we have thrown the tables created in the section above into our original document, which makes for a pretty complex product.

This window follows the same conventions as a normal filesystem tree-like structure, and benefits from forward-planning with regards to naming of elements. If the document contains text, pictures, embedded objects, formulae or tables, there will be a headline entry in the Document Structure pane.

Now let's suggest that at the bottom of an extensive stack of layers, there is a text box with a glaring spelling mistake. You could painstakingly move every layer out of the way and edit the text, or we could right-click on its entry in the document structure and select `Edit Text Frameset'. This will place the cursor at the starting point of the text, allowing you to navigate to the error using the cursor keys. For more extensive editing you could, once the frame is selected, can bring it to the front with `Frames > Bring to Front' and then put it back precisely where it was with `Frames > Lower Frame'.

From this pane we can also adjust the Frame's properties without actually trying to grasp the frame edges. We can also delete a frame from the same context-sensitive menu.. LXF