Get Started
Documentation

Clear

Clear() → { bool }

Clears the content of the table.

Returns:

Type
bool

Example

Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered - Accent 5"));
oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("This is just a sample text.");
oDocument.Push(oTable);
oTable.Clear();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("The content of the table was cleared.");
oDocument.Push(oParagraph);
builder.SaveFile("docx", "Clear.docx");
builder.CloseFile();

Resulting document