Creating and Using Fields

Fields are bits of information, such as page numbers , dates, document headings, cross-references, index markers, database fields, and a host of other information that Writer generates or that you can insert. You can insert them quickly from the Insert menu, but they're all accessible and editable from the Fields window: choose Insert > Fields > Other.

graphics/34inf01.jpg

For example, you can insert a field into a document that shows the date that the document was last modified, or you can insert page numbering to show the current page number along with the total page count, as shown in Figure 34-1.

Figure 34-1. Inserting page numbering and page count fields

graphics/34fig01.gif

Much of the business card information is defined in headers, as well as a lot of what you see in templates. You can also define conditional fields that print a different value based on whether a condition is true.

Inserting Fields

  1. Click in the exact spot in the document where you want to insert a field.

  2. In the toolbar, click and hold down the Insert Fields tool, and choose the field you want to insert. (You can also choose Insert > Fields.)

    If you don't see the field you want, choose Other, and select the field you want to use in the Fields window. For definitions of the fields in this window, see Table 34-1 on page 860.

    graphics/34inf02.jpg

Changing the Date Format for the Date Field

When you choose Insert > Fields > Date, it's always inserted in MM/DD/YY format. We don't know how to change this default format, but you can do either of the following:

  • You can change the format each time by double-clicking the field and selecting a different format in the Edit Fields window.

  • Select the inserted date field after you've correctly formatted it, then select it and create a new AutoText entry. See Creating and Inserting AutoText on page 866.

Turning Off the Gray Background

Any time you insert a field or any other element that's generated by Writer, it is displayed with a nonprinting gray background by default. If you don't want to see the gray background on-screen, choose View > Field Shadings.

However, we recommend leaving field shading on, because it helps you distinguish between what you enter as text and what is generated by Writer.

Advanced Field Definition and Use With the "Other" Fields

When you click and hold on the Insert Fields tool in the toolbar, then choose Other (or choose Insert > Fields > Other), the Fields window is displayed (Figure 34-2) to let you select another type of field.

Figure 34-2. The Fields window

graphics/34fig02.jpg

You can leave the Fields window open , and switch back and forth between it and your document. Table 34-1 describes the fields available in the Fields window.

Table 34-1. Descriptions of "Other" fields

Field

Description

Document tab

About Document fields

These fields are for inserting values primarily stored in the windows accessible through File > Properties and Tools > Options > OpenOffice.org > User data.

Sender

The author of the document, as identified in Tools > Options > OpenOffice.org > User Data. Select the Fixed content option if you don't want the name of the author to change when someone else opens the document.

Chapter

Think of this as "chapter-level heading" instead. Use this to display the current document heading in the header or footer (called running heads). In the Level field, set the level of heading you want to display. Levels map directly to chapter numbering styles. See Outline Numbering, for Chapter, Figure, and Cross-Reference Numbering on page 314.

Date

Inserts the current date, based on the computer's date setting. Select Date (fixed) if you want the date to remain what it was when you inserted it. Select Date if you want the date to update each time the document is opened. Select the formatting under the far right Format column.

Document Template

Inserts basic information about the template the document is based on, from File > Properties.

File Name

Lets you insert the name of the file in different ways. Select the Fixed content box if you want to display the original file name if it's later changed.

Page

Inserts a page number. Select the As Page Style format to use the default numbering format set up in the current page style. Otherwise , select the numbering style you want to use.

Sender

Inserts select information about the person sending the document, as defined in Tools > Options > General > User Data.

Statistics

Gives you the count of the number of different elements in the document: words, characters , pages, graphics, etc., from File > Properties.

Time

Inserts the time, based on the computer's clock. Select Time (fixed) if you want the time to remain what it was when you inserted it (further testing needs to be done to see if this makes time stand still). Select Time if you want the time to update each time the document is opened. You can enter a positive or negative offset number to adjust the inserted time relative to the current time. You can also select Additional Formats in the Format list and define your own time format.

References tab

