ApiBlockLvlSdt
Class represent a container for the content of the document
Methods
Name |
Description |
AddElement |
Push a paragraph or a table or a blocklvl content control to actually add it to the document. |
AddText |
Adds a text to the current content control. |
Delete |
Removes content control and content. If keepContent is true, the content is not deleted. |
GetAlias |
Get the alias attribute for this container |
GetAllContentControls |
Gets the collection of content control objects in the content control. |
GetAllDrawingObjects |
Gets the collection of drawing objects in the document. |
GetAllParagraphs |
Get a collection of paragraph objects in a content control. |
GetAllTablesOnPage |
Get the collection of tables on a given absolute page |
GetClassType |
Get the type of this class. |
GetContent |
Get the content of this container |
GetLabel |
Get the label attribute for this container |
GetLock |
Get the lock type of this container |
GetParentContentControl |
Gets the content control that contains the current content control. |
GetParentTable |
Gets the table that contains the content control. |
GetParentTableCell |
Gets the table cell that contains the content control. |
GetRange |
Returns a Range object that represents the part of the document contained in the specified content control. |
GetTag |
Get the tag attribute for this container |
Push |
Push a paragraph or a table or BlockLvl content control to actually add it to the document. |
RemoveAllElements |
Clears the contents of a content control. |
Search |
Searches for the scope of a content control object. The search results are a collection of ApiRange objects. |
Select |
Select a content control. |
SetAlias |
Set the alias attribute for this container |
SetLabel |
Set the label attribute for this container |
SetLock |
Set the lock to the current inline text content control.
"contentLocked" - content cannot be edited
"sdtContentLocked" - content cannot be edited and BlockLvlSdt cannot be deleted.
"sdtLocked" - BlockLvlSdt cannot be deleted. |
SetTag |
Set the tag attribute for this container |
SetTextPr |
Applies text settings to content of content control. |
Example
Copy code
builder.CreateFile("docx");
oDocument = Api.GetDocument();
oBlockLvlSdt = Api.CreateBlockLvlSdt();
oBlockLvlSdt.GetContent().GetElement(0).AddText("This is the first paragraph of the content control.");
oContent = oBlockLvlSdt.GetContent();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("This is the second paragraph of the content control.");
oContent.AddElement(oParagraph);
oContent.Push(oParagraph);
oDocument.AddElement(0, oBlockLvlSdt);
aParagraphs = oBlockLvlSdt.GetAllParagraphs();
aParagraphs[0].SetBold(true);
oBlockLvlSdt.Search("paragraph")[1].SetItalic(true);
oBlockLvlSdt.SetLabel("2147483647");
oBlockLvlSdt.SetLock("sdtContentLocked");
oBlockLvlSdt.SetAlias("№1");
oBlockLvlSdt.SetTag("This is a tag.");
oLabel = oBlockLvlSdt.GetLabel();
oLock = oBlockLvlSdt.GetLock();
oAlias = oBlockLvlSdt.GetAlias();
oTag = oBlockLvlSdt.GetTag();
oClassType = oBlockLvlSdt.GetClassType();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Class type: " + oClassType);
oParagraph.AddLineBreak();
oParagraph.AddText("Lock type: " + oLock);
oParagraph.AddLineBreak();
oParagraph.AddText("Label: " + oLabel);
oParagraph.AddLineBreak();
oParagraph.AddText("Alias: " + oAlias);
oParagraph.AddLineBreak();
oParagraph.AddText("Tag: " + oTag);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "ApiBlockLvlSdt.docx");
builder.CloseFile();
Resulting document