Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
标题是任何文档的重要部分。作者总是试图使标题对读者更加突出和有意义。如果文档中有多个标题,作者有几种选择来组织这些标题。组织标题的最常见方法之一是以编号样式书写标题。
Aspose.PDF for .NET 提供许多预定义的编号样式。这些预定义的编号样式存储在一个枚举中,NumberingStyle。NumberingStyle 枚举的预定义值及其描述如下:
标题类型 | 描述 |
---|---|
NumeralsArabic | 阿拉伯类型,例如,1,1.1,… |
NumeralsRomanUppercase | 罗马大写类型,例如,I,I.II,… |
NumeralsRomanLowercase | 罗马小写类型,例如,i,i.ii,… |
LettersUppercase | 英语大写类型,例如,A,A.B,… |
LettersLowercase | 英语小写类型,例如,a,a.b,… |
Aspose.Pdf.Heading 类的 Style 属性用于设置标题的编号样式。 |
图:预定义编号样式 |
---|
获取上图所示输出的源代码如下所示。 |
下一个代码片段也与 Aspose.Drawing 库一起使用。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ApplyNumberStyleToPdf()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
document.PageInfo.Width = 612.0;
document.PageInfo.Height = 792.0;
document.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
document.PageInfo.Margin.Left = 72;
document.PageInfo.Margin.Right = 72;
document.PageInfo.Margin.Top = 72;
document.PageInfo.Margin.Bottom = 72;
// Add page
var pdfPage = document.Pages.Add();
pdfPage.PageInfo.Width = 612.0;
pdfPage.PageInfo.Height = 792.0;
pdfPage.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
pdfPage.PageInfo.Margin.Left = 72;
pdfPage.PageInfo.Margin.Right = 72;
pdfPage.PageInfo.Margin.Top = 72;
pdfPage.PageInfo.Margin.Bottom = 72;
// Create a floating box with the same margin as the page
var floatBox = new Aspose.Pdf.FloatingBox();
floatBox.Margin = pdfPage.PageInfo.Margin;
// Add the floating box to the page
pdfPage.Paragraphs.Add(floatBox);
// Add headings with numbering styles
var heading = new Aspose.Pdf.Heading(1);
heading.IsInList = true;
heading.StartNumber = 1;
heading.Text = "List 1";
heading.Style = Aspose.Pdf.NumberingStyle.NumeralsRomanLowercase;
heading.IsAutoSequence = true;
floatBox.Paragraphs.Add(heading);
var heading2 = new Aspose.Pdf.Heading(1);
heading2.IsInList = true;
heading2.StartNumber = 13;
heading2.Text = "List 2";
heading2.Style = Aspose.Pdf.NumberingStyle.NumeralsRomanLowercase;
heading2.IsAutoSequence = true;
floatBox.Paragraphs.Add(heading2);
var heading3 = new Aspose.Pdf.Heading(2);
heading3.IsInList = true;
heading3.StartNumber = 1;
heading3.Text = "the value, as of the effective date of the plan, of property to be distributed under the plan on account of each allowed";
heading3.Style = Aspose.Pdf.NumberingStyle.LettersLowercase;
heading3.IsAutoSequence = true;
floatBox.Paragraphs.Add(heading3);
// Save PDF document
document.Save(dataDir + "ApplyNumberStyle_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.