Enum HtmlFixedPageHorizontalAlignment

Enum HtmlFixedPageHorizontalAlignment

Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.12.0)

Specifies the horizontal alignment for pages in output HTML document.

public enum HtmlFixedPageHorizontalAlignment

Fields

Center = 1

Center pages. This is the default value.

Left = 0

Align pages to the left.

Right = 2

Align pages to the right.

Examples

Shows how to set the horizontal alignment of pages when saving a document to HTML.

Document doc = new Document(MyDir + "Rendering.docx");

                                                                                             HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions
                                                                                             {
                                                                                                 PageHorizontalAlignment = pageHorizontalAlignment
                                                                                             };

                                                                                             doc.Save(ArtifactsDir + "HtmlFixedSaveOptions.HorizontalAlignment.html", htmlFixedSaveOptions);

                                                                                             string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlFixedSaveOptions.HorizontalAlignment/styles.css");

                                                                                             switch (pageHorizontalAlignment)
                                                                                             {
                                                                                                 case HtmlFixedPageHorizontalAlignment.Center:
                                                                                                     Assert.That(Regex.Match(outDocContents,
                                                                                                         "[.]awpage { position:relative; border:solid 1pt black; margin:10pt auto 10pt auto; overflow:hidden; }").Success, Is.True);
                                                                                                     break;
                                                                                                 case HtmlFixedPageHorizontalAlignment.Left:
                                                                                                     Assert.That(Regex.Match(outDocContents,
                                                                                                         "[.]awpage { position:relative; border:solid 1pt black; margin:10pt auto 10pt 10pt; overflow:hidden; }").Success, Is.True);
                                                                                                     break;
                                                                                                 case HtmlFixedPageHorizontalAlignment.Right:
                                                                                                     Assert.That(Regex.Match(outDocContents,
                                                                                                         "[.]awpage { position:relative; border:solid 1pt black; margin:10pt 10pt 10pt auto; overflow:hidden; }").Success, Is.True);
                                                                                                     break;
                                                                                             }
 English