Confluence Python API & confluence.get_page_as_word

Gunther Lukat
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 25, 2023
Hi,
I just started with using the python confluence api. However i am stuck exporting to wordfile.
wordFile = confluence.get_page_as_word(page_id)

f2 = open("file.docx", "wb")

f2.write(wordFile)

f2.close()

A file is written but it seems like the format is wrong. I can not open it in word or user further processing on it such as using python-docx.

To me it seems like the result is not really a zip file or docx in this case.

How do i save the result from confluence.get_page_as_word as a proper docx?

 

 

1 answer

0 votes
Nerf, Christopher
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 17, 2023

Hi Gunther (and other people who might have this issue):

 

It seems that `get_page_as_word` exports in the form of `doc` not `docx`.

You should be able to have a work around by changing your write line to:

f2 = open("file.doc", "wb") 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events