diff --git a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java
index 0d031396c0..baea9052f3 100644
--- a/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java
+++ b/src/scratchpad/src/org/apache/poi/hssf/converter/ExcelToFoConverter.java
@@ -130,6 +130,8 @@ public class ExcelToFoConverter extends AbstractExcelConverter
private final FoDocumentFacade foDocumentFacade;
+ private float pageMarginInches = 0.4f;
+
public ExcelToFoConverter( Document document )
{
this.foDocumentFacade = new FoDocumentFacade( document );
@@ -140,7 +142,7 @@ public class ExcelToFoConverter extends AbstractExcelConverter
final float paperHeightIn;
final float paperWidthIn;
{
- float requiredWidthIn = tableWidthIn + 2;
+ float requiredWidthIn = tableWidthIn + 2 * getPageMarginInches();
if ( requiredWidthIn < PAPER_A4_WIDTH_INCHES )
{
@@ -157,10 +159,10 @@ public class ExcelToFoConverter extends AbstractExcelConverter
}
}
- final float leftMargin = 1;
- final float rightMargin = 1;
- final float topMargin = 1;
- final float bottomMargin = 1;
+ final float leftMargin = getPageMarginInches();
+ final float rightMargin = getPageMarginInches();
+ final float topMargin = getPageMarginInches();
+ final float bottomMargin = getPageMarginInches();
Element pageMaster = foDocumentFacade
.addSimplePageMaster( pageMasterName );
@@ -180,6 +182,11 @@ public class ExcelToFoConverter extends AbstractExcelConverter
return foDocumentFacade.getDocument();
}
+ public float getPageMarginInches()
+ {
+ return pageMarginInches;
+ }
+
/**
* Returns false if cell style by itself (without text, i.e.
* borders, fill, etc.) worth a mention, true otherwise
@@ -323,8 +330,8 @@ public class ExcelToFoConverter extends AbstractExcelConverter
block.setAttribute( "keep-together.within-line", "always" );
}
- processCellStyle( workbook, cell.getCellStyle(),
- tableCellElement, block );
+ processCellStyle( workbook, cell.getCellStyle(), tableCellElement,
+ block );
block.appendChild( text );
tableCellElement.appendChild( block );
@@ -812,4 +819,9 @@ public class ExcelToFoConverter extends AbstractExcelConverter
textBlock.setAttribute( "font-family", triplet.fontName );
}
+ public void setPageMarginInches( float pageMarginInches )
+ {
+ this.pageMarginInches = pageMarginInches;
+ }
+
}