Aspose::Words::DocumentBuilder::get_CurrentStory метод
DocumentBuilder::get_CurrentStory method
Получает историю, которая в данный момент выбрана в этом DocumentBuilder.
System::SharedPtr<Aspose::Words::Story> Aspose::Words::DocumentBuilder::get_CurrentStory()
Примеры
Показывает, как работать с текущей историей построителя документов.
auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
// История — это тип узла, который имеет дочерние узлы Paragraph, такие как Body.
ASPOSE_ASSERT_EQ(builder->get_CurrentStory(), doc->get_FirstSection()->get_Body());
ASPOSE_ASSERT_EQ(builder->get_CurrentStory(), builder->get_CurrentParagraph()->get_ParentNode());
ASSERT_EQ(Aspose::Words::StoryType::MainText, builder->get_CurrentStory()->get_StoryType());
builder->get_CurrentStory()->AppendParagraph(u"Text added to current Story.");
// История также может содержать таблицы.
System::SharedPtr<Aspose::Words::Tables::Table> table = builder->StartTable();
builder->InsertCell();
builder->Write(u"Row 1, cell 1");
builder->InsertCell();
builder->Write(u"Row 1, cell 2");
builder->EndTable();
ASSERT_TRUE(builder->get_CurrentStory()->get_Tables()->Contains(table));
См. также
- Class Story
- Class DocumentBuilder
- Namespace Aspose::Words
- Library Aspose.Words for C++