Skip to content

Commit f223a5b

Browse files
Merge pull request #3804 from syncfusion-content/814887-get-content-CM
814887: Added Get content as plain text/rich text and corrected the naming for the content in Core and MVC
2 parents f5770c4 + d393abd commit f223a5b

File tree

6 files changed

+42
-20
lines changed

6 files changed

+42
-20
lines changed

ej2-asp-core-mvc/code-snippet/document-editor-container/get-paragraph/razor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
// To select the current paragraph in document
1212
container.documentEditor.selection.selectParagraph();
1313

14-
// To get the selected content as sfdt
15-
var selectedContent = container.documentEditor.selection.sfdt;
14+
// To get the selected content as text
15+
var selectedContentText = container.documentEditor.selection.text;
16+
// To get the selected content as SFDT (rich text)
17+
var selectedContentSFDT = container.documentEditor.selection.sfdt;
1618
}
1719
</script>

ej2-asp-core-mvc/code-snippet/document-editor-container/get-paragraph/tagHelper

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
// To select the current paragraph in document
1414
container.documentEditor.selection.selectParagraph();
1515

16-
// To get the selected content as sfdt
17-
var selectedContent = container.documentEditor.selection.sfdt;
16+
// To get the selected content as text
17+
var selectedContentText = container.documentEditor.selection.text;
18+
// To get the selected content as SFDT (rich text)
19+
var selectedContentSFDT = container.documentEditor.selection.sfdt;
1820
}
1921
</script>

ej2-asp-core-mvc/code-snippet/document-editor-container/get-word/razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
container.documentEditor.selection.selectCurrentWord();
1313

1414
// To get the selected content as text
15-
var selectedContent = container.documentEditor.selection.text;
15+
var selectedContentText = container.documentEditor.selection.text;
16+
// To get the selected content as SFDT (rich text)
17+
var selectedContentSFDT = container.documentEditor.selection.sfdt;
1618
}
1719
</script>

ej2-asp-core-mvc/code-snippet/document-editor-container/get-word/tagHelper

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
container.documentEditor.selection.selectCurrentWord();
1515

1616
// To get the selected content as text
17-
var selectedContent = container.documentEditor.selection.text;
17+
var selectedContentText = container.documentEditor.selection.text;
18+
// To get the selected content as SFDT (rich text)
19+
var selectedContentSFDT = container.documentEditor.selection.sfdt;
1820
}
1921
</script>

