public class HtmlFixedPageHorizontalAlignment
extends java.lang.Object
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;
}
| Modifier and Type | Field and Description |
|---|---|
static int |
CENTER
Center pages.
|
static int |
LEFT
Align pages to the left.
|
static int |
length |
static int |
RIGHT
Align pages to the right.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String htmlFixedPageHorizontalAlignmentName) |
static java.lang.String |
getName(int htmlFixedPageHorizontalAlignment) |
static int[] |
getValues() |
static java.lang.String |
toString(int htmlFixedPageHorizontalAlignment) |
public static int LEFT
public static int CENTER
public static int RIGHT
public static int length
public static java.lang.String getName(int htmlFixedPageHorizontalAlignment)
public static java.lang.String toString(int htmlFixedPageHorizontalAlignment)
public static int fromName(java.lang.String htmlFixedPageHorizontalAlignmentName)
public static int[] getValues()