Centering an image in an html field using ReportingEngine

Hi,

I’m using the Aspose Linq Reporting Engine (C#) to generate a word document. Some of the values that are inserted in the document are saved in HTML-format using the TinyMCE library. I am inserting these values using the following syntax:

<<[HtmlString] -html>>

In most cases, this works wonderfully, but I’m running into an issue when I want to insert a horizontally centered image. The TinyMCE library exports such an image as follows:

<p>
    <img style="display: block; margin-left: auto; margin-right: auto;" src="lion.jpg" width="200" height="200"/>
</p>

In the browser, this image is shown centered, because of the margin-left: auto; margin-right: auto attributes. However, in the report, the image is simply left-aligned.

What can I do to make sure this image is centred in the output document? Is there another html attribute that is picked up correctly that I could use? Or a setting that I can enable?

I have included a sample application that demonstrates this behaviour here:
CenteredImage.zip (525.1 KB)

@TPTWouter,

In this case, simply adding style=“text-align:center” to the <p> tag should fix this issue.

<p>Some text above the image</p>
<p style="text-align:center">
    <img style="display: block; margin-left: auto; margin-right: auto;" src="lion.jpg" width="200" height="200"/>
</p>
<p>Some text below the image</p>

@awais.hafeez,

Thank you for your response, this solution worked wonderfully.

@TPTWouter,

Thanks for your feedback. Please let us know anytime you have any further queries.