Hello,
How to export Confluence Page to Word with preserving attachments.
My code is:
public String execute() throws Exception {
final PageContext context = page.toPageContext();
String pageContent = page.getBodyContent().getContent().getBodyAsString();
String newResult = xhtmlContent.(pageContent, new DefaultConversionContext(context));
StringBuilder contentDispositionValue = new StringBuilder();
contentDispositionValue.append(newResult);
final HttpServletResponse response = ServletActionContext.getResponse();
response.setHeader("content-type", "application/vnd.ms-word; charset=UTF-8");
response.addHeader("Content-Disposition", "attachment;filename=spec.doc");
response.getWriter().write(String.valueOf(contentDispositionValue));
response.getWriter().close();
response.getWriter().flush();
return "success";
}
After performing export the image is disappeared:
Please, your help,
Thank you,
Viktorya