Aspose::Words::Tables::Table::SetShading method
Contents
[
Hide
]Table::SetShading method
Sets shading to the specified values on whole table.
void Aspose::Words::Tables::Table::SetShading(Aspose::Words::TextureIndex texture, System::Drawing::Color foregroundColor, System::Drawing::Color backgroundColor)
Parameter | Type | Description |
---|---|---|
texture | Aspose::Words::TextureIndex | The texture to apply. |
foregroundColor | System::Drawing::Color | The color of the texture. |
backgroundColor | System::Drawing::Color | The color of the background fill. |
Examples
Shows how to apply an outline border to a table.
auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Tables.docx");
System::SharedPtr<Aspose::Words::Tables::Table> table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
// Align the table to the center of the page.
table->set_Alignment(Aspose::Words::Tables::TableAlignment::Center);
// Clear any existing borders and shading from the table.
table->ClearBorders();
table->ClearShading();
// Add green borders to the outline of the table.
table->SetBorder(Aspose::Words::BorderType::Left, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Right, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Top, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
table->SetBorder(Aspose::Words::BorderType::Bottom, Aspose::Words::LineStyle::Single, 1.5, System::Drawing::Color::get_Green(), true);
// Fill the cells with a light green solid color.
table->SetShading(Aspose::Words::TextureIndex::TextureSolid, System::Drawing::Color::get_LightGreen(), System::Drawing::Color::Empty);
doc->Save(get_ArtifactsDir() + u"Table.SetOutlineBorders.docx");
See Also
- Enum TextureIndex
- Class Table
- Namespace Aspose::Words::Tables
- Library Aspose.Words for C++