[All Adaptavist Apps]
The Office Connector (also known as Word/DAV plugin) allows you to import from or edit pages in popular word processing applications such as MS Word and Open Office Writer. This tutorial shows how to add navigation links to these features.
The "Edit in Word" feature allows you to edit a wiki page using popular word processing applications. When you click the link, the page will open in the word processor (you'll sometimes be asked to log-in while doing this) and when you've made your changes simply save the document and the wiki page will be updated (you'll have to refresh the wiki pages to see the changes take effect).
The "Doc Import" feature allows you to import a word processor document in to a wiki page. This is useful when you have documents that contain formatting that's not possible using wiki markup - the document will be rendered in your wiki page as close as is possible to the original, but not nessecarily exactly the same.
Important
The code snippets below have been split on to multiple lines to make them easier to read. When you are adding them to your theme layout please remember to put everything on a single line.
You must have the plugin installed before you can use these features. Also, please note that the links are different depending on your version of Confluence.
The Office Connector plugin has a handy macro that you can drop in to any theme panel to add an "Edit in Word" link:
{editinwordlink}
You can see some examples in the Office Connector Support FAQ.
The way that the edit in word link is generated by the office connector code is not compatible with the builder menu system, to work around this we have duplicated and refined the office-connector's code and included it within builder (not the connector itself, but the code that calls it), to use the edit in word feature in a builder menu you will need Builder 3.3.0 or later and use the following syntax
{compound-menuitem:editInWord|icon=word|caption=Edit this %page% in word...}
Tip: You can use any of the menu icons available in Theme Builder if preferred.
To add the "Doc Import" link to your menu, use the following notation:
{compound-menuitem:webui |location=system.content.action/secondary |key=importworditem1 |caption=Doc Import}
The way that the edit in word link is generated by the office connector code is not compatible with the builder menu system, to work around this we have duplicated and refined the office-connector's code and included it within builder (not the connector itself, but the code that calls it), to use the edit in word feature in a builder menu you will need Builder 3.3.0 or later and use the following syntax
{compound-menuitem:editInWord|icon=word|caption=Edit this %page% in word...}
Tip: You can use any of the menu icons available in Theme Builder if preferred.
To add the "Doc Import" link to your menu, use the following notation:
{compound-menuitem:webui |location=system.page |key=importworditem |caption=Doc Import}
Go in to the Layout Manager and click on the Menus Tab:
Click on the "Edit" button in the "Menu Shortcut Macros" section and then click on the "Edit Menu" tab of the window that appears:
Add the appropriate macros based on the version of Confluence you are using (see above) and then click the "OK" button to confirm the changes.
Save your layout (click the
button - see Layout Manager for more details) and you should see the new links appear in the Edit menu.
To add text hyperlinks outside of a menu, eg. in a sidebar, just add the "flat=true" parameter to the compound-menuitem macro, for example:
{compound-menuitem:webui |location=system.content.action/primary |key=editinworditem3 |icon=page_white_word |caption=Edit in Word |flat=true}
22 Comments
Unknown User (nana)
The edit in word link to macro given for 2.8 and above does not work
I copied it exactly as shown.
Unknown User (jking@phelon.com)
Same here. The "Edit in Word" macro launches the file, but the instructions for adding the "Edit in Word" link to a Confluence 2.8 menu does absolutely nothing.
Unknown User (gfraser)
Adaptavist are currently investigating this problem, with the assistance of Ryan Ackley (the plugin author). It seems that there are issues with the links generated by the plugin in Confluence 2.8 which prevent the link from functioning properly in custom themes.
We'll update this page with more information as it becomes available.
Unknown User (theosophe74)
The Office Connector for Confluence also cannot be integrated into the menus of Confluence 2.7 or earlier either.
I tested it within an instance running Confluence 2.5.7, Theme Builder 2.0.9, and Office Connector 1.3.6.
Attempting to use any of the following three menu items resulted in no menu item being displayed, and no errors being reported in the Atlassian Confluence log:
Is there any chance that you and Ryan can also determine why none of the above menu items will appear in Confluence 2.7 or earlier?
Unknown User (ryan)
Guy, can you file a bug in JIRA if you understand the issue.
http://developer.atlassian.com/jira/browse/WORDDV
I have no idea why this wouldn't be working. Is it something wrong with the javascript that themebuilder is having trouble with?
Unknown User (gfraser)
It's the same problem that's being discussed in the ticket we've added you to on our tracker (StatPro). I think Alain recently added some more info to that ticket for your review?
Also, are you at AtlasCamp? If so, maybe we can sit down together and find a solution?
Unknown User (ryan)
I don't see any information besides
Am I overlooking something? Is anyone able to get the OC interface items to show up? Can you verify whether or not this is happening for all builder users?
Unknown User (gfraser)
It's happening for all Builder users and also several customers who are using other themes (eg. custom java theme plugins).
One workaround temporarily is to add the {editinwordlink} macro to the title panel or call it from velocity in a custom java theme plugin.
Unknown User (ryan)
How do I get a copy of themebuilder 3? If this is a problem with theme builder you owe me a beer...
Unfortunately, I probably won't be at AtlasCamp to collect. I just moved to Sydney. I can't see them sending me back so soon.
Unknown User (theosophe74)
Here is what I have learned thus far in a Confluence 2.5.7, Builder 2.0.9, Connector 1.3.6 environment:
Unknown User (theosophe74)
To figure out whether "return false;" statements were really needed when using the "javascript:" syntax, I exploded the JavaScript out into a readable form and removed the return statements:
As you can see, because you do a sufficient amount of "if" tests and error checking, I don't think you would ever be sent down a path you should not go down based on your browser, etc.
So I packed up that version of the JavaScript, made that the logic to be executed after the "javascript:" call in all three web-items within atlassian-plugin.xml, re-JAR'ed the files, and re-installed the plugin JAR.
Now, when I click on "Edit in Word", in both Firefox and IE, the file is opened via WebDAV for editing, and I can apply changes, save them, and refresh the corresponding Wiki page to see them.
I ran into additional issues after reaching this point, but I don't think they're Theme Builder-related, so I have captured them as potential Office Connector issues:
Unknown User (gfraser)
Quick update: We've made some progress on the integration issues (still undergoing testing).
One interim workaround is to add the {editinwordlink} in to one of your theme panels, outside a menu.
We'll hopefully be posting details in the coming week as to how to get the links working from within a menu.
Unknown User (theosophe74)
I'm sorry I can't test it myself right now, but I'm pretty sure that "Import Doc" has the same limitations as "Edit in Word". You lose the same types of formatting, as it's saving it as an actual Wiki page.
If you want the majority of the formatting to be preserved, you need to use the {viewfile} macro.
A neat trick would be to define an "Import and Preserve" or similarly named menu link that creates a new Wiki page with the name of the Word document, uploads the Word document as an attachment to the page, and adds the line {\viewfile:Imported+Document+Name.doc} to the page before saving it and presenting it to the user.
Thanks,
Mike
Unknown User (amoran)
You would need to talk to the developer of the plugin (Unknown User (ryan)) about that.
Unknown User (theosophe74)
Can you update, though, the Overview section of this page to be reflective of what the "Doc Import" feature is actually capable of doing?
I hope my comments on this page about implementing a work-around to the Builder / Office Connector mismatch were helpful in creating an "editInWord" menu item.
Thanks,
Mike
Unknown User (amoran)
Unfortunatley we do not have any control over the office connector code, you will need to speak to Unknown User (ryan) about any changes you would like made to that plugin.
Unknown User (gfraser)
Ryan should be connected via https://support.atlassian.com
Unknown User (theosophe74)
I'm not asking for a Connector code change. I am asking for you to update your documentation to be accurate.
You state:
But the Office Connector Documentation for "Doc Import" states:
http://confluence.atlassian.com/display/CONFEXT/Document+Import+with+the+Office+Connector
Unknown User (amoran)
updated.
Unknown User (philip parkinson)
You make reference to builder 3.2.2 in your documentation here, however the latest release is 3.2.1. Are you refering to your early release version?
In any case having no luck with Builder 3.2.1 and the example menu macros.
Unknown User (amoran)
3.2.2 has been bumped now to become 3.3.0 and is available through the Early Access Programme
Unknown User (tstrugar@wwf.org.au)
When you have time it would be great to have a new icon for this, word_edit, like the existing word icon just with a little pencil added next to it (like the other _edit icons).