Skip to content

Commit d9a25b0

Browse files
author
SalmanBaris25
committed
890821: Updated the content control documentation contents
1 parent b8cc10f commit d9a25b0

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

ej2-asp-core-mvc/document-editor/content-control.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ documentation: ug
1111

1212
# Content Control in DocumentEditor
1313

14-
Document Editor provides content control preservation support (i.e.) Content control present in the input document is preserved upon saving.
14+
Document Editor provides support for inserting, editing content controls.
1515

1616
Content controls can be categorized based on its occurrence in a document as follows,
1717

@@ -26,4 +26,76 @@ InlineContentControl: Among inline content inside, as a child of a paragraph. Bl
2626
* Drop-Down List and Combo Box
2727
* Picture
2828

29+
## Insert content control
30+
31+
Content control can be inserted using `insertContentControl` method in editor module.
32+
33+
{% highlight ts %}
34+
//Insert Rich Text Content Control
35+
documentEditor.editor.insertContentControl('RichText');
36+
//Insert Rich Text Content Control with default sfdt string
37+
var sfdt = {"sections":[{"blocks":[{"inlines":[{"text": "Hello"}]}]}]};
38+
documentEditor.editor.insertContentControl('RichText', sfdt);
39+
40+
//Insert Plain Text Content Control
41+
documentEditor.editor.insertContentControl('Text');
42+
//Insert Plain Text Content Control with default string
43+
documentEditor.editor.insertContentControl('Text', 'Hello World');
44+
45+
//Insert CheckBox Content Control
46+
documentEditor.editor.insertContentControl('CheckBox');
47+
//Insert CheckBox Content Control with mention checked state
48+
documentEditor.editor.insertContentControl('CheckBox', true);
49+
50+
//Insert ComboBox Content Control
51+
documentEditor.editor.insertContentControl('ComboBox');
52+
//Insert ComboBox Content Control with items
53+
documentEditor.editor.insertContentControl('ComboBox', 'One', ['One', 'Two', 'Three']);
54+
55+
//Insert Date Content Control
56+
documentEditor.editor.insertContentControl('Date');
57+
//Insert Date Content Control
58+
documentEditor.editor.insertContentControl('Date', '01/01/2024');
59+
60+
//Insert DropDownList Content Control
61+
documentEditor.editor.insertContentControl('DropDownList');
62+
//Insert DropDownList Content Control with items
63+
documentEditor.editor.insertContentControl('DropDownList', 'One', ['One', 'Two', 'Three']);
64+
65+
//Insert Picture Content Control
66+
documentEditor.editor.insertContentControl('Picture');
67+
//Insert Picture Content Control with default image
68+
documentEditor.editor.insertContentControl('Picture', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADgSURBVEhLY3jx4sV/WuDBafCluXH/D6ydhlWObIMPLmn8/32KPBiD2OjyKAY7+zbDsX945/91azehiBWU9IPVgVwJMxSX4SgG65jXwrGVa+v/6TOXoojBDEZ2LQh/m676/+D+/XBzQJgsg0EY5GqQgSCDsYUz2QaDMCiosIUvCKMYDFKIjK9dvYrCB3kXJIaMkfUjY5JdDEpioCCAYZCFyGbAMFkGI0fcMDUYpAgZY4s8EEYWwxWBJLsYhJHFQIYjmwHDQ9xgkGEwDCp0QAYji8EMRhYjymBq4lGDofjFfwCV5AGEIf9DQQAAAABJRU5ErkJggg==');
69+
{% endhighlight %}
70+
71+
## Import content control properties
72+
73+
Content control properties can be set using the `ContentControlInfo` and import it using `importContentControlData`
74+
75+
{% highlight ts %}
76+
var data = [];
77+
var contentControlData = { title: placeHolderPrefix + 'Name', tag: '', value: 'John', canDelete: false, canEdit: false, type: 'RichText' };
78+
data.push(contentControlData);
79+
documentEditor.importContentControlData(data);
80+
{% endhighlight %}
81+
82+
## Export content control properties
83+
84+
Content control properties can be exported using the `exportContentControlData`
85+
86+
{% highlight ts %}
87+
var contentControlInfos = documentEditor.exportContentControlData();
88+
{% endhighlight %}
89+
90+
## Reset content control
91+
92+
Content control properties can be reset using the `resetcontentcontroldata`
93+
94+
{% highlight ts %}
95+
var data = [];
96+
var contentControlData = { title: placeHolderPrefix + 'Name', tag: '', value: 'John', canDelete: false, canEdit: false, type: 'RichText' };
97+
data.push(contentControlData);
98+
documentEditor.resetContentControlData(data);
99+
{% endhighlight %}
100+
29101
N> Content control with custom XML mapping of file type WordML is converted as normal Rich Text Content Control to provide lossless round-tripping upon saving.

0 commit comments

Comments
 (0)