This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Office Software

Back up and print your blog with OpenOffice.org Base

By Dmitri Popov on November 01, 2007 (8:00:00 AM)

Share    Print    Comments   

If you are running a blog (or any Web publishing system, for that matter) that relies on a database back end, you will sooner or later face the problem of backing up the content stored in the database. One way to go about it is to build a backup tool using OpenOffice.org Base. Since Base can pull data from a MySQL or any ODBC-compliant data source, you can create a simple database that connects to the blog's back end and extracts content from it, which you can then export in different formats.

Besides keeping your content safe, this solution offers a few other benefits. First, it allows you to browse all the blog posts directly from within OpenOffice.org and to quickly insert posts into your current Writer document. More importantly, however, you can use Writer's import feature or Sun Report Builder to create a printable version of your blog, which effectively turns the Base database into a nifty blog-to-print tool.

To see how to make this work, we'll try it with the Gelato tumblelog software that uses MySQL as its back end. Gelato stores all of its content (i.e. blog posts) in a simple database table gelato_data, which makes it easy to figure out how to extract the relevant data from the system. If you are not familiar with Gelato or need help on installing it on your server, take a look at the article Gelato: Tasty tumblelog software.

Our first step is to create a connection between the Gelato MySQL database and OpenOffice.org. To do this, OpenOffice.org requires a properly configured database connector. If you are not sure how to create one, take a look at the Connect OpenOffice.org to MySQL article, which will help you choose the right connector and configure it. The following description assumes that you are using the Connector/J connector, since it's the easiest one to set up.

Once you've configured the connector, you can create a Base database that will act as a backup tool for the content stored in the gelato_data table. In OpenOffice.org, choose New -> Database. In the Database Wizard, select the Connect to an existing database option, select MySQL from the drop-down list, and click Next. Select the Connect using JDBC (Java Database Connectivity) option and press Next. Enter the database name and database server URL into the appropriate fields, then press Next. Provide a user name and tick the Password required check box, if necessary. To see whether everything works properly, click the Test Connection button. Press the Next button, select Yes, register the database for me option, and click Finish. Give the database a name and save it. Launch the created database and switch to the Table section. Base then connects to the MySQL database, and you should see a list of its tables.

Backing up the data in the tables is straightforward. Right-click on the table you want to back up (gelato_data in Gelato) and choose Copy. To save the data in a spreadsheet, create a new Calc spreadsheet, and choose Edit -> Paste (or press Ctrl-V). This inserts the copied content into the spreadsheet, which you can then save in different formats.

Instead of a spreadsheet, you can paste the copied data into a blank Writer document. If you do that, OpenOffice.org opens the Inserts Database Columns dialog box, and you can choose how to insert the copied data into the document. You can, for example, import the data as a table or as text. To select what fields you want to import, move them from the left window to the right. With the gelato_data table, you might want to add the Title, Description, and URL fields. If you choose to import the data as a table, you can edit the table's design by pressing on the AutoFormat button. If you opt for the text option, you can format each field by selecting the desired paragraph style from the Paragraph Style drop-down list. The result is a nicely formatted Writer document containing all your blog posts.

The created backup database is good not only for backing up your blog's content and turning it into a printable form. You can also access the database from within any OpenOffice.org application thought the Data Sources pane and quickly insert the content of your blog into the currently opened document. This can come in handy if you, for example, want to insert a blog post into a Writer document. To do this, open the Writer document and place the cursor where you want to insert the blog post. Press F4 to open the Data Source window. Choose the gelato_data table and select the row containing the blog post you want to insert, and press the Data to Text button. Use the Insert Database Columns window to select the exact data you wan to insert as described above.

Dmitri Popov is a freelance writer whose articles have appeared in Russian, British, US, German, and Danish computer magazines.

Share    Print    Comments   

Comments

on Back up and print your blog with OpenOffice.org Base

Note: Comments are owned by the poster. We are not responsible for their content.

Can I copy it to another database?

Posted by: Anonymous [ip: 64.6.40.50] on November 01, 2007 01:14 PM
Will it create the tables for me if I paste it into another database?



I guess I'll have to try and see.

#

link count

Posted by: Anonymous [ip: 66.122.165.195] on November 01, 2007 10:16 PM
I'd like to see a link count on a web page that is also distinguished by links directly associated to the page and refrences to other sources. An example would be the BSD web site has a number of tutorials with links to other pages that appear to be part of the same tutorial. When a page is downloaded to a memory drive and then accessed from the drive, non of the links are available since they were not copied. I would not want my copy utillity to inavertently copy the web however, it would be nice to indicate if the feature is not available, a copy depth and were posible a link number that constituted the entire web page. This way a page can be copied/downloaded then recalled when off line providing its usefull function by way of active links to a reasonable depth.

#

Back up and print your blog with OpenOffice.org Base

Posted by: Anonymous [ip: 87.62.91.8] on November 13, 2007 02:07 PM
Yes I was human before I tried to find spelling correction on open office xp. Since then I have torn all my hair out and eaten all my pet lizards.
"Are you a Nice human ???" If so could you please help a super computer idiot get spelling correction in English in the simplest words possible?
If so I should be most grateful
Nigel

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya