BuiltInDocumentPropertiesTitlesOfParts Property

Each string in the array specifies the name of a part in the document.

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 21.3.0

ExpandedSyntax

public string[] TitlesOfParts { get; set; }

Property Value

Type: String

ExpandedRemarks

Aspose.Words does not update this property.

ExpandedExamples

Shows the relationship between "HeadingPairs" and "TitlesOfParts" properties.
Document doc = new Document(MyDir + "Heading pairs and titles of parts.docx");

// We can find the combined values of these collections via
// "File" -> "Properties" -> "Advanced Properties" -> "Contents" tab.
// The HeadingPairs property is a collection of <string, int> pairs that
// determines how many document parts a heading spans across.
object[] headingPairs = doc.BuiltInDocumentProperties.HeadingPairs;

// The TitlesOfParts property contains the names of parts that belong to the above headings.
string[] titlesOfParts = doc.BuiltInDocumentProperties.TitlesOfParts;

int headingPairsIndex = 0;
int titlesOfPartsIndex = 0;
while (headingPairsIndex < headingPairs.Length)
{
    Console.WriteLine($"Parts for {headingPairs[headingPairsIndex++]}:");
    int partsCount = Convert.ToInt32(headingPairs[headingPairsIndex++]);

    for (int i = 0; i < partsCount; i++)
        Console.WriteLine($"\t\"{titlesOfParts[titlesOfPartsIndex++]}\"");
}

ExpandedSee Also