Get page content in storage format in preview

Dear Community,

one of my macros needs the page content in storage format to render its output. Everything works fine except in page preview mode (the preview in edit macro dialog is also fine). The getBodyAsString method returns HTML rather than storage format in page preview mode.

conversionContext.getEntity().getBodyAsString() returns HTML only page preview
conversionContext.getEntity().getBodyAsString() returns storage format in all other cases

Is there a way to get the storage format rather than rendered HTML in preview mode?

Thank you

Andreas

In short no, you get the content transformed. Take a look in this class https://docs.atlassian.com/confluence/5.8.8/com/atlassian/confluence/content/render/xhtml/FormatConverter.html it should do what you need to do

Dear Panos,

thank you for the quick answer and the link to the converter.

Thank you

Andreas