Ashish
Ashish
Styles
Bundles formatting attributes under one name. For example, a paragraph style
defines numerous settings such as font type and size, whether paragraphs should
be indented, the space between lines, how paragraphs should be aligned on the
page, and many others.
Because styles apply whole groups of attributes at the same time, you can easily format
a document consistently and change the formatting of an entire document with minimal
effort. Styles are also used by LibreOffice for many processes, even if you are naot
aware of them. For example, Writer relies on heading styles (or other styles you specify)
when it compiles a table of contents. Some common uses of styles are given in
“Examples of style use” on page 1.
Note
Direct formatting overrides styles. You cannot remove manual formatting by
applying a style to it. To remove direct formatting, select the text, right-click,
and choose Clear Direct Formatting in the context menu. Alternatively you can
clear direct formatting from selected text by
pressing Ctrl+M (Ctrl+Shift+M in Impress), by
selecting Format > Clear Direct Formatting on the Menu bar, by selecting
the Clear Direct Formatting icon on Writer’s Formatting toolbar, or by
selecting the Clear Direct Formatting icon on Calc’s Standard toolbar.
Page styles include margins, headers and footers, borders and backgrounds. In
Calc, page styles also define the sequence for printing sheets.
Paragraph styles control all aspects of a paragraph’s appearance, such as text
alignment, tab stops, line spacing, and borders, and can include character formatting.
Character styles affect selected text within a paragraph, such as the font and
size of text, or bold and italic formats.
Table styles apply predefined formats to tables and table elements in a text
document.
Frame styles are used to format graphic and text frames, including text wrap,
borders, backgrounds, and columns.
List styles allow you to select, format, and position numbers or bullets in lists.
Cell styles include fonts, alignment, borders, background, number
formats (for example, currency, date, number), and cell protection.
Drawing styles in drawings and presentations include line, area,
shadowing, transparency, font, connectors, dimensioning, and other attributes.
Presentation styles include attributes for font, indents, spacing,
alignment, and tabs.
Different styles are available in the various components of LibreOffice, as listed in Table
1. Details are given in the user guide for each component.
LibreOffice comes with many predefined styles. You can use the styles as provided,
modify them, or create new ones, as described in this chapter.
Frame X
List X
Table X
Cell X
Presentation X X
Drawing X X
Applying styles
LibreOffice provides several ways for you to select and apply styles:
Styles deck on the Sidebar
Styles menu on the Menu bar (Writer and Calc)
Set Paragraph Style list (Writer) and Apply Style list (Calc) on the Formatting
toolbar
Right-click context menu (Writer and Calc)
Fill Format mode (Writer and Calc)
Keyboard shortcuts
To apply a paragraph style, position the cursor anywhere in the paragraph, and then
select one of the paragraph styles in the Styles menu. To apply a character style to
several characters or more than one word, select the characters first and apply the
character style from the menu.
In Calc, the Styles menu has cell styles and style management entries. To apply a cell
style, select the cell or group of cells to be formatted, and then select the required style.
Set Paragraph Style list (Writer) and Apply Style list (Calc)
In Writer, after you have used a paragraph style at least once in a document, the style
name appears in the Set Paragraph Style list at the left-hand end of the Formatting
toolbar.
In Calc, after you have used a cell style at least once in a spreadsheet, the style name
appears in the Apply Style list at the left-hand end of the Formatting toolbar. If the Apply
Style list is not visible, you can enable it using one of the methods given in “Customizing
toolbars” in Chapter 1, Introducing LibreOffice.
You can open this list and click the style you want, or you can use the up and down
arrow keys to move through the list and then press Enter to apply the highlighted style.
Tip
Select More Styles at the bottom of the list (not shown in illustration) to
open the Styles deck on the Sidebar. You may need to scroll down the list to
see it.
Figure 2: The Set Paragraph Style list in Writer
n
Context (right-click) menu (Writer and Calc)
In Writer, right-click anywhere in a paragraph to open the context menu; choose
Paragraph. Or, right-click in a word and choose Character in the context menu. In Calc,
right-click in a cell and choose Styles in the context menu.
In each case, the submenu includes some commonly used styles. You can add styles to
this submenu; see Chapter 14, Customizing LibreOffice.
1) Open the Styles deck on the Sidebar and select the style you want to apply.
2) Click the Fill Format Mode icon at the top of the Styles deck.
3) To apply a paragraph, page, frame, or cell style, hover the mouse over the
paragraph, page, frame, or cell and click. To apply a
character style, hold down the mouse button while selecting the characters.
Clicking on a word applies the character style to that word.
4) Repeat step 3 until you have applied that style everywhere you desire.
5) To quit Fill Format mode, click the Fill Format Mode icon again or press the
Esc key.
Keyboard shortcuts
Some keyboard shortcuts for applying styles are predefined. For example, in Writer
Ctrl+0 applies the Text Body style, Ctrl+1 applies the Heading 1 style, and Ctrl+2
applies the Heading 2 style. You can modify these shortcuts and create your own; see
Chapter 14, Customizing LibreOffice, for more details.
Modifying styles
LibreOffice includes some predefined styles, and you can create custom styles (see
page 1). You can modify both predefined and custom styles in several ways:
A Style dialog is displayed with title, content, and layout dependent on the type of style
selected. Each variant of the dialog has several tabs. See the chapters on styles in the
component user guides for more information.
Tip
You can also access the relevant Style dialogs through the Set Paragraph
Style (Writer) and Apply Style (Calc) lists. Click the arrow at
the right of the entry for the style to be modified and select Edit Style in the
context menu. You can access the appropriate Style dialog for the style of
the current selection by going to Styles > Edit Style on the Menu bar.
Krishank
Tip
Other ways to modify the current style include
pressing Ctrl+Shift+F11 (Writer), selecting Styles > Update Selected
Style on the Menu bar (Writer and Calc), or clicking the Update
Selected Style icon on the Formatting toolbar (Writer).
You can also modify a style through the Set Paragraph Style (Writer) and
Apply Style (Calc) lists. Click the arrow at the right of the entry
for the style to be modified and select Update to Match Selection in the
drop-down menu (Figure 4).
Figure 4: Modifying a style from the Set Paragraph Style list
Krishank
Tip
If you are in the habit of manually overriding styles in your document, be
sure that AutoUpdate is not enabled.
The new style will inherit characteristics from the style that you selected. If you later
change the base style (for example, by changing the font from Times to Helvetica), all
the linked styles will change as well. Sometimes this is exactly what
you want; other times you do not want the changes to apply to all the linked styles.
You can change any of those characteristics using the Style dialog.
The dialogs and choices are the same for defining new styles and for modifying existing
styles. See the chapters on styles in the user guides for details.
1) Open the Styles deck on the Sidebar and choose the category of style you
want to create.
2) In the document, select the item you want to save as a style.
3) On the Styles deck, click on the Styles actions icon and click the New Style
from Selection menu item in Writer or the New Style from Selection icon in
Calc, Draw, and Impress.
4) In the New Style from Selection dialog (Figure 5), type a name for the new
style. The list shows the names of existing custom styles of the selected
category. Click OK to save the new style.
Figure 5: Naming a new style created from a selection
Krisha
nk
Tip
You can also create a new style from a selection by pressing
Shift+F11 (Writer), by selecting Styles > New Style from Selection (Writer,
Calc), or by clicking the New Style from Selection icon
on the Formatting toolbar (Writer).
Dragging and dropping to create a style
You can drag and drop a selection into the Styles deck to create a new style. The
element to drag depends upon the LibreOffice application.
Writer
Select some text and drag it to the Styles deck to open the Create Style dialog. If
Paragraph Styles are active, the paragraph style will be added to the list. If
Character Styles are active, the character style will be added to the list.
Calc
Drag a cell selection to the Styles deck to open the Create Style dialog and create
a cell style. (Click and then Shift+Click to select the cell.)
1) Create a table and apply formatting for cells, backgrounds, borders, and more.
2) Select the whole table.
3) Drag the table and drop it in the Table Styles category of the Styles deck in the
Sidebar.
Alternatively:
1) Create a table and apply formatting for cells, backgrounds, borders, and more.
2) Click in the table and select Table > AutoFormat Styles on the Menu bar.
On the AutoFormat dialog (Figure 6), click the Add button.
3) In the pop-up dialog, enter a name for the new table style, and then click OK.
4) The new table style is now listed in the left pane of the AutoFormat
dialog. Click OK again to close the dialog.
The new table style can be applied to tables as described in “Applying styles” on page 1.
Figure 6: Table AutoFormat dialog
Krisha
nk
Tip
You can also access the Load Styles dialog by selecting Styles > Load Styles
from Template on the Menu bar.
Insert Image and graphics in documents
You can add graphic and image files, including photos, drawings, and scanned images,
to LibreOffice documents. Images in LibreOffice are of these basic types:
This chapter covers images, diagrams, and Fontwork. For more detailed instructions on
working with drawing tools, see the Draw Guide and Impress Guide. Instructions on how
to create charts are given in the Calc Guide.
LibreOffice can import various vector (line drawing) images, and can rotate and flip such
images. LibreOffice also supports raster (bitmap) file formats, the most common of
which are GIF, JPG, PNG, and BMP. See Appendix B for a full list of the graphic formats
LibreOffice can import.
LibreOffice can also import SmartArt images from Microsoft Office files. For example,
Writer can open a Microsoft Word file that contains SmartArt, and you can use Writer to
edit the images.
To edit photos and other bitmap images, use a bitmap editor. To edit line drawings, use
a vector drawing program. You do not need to buy expensive programs. For many
graphics, LibreOffice Draw is sufficient. Open-source (and usually no-cost) tools such as
GIMP (bitmap editor) and Inkscape (vector drawing program) are excellent. These and
many other programs work on Windows, macOS, and Linux.
1) Open a file browser window and locate the image you want to insert.
2) Drag the image into the LibreOffice document and drop it where you want it to
appear. A faint vertical line marks where the image will be dropped.
Insert Image dialog
1) Click in the LibreOffice document where you want the image to appear.
2) Choose Insert > Image on the Menu bar or click the Insert Image icon on
the Standard toolbar.
3) On the Insert Image dialog, navigate to the file to be inserted, and select it.
4) At the bottom of the dialog (Figure 1) is a Link option. See “Linking an image
file” below for the use of Link.
5) Click Open.
Note
If you choose the Link option, a message box appears when you click
Open. It asks if you want to embed the graphic instead. Choose Keep
Link if you want the link, or Embed Graphic if you do not. To prevent this
message from appearing again, deselect the option Ask when linking a
graphic at the bottom of the message.
Figure 1: Insert Image dialog
Krishank
Krisha
nk
1) Open the document in LibreOffice and choose Edit > Links to External Files.
2) In the Edit Links dialog (Figure 2), select the files you want to change from
linked to embedded.
3) Click the Break Link button and then click Yes to confirm embedding the
image.
Although this practice is quick and easy, it is unlikely to result in a high-quality image of
the correct size. You may get better results by scanning material into a graphics
program and cleaning it up there before inserting the resulting image into LibreOffice.
To insert an object as a link, hold down the Shift and Ctrl keys and drag and drop the
object into the document.
Cropping images
When you are only interested in a section of the image for the purpose of your
document, you may wish to crop (cut off) parts of it. LibreOffice provides two ways to
crop an image: the Crop tool and the Crop tab of the Image dialog in Writer (accessed by
right-clicking on the image and selecting Properties in the context menu). The Crop tool
provides a quick and easy way to crop an image; but for more control, use the Image
dialog. For more information, see the Writer Guide.
Note
If you crop an image in LibreOffice, the image itself is not changed.
LibreOffice hides, but does not cut off, part of the image. If you export the
document to HTML, the original image is exported, not the cropped image.
For exporting individual cropped images, see “Exporting (saving) images”
below.
Resizing an image
To fit the image into your document, you may need to resize it. A quick and easy way to
resize is by dragging the image’s sizing handles:
1) Click the image, if necessary, to show the sizing handles.
2) Position the pointer over one of the sizing handles. The pointer changes
shape, giving a graphical representation of the direction of the resizing.
3) Click and drag to resize the image.
Tip
The corner handles resize both the width and the height of the image
simultaneously, while the other four handles resize only one
dimension at a time. To retain the original proportions of the image, hold
down the Shift key while dragging one of these handles.
For more accurate resizing of images, use the Type tab of the Image dialog.
Writer provides more rotation options than the other LibreOffice components. See the
Writer Guide for more information.
Other settings
The Image dialog in Writer has ten tabs:
Type: define the size and anchor of the image and its position on the page.
Options: give the image a descriptive name, define the alternative text to be
displayed when the mouse hovers over the image, and protect some of the image
settings from changes.
Wrap: choose how text wraps around the image, and the spacing between the
image and the text.
Hyperlink: associate a hyperlink to the image, or create an image map.
Image: flip or rotate the image, and display the original location of the file in case
the image is linked rather than embedded.
Crop: cut off portions of the image, scale it and set its size.
Borders: create borders around the image and add a shadow.
Area: change the background (color, bitmap, gradient, pattern, or hatching) of the
image. This setting produces the desired results only for images with a transparent
color.
Transparency: set the transparency and gradient options for the image.
Macro: associate a macro to the image. You can choose among the predefined
macros or write your own.
Before the image is saved another dialog opens, where you can choose various image
size and format options. The content of this dialog depends on the output file type
selected. If the image has been modified within Writer, you will also see a confirmation
dialog where you can choose to save the original version or the modified version of the
image.
Compressing images
If you insert a large image in a document and resize it to fit into the layout of the page,
the complete full-size original image is stored in the document file to preserve its
content, possibly resulting in a large document file to store or send by mail.
If you can accept some loss of quality of the image rendering or want to resize it, you
can compress or resize the image object to reduce its data volume while preserving its
display in the page layout.
Right-click to select the image and open the context menu. Then choose
Compress to open the Compress Image dialog (Figure 4). Use the Calculate
New Size button to update the image information on the dialog on each parameter set
you change.
Click OK to apply the compression settings. If the resulting image is not acceptable,
press Ctrl+Z to undo and choose another compression setting. For more information,
see the Help.
You can display the Gallery in Icon View (Figure 3) or Detailed View (Figure 5),
and you can hide or show the Gallery by clicking on the Sidebar’s Hide button.
Krishank
Note
The default themes supplied with LibreOffice can not be customized, although
new themes can be added; see “Adding a new theme to the Gallery” below. The
locked themes are easily recognizable by right- clicking on them; the only option in
the context menu is Properties.
Krisha
nk
To delete a theme from the Gallery, select it from the list of themes, right-click, then
click Delete in the context menu. You cannot delete a theme supplied with LibreOffice.
Note
Deleting the name of a file from the list in the Gallery does not delete the file
from the hard disk or other location.
In a workgroup, you may have access to a shared Gallery (where you cannot change the
contents unless authorized to do so) and a user Gallery, where you can add, change, or
delete objects.
The location of the user Gallery is specified in Tools > Options > LibreOffice > Paths.
You can change this location, and you can copy your gallery files (*.sdv) to other
computers.
Gallery contents provided with LibreOffice are stored in a different location. You cannot
change this location.
Note
The locations of Gallery themes distributed through LibreOffice extensions are
determined by the extensions’ settings.
The toolbar at the top of the dialog contains the following tools:
Apply: applies the changes.
Open, Save, Close, and Select.
Rectangle, Ellipse, Polygon, and Freeform Polygon: tools for drawing a hotspot
shape. These tools work in the same way as the tools in the Drawing toolbar.
Edit, Move, Insert, Delete Points: advanced editing tools to manipulate the
shape of a polygon hotspot. Select the Edit Points tool to activate the other tools.
Undo and Redo: cancels the previous action or reapplies the previous canceled
action.
Active: toggles the status of a selected hotspot between active and
inactive.
Macro: associates a macro with the hotspot instead of just associating a
hyperlink.
Properties: sets the hyperlink properties and adds the Name attribute to the
hyperlink.
Below the toolbar, specify for the selected hotspot:
Address: the address pointed to by the hyperlink. You can also point to an anchor
in a document; to do this, write the address in this format:
file:///<path>/document_name#anchor_name
Text: type the text that you want to be displayed when the cursor is moved over
the hotspot.
Frame: where the target of the hyperlink will open: pick among _blank (opens
in a new browser window), _self (opens in the active browser window),
_top or _parent.
Tip
A template is a model document that you use to create other documents. For example,
you can create a template for business reports that has your company’s logo on the first
page. New documents created from this template will all have your company’s logo on
the first page.
Templates can contain anything that regular documents can contain, such as text,
graphics, a set of styles, and user-specific setup information such as measurement
units, language, the default printer, and toolbar and menu customization.
All documents in LibreOffice are based on templates. You can create, or download and
install, as many templates as you wish, and you can set a default template for each type
of document (text, spreadsheet, drawing, presentation). If you do not choose a template
when you start a new Writer document, then the document is based on the default
template for text documents. If you have not specified a default template, Writer uses
the built-in blank template for text documents that is installed with LibreOffice. See
“Setting a default template” below.
In Writer, you can create templates for master documents as well as for ordinary
documents.
This chapter describes the use of LibreOffice’s template management features. You can
also use templates in other ways, but the effects are a bit different. See “Other ways to
manage templates” below for more information.
The template the document is based on is listed in File > Properties > General.
Tip
In the Start Center, you can click on the Templates button, or open the drop-
down menu and select a type of template, to view the available templates
without opening the Templates dialog. Click on the required template to
create a new document.
Figure 1: Thumbnail view of Templates dialog, showing context menu for
a selected user-created template
Krishank
Note
The connection between a template and a document remains until the template is
modified and you do not update the document to match
the template.
If you copy or move the document to a different computer which does not
have a copy of that template installed, the connection is broken even
though it continues to be listed in the document’s properties. See
“Changing the template assigned to a document” below for a way to
reconnect a template to a document.
Creating a template
You can create templates in two ways: by saving a document as a template or by using
a wizard.
Templates can also contain predefined text, saving you from having to type it every time
you create a new document. For example, a letter template may contain your name,
address, and salutation.
1) On the Menu bar, choose File > Wizards > [type of template
required] (Figure 4).
2) Follow the instructions on the pages of the wizard. This process is
slightly different for each type of template, but the format is similar.
Figure 4: Choosing a template wizard
3) In the last section of the wizard, you can specify the template name that will
show in the Templates dialog and the file name and location for saving the
template. The two names can be differsent but this may cause confusion. The
default location is your user templates folder but you can choose a different
location.
4) To set the file name or change the folder, click the Path icon (the three dots to
the right of the location). On the Save As dialog, make your selections and click
Save to return to the wizard.
5) Finally, you can choose whether to create a new document from the template
immediately or manually change the template. Click Finish to save the template.
You can also choose Extensions in the submenu of the Manage button on the upper
right of the Templates dialog (Figure 6) to open an Extensions: Templates dialog, where
you can scroll through a list of extensions. In this version of LibreOffice, there is no easy
way to filter this list, so you may prefer to go directly to the web page, as described
above.
On other websites, you may find collections of templates that have been packaged into
extension (.OXT) files.
Installing templates
You can install templates using either the Templates dialog or the Extension Manager.
Introduction
Once you are familiar with functions and formulas, the next step is to learn how to use
Calc’s automated processes to quickly perform useful analysis of your data.
In addition to formulas and functions, Calc includes several tools for processing your
data. These tools include features for copying and reusing data, creating subtotals,
running what-if analysis, and performing statistical analysis. They can be found under
the Tools and Data menus on the Menu bar. Although they are not necessary when
using Calc, they can help you save time and effort with handling large data sets or
preserving your work for future review.
Note
A related tool, the Pivot Table, is not mentioned here, as it is complex enough to
require its own chapter. See Chapter 9, Using Pivot Tables,
for more information.
Consolidating data
The Consolidate tool allows you to combine and aggregate data spread across one or
more sheets. This tool is useful if you need to quickly summarize a large, scattered set
of data for review. For example, you could use it to consolidate multiple department
budgets from different sheets into a single company-wide budget contained in a master
sheet.
To consolidate data:
1) Open the document containing the cell ranges to be consolidated.
2) Select Data > Consolidate on the Menu bar to open the Consolidate dialog
(Figure 1).
3) Click on the Source data ranges field, then type a reference to a source data
range, a named range, or select it with the mouse. Use the associated Shrink /
Expand button if you need to minimize the dialog while you select the range.
Alternatively, select a named range from the drop- down list to the left of the field.
4) Click Add. The selected range is added to the Consolidation ranges list.
5) Repeat steps and to add additional source ranges.
6) To delete an entry in the Consolidation ranges list, select it and click
Delete. The deletion is carried out without further confirmation.
7) Click on the Copy results to field, then type a reference to the first cell of the
target range or select it with your mouse. You can also select a named range in
the drop-down list to the left of the field.
8) Select a function to aggregate your data in the Function drop-down list. The
default is Sum. Other available functions are Count, Average, Max, Min, Product,
Count (numbers only), StdDev (sample), StDevP (population), Var (sample), and
VarP (population).
9) Click OK to consolidate the ranges. Calc runs the function from step on your
source data ranges and populates the target range with the results.
Tip
If you are consolidating the same cell ranges repeatedly, consider converting
them into reusable named ranges to make the process easier. For more
information about named ranges, see Chapter 14,
Calc as a Database.
Figure 1: Consolidate dialog
Krishank
Consolidation settings
In the Consolidate dialog, expand the Options section to access the settings shown in
Figure 2.
Consolidate by
In this section, choose whether to consolidate your source data ranges by their
range position or by matching labels. Consolidation labels must be
contained within each range, and the text of corresponding row or column labels
must match for the rows or columns themselves to be combined.
Row labels – Consolidates rows by matching label. If this option is
unchecked, the tool will consolidate rows by position instead.
Column labels – Works the same as Row labels, but with
columns instead.
Options
Select Link to source data to add formulas in the target range that link back to
values in the source ranges. When you select this option, any changes you make
in the source ranges will automatically update values in the target range.
Note
If you use the Link to source data option, each source link is inserted into
the target range, then ordered and hidden from view. Only the final results
of consolidation are displayed by default.
Consolidation example
Figures 3, 4, and 5 show a simple example of consolidation using a spreadsheet with
the sheets Year 1, Year 2, and Consolidated Sales. Figure 3 shows the contents of the
Year 1 sheet, with sales figures by region for each of the four product colors.
Figure 3: Year 1 sales by region
Krishank
Figure 4 shows the Year 2 sheet, sales figures by region for each of four product colors.
Note the different ordering of row and column labels between the two figures.
The source ranges and target range are saved as part of the document. If you later open
a document with consolidated ranges, they will still be available in the Consolidation
ranges list of the Consolidate dialog.
Figure 5: Consolidated sales by region
Creating subtotals
Calc offers two methods of creating subtotals: the SUBTOTAL function and the
Subtotals tool.
A SUBTOTAL example
To illustrate how to use the SUBTOTAL function, we use the sales data sheet shown in
Figure 6. The AutoFilter function is already applied to the sales data, as indicated by the
down arrow buttons at the head of each column. AutoFilters are described in Chapter 2,
Entering and Editing Data.
Figure 6: Sales data with AutoFilter applied (only the first few rows are
shown)
To create a summation subtotal for the Sales Value field using the Function Wizard:
1) Select the cell to contain a subtotal. Typically, this cell is at the bottom of the
column being subtotaled, which, for our example, is the Sales Value column.
2) Use one of the following methods to open the Function Wizard dialog (Figure
7):
Select Insert > Function on the Menu bar
Click the Function Wizard icon on the Formula bar
Press Ctrl+F2
Figure 7: Function Wizard dialog
Krishank
3) Select SUBTOTAL in the Function list of the Function Wizard dialog and click
Next.
4) Enter the numeric code of a function into the Function field on the right side of
the dialog. This code must be a value in the range 1 to 11, or 101 to 111, with the
meaning of each value shown in Table 1.
Note
Values 1 to 11 include hidden values in the calculated subtotal, while values 101
to 111 do not. Hiding and showing data is described in Chapter 2, Entering and
Editing Data. Filtered-out cells are always excluded by the SUBTOTAL function.
Table 1: SUBTOTAL function numbers
Function index Function index
(includes hidden values) (ignores hidden values) Function
1 101 AVERAGE
2 102 COUNT
3 103 COUNTA
Function index Function index
(includes hidden values) (ignores hidden values) Function
4 104 MAX
5 105 MIN
6 106 PRODUCT
7 107 STDEV
8 108 STDEVP
9 109 SUM
10 110 VAR
11 111 VARP
5) Click on the Range field, then type a reference to the Sales Value range or
select the cells with your mouse (Figure 7). Use the Shrink /
Expand button if you need to temporarily minimize the dialog while selecting the
cells.
6) Click OK to close the Function Wizard dialog. The cell you selected in step
now contains the total sales value.
7) Click on the AutoFilter down arrow button at the top of the
Employee column and remove all marks from the filter area except those next to
Brigitte and (empty). The cell that you selected in step should now reflect the sum
of all of Brigitte’s sales (Figure 8).
Note
If the cell range used to calculate a subtotal contains other subtotals, these
subtotals will not be counted in the final one. Similarly, if you
use this function with AutoFilters, only the data satisfying the current filter
selections will be displayed. Any filtered-out data is ignored.
Figure 8: SUBTOTAL result for Brigitte’s sales
The Subtotals tool
Calc offers the Subtotals tool as a more comprehensive alternative to the SUBTOTAL
function. In contrast to SUBTOTAL, which only works on a single array, the Subtotals
tool can create subtotals for up to three arrays arranged in labeled columns. It also
groups subtotals by category and sorts them automatically, thereby eliminating the
need to apply AutoFilters and filter categories by hand.
Krisha
nk
For our sales data example, a partial view of the results is shown in Figure 10. The group
settings are identified in Table 2.
Setting up multiple sheets
Chapter 1, Introduction, gives a detailed explanation of how to set up multiple sheets in
a spreadsheet. Here is a quick review.
Identifying sheets
When you open a new spreadsheet it has, by default, one sheet named Sheet1. You can
specify a different number of sheets to be created in a new document, or a different
prefix name for new sheets, by going to Tools > Options > LibreOffice Calc > Defaults
on the Menu bar (Figure 1).
Krishank
Sheets in Calc are managed using tabs located at the bottom of the spreadsheet.
The above methods use either the Insert Sheet dialog (Figure 3) or the Append Sheet
dialog (Figure 4).
Choose whether to put the new sheet before or after the currently
selected sheet tab.
Choose how many sheets to insert.
Choose the name for a single sheet (the Name field is unavailable if more
than one sheet is to be inserted).
The From file option is described in “Inserting sheets from a different
spreadsheet” (page 1).
For John’s spreadsheet we need six sheets, one for each of his five accounts and one
as a summary sheet. We also want to name each of these sheets for the account they
represent: Summary, Checking Account, Savings Account, Credit Card 1, Credit Card 2,
and Car Loan.
After creating a new spreadsheet with one sheet, we could:
Insert five new sheets and rename all six sheets afterwards
Rename the existing sheet, then insert the five new sheets one at a time,
renaming each new sheet during the insert step.
To insert sheets and rename them afterwards:
1) Make sure that the correct sheet tab is selected and open the Insert Sheet
dialog.
2) Choose the position for the new sheets (in this example, we use After
current sheet).
3) Choose New sheet and enter 5 after No. of sheets:. Because you are
inserting more than one sheet, the Name box is not available.
4) Click OK to insert the sheets.
For the subsequent steps to rename the sheets, see “Renaming sheets” (page 1).
To insert sheets and name them at the same time:
1) Rename the existing sheet as Summary, as described in “Renaming
sheets” (page 1).
2) Make sure that the correct sheet tab is selected and open the Insert Sheet
dialog.
3) Choose the sheet tab position for the new sheet (Before current
sheet or After current sheet, as applicable).
4) Choose New sheet and enter 1 in the No. of sheets field.
The Name box is now available.
5) In the Name box, type a name for this new sheet, for example Checking
Account.
6) Click OK to insert the sheet.
7) Repeat steps to for each new sheet, giving them the names Savings
Account, Credit Card 1, Credit Card 2, and Car Loan.
Inserting sheets from a different spreadsheet
On the Insert Sheet dialog, you can also add a sheet from a different spreadsheet (for
example, another Calc or Microsoft Excel file), by choosing the From file option.
Click Browse, select the file using the file browser dialog, and click Open. A list of
the available sheets in that file appears in the adjacent list box (Figure 5). Select the
sheet to import (you can only import one at a time). If, after you select the file, no sheets
appear, you probably selected an invalid file type (not a spreadsheet, for example).
Figure 5: From file area of Insert Sheet dialog showing file path and
names of available sheets
If you prefer, select the Link option to insert the external sheet as a link instead of as a
copy. This is one of several ways to include “live” data from another spreadsheet – see
also “Linking to external data” (page 1). The links can be updated manually to show the
current contents of the external file using Edit > Links to External Files on the Menu bar.
Alternatively the links can be updated automatically whenever the file is opened,
depending on the options set on the dialog accessed by selecting Tools > Options >
LibreOffice Calc > General on the Menu bar. The three options available in the
Update links when opening section are Always (from trusted locations), On
request, and Never.
To define trusted file locations, select Tools > Options > LibreOffice > Security
> Macro Security (Trusted Sources tab) on the Menu bar. This is useful if you want
to use macros in your spreadsheet. For more information about macros see Chapter 13,
Macros.
Renaming sheets
Sheets can be renamed at any time. To give a sheet a more meaningful name:
Enter the name in the Name box when you create the sheet.
Double-click on the relevant sheet tab and replace the existing name
through the Rename Sheet dialog.
Right-click on the relevant sheet tab, select Rename Sheet in the context
menu, and replace the existing name through the Rename Sheet dialog.
Left-click on the relevant sheet tab, select Sheet > Rename Sheet on the
Menu bar, and replace the existing name through the Rename Sheet dialog.
Figure 6: Rename Sheet dialog
A sheet name cannot be empty and must not be a duplicate of an existing name.
Sharing spreadsheets
Sharing a spreadsheet allows several users to open the same file for editing at the
same time. The spreadsheet needs to be on a shared drive, server, website, or similar.
Some conditions must be met on operating systems with user permission
management:
Tip
In order to correctly identify the changes, each collaborator should enter their
name in Tools > Options > LibreOffice > User Data on
the Menu bar.
c
To enable sharing, select the checkbox at the top of the dialog (Figure 1) and click OK. If
the spreadsheet has been saved previously, a message appears stating that you must
save it to activate shared mode; click Yes to continue. If the spreadsheet has not been
saved previously, the Save dialog opens. After saving, the text “(shared)” is shown on
the Title bar, after the title.
Tools > Share Spreadsheet on the Menu bar can also be used to switch a spreadsheet
from shared to unshared. However, this means that other users can no longer edit it.
Instead, you may wish to save a copy of the shared spreadsheet using another name or
path, thus creating a copy of the shared spreadsheet, and then switch the copy to
unshared.
If the spreadsheet has been modified and saved by another user since you opened it, one
of the following will occur:
If the changes do not conflict, the document is saved, the message “Your
spreadsheet has been updated with changes saved by other users” appears, and
any cells modified by the other user are shown with a red border.
Figure 2: Resolve Conflicts dialog
Reviewing documents
You can use several methods to review, edit, and comment on a spreadsheet. Each
reviewer works on a separate copy of the document.
You can use change marks to show added and deleted material. Later, you
or another person can review the document and accept or reject each change.
You can make changes to a copy of the document (stored in a different
folder, under a different name, or both), then use Calc to compare the files and
show the changes. See “Comparing documents” below.
You can save versions that are stored as part of the original file. See
“Saving versions” below.
Reviewers can leave comments in the document, either attached to specific changes or
standalone.
After you have turned on revision marks, you can optionally password protect the
spreadsheet so that any user must enter the correct password in order to accept or
reject changes.
1) Open the spreadsheet and select Edit > Track Changes > Record on the
Menu bar, or press Ctrl+Shift+C. You can also use File > Properties > Security
and select Record changes.
2) If you want to protect the spreadsheet, click Edit > Track Changes > Protect
on the Menu bar. On the Protect Records dialog, type a password (twice) and click
OK. You can also use File > Properties > Security and click the Protect button to
open the similar Enter Password dialog. Guidelines for choosing a suitable
password are in the Help.
Recording changes
To record changes, open the spreadsheet and make sure that the Edit > Track Changes
> Record menu item has a check mark next to it, indicating that change recording is
active.
Caution
After making some changes, do not turn off change recording. Turning off
change recording in Calc causes all the recorded changes to be accepted
and no longer shown as changes. A message box will warn if you try to do
this.
When changes are made in a cell, a colored border with a dot in the upper left- hand
corner appears around the cell (Figure 3). A deleted column or row is marked by a heavy
colored bar.
Note
Some changes, for example cell formatting, are not recorded and marked.
Tip
To change the color that indicates a changed cell, select Tools > Options >
LibreOffice Calc > Changes on the Menu bar.
You may want to explain your rationale for the changes. You can do this by adding
comments to the changes you made or by adding general comments to the
spreadsheet.
In LibreOffice Base, you can access data that is stored in a wide variety of database file
formats. LibreOffice Base natively supports some flat file database formats, such as the
dBASE format. You can also use LibreOffice Base to connect to external relational
databases, such as databases from MySQL or Oracle.
The following database types are read-only types in LibreOffice Base. From within
LibreOffice Base it is not possible to change the database structure or to edit, insert, and
delete database records for these database types:
Spreadsheet files
Text files
Address book data
The database file contains queries, reports, and forms for the database as
well as a link to the database where the records are stored. Formatting
information is also stored in the database file.
To open a database file, choose File - Open. In the File type list box,
select to view only "Database documents". Select a database document
and click Open.
Viewing a Database
There are two different methods of viewing a database in LibreOffice.
Choose File - Open to open the database file.
The database file gives you full access to tables, queries, reports, and
forms. You can edit the structure of your tables and change the
contents of the data records.
Choose View - Data source to view the registered databases.
The data source view can be used to drag-and-drop table fields from
registered databases into your documents and to produce mail merges.
Database Overview
Working with databases in LibreOffice
Data Sources
Address book as data source
View data source contents Menu
bar of a database file
Queries
Create new query or table view, edit query structure Query
Wizard
Enter, edit and copy records
Tables
Create new table, edit table structure, index, relations Table
Wizard
Enter, edit and copy records
Table Design
In the Table Design window you define new tables or edit the structure of an existing
table.
To access this command...
In a database file window, click the Tables icon. Choose Insert - Table
Design or Edit - Edit.
Field properties
Defines the field properties of the currently selected field. Length
Specifies the maximum number of characters allowed for data entry of the
corresponding data field including any spaces or special characters.
Decimal places
Specifies the number of decimal places for a numerical field or decimal field.
Default value
Specifies the value that is the default in new data records. Format
example
Displays a sample of the format code of the field by applying it to the default
value. Select the format code with the Format Field button.