About Reference fields

This is where you insert the references or referenced fields into the active document. References are referenced fields within the same document or within sub-documents of a master document.

The advantage of entering a cross-reference as a field is that you do not have to adjust the references manually every time you change the document. Just update the fields with F9 and the references in the document are updated too.

Set Reference

Use this for cross-referencing. In Writer, you don't cross-reference existing content. You must put (set) a reference in the spot you want to cross-reference. Click where you want to reference, enter the name of the reference point (usually the name of a heading, figure, or table you want to cross-reference), and click Insert. The reference names you've entered display in the Selection list, where you can cross-reference them using Insert Reference ( next ).

In an HTML document, reference fields entered this way will be ignored. For the target in HTML documents, you have to insert a reference field.

Insert Reference

When you want to cross-reference something (either in the current document or in another file that's part of a master document), select Insert Reference, select the item you want to cross-reference (in the Selection list), select the format for the cross-reference, and click Insert. (For more information, see Cross-Referencing on page 331.) You can also use above/below, which inserts the words above or below if the reference occurs before or after the insertion point. For example, "See Water Ballet for Dogs above." But for heaven's sake, if you use above/below, make sure the reference is physically on the same page as the cross-reference. If it's not, you may have your poor readers looking randomly up at the sky or down at the floor trying to find the reference.

Bookmarks

You can also cross-reference bookmarks you've inserted using Insert > Bookmark. When you insert bookmarks in an HTML document, Writer creates an <A NAME= bookmarkname > reference for internal page jumps . However, bookmarks in a Writer document are not converted to <A NAME=> references if you convert the document to HTML.

Functions tab

About function fields

Function fields execute a certain function which can be tied to a condition, depending on the field type. You can define fields that execute a certain macro when clicked with the mouse or fields that hide a text passage depending on a certain condition. For graphics, tables, frames and other objects, you can define placeholders in order to insert the objects into the document when needed.

Conditional Text

Insert text depending on a condition. Under Condition, enter x eq 1, for example, where x is a field in the document. Under Then, enter text that is inserted if x=1. Under Else, enter text that is inserted otherwise. X can be determined with the field types "Set variable" or with an input field for a new variable.

Input Field

Inserting form fields for text input. You can add a remark. When you click the Insert button, the dialog Input Field appears, where you can enter and edit the desired text.

Execute Macro

Insert a text field that automatically executes an assigned macro following a double-click. You can choose the desired macro with the Macro button. After choosing the macro, you can enter the necessary remarks in the text field Remark.

Placeholder

Insert a placeholder in the document. You determine the placeholder type under Format. Enter the description in the Text field Placeholder. If you click the placeholder in the document, you can insert the object that is represented by the placeholder.

Hidden Text

Insert text that is hidden if a condition is met. In order to hide such text on screen, deselect the option Hidden Text under Tools > Options > Text document > Contents.

Hidden Paragraph

Hide a paragraph if the condition entered under Condition is true. These fields can be used, for example, to suppress empty paragraphs during printing. To hide such paragraphs on screen, deactivate the menu command View > Hidden Paragraphs or the option Hidden Paragraphs under Tools > Options > Text document > Contents.

The conditions for "Hidden Text" and "Hidden Paragraph" can now be formulated in a similar manner. In earlier document formats, up until StarWriter 4.0, the reversed logic was valid for "Hidden text". When saving and loading older formats, the logic for "Hidden text" is therefore automatically reversed .

Combine Characters (only when Asian fonts are supported)

Combine 1 to 6 characters that are treated as one normal character after they have been successfully combined.

DocInformation tab

About DocInformation

These fields let you insert information stored in the window accessed through File > Properties. The Document tab lets you access other fields from that same window.

Created

Lets you insert the name of the author who created the document, and the time and date the document was created. Select the Fixed content option to keep this information from changing when other people open and change the document.

Description

Inserts the document description, taken from the Comment field of the document properties (File > Properties, Description tab).

Document Number

Inserts the number of times the document has been saved.

Editing Time

Inserts information about time spent editing the document.

Info

Inserts the information from the selected Info field, taken from the Info fields of the document properties (File > Properties, User Defined tab).

Keywords

Inserts the keywords assigned to the document, taken from the Keywords field of the document properties (File > Properties, Description tab).

Modified

Inserts the name of the author who last modified the document, or the time and date the document was last modified.

Most Recent Print

Inserts the name of the author who last printed the document, or the time and date the document was last printed.

Subject

Inserts the subject of the document, taken from the Subject field of the document properties (File > Properties, Description tab).

Title

Inserts the title of the document, taken from the Title field of the document properties (File > Properties, Description tab).

Variables tab

About Variables fields

With variable fields, you can control the content of your document dynamically. For example, you can change the counting of the page variables or define numberings as variables in order to enable automatic updating. You can define variables individually or select them from preset variable types.

Set Variable

Lets you create and insert a variable in a document that can be used as a trigger for conditions. For example, you can create a variable to trigger certain sections of the document to be hidden if the variable is a certain value.

Show Variable

Inserts the value of a selected variable in the document.

DDE Field

Lets you insert a Dynamic Data Exchange (DDE) link to another document.

Insert Formula

Lets you enter a formula and insert the results in the document.

Input Field

Lets you select a predefined variable and turn it into a hyperlink that brings up a window to let you change its value.

Number Range

Lets you insert a number, as well as incorporate the chapter number (set up in Tools > Outline Numbering), for a drawing, graphic, illustration, table, or for text in general.

Set Page Variable

For use with the Show Page Variable. Lets you set a marker in the document from which to begin page counting. Be sure to select "on". You can also enter an offset, positive or negative, with relation to the marker. An offset of -1 would be as if the marker were inserted 1 page earlier. See the next description for how you might use this.

Show Page Variable

Inserts the number of pages from the Set Page Variable marker to where this variable is inserted. One way to use this would be to set a marker (using Set Page Variable) in a document at the beginning of a topic, and at the end of the topic (say it's five pages later), type, "The past <#> pages described the three major factors to overcome in order to successfully build a summer home in a fire swamp", where <#> is the inserted Show Page Variable.

User Field

Lets you create a variable that will be the same wherever you insert it and change universally when you change it in one place. For example, say you want to insert the text "Microsoft" throughout a document. If you know the value of that variable is going to change, like from "Microsoft" to "Monopoly", a user field lets you change it in one place and it updates everywhere. To help automate the changing of its value, select the first instance of a user variable in the document, and insert an Input field so that all you have to do to change the value of the field is click on it and make the change in the window that appears.

Database tab

Any Record

Lets you set a condition on database records to determine which records are used in a mail merge. Click the Help button in this window for more details.

TRUE is the default condition, which means all selected records will be included.

Database Name

Inserts into the document the name of the database selected in the Database selection area.

Form letter field

Lets you insert database fields in a document to set up a mail merge.

Next record

Inserts a Next record marker between mail merge groupings in a document to print consecutive records on the same page. The records you want to include must be selected in the data source viewer window.

Record number

Inserts in the document the number of the record that's selected in the data source viewer window.

Editing Fields

You can't edit a field by typing in it. You have to either replace it with another field or double-click it to open the Edit Fields window and redefine the field. Refer to Table 34-1 for help on types of fields.

User-Definable Number Formatting for Cells and Fields

When you select Additional Formats in the far right Format column in the Fields Window, the Number Formatting window appears. To learn how to create your own numbering formats, see Number Formatting in Cells on page 286.

Condition Syntax

See the online help for extensive conditional syntax information.

Note

See also conditions used in sections, in Hiding a Section With or Without a Condition on page 415.




OpenOffice. org 1.0 Resource Kit
OpenOffice.Org 1.0 Resource Kit
ISBN: 0131407457
EAN: 2147483647
Year: 2005
Pages: 407

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net