The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create a Scriptrunner API endpoint for Word Import?

Joshua DeClerck
Contributor
August 31, 2017

There are a few reporting tools we use that can't generate wiki markup at this time, but can generate simply formatted Word documents that cleanly convert to Confluence pages using its importer.

What I'd like to explore is whether there's any kind of way to expose Confluence's Word importer as a REST endpoint that our reporting engines can automatically post to. It wouldn't need to do much more than take a doc/docx input, target space and (optionally) parent page, and disable page splitting.

But I realize even that much might be asking for a lot. Any help, or suggested alternatives, is appreciated!

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Christo Mastoroudes [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 5, 2017

It might also be possible to do a rest call that creates a page containing a "View File Macro" with it's property pre-configured to the name of the word doc, and also then attach the word doc to the page.

https://confluence.atlassian.com/doc/view-file-macro-170494360.html

1 vote
Christo Mastoroudes [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 5, 2017

I had a quick look at your problem and it is not completely straight forward but should be doable.

So the service that does the conversion is a plugin called "Office Connector plugin" and it seems this is installed as default with confluence.

You should be able to gain access to this service by using the annotation in your rest endpoint defined in ScriptRunner.


import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin
("com.atlassian.confluence.extra.officeconnector")

https://scriptrunner.adaptavist.com/5.1.0/jira/scripting-other-plugins.html

The classes in the OfficeConnector plugin that seem to do the work is WordTextExtractor and WordXMLTextExtractor.

You can download the plugin and investigate the code: https://marketplace.atlassian.com/plugins/com.atlassian.confluence.extra.officeconnector/versions

TAGS
AUG Leaders

Atlassian Community Events