LayoutOptions

LayoutOptions class

包含允许控制文档布局过程的选项。

要了解更多信息,请访问转换为固定页面格式文档文章。

public class LayoutOptions

构造函数

姓名描述
LayoutOptions()默认构造函数。

特性

姓名描述
Callback { get; set; }获取或设置IPageLayoutCallback页面布局模型使用的实现。
CommentDisplayMode { get; set; }获取或设置评论的呈现方式。 默认值为ShowInBalloons.
ContinuousSectionPageNumberingRestart { get; set; }获取或设置连续部分重新开始页码编号时计算页码的行为模式。
IgnorePrinterMetrics { get; set; }获取或设置是否忽略“使用打印机指标来布局文档”兼容性选项的指示。 默认值为真的.
KeepOriginalFontMetrics { get; set; }获取或设置字体替换后是否应使用原始字体规格的指示。 默认值为真的.
RevisionOptions { get; }获取修订选项。
ShowHiddenText { get; set; }获取或设置是否显示文档中隐藏文本的指示。 默认值为错误的.
ShowParagraphMarks { get; set; }获取或设置是否呈现段落标记的指示。 默认值为错误的.
TextShaperFactory { get; set; }获取或设置ITextShaperFactory用于高级排版渲染功能的实现。

评论

您不能直接创建此类的实例。使用LayoutOptions属性来访问此文档的布局选项。

请注意,在更改此类中的任何选项后,UpdatePageLayout应该调用 method 以便将更改的选项应用到布局。

例子

展示如何在渲染的输出文档中隐藏文本。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// 插入隐藏文本,然后指定我们是否希望从呈现的文档中省略它。
builder.Writeln("This text is not hidden.");
builder.Font.Hidden = true;
builder.Writeln("This text is hidden.");

doc.LayoutOptions.ShowHiddenText = showHiddenText;

doc.Save(ArtifactsDir + "Document.LayoutOptionsHiddenText.pdf");

展示如何在渲染的输出文档中显示段落标记。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// 添加一些段落,然后启用段落标记来显示段落的结尾
// 当我们呈现文档时,使用段落标记 (¶) 符号。
builder.Writeln("Hello world!");
builder.Writeln("Hello again!");

doc.LayoutOptions.ShowParagraphMarks = showParagraphMarks;

doc.Save(ArtifactsDir + "Document.LayoutOptionsParagraphMarks.pdf");

展示如何改变渲染输出文档中修订版本的外观。

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// 插入修订,然后将所有修订的颜色更改为绿色。
builder.Writeln("This is not a revision.");
doc.StartTrackRevisions("John Doe", DateTime.Now);
builder.Writeln("This is a revision.");
doc.StopTrackRevisions();
builder.Writeln("This is not a revision.");

// 删除出现在每个修订行左侧的栏。
doc.LayoutOptions.RevisionOptions.InsertedTextColor = RevisionColor.BrightGreen;
doc.LayoutOptions.RevisionOptions.ShowRevisionBars = false;
doc.LayoutOptions.RevisionOptions.RevisionBarsPosition = HorizontalAlignment.Right;

doc.Save(ArtifactsDir + "Revision.LayoutOptionsRevisions.pdf");

也可以看看