- MCP server with stdio transport for local use - Search episodes, transcripts, hosts, and series - 4,511 episodes with metadata and transcripts - Data loader with in-memory JSON storage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
228 lines
19 KiB
Plaintext
228 lines
19 KiB
Plaintext
Episode: 1695
|
|
Title: HPR1695: 46 - LibreOffice Calc - The Object Model and Using Templates
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1695/hpr1695.mp3
|
|
Transcribed: 2025-10-18 07:49:46
|
|
|
|
---
|
|
|
|
It's Friday 30th of January 2015, this in HP are episode 1695 titled 46 Libra Office
|
|
Hulk, the object model, and using templates, and is part of the series, Libra Office.
|
|
It is hosted by a huker, and is about 25 minutes long.
|
|
Feedback can be sent to Swilnik at Swilnik.com, or by leaving a comment on this episode.
|
|
The summary is, of the standing the object model, and how templates work.
|
|
This episode of HPR is brought to you by Ananasthos.com, get 15% discount on all shared hosting
|
|
with the offer code HPR15, that's HPR15.
|
|
Better web hosting that's honest and fair, at Ananasthos.com.
|
|
Hello, this is Hukka, welcoming you to Hacker Public Radio and another exciting episode
|
|
in our series on Libra Office Calc.
|
|
I want to build on the introduction we did last time and do a slightly deeper dive into
|
|
the whole thing of templates, and also to bring up again the idea of the object model.
|
|
I think that's important to understanding how all of this stuff works.
|
|
Now I've noticed that many of the explanations I've seen for using styles and templates,
|
|
whether it's Libra Office, Open Office, Microsoft Office, what have you, almost always they
|
|
start with styles.
|
|
Now that can be a problem if you don't recall that styles always live inside of templates.
|
|
So I prefer to cover the use of templates first, so that when you start working with styles,
|
|
you know how to store your work properly for future use.
|
|
There could be nothing more annoying than investing a lot of time in creating styles and
|
|
discovering that they've disappeared.
|
|
Get the right end first, create the templates and then create styles inside of the templates,
|
|
save them with the templates, then you're going to be golden here.
|
|
Now I said in the last tutorial, templates can be understood as a container for a number of
|
|
settings, most particularly styles.
|
|
This follows the object model, which I always think of that it's a lot like those Russian dolls
|
|
that, one inside of another, the file for your spreadsheet is an object.
|
|
It contains individual sheets, which are objects.
|
|
Each sheet contains cells, which are objects, and each cell contains various characters,
|
|
which are objects, which can be used to represent numbers, formulas, addresses, labels, and so on.
|
|
Now objects exhibit two features we always want to keep on in mind.
|
|
First objects have properties that are particular to the kind of object.
|
|
The properties of a file might include who the author is, where the file resides on the system,
|
|
and the access restrictions, like making the file password protected, and so on.
|
|
The properties of each sheet might include things like the name of the sheet,
|
|
the orientation, such as landscape versus portrait, headers and footers, etc.
|
|
Then the properties of the cell might include the type of cell and how it is formatted,
|
|
like text, currency, general number, etc., and finally the properties of the character include
|
|
the font family, font style, font size, and so on.
|
|
Now the second general characteristic in the object model is inheritance,
|
|
which says that any object will tend to inherit the properties of the object, which contains it.
|
|
In some cases, that can be overridden, as when you have a sheet with cells that are generally
|
|
set to be numbers, and then override on a particular cell to make it text.
|
|
The reason this matters is that very often people get confused about why something is happening
|
|
in their spreadsheet or their document or their presentation. This is a very general point
|
|
that we're making here. The reason usually is that they have not thought through how properties
|
|
are propagated through the object model. If the setting is in the template, you cannot make
|
|
the change properly unless you know exactly where to look. As we address styles, we can develop
|
|
this idea further. When you create a template and populate it with styles, you have created
|
|
you are setting default properties for the spreadsheet file you are creating.
|
|
In general, there are two kinds of templates you can work with.
|
|
Most often you would use a default template, which is the standard you would have every time you
|
|
open the application and start a new spreadsheet. The other kind is a special purpose template
|
|
that is created to address a particular need. Now in the out-of-the-box installation of
|
|
LibreOffice, you start out pretty bare. But as you create templates and install templates from
|
|
other sources, your options will increase. Let's take a look now at some of the basic template
|
|
operations. The first one is creating a template. Open a spreadsheet file that you want to make into
|
|
a template. Add the content and styles you want to have in it, then go to File, Save as template.
|
|
This will open the template manager. If you see an icon for the My Templates folder,
|
|
double-click it to open this folder, then click the Save button. Give your template a name,
|
|
click OK and your template will be saved into this folder.
|
|
Now among the things you can put into a template are printer settings,
|
|
like single versus double-sided printing, paper size, and of course, page styles and cell styles.
|
|
We will cover the specifics of these styles in a subsequent tutorial.
|
|
Note that you can also put in text that you want to have. So you could be creating a template
|
|
for instance an expense report that you want everyone to be using in your organization.
|
|
You can put in text in a bunch of cells and just have people fill in numbers later and have those
|
|
the text and all of those cells as being a part of the template. Be very handy.
|
|
Now once you have a template, you want to create a file. Now if you just open up a calc
|
|
from scratch or you just click the new button without thinking, you will get a copy of the
|
|
default template. But if you want to use one of these templates you've created, what you have to
|
|
do when you open up calc is go to the File menu, go to New and then select templates from there.
|
|
If you just click the new button, you're getting default. So that's why you need to go to the File
|
|
menu to new to templates and then open up the template manager. Now in the template manager go
|
|
to the spreadsheet tab and click all templates, if it is not already selected, if you don't see it,
|
|
it's already selected. Double click the folder that contains the template you want to use and
|
|
double click on the template to create a file based on it. Now if you're uncertain which template
|
|
you want, note that you can select a template and click on the properties button to bring up the
|
|
template properties window and inspect the properties. So that can be helpful in determining which
|
|
one you want to be working with. Now once you have a template, you might want to edit it at some
|
|
point. Maybe make some modifications, maybe you want to make a new template based on this one
|
|
with just a few changes. All of these are things you can do through editing.
|
|
To edit a template, you open the template manager by going to the File menu to new to templates.
|
|
Select the Spreadsheets tab and click all templates to reveal your folders. Then double click the
|
|
folder that contains the template you want to edit. Select the template, click the edit button,
|
|
then make your edits and go to File Save to save your changes.
|
|
Note that as with writer, a template you are editing looks just like a regular file,
|
|
but you will know that you are in a template by looking at the very top to the title bar.
|
|
The name of the file is always in the top left of the screen. When you are in a regular spreadsheet
|
|
file, the file name has an extension ODS, which stands for Open Document Spreadsheet.
|
|
But when you are in a template, the extension changes to OTS and the T is there to signify template.
|
|
Note that if you are editing a template that you have used previously to create a file,
|
|
LibreOffice remembers this fact. The next time you open the file, you will be given an opportunity
|
|
to update the file to the new template. But you only see this once since LibreOffice remembers
|
|
the answer you gave. There is a macro you can use to re-enable the updating, but that's an advanced
|
|
topic. I don't plan to get into that right now. If you need it, do a web search. It is in the
|
|
documentation. Now, how about adding a downloaded template using extension manager? This is another
|
|
technique you might want to use. Now, as most Linux users know, in Linux, you have things called
|
|
package managers that let you install software packages that have been created for that purpose.
|
|
There is a similar capability in LibreOffice to add templates through the extension manager.
|
|
In fact, the extension manager handles more than just templates. You can also install macros,
|
|
graphics, and other add-ins through this mechanism. To see some of what is available,
|
|
look at the extension site, which is extension.libreoffice.org. There will be a link in the show notes.
|
|
What you need to look for is a file with the OXT extension.
|
|
Oscar X-ray Tango, OXT. This indicates that it has been properly packaged for the extension
|
|
manager to handle. To install an extension, and for now, we're going to assume it's a template,
|
|
find the template you want, and download it. Verify that it does have an OXT extension.
|
|
Go to Tools, Menu, Extension Manager to open the extension manager, then click Add. Find the file,
|
|
probably in your Downloads file, but that's really up to how you configure your browser.
|
|
And click Open. Depending on the template, you may be asked to accept a license agreement,
|
|
but if you're looking at the above site from LibreOffice.org, those will all be free software.
|
|
When installation is complete, the template will be listed in the template manager,
|
|
and in the extension manager. Now, one thing you want to watch out for in downloading extensions
|
|
is the version they are compatible with. These things may be backwards compatible, meaning if it
|
|
worked once it will continue to work, but not always. Each template is listed with a latest release
|
|
compatible note, which tells you when it was last tested. Now, you may be okay with a template that
|
|
is close to the version you are running, but the farther away the less likely this is.
|
|
For example, as I was writing this, I was using LibreOffice 4.1.6.2,
|
|
and I wrote this some months before it actually gets broadcast on Hacker Public Radio.
|
|
If I saw a template that said 4.0, I'd give it a shot. If it says 3.4, I would at least be
|
|
cautious. It probably won't do anything worse than just not work, but be advised.
|
|
If you see something that looks like it might be useful, click on the name of the template,
|
|
and a page will open with more information. I looked at one that said there's not a stable release
|
|
yet, so this may be a work in progress. Also, look for if it's being maintained.
|
|
Another I clicked on had a warning batter that said it had not had a release in a year and
|
|
might not be an active development. Is that a problem? Well, given that the underlying software
|
|
keeps changing, I would say yes. When I started this series, I was on LibreOffice 3.4.
|
|
When I wrote this tutorial, I was on 4.1. 4.3 has just been released. LibreOffice is a very
|
|
actively developed suite, and I know that they're working on 4.4 right now.
|
|
So look for templates that are current and actively in development for the best results,
|
|
and don't be surprised if a template you have used for a while starts to show problems.
|
|
That's just the nature of software changing, honestly.
|
|
Another thing you should bear in mind is that ApacheOpenOffice.org and LibreOffice are mostly
|
|
the same, and templates developed for one can be used in the other.
|
|
So here's some that you might want to look at that are ApacheOpenOffice.org templates,
|
|
and I want to thank my friend Andrew Pataniak for these suggestions. And by the way,
|
|
if you ever see a post by Andrew on a mailing list or online, he's a real expert at this stuff.
|
|
So the first one is the Professional Template Pack English, a collection of templates for Apache Open
|
|
Office.org has templates for writer, calc, and impress. They're very good. The calc templates include,
|
|
for instance, a class schedule template and several templates for managing tournaments.
|
|
I know, that's something that you have a need for, it's worth knowing.
|
|
And then there's a Professional Template Pack 2 English. Similarly, this one adds templates for
|
|
calc that are business related, such as a marketing budget template, a startup capital estimate
|
|
template, and a project planning template. So if you are searching for possible templates,
|
|
and other things, remember to check ApacheOpenOffice.org, as well as LibreOffice.
|
|
You can find some good stuff there.
|
|
Now another thing, suppose you've found a template that you've not been able to find a template
|
|
that's packaged as an extension, there are alternatives. Many templates are available as .OTS
|
|
files. Now to add this to your template selections, just open the template manager by going to
|
|
File, Menu, New, Templates. Open your My Templates folder if it is not already open.
|
|
And then look for the Import button. This opens a Standard File Manager window.
|
|
Go to where your downloaded .OTS file is, select it, and click Open.
|
|
So with that in mind, let's take a look at a candidate you might want to download. It is called
|
|
Account ID Manager, and is used to maintain a list of your accounts and passwords.
|
|
Of course, one of the things you should be concerned with in this case is the security of your data.
|
|
And this template page explains how you can password encrypt the file using AES256 encryption,
|
|
which is very good. It says it was tested with LibreOffice 4.0, so it looks like a good candidate,
|
|
and it says it was updated for LibreOffice 4.0, which suggests to me that it is being maintained.
|
|
So I click on the Get Account ID Manager for all platforms link to download.
|
|
This places the file in my Downloads directory. I look at the file, it has an OTS extension,
|
|
so I know I need to use the Import function. I follow the procedure outlined above,
|
|
go to my Downloads folder, and soon I have a new template in my Templates folder called Account ID
|
|
Manager 3-L. Now, note that it says Get Account ID Manager for all platforms. This is a good time
|
|
to just remind you once again that LibreOffice is available on Linux, Windows, and Macintosh,
|
|
and it is just as functional on all of those, and your templates are interchangeable,
|
|
so you can create a template on one platform, and then import it into another one, and you're good
|
|
to go. So that's always worth bearing in mind, if you were like our friend Nightwise and our
|
|
cross-platform slider, as many of us are, it's worth knowing that you can do that.
|
|
Now, the next technique I want to look at making a template.
|
|
Now, you can make one from an ODS file. Remember ODS is just a spreadsheet document,
|
|
it's just something you've created, and I've seen files offered as templates that are really
|
|
just spreadsheet files. One that I found that looked interesting to me because my day job is
|
|
project management, it's called Gantt Chart Template. I checked and it was released March 27th,
|
|
2014, and the latest release was validated against LibreOffice 4.2, so it was extremely current.
|
|
It might cause a problem if it relies on features only found in 4.2, since this machine is still
|
|
on 4.1, but I thought it was worth a shot, so I downloaded it. In this case, it was an ODS file.
|
|
Now, this can be added using the import function in the template manager, in most cases,
|
|
but the alternative solution is to open it as a spreadsheet, then save it as a template by going
|
|
to the file menu and selecting save as template. Now, the fault template. Of course, as we saw
|
|
with writer, once you know how to set up a template to do what you need, you will probably want
|
|
to create your own default template. Remember that this is the template that will be used if you
|
|
simply click file new spreadsheet or click the new icon or press control plus n without specifying
|
|
a template. The default that comes with LibreOffice 5.2 is featureless, and when you understand how to
|
|
customize, you will want to add your own touches. To do this, create a template with all the features
|
|
you want and save it to your My Templates folder, or really whichever folder you like,
|
|
open the template manager, highlight the template to select it, and then click the set as default
|
|
button. If you later decide this was a mistake and you want to go back to the plain vanilla
|
|
default that comes built in, go to the template manager, look for the icon of a gear in the upper right,
|
|
click on it and select reset default template, spreadsheet, and you will have it back as the default.
|
|
Now, if you really get into using templates, you may find that putting all of them into the My Templates
|
|
folder is not satisfactory. And the template manager allows you to do a little more organizing,
|
|
if you wish, open to your My Templates folder, select a template, and then click move to folder.
|
|
If you already have a folder to move it to, just select it, but of course the first time you
|
|
will want to use the new folder option that appears in the drop down menu. Now, what about exporting?
|
|
Exporting is something you might want to do for two reasons. First, if you are creating a template
|
|
for use by a group of people, you need to export it so you can share it. Second,
|
|
if you want to use it on multiple machines, which is something I frequently do,
|
|
this lets you copy the template to as many machines as you like.
|
|
You can even export it as a file that you place in Dropbox for easy moving and sharing.
|
|
To export a template, open the template manager then open the folder containing the template
|
|
and select the template. Click the export button above the list of templates.
|
|
This will open the standard file manager and you can choose where to save the file.
|
|
Now a closing thought. This pretty much wraps up the topic of working with templates
|
|
and it sets us up for the next topic, which is styles. The point is that styles must be saved
|
|
within a template and that's why I covered templates first. Whether you're creating a template from
|
|
scratch, adapting one that you have already created, or are working with one you downloaded,
|
|
you need to know these things. My suggestion is that you prepare for the next few tutorials by
|
|
creating your own defaults template and saving it right now. Then as we go through styles,
|
|
you can edit that template to add your refinements. As I did with writer, I created mine
|
|
as KLB default and when I'm done, I will share it to my other machines.
|
|
So next time is page styles. So this is a hookah for hacker public radio. I'm signing off on this
|
|
episode reminding you is always to support free software. Bye bye.
|
|
You've been listening to Hacker Public Radio at HackerPublicRadio.org. We are a community podcast
|
|
network that releases shows every weekday Monday through Friday. Today's show, like all our shows,
|
|
was contributed by an HBR listener like yourself. If you ever thought of recording a podcast
|
|
and click on our contributing to find out how easy it really is. Hacker Public Radio was founded
|
|
by the digital dog pound and the infonomican computer club and it's part of the binary revolution
|
|
at binrev.com. If you have comments on today's show, please email the host directly, leave a comment
|
|
on the website or record a follow-up episode yourself. Unless otherwise stated, today's show is
|
|
released on the creative comments, attribution, share a light 3.0 license.
|