Can I create a user macro, which includes a macro with content?
Example
We have several documents, where we want to have a page-info with some content (table) for PDF export (Scroll PDF Export).
Now, for our authors it is annoying to always create this macro, add the same content, resp. to copy-paste it from a different page.
I also can not create a page and include the page to the document page, as the page info has always the same columns but mostly different content (document numbers etc).
My idea is to create a user macro, which the author can use, which adds the page info macro with the table already prepared. Kind of a template.
Has someone a sample user macro or can guide me to the direction?
I found some parts, but this does not work at all.
Maybe it does not work, I do not know.
Thanks for all replies :)
I think, this would be possible. I'm interessted, what kind of information you want to display?
Depending on the information you want to display, you can easily make a user macro and display the parameters in a table.
For example:
## Macro title: ABC
## Macro has a body: N
##
## This is an example macro
## @param a:title=A|type=boolean|desc=A
## @param b:title=B|type=boolean|desc=B
## @param c:title=C|type=boolean|desc=C
<table id="myTable">
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<td>$parama</td>
<td>$paramb</td>
<td>$paramc</td>
</tr>
</table>
Include another macro
To include another macro, you can copy paste the "Storage Format" of the macro, like:
<ac:structured-macro ac:name="cheese" ac:schema-version="1" ac:macro-id="efb2934d-2e16-4a01-88a9-890c8ac3ce11" />
This is the storage format for the "I like Cheese " macro. Just copy that into your user macro.
How to get to the Storage Format?
Hope this helps you a bit. If you have any further questions, let me know.
Regards, Dominic
Hello Dominic,
thanks for the fast reply.
When I see it correctly, this will create a user macro with a table and a macro.
But this will be independent, right? I will then have a table and beneath (or above) the macro, correct?
What I want to achieve actually is the macro with already added content, like a template.
This is the content I require (well, more rows, but as example I think it explains it)
So, how can I add content in the page properties macro which I embed in my user macro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not quite sure I understand you correctly :)
I try to explain.
A user macro renders its content when viewing the page. So the user macro looks different in the view mode and the edit mode. In the edit mode, you can't add a "template table".
So for you, this would looks like this (I think):
User Macro
## This is an example macro
## @param title:title=Document Sub Title|type=string|desc=Document Sub Title
## @param number:title=Document Number|type=string|desc=Document Number
## @param release:title=Release Date|type=string|desc=Release Date
<table id="myTable">
<tr>
<td>Document Sub Title</td>
<td>$paramtitle</td>
</tr>
<tr>
<td>Document Number</td>
<td>$paramnumber</td>
</tr>
</tr>
<tr>
<td>Release Date</td>
<td>$paramrelease</td>
</tr>
</table>
Edit Mode from the macro
Edit Mode of the page
View Mode of the page
And if this is not the use case you want, I'm so sorry that I didn't understand you correctly...
Let me know it.
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Dominic,
well, I think, when I understand you correctly, that technically it does not work.
I require more a template for a user macro.
Imagine that:
You have 200 Documents and on every document you have to add a macro _Page Properties_ with a table inside the macro of properties (see picture above)
Instead of telling our author to add the page property-macro manually and to add the table manually with the exact same content on the left side of rows, I was thinking to have a macro, which implements exactly this: the page property macro with already prepared table with template content.
More like
Where, when I choose the User Macro, it adds the page properties macro with an embedded table.
Well, and actually, the page properties is hidden, it is only used for the PDF-Export. :D
Actually, I'd have a second use case, but let's focus on this one ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I don't think this is possible with a user macro, I'm sorry...
What about a real template?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You mean a Blueprint?
This works for new documents, that's true. I added that here already.
But we have loads of existing and I was hoping to solve it the easy way.
Anyway, was worth a try.
Thanks for supporting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, a blueprint or a template. That's not the same.
Blueprints have index pages, can't be easily created and can't have predefined labels.
Yeah, sorry for not working this out.
Regards, Dominic
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries mate, thanks anyway for the useful information.
I'm pretty sure I'll have need of that on a later stage :)
Maybe I have to "reopen" this question as for a second case, but I have to re-think that :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.