Documentation/WollMux/FormularMax/Create Customize a template

    From The Document Foundation Wiki
    Other languages:

    Creation of a (WollMux) template

    The topics explained here and on Content based directives explain step by step how to create a new template with LibreOffice and the WollMux. Additions to the template conversion are marked separately.


    Choosing a mixed template

    What is a mixed template

    A mixed template is a template for a template. Almost all templates at the City of Munich contain a letterhead. Mixed templates allow you to create templates without having to worry about the design of the letterhead. You only have to decide which letterhead the template should contain and select the appropriate mixed template.

    The mixed templates do not contain a letterhead, but only a command, which is used to insert the letterhead when the template is opened.

    This also has the advantage that you do not have to copy a letterhead into the template. Also, the mixed templates always use the exact same letterhead for all templates. These templates can be used by many people, because the personal data is only entered when the letterhead is mixed with the template. Adjustments to the letterhead can also be made without much effort, since you only need to change one letterhead that is used in all templates.

    WARNING Templates in WollMux never contain a visible letterhead

    Procedure

    1. Decide which letterhead is needed for the template.
    2. In the WollMux bar in the menu Standard → Mixed Templates select the appropriate mixed template. If necessary, the location for the mixed templates differs in some units.
    3. Delete the note text and add content to the template.
    4. Save the resulting template as .ott.



    Template style

    In principle, templates and documents should be formatted using styles as much as possible. "Hard" formatting should be avoided.

    Proper style

    Details and explanations can be found in the internet. There is good documentation on the following sites:

    1. Introduction to Styles (English)
    2. styles or styles or search in the AOO wiki

    WollMux styles

    Styles can either be created by yourself or you can use the styles used by WollMux for letterheads. These styles are located in a separate Writer template, which can be inserted into any template. This template (name: WOL_Briefkopf-Absatzformate_v1_2005-11-22.ott) is included in every WollMux configuration.

    These styles can be used as follows:

    1. Switch to the template where the styles are to be inserted.
    2. Please make sure that no text or similar is marked - this would be deleted. Otherwise it does not matter where the cursor is.
    3. Insert the WOL_Briefkopf-Absatzformate_v1_2005-11-22.ott via Insert → File. For this, of course, it must be somewhere in the file system.

    The WOL_Briefkopf-Absatzformate_v1_2005-11-22.ott contains some styles. Explanations of the styles can be found in the WollMux Wiki on the Styles page.

    WARNING The styles inserted in this way must not be modified! These changes would be lost again when mixing the letterhead into the template.

    If these styles are to be adjusted, this must be done via linked styles. This is done in the template to be edited:

    1. Right click on the style to be modified and select New.
    2. Assign a descriptive name, e.g. "Body text indented 2cm". At linked to it says "body text".
    3. Make the settings for this style and save it.

    The template can now be formatted with the styles you have created and inserted. Where, for example, body text is used for the normal template content.

    For templates that are to be converted, all the styles they contain should be deleted first. If necessary, a printout should be made beforehand to be able to check how the text was formatted beforehand, since formatting such as font design, indentations, enumerations, etc. can be lost as a result. To do this, highlight the text and either right-click or use Format → Standard Formatting to remove the formatting.

    fig:Standard formatting
    Standard formatting


    Why use styles

    You shouldn't use styles sheets just as a matter of principle, of course, they offer many advantages, for example:

    • Changing the styles of text or text areas is easier when the text is formatted with styles.
    • It is also easier to implement, for example, a corporate identity (such as the visual identity of the city of Munich).
    • In many cases, styles also reduce the problems that can occur when cross-editing (in different office suites).

    You can also create your own templates analogous to WOL_Briefkopf-Absatzformate_v1_2005-11-22.ott and "swap" your own styles into them. These can also be inserted into any template as described above. This can also be automated as described in chapter Automatic insertion of clerk data using special WollMux commands.

    Saving the template

    In principle, with the previously performed steps, the template is ready to be converted or created. The points described in the following chapters serve to make the template more professional, comfortable and user-friendly.

    To save the formatted template, go to the menu item File in the menu bar and then select the sub-item Save as....

    In the following window you can enter any file name and you have to select the document template with the extension .ott as file type.

    fig:Save Dialog
    Save Dialog


    Opening templates

    If a template is to be opened for (further) editing, this is not possible via File → Open or double-click in Explorer/Konqueror or File Manager. That would turn the template into a document.

    To open a template for editing, there are these alternatives, among others:

    In Writer

    In Explorer (Windows)

    In the base client (only city of Munich)

    In the console, for example.

    File → Document Template → Edit

    Right click on the template and choose Open.

    Right-click on the template and choose Edit Template.

    $ libreoffice5.2 -o /home/Doks/Template.ott

    WARNING Templates in WollMux never contain a visible letterhead.

    Other styles

    Most other formatting, such as indentation, tab stops, etc., is also best handled using styles.

    Tips:

    • Do not indent text with spaces. → better to use tabs or indentations in the styles.
    • Do not indent text with multiple tabs. → a defined tab in a style is better suited.
    • Do not define page breaks using line breaks or paragraphs. → Use "Ctrl + Enter" to insert page breaks.
    • Tables or frames are also suitable for aligning text.



    Automatic insertion of clerk data

    WollMux offers the possibility to insert certain data automatically into the document. A common case here is the clerk data, as they also appear in the letterhead. For example, at the end of a letter, the first name, last name and job title of the clerk should always appear automatically. This is realized by using bookmarks.

    Insert bookmarks

    When using bookmarks, it makes sense to create a kind of placeholder at the desired position, since the position of the bookmark in the template or document is otherwise not visible.

    The placeholder can be marked with angle brackets, for example. For a bookmark that inserts the last name, <lastname> would be suitable. When executing the document, the placeholders are automatically replaced by the appropriate values.

    To insert the bookmark, select the word/text including the angle brackets and then choose Insert → Bookmark.

    After that the window Insert bookmark opens. In this window the WollMux command is entered. This reads as follows:

    HINT WM(CMD 'insertValue' DB_SPALTE '<column name>'

    When entering the command, be exactly case sensitive. The spaces are optional. <Columnname> is to be replaced with values as they are also in Automatically-fillable-fields (City of Munich).

    fig:Insert bookmark
    Insert bookmark

    Updating fields

    Furthermore, there is the possibility to insert an "update field". When inserting text fragments containing text fields (e.g. the date field), these text fields are not automatically updated by LibreOffice. This behavior is especially undesirable when creating new documents, since the text fields in this case should naturally represent the current state. The command "updateFields" can be placed around one or more such text fields and ensures that the contained text fields are updated.

    Automatically fillable fields (City of Munich)

    The most common data to insert into a template using the city of Munich as an example.

    Description

    WollMux commands

    Last name of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'last name')

    First name of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'FirstName')

    Long service name of the clerk.

    WM(CMD 'insertValue' DB_SPALTE 'DienstBezLang')

    Short service designation of the clerk.

    WM(CMD 'insertValue' DB_SPALTE 'DienstBezKurz')

    Salutation of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Salutation')

    Title of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Title')

    Phone number of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Phone')

    Fax number of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Fax')

    Email address of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Mail')

    Room number of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Room')

    Office building of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'duty building')

    Postal code of the service building of the clerk.

    WM(CMD 'insertValue' DB_SPALTE 'DienstgebaeudePLZ')

    Place name of the official building of the clerk.

    WM(CMD 'insertValue' DB_SPALTE 'DienstgebaeudeOrt')

    Abbreviation of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaShort')

    Long name of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaLang')

    Name of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaName')

    Postal address of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'Postal address')

    Postal code of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'PostPLZ')

    Location of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'PostOrt')

    E-mail of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaEmail')

    Phone number of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaTelephone')

    Fax number of the organizational unit

    WM(CMD 'insertValue' DB_SPALTE 'OrgaFax')

    Unit of the clerk

    WM(CMD 'insertValue' DB_SPALTE 'Unit')

    Updating fields

    WM(CMD 'updateFields')

    Change bookmarks

    The overview of the bookmarks can be found in the navigator, which you can access with F5, the small compass in the menu bar or with Edit → Navigator. Here the bookmarks can be edited and deleted.

    To see the bookmarks, you have to left-click on the plus to the left of Bookmarks in the Navigator.

    fig:Bookmarks in Navigator
    Bookmarks in Navigator

    The most common case is probably to rename the bookmark. To do this, right click on the bookmark and then select Bookmark → Rename.

    WARNING If you choose Edit, a copy of the bookmark will be created, there will be two existing on the same position. The old one must be explicitly deleted, as errors may occur during execution (if there was a syntax error, for example).

    Double-click with the left mouse button on a bookmark to display the position of the bookmark in the text.

    WARNING Unfortunately, there is a bug in LibreOffice that causes the bookmark change not to be recognized. So if you change a bookmark, just make a space somewhere and delete it again. Then you can save the change in any case.

    Delete bookmarks

    The deletion of the bookmarks is also done in the navigator. To do this, after right-clicking on the bookmark to be deleted, Bookmark → Delete is selected.

    However, bookmarks can also be deleted by selecting the bookmark to be deleted in the menu via Insert → Bookmark and then pressing the Delete button.



    Inserting fragments

    WollMux also allows you to insert fragments (a fragment basically corresponds to a template). This allows, for example, to combine different data from the data source (e.g. LDAP) into one fragment and have it inserted into a template. This principle is also used for inserting letterheads into mixed templates.

    The command to do this is as follows:

    HINT WM(CMD 'insertFrag' FRAG_ID '$lt;FRAG_ID>'

    The <FRAG_ID> is to be replaced with the appropriate FRAG_ID.

    The templates in WollMux are composed by a large number of fragments. However, in principle only two of them are suitable for template creation:

    • Signature
    • name_designation

    By signature

    Sincerely.
    
    <Title> <FirstName> <LastName>
    
    <DienstBezLang>

    inserted.

    By name_designation becomes

    Sincerely.
    
    <Title> <LastName>

    is inserted.

    For the rest, the notes from chapter Automatic insertion of clerk data apply.

    WARNING In order to use self-created fragments, they must be included in the WollMux configuration and have an ID, usually The filename.

    OverrideFrag

    If you need to customize the letterhead content for some situations, you don't need to build a new letterhead or change the current one. For this case, there is a command called "OverrideFrag". This command replaces one fragment present in the letterhead with another. For example, normally the personal email address is displayed in the external letterhead, but for some cases the email address of the organizational unit is needed.

    The command for this is:

    HINT WM(CMD 'overrideFrag' FRAG_ID 'Frag_id' NEW_FRAG_ID 'New_Frag_id')

    For the above example, it would look like this:

    WM(CMD 'overrideFrag' FRAG_ID 'Email' NEW_FRAG_ID 'OrgaEMail')

    To insert this command, take the appropriate mixed template and insert a text marker with this command in the area where the command for inserting the letterhead is also located.

    All fragments and the corresponding IDs can be found in the WollMux configuration.