How to retrieve the contents (text) of an Microsoft Office Attachment (ppt, doc, xls)?

Philipp Steinwender
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 Leaders.
November 6, 2012

Following szenario:

A user uploads an attachment to a page. I intercept the event, extract the contents of the attachment and do stuff with the text.

I dont want to implement the whole attachment type recognition and text extraction by myself, as confluence does this already.

Is there a possibility to get the extracted text from the confluence api? I mean, if you click on an attachment, confluence shows you the contents. There must be an api to retrieve the text.

Does anyone know how?

king regards

3 answers

1 accepted

0 votes
Answer accepted
Philipp Steinwender
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 Leaders.
April 11, 2013

@OfficeConnector Team: please provide a Service that lets plugin developers get the extracted text of uploaded attachments. You have implemented this, you have the text in your hands, but then let it disappear in the depth of confluence.

I implemented a similar function on my own. See this post on how to use Apache POI to extract plain text of uploaded Attachments: https://answers.atlassian.com/questions/156739/how-to-get-apache-tika-poi-to-work-in-confluence-plugin

0 votes
Selcuk Savas
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 Leaders.
November 7, 2012

Hi,

Please have a look at the images that I sent.

1st Image shows how the doc displays on a page.

2nd is the edit mode.

Also you can find some more info at https://confluence.atlassian.com/display/CONF41/Displaying+Office+Files+in+Confluence

Philipp Steinwender
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 Leaders.
November 8, 2012

thank you, but this is not what i need.
I have to get the contents of these documents programmatically in the backend.

like

String text = SomeServiceOfThisPlugin.getContentOfAttachment(attachment);

0 votes
Selcuk Savas
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 Leaders.
November 6, 2012

Hi,

There is a macro called Office Macro for excel, word and powerpoit which allows you to embed document into Confluence page and allows editing usind the MS Office without ned to re-upload.

I hope this help?

Cheers,

selcuk

Philipp Steinwender
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 Leaders.
November 7, 2012

Can I retrieve the contents of the attachment with this macro in the backend?
I could not find anything about this in the docs.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events