com.aspose.words
Class HtmlFixedPageHorizontalAlignment

java.lang.Object
    extended by com.aspose.words.HtmlFixedPageHorizontalAlignment

public class HtmlFixedPageHorizontalAlignment 
extends java.lang.Object

Utility class containing constants. Specifies the horizontal alignment for pages in output HTML document.

Example:

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;
}

Field Summary
static final intLEFT = 0
           Align pages to the left.
static final intCENTER = 1
           Center pages. This is the default value.
static final intRIGHT = 2
           Align pages to the right.
 

Field Detail

LEFT = 0

public static final int LEFT
Align pages to the left.

CENTER = 1

public static final int CENTER
Center pages. This is the default value.

RIGHT = 2

public static final int RIGHT
Align pages to the right.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.