Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 36 additions & 29 deletions Document-Processing/Word/Word-Processor/wpf/Document-Properties.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,111 @@
---
title: Document Properties in WPF RichTextBox control | Syncfusion
description: Learn here all about Document Properties support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
description: Learn about the Document Properties support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
platform: document-processing
control: SfRichTextBoxAdv
documentation: ug
keywords: Word count, paragraph count, page count, current page number.
---
# Document Properties in WPF RichTextBox (SfRichTextBoxAdv)
[WPF RichTexBox](https://www.syncfusion.com/wpf-controls/richtextbox) keep tracking the statistics about your documents. These statistics contains information about word count, paragraph count and pages count.
[WPF RichTextBox](https://www.syncfusion.com/wpf-controls/richtextbox) keeps track of the statistics about your documents. These statistics contain information about word count, paragraph count and pages count.

## Word Count
RichTextBox automatically counts the number of words in a document while you type. You can get the words count from [WordCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_WordCount.html) property. The default value of this property is 0.
## Word count
RichTextBox automatically counts the number of words in a document while you type. You can get the words count from [WordCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_WordCount) property. The default value of this property is 0.

The following sample code demonstrates how to get the total number of words in the document.
{% tabs %}
{% highlight Xaml %}
<TextBlock Text="{Binding Path=WordCount, Mode=TwoWay}" />
{% highlight xaml %}
<TextBlock Text="{Binding Path=WordCount, Mode=TwoWay, ElementName=richTextBoxAdv}" />

{% endhighlight %}
{% highlight C# %}
int wordCount.Text = richTextBoxAdv.WordCount.ToString();
{% highlight c# %}
int wordCount = richTextBoxAdv.WordCount;

{% endhighlight %}
{% highlight VB %}
wordCount.Text = richTextBoxAdv.WordCount.ToString()
Dim wordCount As Integer = richTextBoxAdv.WordCount

{% endhighlight %}
{% endtabs %}

## Paragraph Count
RichTextBox automatically counts the number of paragraphs in a document while you type. You can get the paragraph count from [ParagraphCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_ParagraphCount.html) property. The default value of this property is 0. Also, it ignores empty paragraphs.
## Paragraph count
RichTextBox automatically counts the number of paragraphs in a document while you type. You can get the paragraph count from [ParagraphCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_ParagraphCount) property. The default value of this property is 0. Also, it ignores empty paragraphs.

The following sample code demonstrates how to get the total number of paragraphs in the document.
{% tabs %}
{% highlight Xaml %}
<TextBlock Name="ParagraphCount" Text="{Binding Path=ParagraphCount, Mode=TwoWay}" />
{% highlight xaml %}
<TextBlock Text="{Binding Path=ParagraphCount, Mode=TwoWay, ElementName=richTextBoxAdv}" />

{% endhighlight %}
{% highlight C# %}
int paragraphCount.Text = richTextBoxAdv.ParagraphCount.ToString();
{% highlight c# %}
int paragraphCount = richTextBoxAdv.ParagraphCount;

{% endhighlight %}
{% highlight VB %}
paragraphCount.Text = richTextBoxAdv.ParagraphCount.ToString()
Dim paragraphCount As Integer = richTextBoxAdv.ParagraphCount

{% endhighlight %}
{% endtabs %}

## Page Count
RichTextBox counts the number of pages in a document while you type. You can get the pages count from [PageCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_ParagraphCount.html) property. The default value of this property is 0.
## Page count
RichTextBox counts the number of pages in a document while you type. You can get the page count from [PageCount](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_PageCount) property. The default value of this property is 0.

The following sample code demonstrates how to get the total number of pages in the document.
{% tabs %}
{% highlight Xaml %}
{% highlight xaml %}
<TextBlock x:Name="PageCount" Grid.Row="0" />
<RichTextBoxAdv:SfRichTextBoxAdv Grid.Row="1" x:Name="richTextBoxAdv" SelectionChanged="RichTextBoxAdv_SelectionChanged"/>

{% endhighlight %}
{% highlight C# %}
{% highlight c# %}
private void RichTextBoxAdv_SelectionChanged(object obj, SelectionChangedEventArgs args)
{
pageCount.Text = richTextBoxAdv.PageCount.ToString();
PageCount.Text = richTextBoxAdv.PageCount.ToString();
}

{% endhighlight %}
{% highlight VB %}
Private Sub RichTextBoxAdv_SelectionChanged(ByVal obj As Object, ByVal args As SelectionChangedEventArgs)
pageCount.Text = richTextBoxAdv.PageCount.ToString()
PageCount.Text = richTextBoxAdv.PageCount.ToString()
End Sub

{% endhighlight %}
{% endtabs %}

## Current Page number
The [CurrentPageNumber](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_CurrentPageNumber.html) property in the RichTextBox control returns the page number where the selection(cursor) is present.
## Current page number
The [CurrentPageNumber](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_CurrentPageNumber) property in the RichTextBox control returns the page number where the selection(cursor) is present.

The following sample code demonstrates how to get current page number in the document.

{% tabs %}
{% highlight Xaml %}
{% highlight xaml %}
<TextBlock x:Name="CurrentPageNumber" Grid.Row="0" />
<RichTextBoxAdv:SfRichTextBoxAdv Grid.Row="1" x:Name="richTextBoxAdv" SelectionChanged="RichTextBoxAdv_SelectionChanged"/>

{% endhighlight %}
{% highlight C# %}
{% highlight c# %}
private void RichTextBoxAdv_SelectionChanged(object obj, SelectionChangedEventArgs args)
{
currentPageNumber.Text = richTextBoxAdv.CurrentPageNumber.ToString();
CurrentPageNumber.Text = richTextBoxAdv.CurrentPageNumber.ToString();
}

{% endhighlight %}
{% highlight VB %}
Private Sub RichTextBoxAdv_SelectionChanged(ByVal obj As Object, ByVal args As SelectionChangedEventArgs)
currentPageNumber.Text = richTextBoxAdv.CurrentPageNumber.ToString()
CurrentPageNumber.Text = richTextBoxAdv.CurrentPageNumber.ToString()
End Sub

{% endhighlight %}
{% endtabs %}

N> The above PageCount and CurrentPageNumber properties are not a dependency property. And it is not notifying for dynamic changes. So, get these properties value in
selection changed event.
You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to knows how to render and configure the editing tools.


N> You can refer to our [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) feature tour page for its groundbreaking feature representations. You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to know how to render and configure the editing tool.

## See also

- [Document Structure in WPF RichTextBox](./Document-Structure)
- [Selection in WPF RichTextBox](./Selection)
- [Commands in WPF RichTextBox](./Commands)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Document Structure in WPF RichTextBox control | Syncfusion
description: Learn here all about Document Structure support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
description: Learn about the Document Structure support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
platform: document-processing
control: SfRichTextBoxAdv
documentation: ug
Expand All @@ -10,4 +10,10 @@ keywords: document-structure

![Document Structure of WPF RichTextBox](Document-Structure_images/wpf-richtextbox-document-structure.jpeg)

N> You can refer to our [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) feature tour page for its groundbreaking feature representations.You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to knows how to render and configure the editing tools.
N> You can refer to our [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) feature tour page for its groundbreaking feature representations. You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to know how to render and configure the editing tool.

## See also

- [Document Properties in WPF RichTextBox](./Document-Properties)
- [Selection in WPF RichTextBox](./Selection)
- [Commands in WPF RichTextBox](./Commands)
40 changes: 20 additions & 20 deletions Document-Processing/Word/Word-Processor/wpf/Document-Styles.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Document Styles in WPF RichTextBox control | Syncfusion
description: Learn here all about Document Styles support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
description: Learn about the Document Styles support in Syncfusion WPF RichTextBox (SfRichTextBoxAdv) control and more.
platform: document-processing
control: SfRichTextBoxAdv
documentation: ug
Expand All @@ -13,26 +13,20 @@ A style is a predefined set of table, numbering, paragraph, and character format
In [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor), styles are created and added to a document programmatically or using the built-in Styles dialog.

A style in a document should have the following properties:
### Name
Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.

### Type
Specifies the document elements that the style will target. For example, paragraph or character.
**Name** – Name of the style. All styles in a document have a unique name, which is used as an identifier when applying the style.

### Next
Specifies the style that will be automatically applied to a new paragraph, which is created following a paragraph with the parent paragraph style applied.
**Type** – Specifies the document elements that the style will target. For example, paragraph or character.

### Link
Provides a relation between the paragraph and character style.
**Next** – Specifies the style that will be automatically applied to a new paragraph, which is created following a paragraph with the parent paragraph style applied.

### CharacterFormat
Specifies the properties of paragraph and character style.
**Link** – Provides a relation between the paragraph and character style.

### ParagraphFormat
Specifies the properties of paragraph style.
**CharacterFormat** – Specifies the properties of paragraph and character style.

### BasedOn
Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined. It can be optional.
**ParagraphFormat** – Specifies the properties of paragraph style.

**BasedOn** – Specifies that the current style inherits the style set to this property. This is how hierarchical styles are defined. It can be optional.

N> The style type should match the inherited style type. For example, it is not possible to have a character style inherit a paragraph style.

Expand Down Expand Up @@ -87,7 +81,7 @@ New styles are created and added to the style collection of the document. Here,
The following code example explains how to create new style dialog through command binding.
{% tabs %}
{% highlight xaml %}
<Button Content="Create style" Command="Syncfusion:SfRichTextBoxAdv.ShowStyleDialogCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}" ></Button>
<Button Content="Create Style" Command="Syncfusion:SfRichTextBoxAdv.ShowStyleDialogCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}" ></Button>
{% endhighlight %}
{% endtabs %}

Expand All @@ -99,7 +93,7 @@ You can modify a style directly using the ShowStylesDialogCommand in SfRichTextB
The following code example explains how to modify the style dialog through command binding.
{% tabs %}
{% highlight xaml %}
<Button Content="Modify style" Command="Syncfusion:SfRichTextBoxAdv.ShowStylesDialogCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}"></Button>
<Button Content="Modify Style" Command="Syncfusion:SfRichTextBoxAdv.ShowStylesDialogCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}"></Button>
{% endhighlight %}
{% endtabs %}

Expand All @@ -119,7 +113,7 @@ When there is no selection, styles of Linked type will change the values of the
The following code example explains how to apply style through command binding.
{% tabs %}
{% highlight xaml %}
<Button Content="Apply style" Command="Syncfusion:SfRichTextBoxAdv.ApplyStyleCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}" CommandParameter="Heading 1"></Button>
<Button Content="Apply Style" Command="Syncfusion:SfRichTextBoxAdv.ApplyStyleCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}" CommandParameter="Heading 1"></Button>
{% endhighlight %}
{% endtabs %}

Expand All @@ -129,8 +123,14 @@ It will remove all the formatting from the selection leaving only the normal unf
The following code example explains how to clear the formatting of text through command binding.
{% tabs %}
{% highlight xaml %}
<Button Content="Clear formatting" Command="Syncfusion:SfRichTextBoxAdv.ClearFormattingCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}"></Button>
<Button Content="Clear Formatting" Command="Syncfusion:SfRichTextBoxAdv.ClearFormattingCommand" CommandTarget="{Binding ElementName=richTextBoxAdv}"></Button>
{% endhighlight %}
{% endtabs %}

N> You can refer to our [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) feature tour page for its groundbreaking feature representations.You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to knows how to render and configure the editing tools.
N> You can refer to our [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) feature tour page for its groundbreaking feature representations. You can also explore our [WPF RichTextBox example](https://github.com/syncfusion/docx-editor-sdk-wpf-demos) to know how to render and configure the editing tool.

## See also

- [Document Properties in WPF RichTextBox](./Document-Properties)
- [Selection in WPF RichTextBox](./Selection)
- [Commands in WPF RichTextBox](./Commands)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Export image as Embedded in HTML in WPF SfRichTextBoxAdv | Syncfusion
description: Learn here all about how to export the inserted image as an Embedded image in HTML in Syncfusion WPF SfRichTextBoxAdv and more.
description: Learn how to export the inserted image as an embedded image in HTML in Syncfusion WPF SfRichTextBoxAdv and more.
platform: document-processing
control: SfRichTextBoxAdv
documentation: ug
Expand All @@ -11,7 +11,7 @@ keywords: embedded-image-html

This page explains how to export the inserted image as an Embedded image in HTML in [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv).

In the SfRichTextBoxAdv control, we offer an option to specify HTML export settings. By utilizing the [ImageNodeVisitedEvent](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.ImageNodeVisitedEventArgs.html) event of the [HtmlImportExportSettings](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.HtmlImportExportSettings.html) instance, you can both retrieve and define the image stream and image source. When setting the image source as Empty, the inserted picture can be exported as an embedded image in the HTML.
In the SfRichTextBoxAdv control, the control provides an option to specify HTML export settings. By utilizing the [ImageNodeVisited](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.ImageNodeVisitedEventArgs.html) event of the [HtmlImportExportSettings](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.HtmlImportExportSettings.html) instance, you can both retrieve and define the image stream and image source. When setting the image source as Empty, the inserted picture can be exported as an embedded image in the HTML.

The following code example illustrates to export the inserted image as an Embedded image in HTML in the SfRichTextBoxAdv.

Expand All @@ -36,4 +36,9 @@ richTextBoxAdv.HtmlImportExportSettings.ImageNodeVisited += HtmlImportExportSett
// Unhooks the event handler for ImageNodeVisited event.
richTextBoxAdv.HtmlImportExportSettings.ImageNodeVisited -= HtmlImportExportSettings_ImageNodeVisited;
{% endhighlight %}
{% endtabs %}
{% endtabs %}

## See also

- [WPF RichTextBox Feature Tour](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor)
- [WPF RichTextBox Examples](https://github.com/syncfusion/docx-editor-sdk-wpf-demos)
Loading