TRY NEW VERSION

Try now New API BETA

Try out the new view and capabilities of the API documentation

START

GetPrevious

GetPrevious() → { ApiTableCell | null }

Returns the previous cell if exists.

Parameters:

This method doesn't have any parameters.

Returns:

Type
ApiTableCell | null

Example

Copy code
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oTableStyle = oDocument.CreateStyle("CustomTableStyle", "table");
oTableStyle.SetBasedOn(oDocument.GetStyle("Bordered"));
var oTable = Api.CreateTable(3, 3);
oTable.SetWidth("percent", 100);
oTable.SetStyle(oTableStyle);
oTable.GetCell(0, 0).GetContent().GetElement(0).AddText("Cell 1");
oTable.GetCell(0, 1).GetContent().GetElement(0).AddText("Cell 2");
oDocument.Push(oTable);
var oPreviousCell = oTable.GetCell(0, 1).GetPrevious();
oPreviousCell.GetContent().GetElement(0).SetBold(true);
builder.SaveFile("docx", "GetPrevious.docx");
builder.CloseFile();

Resulting document