PageHorizontalAlignment
Contenuti
[
Nascondere
]HtmlFixedSaveOptions.PageHorizontalAlignment property
Specifica l’allineamento orizzontale delle pagine in un documento HTML. Il valore predefinito èCenter .
public HtmlFixedPageHorizontalAlignment PageHorizontalAlignment { get; set; }
Esempi
Mostra come impostare l’allineamento orizzontale delle pagine durante il salvataggio di un documento in 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;
}
Guarda anche
- enum HtmlFixedPageHorizontalAlignment
- class HtmlFixedSaveOptions
- spazio dei nomi Aspose.Words.Saving
- assemblea Aspose.Words