Aspose::Words::Story::get_Tables method
Story::get_Tables method
Gets a collection of tables that are immediate children of the story.
System::SharedPtr<Aspose::Words::Tables::TableCollection> Aspose::Words::Story::get_Tables() override
Examples
Shows how to remove the first and last rows of all tables in a document.
auto doc = MakeObject<Document>(MyDir + u"Tables.docx");
SharedPtr<TableCollection> tables = doc->get_FirstSection()->get_Body()->get_Tables();
ASSERT_EQ(5, tables->idx_get(0)->get_Rows()->get_Count());
ASSERT_EQ(4, tables->idx_get(1)->get_Rows()->get_Count());
for (const auto& table : System::IterateOver(tables->LINQ_OfType<SharedPtr<Table>>()))
{
if (table->get_FirstRow() != nullptr)
{
table->get_FirstRow()->Remove();
}
if (table->get_LastRow() != nullptr)
{
table->get_LastRow()->Remove();
}
}
ASSERT_EQ(3, tables->idx_get(0)->get_Rows()->get_Count());
ASSERT_EQ(2, tables->idx_get(1)->get_Rows()->get_Count());
See Also
- Class TableCollection
- Class Story
- Namespace Aspose::Words
- Library Aspose.Words for C++