ej2-asp-core-mvc/document-editor/how-to/get-current-word.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Select and retrieve current word and Paragraph in ##Platform_Name## Document Editor Component
3+
title: Get current Word/Para in ##Platform_Name## Document editor control | Syncfusion
44
description: Learn how to select and retrieve current word and Paragraph from the Syncfusion ##Platform_Name## Document Editor Component
55
platform: ej2-asp-core-mvc
66
control: Get The Current Word And Paragrapgh
@@ -25,7 +25,9 @@ The following example code illustrates how to select and get the current word as
2525
{% include code-snippet/document-editor-container/get-word/tagHelper %}
2626
{% endhighlight %}
2727
{% highlight c# tabtitle="Get-word.cs" %}
28-
{% endhighlight %}{% endtabs %}
28+
{% endhighlight %}
29+
{% code-snippet/document-editor-container/get-word/document-editor.cs %}
30+
{% endtabs %}
2931

3032
{% elsif page.publishingplatform == "aspnet-mvc" %}
3133

@@ -34,12 +36,12 @@ The following example code illustrates how to select and get the current word as
3436
{% include code-snippet/document-editor-container/get-word/razor %}
3537
{% endhighlight %}
3638
{% highlight c# tabtitle="Get-word.cs" %}
37-
{% endhighlight %}{% endtabs %}
39+
{% code-snippet/document-editor-container/get-word/document-editor.cs %}
40+
{% endhighlight %}
41+
{% endtabs %}
3842
{% endif %}
3943

4044

41-
To get the bookmark content as SFDT (rich text), check this [`link`](../../document-editor/how-to/get-the-selected-content/#get-the-selected-content-as-sfdt-rich-text)
42-
4345
## Select and get the paragraph in current cursor position
4446

4547
You can use [`selectParagraph`] API in selection module to select the current paragraph at cursor position and use [`text`] API or [`sfdt`] API to get the selected content as plain text or SFDT from Document Editor component.
@@ -53,7 +55,9 @@ The following example code illustrates how to select and get the current paragra
5355
{% include code-snippet/document-editor-container/get-paragraph/tagHelper %}
5456
{% endhighlight %}
5557
{% highlight c# tabtitle="Get-paragraph.cs" %}
56-
{% endhighlight %}{% endtabs %}
58+
{% code-snippet/document-editor-container/get-paragraph/document-editor.cs %}
59+
{% endhighlight %}
60+
{% endtabs %}
5761

5862
{% elsif page.publishingplatform == "aspnet-mvc" %}
5963

@@ -62,5 +66,7 @@ The following example code illustrates how to select and get the current paragra
6266
{% include code-snippet/document-editor-container/get-paragraph/razor %}
6367
{% endhighlight %}
6468
{% highlight c# tabtitle="Get-paragraph.cs" %}
65-
{% endhighlight %}{% endtabs %}
69+
{% code-snippet/document-editor-container/get-paragraph/document-editor.cs %}
70+
{% endhighlight %}
71+
{% endtabs %}
6672
{% endif %}

ej2-asp-core-mvc/document-editor/how-to/get-the-selected-content.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: post
3-
title: Get The Selected Content in ##Platform_Name## Document Editor Component
3+
title: Get Selected Content in ##Platform_Name## Document Editor Component | Syncfusion
44
description: Learn here all about get the selected content in Syncfusion ##Platform_Name## Document Editor component of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
66
control: Get The Selected Content
@@ -24,7 +24,9 @@ You can use `text` API to get the selected content as plain text from React Docu
2424
{% include code-snippet/document-editor-container/get-text/tagHelper %}
2525
{% endhighlight %}
2626
{% highlight c# tabtitle="Get-text.cs" %}
27-
{% endhighlight %}{% endtabs %}
27+
{% code-snippet/document-editor-container/get-text/document-editor.cs %}
28+
{% endhighlight %}
29+
{% endtabs %}
2830

2931
{% elsif page.publishingplatform == "aspnet-mvc" %}
3032

@@ -33,7 +35,9 @@ You can use `text` API to get the selected content as plain text from React Docu
3335
{% include code-snippet/document-editor-container/get-text/razor %}
3436
{% endhighlight %}
3537
{% highlight c# tabtitle="Get-text.cs" %}
36-
{% endhighlight %}{% endtabs %}
38+
{% code-snippet/document-editor-container/get-text/document-editor.cs %}
39+
{% endhighlight %}
40+
{% endtabs %}
3741
{% endif %}
3842

3943

@@ -46,7 +50,7 @@ You can add the following custom options using this API,
4650

4751
## Get the selected content as SFDT (rich text)
4852

49-
You can use `sfdt` API to get the selected content as plain text from React Document Editor component.
53+
You can use `sfdt` API to get the selected content as rich text from React Document Editor component.
5054

5155
{% if page.publishingplatform == "aspnet-core" %}
5256

@@ -55,7 +59,9 @@ You can use `sfdt` API to get the selected content as plain text from React Docu
5559
{% include code-snippet/document-editor-container/get-sfdt/tagHelper %}
5660
{% endhighlight %}
5761
{% highlight c# tabtitle="Get-sfdt.cs" %}
58-
{% endhighlight %}{% endtabs %}
62+
{% code-snippet/document-editor-container/get-sfdt/document-editor.cs %}
63+
{% endhighlight %}
64+
{% endtabs %}
5965

6066
{% elsif page.publishingplatform == "aspnet-mvc" %}
6167

@@ -64,13 +70,15 @@ You can use `sfdt` API to get the selected content as plain text from React Docu
6470
{% include code-snippet/document-editor-container/get-sfdt/razor %}
6571
{% endhighlight %}
6672
{% highlight c# tabtitle="Get-sfdt.cs" %}
67-
{% endhighlight %}{% endtabs %}
73+
{% code-snippet/document-editor-container/get-sfdt/document-editor.cs %}
74+
{% endhighlight %}
75+
{% endtabs %}
6876
{% endif %}
6977

7078

7179

7280
You can add the following custom options using this API,
7381

7482
* Save or export the selected content as SFDT file.
75-
* Get the content of a bookmark in Word document as SFDT by selecting a bookmark using `selectbookmark` API.
83+
* Get the content of a bookmark in Word document as SFDT by selecting a bookmark using `select bookmark` API.
7684
* Create template content that can be inserted to multiple documents in cursor position using `paste` API.

0 commit comments

Comments
 (0)