HtmlFixedPageHorizontalAlignment

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

FieldDescription
CENTERCenter pages.
LEFTAlign pages to the left.
RIGHTAlign pages to the right.
length

Methods

MethodDescription
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.

public static int RIGHT

Align pages to the right.

length

public static int length

fromName(String htmlFixedPageHorizontalAlignmentName)

public static int fromName(String htmlFixedPageHorizontalAlignmentName)

Parameters:

ParameterTypeDescription
htmlFixedPageHorizontalAlignmentNamejava.lang.String

Returns: int

getName(int htmlFixedPageHorizontalAlignment)

public static String getName(int htmlFixedPageHorizontalAlignment)

Parameters:

ParameterTypeDescription
htmlFixedPageHorizontalAlignmentint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int htmlFixedPageHorizontalAlignment)

public static String toString(int htmlFixedPageHorizontalAlignment)

Parameters:

ParameterTypeDescription
htmlFixedPageHorizontalAlignmentint

Returns: java.lang.String