Hello :)
How can attached files/content be displayed on a confluence page?
Using Atlassian Python API confluence.attach_content/confluence.attach file does not display the attachment.
For images the code below can be used as the append body to display an image
f"""<ac:image>
<ri:attachment ri:filename="{file_name}" />
</ac:image>"""
How can this be achieved if the content/file is html?
Thanks,
Alan
Community moderators have prevented the ability to post new answers.
Hi!
that that file already attached on the page?
yes this is the working code for displaying a image of a plot with update capability
def plot_to_confluence(plot_to_post, name:str, page_id:str, page_title:str, update=False):
file_name = f"{name}.png"
plot_to_post.figure.savefig(file_name)
confluence.attach_file(file_name, name=file_name, content_type=None, page_id=page_id, title=None, space=None, comment=None)
if not update:
html = f"""<ac:image>
<ri:attachment ri:filename="{file_name}" />
</ac:image><br/>"""
confluence.append_page(page_id, page_title, html, parent_id=None, type='page', representation='storage', minor_edit=False)
plot_to_confluence(plot, 'plot_name', page_id, page_title)
I'd like to be able to post html (e.g. a table) with update capability. Perhaps `<ac:image>` can be replaced with something else to do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.