PageHorizontalAlignment
Innehåll
[
Dölj
]HtmlFixedSaveOptions.PageHorizontalAlignment property
Anger den horisontella justeringen av sidor i ett HTML-dokument. Standardvärdet ärCenter .
public HtmlFixedPageHorizontalAlignment PageHorizontalAlignment { get; set; }
Exempel
Visar hur du ställer in den horisontella justeringen av sidor när du sparar ett dokument till 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.True(Regex.Match(outDocContents,
"[.]awpage { position:relative; border:solid 1pt black; margin:10pt auto 10pt auto; overflow:hidden; }").Success);
break;
case HtmlFixedPageHorizontalAlignment.Left:
Assert.True(Regex.Match(outDocContents,
"[.]awpage { position:relative; border:solid 1pt black; margin:10pt auto 10pt 10pt; overflow:hidden; }").Success);
break;
case HtmlFixedPageHorizontalAlignment.Right:
Assert.True(Regex.Match(outDocContents,
"[.]awpage { position:relative; border:solid 1pt black; margin:10pt 10pt 10pt auto; overflow:hidden; }").Success);
break;
}
Se även
- enum HtmlFixedPageHorizontalAlignment
- class HtmlFixedSaveOptions
- namnutrymme Aspose.Words.Saving
- hopsättning Aspose.Words