Export and then import a confluence page that has jira filters
Asked by George Gkiokas:

Hello community,

I would like to ask for an advice on the question of effective update of confluence pages. I will break the question into two parts.

I have the following confluence page that contains as you see below:

* tables
* notes
* and JIRA filters that if expanded they create pie charts.

My purpose is to copy this page to another location and use **different** JIRA filters. So I want to investigate the below:

![245316258_300847455204537_3087926403157605187_n.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/165115i1405B631A089E576/image-size/large?v=v2&px=999 "245316258_300847455204537_3087926403157605187_n.jpg")

++1st Question++

Can I export an html page, then re-import it and get the exact same result as the image above ? I have tried the actions **Export to Word** and then **Import word document** but it seems that it doesn't work. The tables are all expanded by default and other problems also exist.

++2nd Question++

Given that 1st Question is something doable, can I replace in the exported html the key-words needed for JIRA filters , then re-import it and the new filters are applied ?

It is very difficult to update all JIRA filters manually in heavy pages like the above.

Export/ Import actions:

![245287542_197444969176565_9040626902149645583_n.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/165114iFD90E6B6B673B9E9/image-size/large?v=v2&px=999 "245287542_197444969176565_9040626902149645583_n.jpg")


Answers:
author: Radek Dost?l
body: Why not copy the page, move the copy to the destination space/parent, and modify the jiraissues macro parameters?

Word is just.. well, Word, it doesn't keep Confluence macros, it just gets a "visual" translation of the Confluence page, and surely enough importing that Word will not create any macros for Jira issues, the Word document doesn't have any such thing. There is some conversion happening in terms of text styles, but at the end of the day, Word does not keep the Confluence macro, it can't be imported back.

However, if you copy the Confluence page, the copy has the same macro, and then you can just edit the page to change the filter.

comments: author: George Gkiokas
body: Dear Radek,

Thank you very much for your quick response.

Indeed, Copy-Paste is very helpful in some cases. The reason I do not copy-paste is the following:

Imagine that I have numerous v1,v2,v3,...,vn and I want to paste them in a different page with **different** jira filters. Then I have to go one by one and change manually the jira filters. So ++5 filters per row **x** N rows++, I have at least 25 filters that I must change manually each time we release a product. This is really difficult if you take into consideration the logical delay of loading these heavy pages.

So I would like to find a way to have this page exported (html format ??), and then re-import it replacing only some key-words of jira filters (e.g team1 ---\> team2). Based on the assumption that new jira filters already exist in Jira, I think macros can also be executed. What do you think ?

Thanks again !

Giorgos


author: Radek Dost?l
body: Do you have <https://marketplace.atlassian.com/apps/1210722/confluence-source-editor?tab=overview> installed by a chance?

The thing is, you could export the page in either wiki or storage format and both are "viable" for import, but you cannot really use either to import a single page unless you want to automate this with REST and basically build your own client to download the source, modify it, and then upload it somewhere, that's possible but also a lot of overhead and maintenance. At least how I see it.

With source editor, you can view the storage format of your source page -- this is basically custom xhtml format of that page (the way it's stored in backend). This storage code contains lines for your macros, similar to

```
<ac:structured-macro name="jiraissues" macro-id="1bsdfsdf654-651sd8f719">
...
  <ac:parameter name="jql">project = ABC and Team = "team 1"</ac:parameter>
...
</ac:structured-macro>
```

In this storage format, it can be either issueId, filterId, or raw JQL, depending on your source parameters. In the storage format, I imagine it would be easy to replace, I can't think of another way to modify it without custom plugins or rest clients.

Just like with the source editor you can view the storage format, you can modify it even with existing pages. I don't know if you can use this for page create, but even if you created an empty page then you can for sure edit it and paste your storage format to create the body.

The one potential problem I see in this is that when you do get the storage format, each macro (and I mean each) has it's own macro-id. I do not know what happens when you copy paste it to a different page with the same id, I don't remember a problem with it, but I gave it no testing. Maybe it will detect and change the id, maybe not, I don't know, it'd be probably worth the time to test it.

You could always just copy the page and **then** modify the storage format directly in Confluence and just replace the jql in the xhtml parameter tags (the editor has search and replace function too).

Sounds a bit weird, but my first idea how to do this "programmatically" outside Confluence page editor without creating more work.


Tags: jira

questions-for-confluence