HtmlFixedPageHorizontalAlignment
Contents
[
Hide
]Inheritance: java.lang.Object
public class HtmlFixedPageHorizontalAlignment
Specifies the horizontal alignment for pages in output HTML document.
Examples:
Shows how to set the horizontal alignment of pages when saving a document to HTML.
Document doc = new Document(getMyDir() + "Rendering.docx");
HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions();
{
htmlFixedSaveOptions.setPageHorizontalAlignment(pageHorizontalAlignment);
}
doc.save(getArtifactsDir() + "HtmlFixedSaveOptions.HorizontalAlignment.html", htmlFixedSaveOptions);
String outDocContents = FileUtils.readFileToString(new File(getArtifactsDir() + "HtmlFixedSaveOptions.HorizontalAlignment/styles.css"), StandardCharsets.UTF_8);
switch (pageHorizontalAlignment)
{
case HtmlFixedPageHorizontalAlignment.CENTER:
Assert.assertTrue(Pattern.compile(
"[.]awpage [{] position:relative; border:solid 1pt black; margin:10pt auto 10pt auto; overflow:hidden; [}]").matcher(outDocContents).find());
break;
case HtmlFixedPageHorizontalAlignment.LEFT:
Assert.assertTrue(Pattern.compile(
"[.]awpage [{] position:relative; border:solid 1pt black; margin:10pt auto 10pt 10pt; overflow:hidden; [}]").matcher(outDocContents).find());
break;
case HtmlFixedPageHorizontalAlignment.RIGHT:
Assert.assertTrue(Pattern.compile(
"[.]awpage [{] position:relative; border:solid 1pt black; margin:10pt 10pt 10pt auto; overflow:hidden; [}]").matcher(outDocContents).find());
break;
}
Fields
Field | Description |
---|---|
CENTER | Center pages. |
LEFT | Align pages to the left. |
RIGHT | Align pages to the right. |
length |
Methods
Method | Description |
---|---|
fromName(String htmlFixedPageHorizontalAlignmentName) | |
getName(int htmlFixedPageHorizontalAlignment) | |
getValues() | |
toString(int htmlFixedPageHorizontalAlignment) |
CENTER
public static int CENTER
Center pages. This is the default value.
LEFT
public static int LEFT
Align pages to the left.
RIGHT
public static int RIGHT
Align pages to the right.
length
public static int length
fromName(String htmlFixedPageHorizontalAlignmentName)
public static int fromName(String htmlFixedPageHorizontalAlignmentName)
Parameters:
Parameter | Type | Description |
---|---|---|
htmlFixedPageHorizontalAlignmentName | java.lang.String |
Returns: int
getName(int htmlFixedPageHorizontalAlignment)
public static String getName(int htmlFixedPageHorizontalAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
htmlFixedPageHorizontalAlignment | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int htmlFixedPageHorizontalAlignment)
public static String toString(int htmlFixedPageHorizontalAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
htmlFixedPageHorizontalAlignment | int |
Returns: java.lang.String