Переглянути джерело

Bug 53453: Apply patch to add methods to set margins in sections of HWPF documents

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1649176 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_3_12_BETA1
Dominik Stadler 9 роки тому
джерело
коміт
1e340fbce8

+ 60
- 0
src/scratchpad/src/org/apache/poi/hwpf/usermodel/Section.java Переглянути файл

@@ -95,6 +95,66 @@ public final class Section extends Range
return _props.getXaPage();
}

/**
* Set the height of the bottom margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
* section.setMarginBottom( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
* be - in twips.
*/
public void setMarginBottom(int marginWidth)
{
this._props.setDyaBottom(marginWidth);
}

/**
* Set the width of the left hand margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
* section.setMarginLeft( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
* be - in twips.
*/
public void setMarginLeft(int marginWidth)
{
this._props.setDxaLeft(marginWidth);
}

/**
* Set the width of the right hand margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
* section.setMarginRight( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
* be - in twips.
*/
public void setMarginRight(int marginWidth)
{
this._props.setDxaRight(marginWidth);
}

/**
* Set the height of the top margin in twips. In the AbstractWordUtils class, a constant
* is defined that indicates how many twips there are per inch and it can be used in setting
* the margins width a little like this;
*
* section.setMarginTop( (int) 1.5 * AbstractWordUtils.TWIPS_PER_INCH );
*
* @param marginWidth A primitive int whose value will indciate how high the margin should
* be - in twips.
*/
public void setMarginTop(int marginWidth)
{
this._props.setDyaTop(marginWidth);
}

public boolean isColumnsEvenlySpaced()
{
return _props.getFEvenlySpaced();

+ 355
- 224
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
Різницю між файлами не показано, бо вона завелика
Переглянути файл


BIN
test-data/document/Bug53453Section.doc Переглянути файл


Завантаження…
Відмінити
Зберегти