Pamela Robert
pamroberts@blueyonder.co.uk
&kspread; Basics Like the rest of &tde;, &kspread; is highly configurable, which can cause problems for readers trying to compare the text in a document such as this with what they see on the version of &kspread; running on their desktop. To cut down on some of the possibilities for confusion, it it suggested that when you first start to use &kspread; you set the default options in all pages of the &kspread; configuration dialog (obtained by selecting SettingsConfigure &kspread;...) except for Completion mode: in the Misc page, which should be set to None. You may also find it helpful to globally Enable tooltips in &kcontrolcenter; in Appearance & ThemesStyle on the Style page. Spreadsheets for Beginners This section attempts to explain by example what a spreadsheet program such as &kspread; actually does, and why it is such a useful tool in any situation where you have to deal with numbers. If you have already used a spreadsheet program you may wish to skip to the next section. The first thing to do is to start up &kspread;. You can do this by left clicking on a &kspread; icon if there is one on your desktop or panel, or you can select Office&kspread; from the K menu. &kspread; at first run When it has started you will be given the choice of opening a recent document, creating a new document from a template (with templates categories) or opening an existing document . Select the General category on the left and choose the Blank Worksheet template. Then click the Use This Template button. Looking at &kspread; once it has started up, you will see a sheet of empty rectangular cells arranged in numbered rows and lettered columns. This is where you enter data or formula, text or charts. Screenshot starting1 Now, enter the text and values shown in the first 5 rows of the above screenshot into the same cells of your spreadsheet. Ignore what is in row 7 for the moment. To enter anything into a cell first select the cell by left clicking inside it, then type whatever you want, then press Enter or use the arrow keys to move the selection point to another cell. What we have entered so far could be a simple budget for the next two months, listing how much we think we will be spending for Food, Shelter, Clothing and any Other expenditure. Now select cell B7 (column B, row 7), type in =B2+B3+B4+B5 and press Enter. Because it begins with a = symbol &kspread; sees this as a formula, something it has to calculate, in this case by adding together the values in the 4 cells B2 to B5, and what is shown in the cell B7 is the result of that calculation. You could enter a similar formula into cell C7, except that in this case it would have to be =C2+C3+C4+C5, but there is an easier way which is to Copy cell B7 and Paste it into C7. &kspread; will automatically adjust the cell references from B.. to C.. when the Paste is done. At this point you may think that &kspread; is doing no more than you could manage with pencil, paper and a calculator, and you could be right, but remember that this is a very small example of a spreadsheet, doing simple calculations on only a few numbers. For any reasonably amount of values or data using a spreadsheet to do the calculations is much quicker and more accurate than doing them manually. Also, a spreadsheet lets you play the What if? game. Because each formula is automatically recalculated whenever any of the values it refers to are changed, you can quickly see what happens if you alter any of them. Using our example you can see the effect of reducing the amount spent on food in December by just entering a new value into cell C2. If you had a spreadsheet that modelled the greenhouse effect accurately you could perhaps see the effect of a 50 percent reduction in the amount of methane released into the atmosphere. Selecting Cells You can select a single cell or a rectangular area of cells in the spreadsheet. The selected cell(s) are displayed with a thick black border. You can select a single cell in one of the following ways left click on it enter the cell reference (for example B5) into the cell reference box at the left end of the Formula toolbar and press Enter use the ViewGoto Cell... menu option You can also steer your way around with the arrow keys. Pressing the Enter key will move the current selection one position up, down, left or right depending on the setting in the Misc page of &kspread;'s configuration dialog box. If you hold the &Shift; key down while using the arrow keys the selection will move to the start or end of the block of occupied cells. To select an area of contiguous cells drag the mouse cursor across the desired area with the left button held down, or enter the references of the top left and bottom right cells separated by a colon into the Formula toolbar cell reference box (for example B7:C14 ) and press Enter, or enter these cell references in a similar format into the dialog box brought up by ViewGoto Cell.... You can also select an area of cells by selecting the cell in one corner of the wanted area then holding the &Shift; key down while using the left mouse button to select the cell in the opposite corner. To select a complete row or column of cells left click on the row number at the left of the worksheet or on the column letters at the top. To select adjacent rows or columns drag the mouse pointer over the appropriate row numbers or column letters with the left button held down. To select non-contiguous cells, click on the first cell you want to select then hold the &Ctrl; key and select the other cells. Entering Data Entering data into a cell can be as simple as selecting the cell, typing your data, then pressing Enter or moving the selection to another cell with one of the arrow keys. Depending on how you enter the data, &kspread; will interpret it as a number, date, time or text: Numbers are entered in the obvious way; 123, -123, 456.7 or in scientific notation -1.2E-5. Dates should be entered in your System format, as defined in the &kcontrolcenter; in Regional & Accessibility Country/Region & LanguageTime & Dates dialog box. If, for example, you are using the DD/MM/YYYY form you should enter 30/03/2002 for 30th March 2002. Leading zeroes can be omitted from the day and month fields and only the last one or two digits of the year need to be entered if the date is in the current century, for example 9/1/2 for 9th January 2002. Times should also be entered using the System format. For example if you are using a 12 hour clock then enter times in HH:MIN am|pm or HH:MIN:SS am|pm format such as 9:42 am or 10:30:52 pm. &kspread; defines any input data as text if it cannot recognize the data as being a number, date or time. By default, &kspread; right justifies numbers, dates and times within a cell and left justifies anything else. This can be a useful guide to whether you have entered a date or time in the correct format. But remember that how items are displayed can be changed by altering the cell format. The main text entry box in the Formula toolbar provides an easy way of editing the contents of a selected cell. Press Enter or left click on the green tick mark when you are happy with what you have entered, or click on the red cross to cancel your edits. Generic Cell Format &kspread; uses the Generic cell format as default. As long as this format is used, &kspread; autodetects the actual data type depending on the current cell data. For example if you enter some text into a cell and later enter a number into the same cell, &kspread; automatically interprets the new data as a number. If you want to define the type of data yourself, you can explicitly set it in the cell format. You can change the format back to Generic at any time. Copy, Cut and Paste At first glance, &kspread;'s Cut, Copy and Paste appear to be similar to these functions in other &tde; applications. Having selected a cell or cells, you can choose Copy or Cut from the Edit menu or from the drop down menu you get by holding the right mouse button down on a selected cell. You can also use the shortcuts &Ctrl;C or &Ctrl;X , then move the selection to the target cell and choose Paste or press &Ctrl;V. However there are some subtleties associated with these functions in &kspread; and these are discussed below. If a cell contains a formula then the formula itself is copied rather than the displayed result, and if the formula contains a reference to another cell, then that reference is changed by the Cut or Copy and Paste operation to point to the cell that is in the same relative position as in the original cell. For example if cell A2 contains the formula =B3 and is copied to C4, cell C4 will contain =D5 . This may seem to be a rather strange way of doing a copy, but 99 percent of the time it is exactly what is wanted (if it is not then see the section about absolute cell references). For example in the simple shopping list shown below, cell D2 should contain =B2 * C2, D3 should be =B3 * C3, D4 should be =B4 * C4 and so on. Instead of having to enter a different formula in each cell, you can just enter the first formula into D2 and then copy it into the cells below, letting &kspread; adjust the cell references to suit. Screenshot copy1 Copying and Pasting Cell Areas In the above example D2 can be copied into all three cells D3 to D5 at once by just copying D2 then selecting the complete cell area D3:D5 before doing the paste. A rectangular area of cells can be cut or copied in one operation by selecting the area before doing the cut or copy. Then select the top left corner cell of the area you want to paste into before doing the paste. If you cut or copy a rectangular area of cells, say B2:C3, and paste it into a larger area such as A10:D13 the original pattern of cells will be repeated to fill the target area. &kspread; also provides a Drag and Copy method for copying cells down into other cells immediately below or to the right of the original cell(s). To use this method select the cell(s) to be copied then position the mouse pointer over the small black square at the bottom right corner of the selected cell(s) so the cursor changes to a double headed arrow. Then hold the left mouse button down while you drag the selected cell(s) as far as you wish. Note that cell references in formulae are incremented according to the relative position change. Absolute references are not changed. Other Paste Modes A cell may contain text, a value, or a formula, and may also contain special font, border or background formatting information. &kspread; has special versions of Paste that let you handle these items in different ways. EditSpecial Paste...brings up the Special Paste dialog box. By selecting the appropriate item from the top part of this dialog you can choose to paste just Text , the cell Format, any Comment in the cell(s) or Everything without border. The items in the bottom part of this dialog box allow you to do simple arithmetic on an area of cells. Paste with Insertion... inserts the copied cell(s) into the sheet by moving the cells that would otherwise be overwritten a suitable number of rows of columns down or to the right. It can also be used to insert complete copied row(s) or column(s) into the worksheet. Insert and Delete Use the Delete key or Edit ClearText to remove the text, value or formula from selected cell(s), row(s) or column(s) without affecting anything else. To delete everything in the selected cell(s), row(s) or column(s), including comments and special formatting, use &Shift;Delete or choose the Delete option from the Edit menu or from the pop up menu you get when you right click on a selection. To remove selected row(s) or column(s) completely, use the Delete Rows or Delete Columns options from the right mouse button pop up menu. If you select a cell or cells and choose Remove Cells... from the right mouse button pop up menu, you can then choose whether other cells in the worksheet will be moved up or to the left to fill in the space left by the cell(s) you have chosen to remove. If you want to insert new, blank, row(s) or column(s) into the sheet, select row(s) or column(s) where you wish the new row(s) or column(s) to be placed and choose the Insert Rows, Insert Columns option from the right mouse button pop up menu. You can insert new cells into the worksheet by selecting the area where you want them to appear then choosing the Insert Cells... option from the right mouse button pop up menu. You will then be asked whether the existing cell(s) in the selected area should be moved down or to the right to make room for the new ones. Simple Sums If the first character in a cell is an equals sign (=) &kspread; will take the cell contents to be a formula which is to be calculated. The result of the calculation will be displayed in the cell rather than the formula itself. For example, enter =2+3 into a cell and it should display 5. More usefully, a formula can contain references to other cells, so that =B4+A3 will calculate the sum of the values in cells B4 and A3, and this calculation will be updated whenever cells B4 or A3 are changed. As well as addition, a formula can make use of the - symbol for subtraction, * for multiplication, and / to perform division. The round bracket symbols ( and ) can also be used as in normal algebra, so you could enter more complex formulae such as =((B10 + C3) *5 - F11) / 2 . Cells containing a formula will be marked with a small blue triangle at the bottom left corner if the Show formula indicator check box in the Format SheetSheet Properties dialog is checked. &kspread; also includes a large number of built-in functions for applications such as statistical, trigonometrical and financial calculations. Their use will be examined in more depth in a later section of this manual, but if you are interested at this stage choose Function... from the Insert menu and take a look through the Function dialog box that will be displayed.. For the time being, however, the SUM function may be of interest as it calculates the sum of all values in a specified area of cells. For example =SUM(B4:C10) calculates the sum of all values in the cell area B4 to C10. If &kspread; displays a row of # symbols when you have entered your formula this usually means that it cannot understand what you have entered, but if the row of # symbols ends with a small red arrow this just means that the cell is not wide enough to display the complete result, in which case you should either make the cell(s) wider or change their format so that the result does fit properly. Recalculation If the Automatic recalculation box in the Format SheetSheet Properties dialog box is checked, &kspread; will recalculate the values of cells whenever anything that affects them is changed in the sheet. When Automatic recalculation is not checked for the current sheet, you can instruct &kspread; to perform a recalculation at any time by using the Recalculate Sheet or Recalculate Document option in the Tools menu or their shortcuts &Shift;F9 or F9. Sorting Data In the simple example shown below, the data consist of the names and countries of a number of mountains together with their height above sea level. &kspread; can sort data such as this in different ways. Screenshot of sorted data We may want the data sorted so that the names are in alphabetical order. To do this select the area containing the data (A2:C7 in this case) and choose Sort... from the Data menu. This opens the Sorting dialog box. Sorting is done alphanumerically, and the default is case sensitive, numbers coming before uppercase letters which come before lowercase letters, so that cells containing the entries Cat, bar, 77 and Bat would be sorted into the following order: 77 Bat Cat bar. Using the Sort Criteria page of this dialog box lets you Sort Rows or Sort Columns. If you check the First row contains headers box data in the first row will not be included in the sort operation. You can choose which column or which row of the data is to be used as a primary sort key and, if you wish, other columns or rows to be used as secondary and tertiary keys. Using the example in the above screenshot, choosing column B as the first key and column C as the second would sort the data by country and, for each country, by height. The Options page of the dialog allows you to sort using the order of items in a custom list such as January, February... instead of alphanumerically. The cell format is moved with the cell content, if you select Copy cell Formatting (Borders, Colors, Text Style) Uncheck the option Case sensitive sort to get a sort not depending on capitalization. The Status bar Summary Calculator The left hand end of the Status bar shows a summary of the values in the selected cell(s). According to the setting of the Method of calc: combo box in the Misc page of &kspread;'s configuration dialog the summary can be: Sum The value displayed is the sum of the values in the selected cells. Min The value displayed is the minimum of the values in the selected cells. Max The value displayed is the maximum of the values in the selected cells. Average The value displayed is the average of the values in the selected cells. Count The value displayed is the number of cells containing numeric values. None No summary calculation is performed. The method of calculation can also be changed by right clicking on the summary calculation result area of the Status bar and choosing an item from the pop up menu. Saving your Work &kspread; saves the complete document, which may include more than one worksheet, as a single document file. If you have created a new document, or want to save an existing one under a different name, use File Save As.... This will bring up &tde;'s common Save Document As dialog box. Choose the folder where you want to save the document and enter a suitable file name into the Location: text box. &kspread; documents are normally automatically saved with a .ods extension, you do not need to add this to the filename but do make sure that the Filter: selection is set to OASIS OpenDocument SpreadSheet. To save your document without changing its name, just use FileSave. You can also save a &kspread; document in a foreign format: see the Import/Export section for more information about doing this. When you save a modified version of an existing document &kspread; will keep the previous version as a backup file, adding a ~ to the end of the filename. &kspread; can provide some protection against losing your work because of a computer crash or because you have closed &kspread; without saving the current document. It does this by automatically saving the latest version of the document you are working on every few minutes using a modified file name. The autosaved version is normally removed when you next save your document, so that it will only exist if it is more up to date than the version that was saved manually. When you open a document &kspread; checks to see if an autosaved version exists, and if it finds one it will offer to open that instead. Autosaved documents are saved with a file name of the form .yourfilename.autosave (note the leading period), so that spread1.ods would be autosaved as .spread1.ods.autosave. The autosave feature is user configurable in the settings dialog. Templates If you are going to be creating a lot of similar documents you can save yourself time and trouble by first creating a template and then using that as the basis for the individual documents. To do this first create a document containing the common elements, then save it as a template by choosing File Create Template From Document.... Doing this opens the Create Template dialog box. Enter a name for your new template into the Name: text box and press OK. The next time you start a new document by choosing FileNew or when you next start &kspread; the startup dialog window will give you the option of creating the new document from your template. The Create Template dialog box also lets you choose a different picture to be displayed above the template name in the startup dialog window, and lets you save your templates under different group names, which will appear as different pages in the dialog. Printing a Spreadsheet Printing a spreadsheet is basically done by selecting FilePrint... which brings up &tde;'s common Print dialog box where you can choose, among other options, the printer to be used, the number of copies and whether all or only selected pages are to be printed. By default &kspread; will print all items in the current worksheet, but you can restrict this by first selecting the area that you want to be printed then choosing Define Print Range from the FormatPrint Range sub menu. &kspread; will print as many pages as are necessary to include all items in the current worksheet. You can quickly see how a worksheet will be spilt into separate pages for printing by checking the View Show Page Borders box. The boundaries of each printed page will then be marked by colored lines in the worksheet. For a more detailed view of what is to be sent to the printer, including anything you have asked to be included in the page headers and footers (see below), choose FilePrint Preview.... To improve the appearance of the printed output , you can change the fonts, colors, borders and sizes of the cells in the worksheet, see the Spreadsheet Formatting section for more details about how to do this. You can also use the Page Layout dialog box, invoked by selecting FormatPage Layout..., to change the orientation of the printed pages, the paper size (this should be suitable for your printer) and the size of the page borders. The Header & Footer page of the Page Layout dialog box also lets you add text, including items such as the filename, date and page number to the header and footer, of each printed page. The Ranges section of the Options page of the Page Layout dialog box provides an alternative way of restricting the printed output to just one part of the worksheet and allows you to repeat selected column(s) or row(s) on each printed page. This page also lets you select whether or not to print the grid, comment indicators and formula indicators, objects and charts. In the section Scale Printout you can set a scalefactor or limit the number of pages for the print.