Hi! How can I add text to the cell in the table in the docx document by using your API?
Hello @amogus,
You can use the following approach and methods to add text to a specific cell:
var oDoc = Api.GetDocument();
var aTable = oDoc.GetAllTables();
var oCell = aTable[0].GetCell(0,0);
var oContent = oCell.GetContent();
var oPar = oContent.GetAllParagraphs();
oPar[0].AddText("Some text");
it works thanks! and also, in Documents, I can’t find the option to align the text in the table cell horizontally (I have to center it), could you please help?
It can be done using the following paragraph method (this alignment is specific to paragraph rather than to cell itself) - SetJc | ONLYOFFICE
Example: oPar[0].setJc("center");