AllowNegativeIndent
İçindekiler
[
Saklamak
]HtmlSaveOptions.AllowNegativeIndent property
HTML, MHTML veya EPUB’a kaydederken paragrafların negatif sol ve sağ girintilerinin normalleştirilip normalleştirilmeyeceğini belirtir. Varsayılan değerYANLIŞ .
public bool AllowNegativeIndent { get; set; }
Notlar
Negatif girintiye izin verilmediğinde, HTML’e sıfır kenar boşluğu olarak aktarılır. Negatif girintiye izin verildiğinde, bir paragraf kısmen tarayıcı penceresinin dışında görünebilir.
Örnekler
Çıktı .html’de negatif girintilerin nasıl korunacağını gösterir.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Negatif girintili bir tablo ekle, bu tabloyu sol sayfa sınırının ötesine itecektir.
Table table = builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1");
builder.InsertCell();
builder.Write("Row 1, Cell 2");
builder.EndTable();
table.LeftIndent = -36;
table.PreferredWidth = PreferredWidth.FromPoints(144);
builder.InsertBreak(BreakType.ParagraphBreak);
// Tabloyu sağa itecek pozitif girintili bir tablo ekle.
table = builder.StartTable();
builder.InsertCell();
builder.Write("Row 1, Cell 1");
builder.InsertCell();
builder.Write("Row 1, Cell 2");
builder.EndTable();
table.LeftIndent = 36;
table.PreferredWidth = PreferredWidth.FromPoints(144);
// Bir belgeyi HTML'e kaydettiğimizde, Aspose.Words yalnızca negatif girintileri koruyacaktır
// "AllowNegativeIndent" bayrağını ayarlarsak ilk tabloya uyguladığımız gibi
// "true"ya geçireceğimiz SaveOptions nesnesinde.
HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.Html)
{
AllowNegativeIndent = allowNegativeIndent,
TableWidthOutputMode = HtmlElementSizeOutputMode.RelativeOnly
};
doc.Save(ArtifactsDir + "HtmlSaveOptions.NegativeIndent.html", options);
string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlSaveOptions.NegativeIndent.html");
if (allowNegativeIndent)
{
Assert.True(outDocContents.Contains(
"<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin-left:-41.65pt; border:0.75pt solid #000000; -aw-border:0.5pt single; -aw-border-insideh:0.5pt single #000000; -aw-border-insidev:0.5pt single #000000; border-collapse:collapse\">"));
Assert.True(outDocContents.Contains(
"<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin-left:30.35pt; border:0.75pt solid #000000; -aw-border:0.5pt single; -aw-border-insideh:0.5pt single #000000; -aw-border-insidev:0.5pt single #000000; border-collapse:collapse\">"));
}
else
{
Assert.True(outDocContents.Contains(
"<table cellspacing=\"0\" cellpadding=\"0\" style=\"border:0.75pt solid #000000; -aw-border:0.5pt single; -aw-border-insideh:0.5pt single #000000; -aw-border-insidev:0.5pt single #000000; border-collapse:collapse\">"));
Assert.True(outDocContents.Contains(
"<table cellspacing=\"0\" cellpadding=\"0\" style=\"margin-left:30.35pt; border:0.75pt solid #000000; -aw-border:0.5pt single; -aw-border-insideh:0.5pt single #000000; -aw-border-insidev:0.5pt single #000000; border-collapse:collapse\">"));
}
Ayrıca bakınız
- class HtmlSaveOptions
- ad alanı Aspose.Words.Saving
- toplantı Aspose.Words