метод Aspose::Words::Properties::BuiltInDocumentProperties::get_TitlesOfParts

BuiltInDocumentProperties::get_TitlesOfParts method

Каждая строка в массиве указывает название части документа.

System::ArrayPtr<System::String> Aspose::Words::Properties::BuiltInDocumentProperties::get_TitlesOfParts()

Примечания

Aspose.Words не обновляет это свойство.

Примеры

Показывает взаимосвязь между свойствами "HeadingPairs" и "TitlesOfParts".

auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Heading pairs and titles of parts.docx");

// Мы можем найти объединённые значения этих коллекций через
// \"File\" -> \"Properties\" -> \"Advanced Properties\" -> \"Contents\" вкладка.
// Свойство HeadingPairs представляет собой коллекцию пар <string, int>, которые
// определяет, сколько частей документа охватывает заголовок.
System::ArrayPtr<System::SharedPtr<System::Object>> headingPairs = doc->get_BuiltInDocumentProperties()->get_HeadingPairs();

// Свойство TitlesOfParts содержит имена частей, которые относятся к вышеуказанным заголовкам.
System::ArrayPtr<System::String> titlesOfParts = doc->get_BuiltInDocumentProperties()->get_TitlesOfParts();

int32_t headingPairsIndex = 0;
int32_t titlesOfPartsIndex = 0;
while (headingPairsIndex < headingPairs->get_Length())
{
    std::cout << System::String::Format(u"Parts for {0}:", headingPairs[headingPairsIndex++]) << std::endl;
    int32_t partsCount = System::Convert::ToInt32(headingPairs[headingPairsIndex++]);

    for (int32_t i = 0; i < partsCount; i++)
    {
        std::cout << System::String::Format(u"\t\"{0}\"", titlesOfParts[titlesOfPartsIndex++]) << std::endl;
    }
}

См. также