PageHorizontalAlignment
Contenu
[
Cacher
]HtmlFixedSaveOptions.PageHorizontalAlignment property
Spécifie l’alignement horizontal des pages dans un document HTML. La valeur par défaut estCenter .
public HtmlFixedPageHorizontalAlignment PageHorizontalAlignment { get; set; }
Exemples
Montre comment définir l’alignement horizontal des pages lors de l’enregistrement d’un document au format 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;
}
Voir également
- enum HtmlFixedPageHorizontalAlignment
- class HtmlFixedSaveOptions
- espace de noms Aspose.Words.Saving
- Assemblée Aspose.Words