Outils pour utilisateurs

Outils du site


issue108:libreoffice

Ceci est une ancienne révision du document !


Often, when creating a document, you find the need to insert information about the document into the document. You can use LibreOffice fields to get information like page number, total pages, title, author, word count, etc. With minimal setup, you can insert the information into your document, and the fields will update as their values change.

Common Fields A group of fields are available directly through the menus, and I call them the common fields, since some developer decided they were the most used. They are located under Insert > Fields. The fields are Page Number, Page Count, Date, Time, Title, Author, and Subject. You will see later where the Title, Author, and Subject fields are set. The Page Number is related to the current page on the current document, while the Page Count is the total number of pages in the document. These fields are handy because they can change from the time you enter them. You might insert a page before the current page. Without the fields, you would have to go through every page after the insert and renumber the pages. Using the fields, the page numbers will adjust automatically. The same is true of the page count. As you edit, you might increase or decrease the total number of pages. The Date and Time fields allow you to insert the current date and time. We saw a good example of using the date and time fields in the last issue (Full Circle 107) in my article on Auto Text, but they are also useful in templates and master documents. To insert the common fields, just select them from the menu Insert > Fields.

Metadata Before we dive further into document fields, we will look at the places where much of the information used by the fields is stored. The two main sources for the information are ‘user data’ and the document properties. Each provides reusable information.

User Data User Data is information about the author (or user) of the document. You can access the User Data at Tools > Options > LibreOffice > User Data. If you have never filled out this information, it is blank. Text boxes are provided for first, last name and initials, as well as full address, title, phones, fax, and email. If you are in a company environment, there is also a box for the company name. Check the box “Use data for document properties” to have LibreOffice to automatically apply information like the name as author to the document properties of new documents. Any changes you make to the User Data takes effect only after you restart LibreOffice.

Document Data There’s a wealth of fields related to the document itself. Some of them are listed in the common fields under Insert > Fields. Some of the information, like word count, page numbers, page count, changes as the document is edited and revised. Other options like the title and subject are added by the writer or editor of the document. The document fields are located in the properties of the document, File > Properties. The General tab shows us a wealth of information that we can't change from this dialog. You can see the file name and its location, as well as its size, creation, and last modified dates. At the bottom of the tab, you find a check box labeled “Apply user data.” When checked, it saves the user's full name with the file. The name used is the one in the User Data mentioned above. The revision number is nothing more than a count of the number of times the document has been saved. If, like me, you save often, this number ticks up quickly. The Reset Properties button will reset all the dates, modifications, author, and revisions to the current state. The current user becomes the author, the created and last modified fields change to the current date and time, and revisions is set to 1.

The Description tab is where you provide the basic information about the document. If you are not in the habit of using this, I recommend giving it a try. You can use this data to maintain consistency in your document. You have text boxes for the title, subject, keywords, and comments. These inputs are where the fields look for this information, so this tab is key to using fields like title and subject. The Custom Properties tab allows you to create your own properties for the document. For example, when creating a document, you need to create a header entry on each page with your last name and a shortened title. To create this custom field, click on the Add button. You get entry boxes for Name, Type, and Value. You can click on the arrow for the Name and see some predefined suggestions for field names or fill in your own. You won't find any that meet our needs, so you type in “Short Title” for the name. There are six different types, Text, DateTime, Date, Duration, Number, and Yes or No. In this case, you are just adding a text property, so you select Text. In the Value text box, enter your last name and short title. For example, “Perry/LibreOffice 59.” Click OK when you are finished adding custom properties.

Document Fields While LibreOffice gives you quick access through the menu to Title, Author, and Subject, dozens of other document fields are available. They are located in the fields dialog. You access them under Insert > Fields > More Fields. On the Document tab, you have general information. While some of the common fields are here like Title, Date, and Time, you can do more with them here than you can by just selecting them from the menu. When you select the Author, you discover you can insert the name or just the writer's initials. Selecting Date or Time gives you a wealth of formatting options. You have options for Chapter, File name, and Page. Sender gives you a list of all the data from the User Data in the LibreOffice options. Statistics allows you to insert tallies on different elements of the document: pages, paragraphs, words, characters, tables, images, and objects. Templates lets you insert information about the template used to create the document. The DocInformation tab contains even more fields about the current document. You can insert the Comments, as well as the Keywords, from the document's properties. There are fields for when the document was created, last modified, and last printed – with options to insert the author, time, and date of the creation, modification, or printing. Subject and Title show up here as well. The Revision number, as I already mentioned, is just the number of times the document has been saved. The “Total editing time” is just that, the total amount of time you have spent with this document open. You can select several formats for this field depending on how you want it to display. Might come in handy if you need to report how long you spent creating and editing a document. You will also find your custom created properties here under Custom.

Once you select any of these fields and the related options, you can click on the Insert button to insert them into your document. If any changes occur, the fields will automatically update. If you need to use one of the fields from the dialog often, you can create an Auto Text – the way you did in part 68 for the Journal Entries (Full Circle 107). Also, the keyboard shortcut for the fields dialog is CTRL-F2. Finally, I'm sure you have noticed that fields get highlighted in gray. The highlighting does not show when you print the document. You can control whether or not the shading shows at Tools > Options > LibreOffice > Appearance. You can change the color of the Field Shadings option, or uncheck it to prevent it from showing. To quickly turn the shading on and off, select View > Field Shadings from the menu, or press CTRL-F8. Using LibreOffice fields, you can insert information about your document directly into the document, and have those fields update as they change. Besides the common fields, you will find statistical fields, fields about the author, fields about the document, and you can even create your own fields. To create quicker access to a field formatted a certain way, you can create an Auto Text entry with a shortcut to access the entry.

issue108/libreoffice.1462051026.txt.gz · Dernière modification : 2016/04/30 23:17 de d52fr