Do you want to: Suggest a feature
Document Server version: 8.2 Community Edition
For example, as shown in the figure below, I have three cells. I tried to obtain the tag of the first cell using the following code according to the Office API.
The result is not a function.
let oDocument = Api.GetDocument();
let oTable = oDocument.GetAllTablesOnPage(0)[0];
let oTableCell = oTable.GetCell(0,0). GetContent(). GetElement(0). GetTag();
console.log("oTableCell", oTableCell);
// oTable. GetCell(...). GetContent(...). GetElement(...). GetTag is not a function
I’ve received the same result on version 7.1. Could you specify what is returned in your case?
In general, GetTag method is available for ApiInlineLvlSdt and ApiBlockLvlSdt elements which are Content Controls.
Before you replied to me, I already knew what the problem was and how to solve it. Your answer confirmed the issue. Inserting text into the document only creates a Paragraph. To use GetTag in a cell, you must first create an InlineLvlSdt or BlockLvlSdt.
I have a suggestion: your current documentation is very poor! Whether it’s the code examples or written tutorials, they often lack context and only cover the middle parts. This has left me unclear about the scenarios in which GetTag can be used. I can only explore it one by one through code suggestions in the macros, which is very time-consuming! I hope you can make the documentation more detailed.