change default page margins to 0.4 inches and allow to changes them
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1170227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3ce711196
commit
95d61faec0
@ -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 <tt>false</tt> if cell style by itself (without text, i.e.
|
||||
* borders, fill, etc.) worth a mention, <tt>true</tt> 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user