Exported chart images in docx have low resolution

Hi,

I have a problem when using Aspose.Words for JasperReports to generate docx files. For example, in Jasper Studio’s preview, bar chart legend looks normal, the font is Arial and size is 10:
New Bitmap Image.jpg (18.0 KB)
But when exported to docx, it looks like:
New Bitmap Image - Copy.jpg (995.7 KB)
Looks like the chart image in exported file has very low DPI, can you help me figure it out? Thanks in advance.

Sample jrxml file:
<?xml version="1.0" encoding="UTF-8"?>

  <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_Letter" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c5cae0f8-1d9f-49e8-b568-3bb95203d74a">
	<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
	<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>
	<style name="Arial_Normal_12" isDefault="true" fontName="Arial" fontSize="12" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<style name="Arial_Bold_12" isDefault="true" fontName="Arial" fontSize="12" isBold="true" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<style name="Arial_bold_12.0Beer" forecolor="#4A4A4A" fontName="Arial" fontSize="12" isBold="true" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
	<pageHeader>
		<band height="40" splitType="Stretch"/>
	</pageHeader>
	<detail>
		<band height="300">
			<property name="com.jaspersoft.studio.unit.height" value="px"/>
			<frame>
				<reportElement x="0" y="0" width="572" height="140" uuid="3e4c4e53-1677-4501-b5c9-d8063d7397fb">
					<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>
				</reportElement>
				<textField>
					<reportElement style="Arial_bold_12.0Beer" x="0" y="0" width="300" height="30" uuid="5dac9dd0-dbbe-4044-8fde-d0beaab22da0"/>
					<textElement markup="html"/>
					<textFieldExpression><![CDATA["MPI Goal (Multiple Points of Interruption)"]]></textFieldExpression>
				</textField>
				<stackedBarChart>
					<chart isShowLegend="true" evaluationTime="Report">
						<reportElement x="50" y="30" width="419" height="110" uuid="725b1da7-1f9b-40c4-8ba0-7ed38fd5fbb7"/>
						<chartTitle/>
						<chartSubtitle/>
						<chartLegend>
							<font fontName="Arial" size="10"/>
						</chartLegend>
					</chart>
					<categoryDataset>
						<categorySeries>
							<seriesExpression><![CDATA["CBI Displays"]]></seriesExpression>
							<categoryExpression><![CDATA[""]]></categoryExpression>
							<valueExpression><![CDATA[93]]></valueExpression>
						</categorySeries>
						<categorySeries>
							<seriesExpression><![CDATA["Target Displays"]]></seriesExpression>
							<categoryExpression><![CDATA[""]]></categoryExpression>
							<valueExpression><![CDATA[7]]></valueExpression>
						</categorySeries>
					</categoryDataset>
					<barPlot>
						<plot orientation="Horizontal">
							<seriesColor seriesOrder="0" color="#EB9F4B"/>
							<seriesColor seriesOrder="1" color="#F3F3F3"/>
						</plot>
						<itemLabel/>
						<categoryAxisFormat>
							<axisFormat labelColor="#4A4A4A" tickLabelColor="#4A4A4A" axisLineColor="#4A4A4A">
								<labelFont>
									<font fontName="Arial" size="10"/>
								</labelFont>
							</axisFormat>
						</categoryAxisFormat>
						<valueAxisFormat>
							<axisFormat labelColor="#FFFFFF" tickLabelColor="#FFFFFF" verticalTickLabels="false" axisLineColor="#FFFFFF">
								<labelFont>
									<font fontName="Arial" size="10"/>
								</labelFont>
							</axisFormat>
						</valueAxisFormat>
					</barPlot>
				</stackedBarChart>
			</frame>
		</band>
	</detail>
	<pageFooter>
		<band height="26">
			<textField>
				<reportElement style="Arial_Normal_12" x="502" y="0" width="45" height="26" forecolor="#747474" uuid="0479da24-dcad-429a-86fe-f3efdfe74a34"/>
				<textElement textAlignment="Left"/>
				<textFieldExpression><![CDATA["Page "]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement style="Arial_Bold_12" x="547" y="0" width="25" height="26" forecolor="#747474" uuid="1b624604-cd70-4e2c-80a8-bdecaad95cc8"/>
				<textElement textAlignment="Left"/>
				<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>

Some updates: 1, tried “net.sf.jasperreports.image.dpi=300” but no luck
2, opened generated docx, right click on image and go to size, the scale height/width percentages is 133 not 100, why…?

@EmiyaShirou,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please share .jrprint file.
  • Please attach the output Word file that shows the undesired behavior.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor,
Thanks for your quick reply! Here is the files.
dpi.zip (17.4 KB)

Best

@EmiyaShirou,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJR-229. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@EmiyaShirou,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSJR-229) as ‘Not a Bug’.

This is correct, but it is necessary also to set [Render Type]=“image” (in chart properties). By default (when [Render Type] is not changed manually) it is set to “draw”, which is not affected by net.sf.jasperreports.image.dpi option.

This is because default DPI for generated drawings in JasperReports is 72, so in order to have standard DPI=96 in DOCX the shape is stretched (by 96/72=1.333…). If you set net.sf.jasperreports.image.dpi=96, the scale will be 100%, if you set net.sf.jasperreports.image.dpi=300, the scale will be 3,125 etc.