Create a custom simple macro

Creating a simple macro with no parameters except the one which defines the width of macro in view mode of confluence page.

So my macro is working perfectly except the part where it keeps on loading on insert/edit macro screen -

Capture 2017-05-02 at 0.32.52.png

So here is my piece of code - 

<xhtml-macro name="search-report" class="com.temp.ReportMacro" key="search-report-xhtml">
        <description key="com.temp.macro.desc"/>
        <category name="reporting"/>            
            <parameter name="width" type="pixel" default="500px"/>


public class ReportMacro implements Macro {

	public String execute(Map<String, String> arg0, String arg1, ConversionContext arg2)
			throws MacroExecutionException {

		Map<String, Object> contextMap = MacroUtils.defaultVelocityContext();
		contextMap.put("reportType", "macro");
		return VelocityUtils.getRenderedTemplate("vm/temp-report.vm", contextMap);

	public BodyType getBodyType() {
		return BodyType.NONE;

	public OutputType getOutputType() {
		return OutputType.BLOCK;


I don't see any problem with the code, so what am i missing.

1 answer

1 accepted

Problem in my code was type="pixel". Wasted 4 hrs on searching other stuff.

Ann Worley Atlassian Team May 09, 2017

Thanks for getting back to us - it will help the next person.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published 14 hours ago in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

99 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you