public class HtmlFixedPageHorizontalAlignment
Example:
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;
}
Field Summary | ||
---|---|---|
static final int | LEFT | |
Align pages to the left.
|
||
static final int | CENTER | |
Center pages. This is the default value.
|
||
static final int | RIGHT | |
Align pages to the right.
|