This user macro creates a panel pre-formatted to specific colours. It will create a panel that looks like this:

(Title)

 

Note: The panel's title will be empty if the user does not give a value for the title parameter.

(warning) The information on this page does not apply to Confluence OnDemand.

Defining the 'Formatted Panel' user macro

  1. Choose the cog icon  at top right of the screen, then choose Confluence Admin.
  2. Choose User Macros in the left-hand panel.
  3. Choose Create a User Macro at the bottom of the list of macros.
  4. Enter the macro attributes as follows:
    • Macro Name: formpanel
    • Visibility: Visible to all users in the Macro Browser
    • Macro Title: Formatted Panel
    • Description: Creates a panel preformatted with specific colours

    • Categories: Formatting
    • Icon URL: You can leave this field empty.
    • Documentation URL: You can leave this field empty.
    • Macro Body Processing: Escaped
    • Template:

      ## @param Title:title=Title|type=string|desc=Title
       
      <ac:macro ac:name="panel">
              <ac:parameter ac:name="titleBGColor">#ccc</ac:parameter>
              <ac:parameter ac:name="borderStyle">solid</ac:parameter>
              <ac:parameter ac:name="borderColor">#6699CC</ac:parameter>
              <ac:parameter ac:name="borderWidth">2</ac:parameter>
              <ac:parameter ac:name="titleColor">#000000</ac:parameter>
          <ac:parameter ac:name="title">$!paramTitle</ac:parameter>
          <ac:rich-text-body>$body</ac:rich-text-body>
      </ac:macro>
  5. Choose Save.

Explanation of the code in the macro template

ItemDescription
## @param Title:title=Title|type=string|desc=Title

@param defines the metadata for your macro parameters. When users select this macro, the macro will contain a parameter called "Title" where they can enter data. A macro dialog window appears when the user selects this macro using Insert > Other Macros or when a user clicks the macro placeholder and chooses Edit. The macro will, later on, use the data stored in this parameter to enter data in the title section of the Panel macro.

@param Title

This parameter is called "Title".

title=Title

defines the parameter title that will appear in the macro dialog window as "Title".

type=string

defines the field type for the parameter as a text field.

desc=Title

defines the description of the parameter.

 <ac:macro ac:name="panel">

This command activates the Confluence Panel macro.

Hint: To discover the code name of a Confluence macro, see Confluence Storage Format for Macros. If the macro you want is not documented there, follow these steps:

  1. Create and save a page containing a Confluence macro you want to investigate.
  2. Choose Tools > View Storage Format. This option is available to Confluence administrators only, and shows the XML source code for the page. (See Confluence Storage Format.)
  3. A Confluence macro starts with the following string: <ac: macro ac:name=

<ac:parameter ac:name="titleBGColor">#ccc</ac:parameter>
<ac:parameter ac:name="borderStyle">solid</ac:parameter>
<ac:parameter ac:name="borderColor">#6699CC</ac:parameter>
<ac:parameter ac:name="borderWidth">2</ac:parameter>
<ac:parameter ac:name="titleColor">#000000</ac:parameter>

Sets the parameters for the macro: the background colour, border style, border colour, border width and title colour.

Hint: To discover the names of the parameters for a Confluence macro, see Confluence Storage Format for Macros. If the macro you want is not documented there, follow these steps:

  1. Create and save a page containing a Confluence macro you want to investigate.
  2. Choose Tools > View Storage Format. This option is available to Confluence administrators only, and shows the XML source code for the page. (See Confluence Storage Format.)
  3. The macro parameters start with the following string: <ac: parameter ac:name
<ac:parameter ac:name="title">$!paramTitle</ac:parameter>

Enters the value stored in the 'Title' parameter into the title section of the macro.

The ! tells the macro to leave the title blank, when there is no data in the "Title" parameter.

<ac:rich-text-body>$body</ac:rich-text-body>

Users can enter data that is stored in the body of the macro. This line enables the macro to access and store the body content passed to your macro.

</ac:macro>

This command marks the end of the macro.

  • No labels