We'll start by creating a space template with a page layout for creating a project report. The purpose of this template is so we will have a general layout which can easily be changed and updated in the future.

By the end of this section your template should look something like this:


Source code

The following source code is shared using Confluence Storage Format, the XHTML-based format that Confluence uses to store the content of pages, page templates, blueprints, blog posts and comments.

For more information on how to use this source code on your Confluence, read the following article:

Click here for the source code...
<ac:structured-macro ac:macro-id="c07533c2-e2e9-4257-ad74-e390af61198c" ac:name="details" ac:schema-version="1">
  <ac:rich-text-body>
    <table class="wrapped">
      <colgroup>
        <col/>
        <col/>
      </colgroup>
      <tbody>
        <tr>
          <th>Status</th>
          <td>
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="1519b390-a6c9-43d1-96fe-0453f18416ee" ac:name="list-data" ac:schema-version="1">
                <ac:parameter ac:name="name">Status</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="d998a7dc-1797-45e0-9098-454e1bc3b600" ac:name="list-option" ac:schema-version="1">
                    <ac:parameter ac:name="value">Open</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <ac:structured-macro ac:macro-id="1edbeebe-ea42-4546-8d38-1f1bc2fc4bf8" ac:name="status" ac:schema-version="1">
                          <ac:parameter ac:name="title">Open</ac:parameter>
                        </ac:structured-macro>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                  <ac:structured-macro ac:macro-id="b50d1bbe-c0e4-4b17-bc36-ba93d772f0e9" ac:name="list-option" ac:schema-version="1">
                    <ac:parameter ac:name="value">In Progress</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <ac:structured-macro ac:macro-id="eb3117a8-54d4-4770-b893-42e20732248f" ac:name="status" ac:schema-version="1">
                          <ac:parameter ac:name="colour">Yellow</ac:parameter>
                          <ac:parameter ac:name="title">In progress</ac:parameter>
                          <ac:parameter ac:name=""/>
                        </ac:structured-macro>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                  <ac:structured-macro ac:macro-id="5ccce22b-a264-454e-a2ac-5f76c3bbbfa8" ac:name="list-option" ac:schema-version="1">
                    <ac:parameter ac:name="value">Resolved</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <ac:structured-macro ac:macro-id="7d70cc7c-cceb-4620-9d23-d293ef611d22" ac:name="status" ac:schema-version="1">
                          <ac:parameter ac:name="colour">Green</ac:parameter>
                          <ac:parameter ac:name="title">resolved</ac:parameter>
                          <ac:parameter ac:name=""/>
                        </ac:structured-macro>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
        <tr>
          <th>Members</th>
          <td>
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="11c8ce96-7352-4e7b-adfd-9f2a12c55b35" ac:name="list-data" ac:schema-version="1">
                <ac:parameter ac:name="multiple">true</ac:parameter>
                <ac:parameter ac:name="name">Users</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:rich-text-body>
                  <ac:structured-macro ac:macro-id="2aaa485c-b9b0-46d4-ae96-2bca2ce975dc" ac:name="user-options" ac:schema-version="1">
                    <ac:parameter ac:name="groups">confluence-users</ac:parameter>
                    <ac:rich-text-body>
                      <p>
                        <br/>
                      </p>
                    </ac:rich-text-body>
                  </ac:structured-macro>
                </ac:rich-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
        <tr>
          <th colspan="1">Team Size</th>
          <td colspan="1">
            <div class="content-wrapper">
              <p>
                <ac:structured-macro ac:macro-id="33b55fb3-0862-459c-9d24-3fcbe5ad9e54" ac:name="report-info" ac:schema-version="1">
                  <ac:parameter ac:name="">data:Users&gt;size</ac:parameter>
                </ac:structured-macro>
              </p>
            </div>
          </td>
        </tr>
        <tr>
          <th colspan="1">Due Date</th>
          <td colspan="1">
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="d0738b34-2a94-417f-8773-d5a93f48235b" ac:name="date-data" ac:schema-version="1">
                <ac:parameter ac:name="format">dd-MMM-yyyy</ac:parameter>
                <ac:parameter ac:name="name">Due Date</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
        <tr>
          <th colspan="1">Remaining Time</th>
          <td colspan="1">
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="4f1abd0e-7efd-4d51-bef5-626d819a8b9b" ac:name="report-eval" ac:schema-version="1">
                <ac:parameter ac:name="default">0</ac:parameter>
                <ac:parameter ac:name="format">#,##0.00 Days</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
                <ac:plain-text-body><![CDATA[(%data:Due Date>milliseconds%-%global:current date>milliseconds%)/(1000*60*60*24)]]></ac:plain-text-body>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
        <tr>
          <th>Cost</th>
          <td>
            <div class="content-wrapper">
              <ac:structured-macro ac:macro-id="92f41784-4ce3-4a9b-be45-a4107167aa18" ac:name="number-data" ac:schema-version="1">
                <ac:parameter ac:name="format">$ #.##0.00</ac:parameter>
                <ac:parameter ac:name="name">Cost</ac:parameter>
                <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
              </ac:structured-macro>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </ac:rich-text-body>
</ac:structured-macro>
CODE

Steps

  1. Go to Space tools > Content Tools > Templates.

  2. Click Create New Template.

  3. Set the title of the Template to "Project".

  4. Add a Page Properties macro.
    Within Page Properties macro, add a 2x6 table.
    In the first column, type in "Status", "Members", "Team Size, "Due Date", "Remaining Time" and "Cost" respectively for each cell.

  5. In the "Status" column, add a List Data macro in the second row.
    Set its Field Name parameter to "Status". 

  6. Add three List Option macros within the List Data macro.

  7. For the first List Option macro set the Value parameter to "Open".
    • (Optional) To make List Option macro stylish you can add a Status macro and set its name to "Open" and choose your desired color (Grey is used in this example).

  8. For the second List Option macro set the Value parameter to "In Progress".
    • (Optional) To make List Option macro stylish you can add a Status macro and set its name as "In Progress" and choose your desired color (Yellow is used in this example).

  9. For the third List Option macro set the Value parameter to "Done".
    • (Optional) to make List Option stylish you can add a Status macro and set its name as "Done" and choose your desired color (Green is used in this example).  

  10. In the "Members" column, add a List Data macro in the second row.
    Set its Field Name
     parameter to "Users".
    Check Allow Multiple.

  11. Within the List Data macro, add a User Options macro.
    • (Optional) If you want to select users associated to a specific Group, set User Options macro's groups parameter to your desired Group name (confluence-users group is used in this example).

  12. In the "Team Size" column, add a Report Info macro in the second row, set its Key parameter to "data:Users>size"

  13. In the "Due Date" column, add a Date Data macro in the second row, set its Field Name parameter to "Due Date"

  14. In the "Remaining Time" column, add a Report Evaluation macro in the second row.
    Set its Default Value parameter to "0".
    Set Format parameter to "#.##0.00 Days" and Save.
    To calculate remaining time, nest "(%data:Due Date>milliseconds%-%global:current date>milliseconds%)/(1000*60*60*24)" within Report Evaluation macro.

  15. In the "Number Data" column, add a Number Data macro in the second row.
    Set its Name parameter to "Cost" and Format parameter to "#.##0.00".

Macro structure

Click here for the macro structure...