Aspose.Words

Page Margins

Unfortunately, at the moment JasperReports print model does not allow exporters detect page margins specified in the report design. Hence, Aspose.Words for JasperReports uses a special algorithm to work this around.

The algorithm works as follows. All page margins are set to a default value that is used by Microsoft Word when creating a new document (1 inch). If some report elements are located closer to page edges, then the corresponding page margins are reduced appropriately. That is, page margins are set to the value of 1in or less, depending on report design.

You can change the default 1in value by specifying what page margins the exporter should try to enforce. Use PAGE_MARGINS parameter for that:

JasperReports:

[Java]

 

   import com.aspose.words.jasperreports.*;

 

   AWDocExporter exporter = new AWDocExporter();

   exporter.setParameter(AWExporterParameter.PAGE_MARGINS, “1in;1in;0.5in;0.5in”);

   exporter.exportReport();

 

 

JasperServer:

[XML]

 

<bean id="aw_exportParameters" class="com.aspose.words.jasperreports.AWExportParametersBean">

    <property name="pageMargins" value="1in;1in;0.5in;0.5in"/>

</bean>

 

 

The value of the parameter is a string of the form

"left_margin;right_margin;top_margin;bottom_margin",

where the following units of measure are allowed:

·          in - inches (default, may be omitted)

·          cm - centimetres

·          mm - millimetres

·          px - pixels

·          pt - points

Note you can use different units of measure in the same string or omit some of margin values.