ParagraphFormatIsHeading Property

True when the paragraph style is one of the built-in Heading styles.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public bool IsHeading { get; }

Property Value

Type: Boolean
Examples
Shows how to create PDF document outline entries for headings.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Creating TOC entries
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
Assert.True(builder.ParagraphFormat.IsHeading);

builder.Writeln("Heading 1");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading4;

builder.Writeln("Heading 1.1.1.1");
builder.Writeln("Heading 1.1.1.2");

builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading9;

builder.Writeln("Heading 1.1.1.1.1.1.1.1.1");
builder.Writeln("Heading 1.1.1.1.1.1.1.1.2");

// Create "PdfSaveOptions" with some mandatory parameters
// "HeadingsOutlineLevels" specifies how many levels of headings to include in the document outline
// "CreateMissingOutlineLevels" determining whether or not to create missing heading levels
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.OutlineOptions.HeadingsOutlineLevels = 9;
pdfSaveOptions.OutlineOptions.CreateMissingOutlineLevels = true;
pdfSaveOptions.SaveFormat = SaveFormat.Pdf;

doc.Save(ArtifactsDir + "PdfSaveOptions.CreateMissingOutlineLevels.pdf", pdfSaveOptions);
See Also