我需要隐藏使用iTextSharp生成的文件中的部分和章节数量(在文件内容中,我不关心书签),例如我需要更改以这种方式生成的实际结果:
这是第1章
1.1.这在标题1中
通过以下方式:
这是第1章
这在标题1中
我尝试了以下代码,重写方法OnSection:
public override void OnSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title)
{title.RemoveAt(0);
base.OnSection(writer, document, paragraphPosition, depth, title);
}
Run Code Online (Sandbox Code Playgroud)
但我没有得到任何结果,有人可以帮忙吗?非常感谢,Ariel
甲章节号码必须使用一个段落标题和一个int作为章节号来创建.章节号默认显示.如果您不想查看章节编号,则必须将其设置numberdepth为0.
部分相同.
样品:
Chapter chapter = new Chapter("ChapterTitle", 0);
chapter.NumberDepth = 0;
Section section = chapter.AddSection("Title", 0);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4589 次 |
| 最近记录: |