Difference between revisions of "Documentation/OOoAuthors User Manual/Writer Guide/Editing a template"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Note in twice, to show problem with Note tag)
Line 29: Line 29:
 
<li>Name the macro. For example, you could call it FixDocument. If the '''Edit''' button is active, click it. If the Edit button is not active, click '''New''', type a module name in the pop-up dialog, and click '''OK'''.</li>
 
<li>Name the macro. For example, you could call it FixDocument. If the '''Edit''' button is active, click it. If the Edit button is not active, click '''New''', type a module name in the pop-up dialog, and click '''OK'''.</li>
 
<li>In the Basic window, enter the following:</li>
 
<li>In the Basic window, enter the following:</li>
<code>
+
<source lang="oobas">
 
   Sub FixDocument
 
   Sub FixDocument
 
   TemplateName = ThisComponent.DocumentInfo.Template
 
   TemplateName = ThisComponent.DocumentInfo.Template
Line 36: Line 36:
 
     end if
 
     end if
 
   End Sub
 
   End Sub
</code>
+
</source>
 
<li>Click the '''Run BASIC''' icon, then close the Basic window.</li>
 
<li>Click the '''Run BASIC''' icon, then close the Basic window.</li>
 
<li>Save the document.</li>
 
<li>Save the document.</li>
Line 50: Line 50:
 
<li>Name the macro. For example, you could call it FixDocument. If the '''Edit''' button is active, click it. If the Edit button is not active, click '''New''', type a module name in the pop-up dialog, and click '''OK'''.</li>
 
<li>Name the macro. For example, you could call it FixDocument. If the '''Edit''' button is active, click it. If the Edit button is not active, click '''New''', type a module name in the pop-up dialog, and click '''OK'''.</li>
 
<li>In the Basic window, enter the following:</li>
 
<li>In the Basic window, enter the following:</li>
<code>
+
<source lang="oobas">
 
   Sub FixDocument
 
   Sub FixDocument
 
   TemplateName = ThisComponent.DocumentInfo.Template
 
   TemplateName = ThisComponent.DocumentInfo.Template
Line 57: Line 57:
 
     end if
 
     end if
 
   End Sub
 
   End Sub
</code>
+
</source>
 
<li>Click the '''Run BASIC''' icon, then close the Basic window.</li>
 
<li>Click the '''Run BASIC''' icon, then close the Basic window.</li>
 
<li>Save the document.</li>
 
<li>Save the document.</li>

Revision as of 07:54, 20 January 2009


You can edit a template's styles and content, and then, if you wish, you can reapply the template's styles to documents that were created from that template. (Note that you can only reapply styles. You cannot reapply content.)

To edit a template:

  1. From the main menu, choose File > Templates > Organize. The Template Management dialog opens.
  2. In the box on the left, double-click the folder that contains the template that you want to edit. A list of all the templates contained in that folder appears underneath the folder name.
  3. Click the template that you want to edit.
  4. Click the Commands button.
  5. From the drop-down menu, choose Edit. The Template Management dialog closes and the selected template opens.
  6. Edit the template just as you would any other document. To save your changes, choose File > Save from the main menu.
Template Management dialog.

The next time that you open a document that was created from the changed template, the following message appears.

Apply current styles message.

Click Yes to apply the template's changed styles to the document. Click No if you do not want to apply the template's changed styles to the document. Whichever option you choose, the message box closes and the document opens in OOo.

Documentation caution.png If you choose No in the message box shown above, that message will not appear again the next time you open the document after changing the template it is based on. You will not get another chance to update the styles from the template, although you can use the macro given in the Note below to re-enable this feature.

Template:Documentation/Note

Note:

To re-enable updating from a template:

  1. Use Tools > Macros > Organize Macros > OpenOffice.org Basic. Select the document from the list, click the +, and select Standard. If Standard has a + beside it, click that and select a module.
  2. Name the macro. For example, you could call it FixDocument. If the Edit button is active, click it. If the Edit button is not active, click New, type a module name in the pop-up dialog, and click OK.
  3. In the Basic window, enter the following:
  4.   Sub FixDocument
      TemplateName = ThisComponent.DocumentInfo.Template
        if TemplateName <> "" then
        ThisComponent.DocumentInfo.Template = TemplateName
        end if
      End Sub
  5. Click the Run BASIC icon, then close the Basic window.
  6. Save the document.

Next time when you open this document you will have the update from template feature back.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools