Touted as a compelling and arguably superior alternative to Microsoft Office, OpenOffice.org begs the question: is it as good as it's cracked up to be? Although the original canary had to complete her shift (even though she didn't report back in short, desperate breaths), I've taken over and headed canary-like to continue mining the depths of this free suite alternative, testing its limits by using it to complete common and advanced business tasks. If I report back to you in short, desperate breaths that the suite is impossibly difficult to use, you will know better than to send in more miners. But if I come out of this experiment alive and well, you may just have to ask yourself, as I asked myself, "Why not give it a try?" (See Trouble Me.)
If you have not been following this series and have not yet seen OpenOffice.org, you might want to back up for a moment to establish your context here. Download and take a look at this open source office suite (OpenOffice.org) or in the interest of time, read previous articles in this series. (See Background Basics)
Editor's Note: The original canary has been replaced. In the interest of full disclosure, she didn't give up or come out of the mine panting, she just finished her shift and turned it over to another OpenOffice.org newbie to continue the series.
> Canary Qualifications
OK, I guess I'm not exactly a newbie the way Kendra was when she started writing this series. I have worked with OpenOffice.org and have actually worked with it extensively. I've even helped other people learn to use it. I've written OpenOffice.org tips for Novell Cool Solutions, and I've even compiled a few tips and videos for this magazine, but I was a newbie at one point and I still remember the feeling.
The first time I saw OpenOffice.org was shortly after I started working for BrainStorm, Inc. Although BrainStorm is a software training company and is actually the Novell End-User Training Partner, they didn't hire me for my software prowess, instead they hired me to write. (My background is in journalism, not technology.) My boss asked me to learn OpenOffice.org and evaluate whether we could use it to publish the Novell Linux Desktop 9 End-User Training Workbook Novell had commissioned us to write. He told me the horror stories the last authors of a similar workbook faced as they tried to place graphics and create PDFs in Microsoft Word.
I downloaded OpenOffice.org, played with its settings for a day, and decided almost immediately that we should use it to write and publish the book. BrainStorm then put me in charge of designing styles and templates for the chapters, helping other contributing writers learn the new program, and putting it all together in a master document and a PDF. Along the way, I became the resident expert on OpenOffice.org Writer.
That is, I became the resident expert on the features I was forced to use in OpenOffice.org. Therefore, I know how to use styles and templates. I know how to anchor and resize graphics. I even know how to create an index and a table of contents. But, I haven't explored everything, and up to the point that I was assigned this article, one of my final OpenOffice.org Writer frontiers was forms.
Linking Forms to a Database
Once you create your forms, you can link them to a database to collect information or use the form to navigate among the records in an existing database; however, before you link the form, you must connect the database to OpenOffice.org by creating a data source. Here's how:
Creating an OpenOffice.org Data Source
Linking Database Fields to Form Controls
- From the File menu, select Wizards > Address Data Source.
- Follow the prompts in the Wizard depending on the type of database you're linking to. You can link to virtually any database using ODBC or JDBC connections.
- Skip the prompt for assigning fields. You only need to assign fields if you plan to use your database for a mail merge.
- Name and save your database connection with a name you will recognize later.
- Press F4 or select View > Data Sources.
- Select your named data source from the tree list on the left. Be sure to expand the tree until the table that contains the data is revealed in the window on the right.
Once you link your current document to a data source, you should be able to follow the steps below to link your database fields to your form controls. But, to check the data source or change it later, right-click the form control in Design mode and select Form. Under the Data tab, be sure the correct data source is selected. When the correct data source is selected, follow these steps:
Hint: To quickly create a form linked to a database, simply press F4 to show the Data Sources window, then while pressing Shift+Ctrl, drag and drop a column of data into your document. A form control field will appear with a label matching that column of data.
- Double-click a form field in Design mode to display the Form Control Properties dialog.
- Click the Data tab.
- Select the data field you want to connect the control to from the drop down list.
> Foraging for Forms
Besides working for BrainStorm, Inc., I also volunteer in my church's childrens' organization. As part of our weekly childrens' meetings, we, the other volunteers and I, wanted to start spotlighting each child to help all the children get to know each other. We decided the easiest way to gather information on the children was to e-mail a form to all the parents. That way we could keep all the answers within the parameters we specify, we could keep it a secret from the kids, and the parents could easily print it out to give to us at our next meeting. This was the perfect opportunity to try out OpenOffice.org forms. (see figure 1.)
A Little Design Work
First, I created a heading for the form. I inserted a picture using Insert | Picture | From File. I anchored it to the page so I could move it anywhere, and then I changed the wrap settings by right clicking and selecting Wrap | Optimal Page Wrap. I created a title for the form and then I wrote my opening paragraph. So far, this was just like creating any other document.
Now, I was ready to create my form fields. I went to the View menu and selected Toolbars. From the list, I chose Form Controls. A little toolbar popped up with icons corresponding to the different form fields I could use. Like many forms, I wanted this spotlight form to start out with a field for First name. I moused over the Form Controls toolbar until I found the text box form control. I clicked the button and my cursor became cross hairs. I clicked and dragged just like I would if I were creating a rectangle or a traditional text box. Sure enough, a text box form control appeared with the little green anchor boxes on all the corners that meant I could reshape it any way I wanted. I arranged the box until it was the right size.
When in Doubt, Right Click
Now I had a perfectly sized box perfectly placed in my document, but I was stuck. I didn't know how to label the box or how to make sure it worked. I've used OpenOffice.org long enough to know that when I'm in doubt I can right click and options for what I'm working on are sure to show up. I right clicked and got a menu I would expect to see when creating shapes or manipulating graphics. That was great to know. I'd go back and play with alignment, wrap and anchoring later, but for now, I was looking for a dialog that would let me set the text box's properties.
I selected Control. A dialog appeared that looked like it would give me the options I needed. (see figure 2.) I filled in a name for the box—First name. Many of the other control properties were pretty self-explanatory. I could set a maximum text length. That means I could determine how many characters a person filling in the form could enter. I could choose Yes or No options for whether I wanted to enable the control (Yes), whether I wanted to make the field readonly (No), and whether or not I wanted the field to print (Yes). I also recognized that if I pushed the buttons with the three little dots (...), I could change the appearance of the font, border and background. I left all of these as the default. Finally, I entered some explanatory text in the help text field. I was guessing this would create a tool tip clue when someone moused over the control. I was right. Once I finished entering all the parameters I knew about, I looked for an OK button. Since I didn't see one, I just closed the dialog and hoped my settings would save, which they did.
Looking for a Label
The one item I didn't find in the Control Properties dialog was how to label the control. There was a label field, but it wouldn't let me enter anything in the box. I went back and moused over the buttons in my Form Controls toolbar and found a Label field button. I selected it, clicked and dragged in my document and the words "LabelField1" appeared. That wasn't exactly what I was thinking would happen. So, I right clicked and chose Control. A new properties window opened up. Everywhere it said "LabelField1," I changed it to say "First name." I also clicked the Font option and changed the font to bold. When I closed the dialog box, I had a nice, bold label for my text box. I changed the anchor to a page anchor, and dragged it above my text box. First one down, several to go.
Keep those e-mails and letters coming! What areas of OpenOffice.org do you want me to explore? Send your suggestions to email@example.com.
Aligning, Sizing and Making It Look Good
When I went to create my next text box for the child's last name, I followed the same steps; however, as I clicked and dragged the text box cross hairs on my document, I came to a realization: There was no way I was going to be able to create a text box the exact size as the one I had just created by using the mouse alone. (I like to say I have exceptional mousing skills, but even I can't create a box the exact same size.) So, I deleted my new text box and decided to try copying and pasting. A quick CTRL+C and CTRL+V and a little dragging later, and I had a text box the exact same size as my first text box. Because of an unfortunate incident I once endured trying to make a form in Adobe Acrobat, I knew that copying and pasting form controls could sometimes lead to problems if I didn't change some of the properties in the copied box. So, I right clicked and changed the name and I was set.
Note: After drawing your control, you can also right click it and choose Position and Size and manually set the exact size and positioning of your control. So I could have made as many text boxes the exact same size just by using the Position and Size dialog for each text box. (see figure 3.)
For those of you who are ready to take your forms to the next level, check out the Events tab in the Control dialog box. With events you can write macros and have them executed when a certain event takes place on the form.
Now that I had two text boxes and labels for those boxes, I could try out some of those aligning, anchoring, wrapping and grouping commands I saw earlier on the right-click menu. Just as I was used to doing in any other graphics program, I held down the shift key while I clicked on each box and label to select more than one. First, I selected both the text boxes and chose Alignment | Bottom. Next I chose the label and the box and chose Alignment | Left. Because I knew that anytime I wanted to move the box I would want to move the label, I selected both the label and the box and selected Group | Group. Copying to keep consistent sizes, aligning and grouping started to make my form look quite professional.
Beyond the Text Box
Now that I had created all my name boxes, I decided to explore other form controls. The next item I wanted to record about the children was their age and grade in school. It was the perfect opportunity for list boxes. I chose the list box tool from the Form Controls toolbar and created a list box with the cross hairs just like I did for the text box. I opened the Form Control properties and started to search for the area in which I would create my list items. I knew it had to be there somewhere. Sure enough, the properties were a little bit different for a List box. It still had all the formatting options and the options to enable, make it read-only and print, but it also had a field called List entries. I tried typing in my first entry. It worked. Then, I pressed Shift+Enter to add my other list items until I had listed all possible ages from 2 to 12. I added a label and voila, I had a list box.
Next, I wanted the parents to be able to enter their child's date of birth so we'd have a definite record of their birthdays. In fact, what I really wanted was one of those date fields where you can choose the date from a calendar. (I guess buying airfare online has convinced me that's the only way to choose a date.) Because I didn't see a specific date form control on the first toolbar, I clicked the More Controls button to open up a tool bar with even more form controls. A quick mouse over showed me that there was a Date Field form control. But, when I clicked and dragged, the cool calendar option didn't show up. I went to the properties and selected "yes" from the Dropdown field. When I closed the properties dialog, the field had a drop down arrow, but I wasn't sure what it did.
Testing It Out
Until now, every time I clicked one of my form controls, the only thing that happened was the appearance of the green selection boxes. I decided it was time to see if this form really worked. Since I was designing the form and I wanted to stop designing for the moment, I clicked the Design Mode On/Off button that I found on my trusty Form Controls toolbar. Now when I clicked, the green boxes were no where to be found and I could try filling out the form. The text boxes worked, the list boxes worked, and when I clicked the drop-down arrow in my date form control, a little calendar popped up. Things were going my way.
The rest of the controls worked pretty much the same way the list boxes and text boxes did. Click and drag to create and then change the properties. (See The Nuances of Each Control.) I created radio button options (the round buttons that can only have one selection at once) and check box options (the boxes that can have more than one selection). To group these controls together, I used a group box with my question as the label. I was especially impressed with how professional these group boxes looked. Once I finished creating all my controls and labels, I went back to each control's properties and assigned it a label in the label field I couldn't type in at first. When I clicked the ellipsis (...) a list of all my labels opened from which I could assign each control. Note: to perform this action, you will need to ungroup your text box and label box. You can regroup them once the label field is assigned. (See Aligning, Sizing and Making It Look Good.)
The Nuances of Each Control
To make OpenOffice.org form controls work the way you want them to, you need to understand how to manipulate the properties for each form control. Here's a list of some of the nuances you'll want to remember.
Check box: To make a check box "uncheck" when you click in it, select Selected in the Default Status field of the control's properties.
Text box: If you need a text box to contain more than just one line of text and you want to give the person filling out the form options to format that text as in a word processor, select multi-line with formatting in the Text Type field of the control's properties.
Formatted field: You can choose any kind of number formatting options for this field. To select your formatting, click the [...] button and choose a format in the dialog that appears. You can also choose User-defined in the Category field of that dialog to create your own number format.
Button: To activate your button when you press Enter, select Yes in the Default button field of the control's properties.
Option button (radio button): To group more than one of these buttons together and create a radio button group, give each button the same name and use the group box control to surround them and add a question or label.
List box and Combo box: Add more than one custom entry in these drop-down list boxes by pressing Shift + Enter after you enter each option in the List Entries field of the control's properties.
Date Field: To get the cool drop-down calendar to show up, select Yes in the Dropdown field of the control's properties.
Time Field: Select Yes in the Strict Format field of the control's properties to force the field to only recognize numbers, not numerical characters. That way, for example, if someone enters "a.m." the field only records numbers in the format you specify.
Number and Currency Fields: When you choose the option to insert a spin button on these controls, you might also want to change the increments that spin button produces. Change the increment value in the Incr./decrement value field of the control's properties.
Pattern Field: The Pattern field allows you to define exactly the way you want text entered. Do this by defining the Literal Mask and Edit Mask fields in the control properties. Using the Literal mask, define which characters you want to be constant. For instance, to define a Literal mask for a United States telephone number with an area code in parentheses, type (___)___-____ in the Literal Mask field. In the Edit Mask field, use some codes to define what type of characters each of the positions in the Literal Mask field must be. So, the Edit Mask would be LNNNLNNNLNNNN, in which L is a text constant that cannot be changed and N is a numerical value 0-9. See a list of all the Edit Mask codes in OpenOffice.org Help.
At this point, I also wanted to test my form to make sure I could use the tab key to navigate in my form. I know I usually use tab to get around in forms, and I assume most other people used to filling in electronic forms do, as well. I had noticed that in each form control there was a Tab order field with the dots that meant it led to another dialog. I opened the properties of one of my form controls and clicked the dots. A tab order dialog with a list of all my controls opened. I had options to move up, move down, and perform an automatic sort. I moved the form controls in my list until the order was set the way I wanted it to be. (see figure 4.)
Making It PDFriendly
Finally, with just a little bit more aligning and a quick proofread overall, (Spell Check doesn't check labels, so be careful about spelling), I was ready to create my PDF. I knew from previous experience that OpenOffice.org creates PDFs quickly and seamlessly, but I wasn't sure if the form controls would translate. I selected Export to PDF from the file menu to make sure I saw a PDF dialog with options. After choosing a filename and clicking save, a dialog opened. Right there on the front General tab the option was already checked: Create PDF form. I chose the default submit format and clicked export. Just to be safe, I opened it in Acrobat reader. The form fields worked and even showed me the warning to print to save the changes in the form exactly as I expected.
I've since e-mailed the form to all the parents, but haven't received any forms back, so I'm not quite sure about the results. I'll be sure to keep you posted.
Kicking it up a notch
For those of you who are ready to take your forms to the next level, check out the Events tab in the Control dialog box. With events you can write macros and have them executed when a certain event takes place on the form. For example, if I want a master list of the children's birthday's, I could use the Event tab to automate the process. Start by writing or recording the macro. Then, in the Event tab, assign when you want the event to take place, for example, when text is modified. Voila! Every time the text is modified in the form, your master list is updated. (see figure 5.) Use it to print your master list with every update, or anything else you can think of.
Interested in the short path to familiarity with OpenOffice.org? Read the previous articles in this series, which cover the following topics: