From 044990f541057ad977991f8fb1cc8b2fbd3a9c9a Mon Sep 17 00:00:00 2001 From: Kalaivannan-Ganesan <93248069+Kalaivannan-Ganesan@users.noreply.github.com> Date: Fri, 24 Jul 2026 20:34:41 +0530 Subject: [PATCH] Addressed error logs from Localization.md to Shapes.md --- .../Word/Word-Processor/wpf/Localization.md | 52 ++++++--- .../Word/Word-Processor/wpf/MVVM.md | 47 ++++---- .../Word/Word-Processor/wpf/Mini-Toolbar.md | 26 +++-- .../Word/Word-Processor/wpf/Overview.md | 4 +- .../Word-Processor/wpf/Printing-Contents.md | 29 +++-- .../Word/Word-Processor/wpf/Selection.md | 109 +++++++++--------- .../Word/Word-Processor/wpf/Shapes.md | 31 +++-- 7 files changed, 181 insertions(+), 117 deletions(-) diff --git a/Document-Processing/Word/Word-Processor/wpf/Localization.md b/Document-Processing/Word/Word-Processor/wpf/Localization.md index 56a9501c3f..3651fe0fe3 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Localization.md +++ b/Document-Processing/Word/Word-Processor/wpf/Localization.md @@ -5,17 +5,21 @@ description: Learn here all about Localization support in Syncfusion WPF RichTex platform: document-processing control: SfRichTextBoxAdv documentation: ug -keywords: localization +keywords: localization,resx,culture,current-ui-culture,resource-file --- # Localization in WPF RichTextBox (SfRichTextBoxAdv) -Localization is the process of configuring the application to a specific language. [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) provides support to localize all the static text in ribbon and all its dialogs. Localization can be done by adding resource file (Resx) and setting the specific culture in the application. +Localization is the process of adapting the application to a specific language. [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) provides support to localize all the static text in the ribbon and its dialogs, including button labels, dialog titles, command tooltips, and menu items. Localization can be done by adding a resource file (Resx) and setting the desired culture in the application. The default culture is `en-US`. + +The default English (`en-US`) resource files (`Syncfusion.SfRichTextBoxAdv.WPF.resx` and `Syncfusion.SfRichTextRibbon.WPF.resx`) are embedded inside the `Syncfusion.SfRichTextBoxAdv.WPF` and `Syncfusion.SfRichTextRibbon.WPF` assemblies, so they are available without any additional setup. + +To localize the controls to a different culture, add a culture-specific `..resx` file (for example, `Syncfusion.SfRichTextBoxAdv.WPF.fr.resx`) to your project with its `Build Action` set to `Embedded Resource`. The runtime resource manager will then pick up the localized strings for the current UI culture, falling back to the embedded default if no culture-specific match is found. ## Setting Current UI Culture -For localizing your application to specific culture, you have to set the ‘CurrentUICulture’ as required before invoking the InitializeComponent() method. +For localizing your application to a specific culture, set the `CurrentUICulture` to the required culture before invoking the `InitializeComponent()` method. -The following code example demonstrates how to set culture information for localizing an application. +The following code example demonstrates how to set the culture for localizing an application. {% tabs %} {% highlight c# %} @@ -30,7 +34,7 @@ public MainWindow() {% highlight VB %} Partial Public Class MainWindow Public Sub New() -System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR") +System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("fr-FR") InitializeComponent() End Sub End Class @@ -40,24 +44,40 @@ End Class {% endtabs %} -[View example in GitHub](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization) +[View the complete localization sample on GitHub](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization) ## Adding Resource file -* Create a folder with name ‘Resources’ in your application. -* Add default English(“en-US”) [Resx](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization/Localization/Resources) (resource) file of SfRichTextBoxAdv and SfRichTextRibbon in the ‘Resources’ folder named as Syncfusion.SfRichTextBoxAdv.WPF.resx and Syncfusion.SfRichTextRibbon.WPF.resx respectively -* Create Resx (resource) files and named as Syncfusion.SfRichTextBoxAdv.WPF. [Culture name].resx and Syncfusion.SfRichTextRibbon.WPF. [Culture name].resx. For example, Syncfusion.SfRichTextBoxAdv.WPF.fr.resx and Syncfusion.SfRichTextRibbon.WPF.fr.resx for French culture. For your reference, French(“fr-FR”) [Resx](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization/Localization/Resources) file. +### Create the Resources folder + +Create a folder named `Resources` in your project root (alongside your `.csproj` / `.vbproj` file). + +### Add the default Resx + +The default English (`en-US`) [Resx](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization/Localization/Resources) (resource) files for `SfRichTextBoxAdv` and `SfRichTextRibbon` are available in the [GitHub sample](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization). Copy `Syncfusion.SfRichTextBoxAdv.WPF.resx` and `Syncfusion.SfRichTextRibbon.WPF.resx` from the sample into the `Resources` folder of your application. + +![Added resource files for SfRichTextBoxAdv and SfRichTextRibbon shown in the Visual Studio Resources folder](Localization_images/wpf-richtextbox-resource-file.jpeg) + +### Create the localized Resx + +Create Resx (resource) files named `Syncfusion.SfRichTextBoxAdv.WPF..resx` and `Syncfusion.SfRichTextRibbon.WPF..resx`. For example, `Syncfusion.SfRichTextBoxAdv.WPF.fr.resx` and `Syncfusion.SfRichTextRibbon.WPF.fr.resx` for the French (`fr`) culture. For your reference, see the French (`fr`) [Resx](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/Localization/Localization/Resources) files. + +### Add resource keys + +Add a resource key (such as the name of the string) and its corresponding localized value in the Resource Designer of the `Syncfusion.SfRichTextBoxAdv.WPF.fr.resx` and `Syncfusion.SfRichTextRibbon.WPF.fr.resx` files. -![Displaying Added Resource File for WPF RichTextBox](Localization_images/wpf-richtextbox-resource-file.jpeg) +![Resource Designer showing the name and localized value columns for the Resx file](Localization_images/wpf-richtextbox-property-values.jpeg) -* Add the resource key such as name and its corresponding localized value in Resource Designer of Syncfusion.SfRichTextBoxAdv.WPF.fr.resx and Syncfusion.SfRichTextRibbon.WPF.fr.resx file. +N> If you have not used `SfRichTextRibbon` in your application, you can skip the `Syncfusion.SfRichTextRibbon.WPF..resx` files mentioned above. After adding or modifying Resx files, rebuild the application so the new resources are picked up at runtime. -![Displaying Resource File Property Items of WPF RichTextBox](Localization_images/wpf-richtextbox-property-values.jpeg) +The following screenshot shows the localization in the SfRichTextBoxAdv and SfRichTextRibbon controls -N> If you have not used SfRichTextRibbon in your application, you can skip Syncfusion.SfRichTextRibbon.WPF.[Culture name].resx file mentioned above. +![SfRichTextBoxAdv and SfRichTextRibbon rendered with French-localized text in the ribbon and dialogs](Localization_images/wpf-richtextbox-localized-text.jpeg) -The following screenshot shows the localization in SfRichTextBoxAdv and SfRichTextRibbon +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. -![Displaying Localized Text in WPF RichTextBoxAdv and RichTextRibbon](Localization_images/wpf-richtextbox-localized-text.jpeg) +## See Also -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. \ No newline at end of file +- [Getting Started in WPF RichTextBox](./Getting-Started) +- [Commands in WPF RichTextBox](./Commands) +- [Document Structure in WPF RichTextBox](./Document-Structure) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/MVVM.md b/Document-Processing/Word/Word-Processor/wpf/MVVM.md index d5eb481185..1a803e2820 100644 --- a/Document-Processing/Word/Word-Processor/wpf/MVVM.md +++ b/Document-Processing/Word/Word-Processor/wpf/MVVM.md @@ -4,15 +4,15 @@ description: Learn here all about MVVM support in Syncfusion WPF RichTextBox (Sf platform: document-processing control: SfRichTextBoxAdv documentation: ug -keywords: mvvm +keywords: mvvm,data-binding,dependency-property,two-way-binding,viewmodel --- # MVVM in WPF RichTextBox (SfRichTextBoxAdv) -The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) control can be used with Model-View-View Model (MVVM) pattern. This section will demonstrate how to use the SfRichTextBoxAdv control with MVVM pattern. +The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) control can be used with the Model-View-ViewModel (MVVM) pattern. This section demonstrates how to use the SfRichTextBoxAdv control with the MVVM pattern. For a complete working example, see the [WPF RichTextBox MVVM sample on GitHub](https://github.com/SyncfusionExamples/WPF-RichTextBox-Examples/tree/main/Samples/MVVM). ## Creating a View Model -The following code example demonstrates how to implement a view model class that contains properties to preserve the description about some of the animals and the animal that is selected for discussion. Whenever the animal chosen for discussion is changed, previously chosen animal description is updated to the database and newly chosen animal description is updated to the text property. +The following code example demonstrates how to implement a view model class that contains properties to hold a collection of animals, the currently selected animal, and the description for the selected animal. When the selected animal changes, the `Text` property is updated with the new animal's description; when `Text` changes (typed by the user), the in-memory description for the current animal is updated. {% tabs %} {% highlight c# %} /// @@ -32,7 +32,7 @@ public class ViewModel : INotifyPropertyChanged /// Gets or sets the animal. /// /// - /// The document title. + /// The animal. /// public string Animal { @@ -63,7 +63,7 @@ public class ViewModel : INotifyPropertyChanged /// Gets or sets the Text. /// /// - /// The document. + /// The text. /// public string Text { @@ -104,7 +104,7 @@ public class ViewModel : INotifyPropertyChanged animals.Add("Tiger", "The tiger is the largest cat species, reaching a total body length of up to 3.38 m over curves and exceptionally weighing up to 388.7 kg in the wild."); animals.Add("Lion", "The lion is one of the strongest animal. It is also known as the king of jungles."); animals.Add("Panda", "The giant panda, also known as panda bear or simply panda, is a bear native to south central China. It is easily recognized by the large, distinctive black patches around its eyes, over the ears, and across its round body."); - animals.Add("Beer", "Bears are mammals and are classified as dog like carnivorous."); + animals.Add("Bear", "Bears are mammals and are classified as dog like carnivorous."); animals.Add("Deer", "Deer are the ruminant mammals. Species in the family include the white-tailed deer, mule deer, elk, moose, red deer, reindeer, fallow deer, roe deer."); Animal = "Lion"; @@ -214,7 +214,7 @@ Public Class ViewModel m_animals.Add("Tiger", "The tiger is the largest cat species, reaching a total body length of up to 3.38 m over curves and exceptionally weighing up to 388.7 kg in the wild."); m_animals.Add("Lion", "The lion is one of the strongest animal. It is also known as the king of jungles."); m_animals.Add("Panda", "The giant panda, also known as panda bear or simply panda, is a bear native to south central China. It is easily recognized by the large, distinctive black patches around its eyes, over the ears, and across its round body."); - m_animals.Add("Beer", "Bears are mammals and are classified as dog like carnivorous."); + m_animals.Add("Bear", "Bears are mammals and are classified as dog like carnivorous."); m_animals.Add("Deer", "Deer are the ruminant mammals. Species in the family include the white-tailed deer, mule deer, elk, moose, red deer, reindeer, fallow deer, roe deer."); Animal = "Lion" @@ -243,7 +243,8 @@ End Class ## Implementing extension class for SfRichTextBoxAdv -The following code example demonstrates how to implement an extension class for SfRichTextBoxAdv with dependency property that supports two way binding. +`SfRichTextBoxAdv` does not expose a `Text` dependency property of its own, so a derived class is needed to add two-way binding support. The following code example demonstrates how to implement an extension class for SfRichTextBoxAdv with a dependency property that supports two-way binding. The extension listens to the control's [ContentChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_ContentChanged) event and re-reads the document as plain text whenever the user edits. + {% tabs %} {% highlight c# %} /// @@ -314,7 +315,7 @@ public class SfRichTextBoxAdvExtension : SfRichTextBoxAdv { if (this.Document != null) { - // To skip internal updation of document on setting Text property. + // To skip internal updating of the document when setting the Text property. skipUpdating = true; Stream stream = new MemoryStream(); // Saves the document's text into a Stream. @@ -337,7 +338,7 @@ public class SfRichTextBoxAdvExtension : SfRichTextBoxAdv /// private void UpdateDocument(string text) { - // If text property is set internally means, skip updating the document. + // If the Text property is being set internally, skip updating the document. if (!skipUpdating && !string.IsNullOrEmpty(text)) { Stream stream = new MemoryStream(); @@ -346,7 +347,7 @@ public class SfRichTextBoxAdvExtension : SfRichTextBoxAdv // Writes the byte array to stream. stream.Write(bytes, 0, bytes.Length); stream.Position = 0; - //Load the stream. + // Loads the stream. Load(stream, FormatType.Txt); } } @@ -389,14 +390,14 @@ Public Class SfRichTextBoxAdvExtension #End Region #Region "Constructor" -''' -''' Initializes the instance of SfRichTextBoxAdvExtension class. -''' -Public Sub New() - ' Wires the ContentChanged event. - AddHandler this.ContentChanged, AddressOf RicTextBoxAdv_ContentChanged -End Sub -#End Region + ''' + ''' Initializes the instance of SfRichTextBoxAdvExtension class. + ''' + Public Sub New() + ' Wires the ContentChanged event. + AddHandler Me.ContentChanged, AddressOf RicTextBoxAdv_ContentChanged + End Sub + #End Region #Region "Static Dependency Properties" ''' @@ -517,4 +518,10 @@ The following code example demonstrates how to create XAML view with SfRichTextB {% 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. \ No newline at end of file +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 + +- [Commands in WPF RichTextBox](./Commands) +- [Layout Types in WPF RichTextBox](./Layout-Types) +- [Document Structure in WPF RichTextBox](./Document-Structure) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/Mini-Toolbar.md b/Document-Processing/Word/Word-Processor/wpf/Mini-Toolbar.md index 216b2860fc..ee0ae03d30 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Mini-Toolbar.md +++ b/Document-Processing/Word/Word-Processor/wpf/Mini-Toolbar.md @@ -4,26 +4,30 @@ description: Learn here all about Mini Toolbar support in Syncfusion WPF RichTex platform: document-processing control: SfRichTextBoxAdv documentation: ug -keywords: mini-toolbar +keywords: mini-toolbar,context-menu,formatting,floating-toolbar --- # Mini Toolbar in WPF RichTextBox (SfRichTextBoxAdv) -The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports built-in mini toolbar to provide rich text formatting options such as Bold, Italic etc. The following screenshot shows built-in mini toolbar of SfRichTextBoxAdv control. -![WPF RichTextBox displays Mini Toolbar](Mini-Toolbar_images/wpf-richtextbox-mini-toolbar.jpeg) +The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports a built-in mini toolbar to provide rich text formatting options such as Bold, Italic, etc. The mini toolbar can be enabled or disabled through the [EnableMiniToolBar](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_EnableMiniToolBar) property. + +The following screenshot shows the built-in mini toolbar of the SfRichTextBoxAdv control. +![WPF RichTextBox showing the built-in mini toolbar with formatting options above a selected text range](Mini-Toolbar_images/wpf-richtextbox-mini-toolbar.jpeg) ## Enable/Disable Mini Toolbar -In SfRichTextBoxAdv, the built-in mini toolbar is enabled by default. It is possible to enable/disable the built-in mini toolbar. The following code example demonstrates how to disable the built-in mini toolbar in SfRichTextBoxAdv. +In SfRichTextBoxAdv, the built-in mini toolbar is enabled by default (the default value of [EnableMiniToolBar](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_EnableMiniToolBar) is `true`). You can enable or disable the built-in mini toolbar as needed. Set `EnableMiniToolBar` to `true` to explicitly enable it, or to `false` to disable it. + +The following code example demonstrates how to disable the built-in mini toolbar in the SfRichTextBoxAdv control. {% tabs %} {% highlight xaml %} - + {% endhighlight %} {% highlight c# %} // Initializes a new instance of RichTextBoxAdv. SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv(); -//Disables the built-in mini tool bar in SfRichTextBoxAdv. +// Disables the built-in mini toolbar in the SfRichTextBoxAdv. richTextBoxAdv.EnableMiniToolBar = false; {% endhighlight %} @@ -31,11 +35,17 @@ richTextBoxAdv.EnableMiniToolBar = false; ' Initializes a new instance of RichTextBoxAdv. Dim richTextBoxAdv As New SfRichTextBoxAdv() -'Disables the built-in mini tool bar in SfRichTextBoxAdv. +' Disables the built-in mini toolbar in the SfRichTextBoxAdv. richTextBoxAdv.EnableMiniToolBar = False {% 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. \ No newline at end of file +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 + +- [Getting Started in WPF RichTextBox](./Getting-Started) +- [Commands in WPF RichTextBox](./Commands) +- [Document Structure in WPF RichTextBox](./Document-Structure) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/Overview.md b/Document-Processing/Word/Word-Processor/wpf/Overview.md index c348b9d713..793a07c58d 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Overview.md +++ b/Document-Processing/Word/Word-Processor/wpf/Overview.md @@ -23,4 +23,6 @@ The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor * Enables [cut](./Clipboard), [copy](./Clipboard), and [paste](./Clipboard) operations, including rich text content via the clipboard. * Supports loading encrypted Word documents with valid password. -N> Currently, the SfRichTextBoxAdv cannot edit rich text in headers and footers. \ No newline at end of file +> **Limitation:** The SfRichTextBoxAdv cannot currently edit rich text in headers and footers. + +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. \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/Printing-Contents.md b/Document-Processing/Word/Word-Processor/wpf/Printing-Contents.md index e4de1e5cea..305b4266a6 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Printing-Contents.md +++ b/Document-Processing/Word/Word-Processor/wpf/Printing-Contents.md @@ -4,11 +4,14 @@ description: Learn here all about Printing Contents support in Syncfusion WPF Ri platform: document-processing control: SfRichTextBoxAdv documentation: ug -keywords: printing +keywords: printing,print-dialog,print-completed,print-comments --- # Printing Contents in WPF RichTextBox (SfRichTextBoxAdv) -The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports API to print the rich text content rendered as pages using the print dialog. +The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports an API to print the rich text content as pages using the print dialog through the [PrintDocument](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_PrintDocument) method. + +## Print + The following sample code demonstrates how to print the document content as pages. {% tabs %} {% highlight c# %} @@ -25,7 +28,9 @@ richTextBoxAdv.PrintDocument() {% endhighlight %} {% endtabs %} -The SfRichTextBoxAdv also supports event to notify whenever the printing operation is completed. The following code example demonstrates how to handle for the print completed event. +## PrintCompleted event + +The SfRichTextBoxAdv also supports the [PrintCompleted](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_PrintCompleted) event that is raised when the printing operation completes. The [PrintCompletedEventArgs](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.PrintCompletedEventArgs.html) provides information about the print operation. The following code example demonstrates how to handle the print completed event. {% tabs %} {% highlight c# %} // Hooks the print completed event. @@ -56,9 +61,9 @@ RemoveHandler richTextBoxAdv.PrintCompleted, AddressOf RichTextBoxAdv_PrintCompl {% endhighlight %} {% endtabs %} -## UI Command for printing +## UI command for printing -The following code example demonstrates how to bind UI Command to invoke printing in SfRichTextBoxAdv. +The following code example demonstrates how to bind the [PrintDocumentCommand](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_PrintDocumentCommand) UI command to invoke printing in SfRichTextBoxAdv. {% tabs %} {% highlight XAML %} @@ -69,9 +74,11 @@ The following code example demonstrates how to bind UI Command to invoke printin {% endtabs %} -In the SfRichTextBoxAdv control, comments will be shown by default on printing the document. You can hide the comments while printing by using the [PrintComments](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditorSettings.html#Syncfusion_Windows_Controls_RichTextBoxAdv_EditorSettings_PrintComments) property of [EditorSettings](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditorSettings.html) class. +## Hide comments when printing -The following code example illustrates how to hide the comments on printing the document. +In the SfRichTextBoxAdv control, comments are shown by default when printing the document (the default value of `PrintComments` is `true`). You can hide the comments while printing by setting the [PrintComments](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditorSettings.html#Syncfusion_Windows_Controls_RichTextBoxAdv_EditorSettings_PrintComments) property of the [EditorSettings](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditorSettings.html) class to `false`. + +The following code example illustrates how to hide the comments when printing the document. {% tabs %} {% highlight xaml %} @@ -96,4 +103,10 @@ richTextBoxAdv.EditorSettings.PrintComments = False N> In order to invoke printing, the standard keyboard shortcut CTRL + P can also be used. -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. \ No newline at end of file +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 + +- [Getting Started in WPF RichTextBox](./Getting-Started) +- [Commands in WPF RichTextBox](./Commands) +- [Document Structure in WPF RichTextBox](./Document-Structure) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/Selection.md b/Document-Processing/Word/Word-Processor/wpf/Selection.md index 9ba6e24362..1159619cf7 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Selection.md +++ b/Document-Processing/Word/Word-Processor/wpf/Selection.md @@ -4,12 +4,12 @@ description: Learn here all about Selection support in Syncfusion WPF RichTextBo platform: document-processing control: SfRichTextBoxAdv documentation: ug -keywords: selection +keywords: selection,cursor,selection-range,text-position,lost-focus,baseline-alignment --- # Selection in WPF RichTextBox (SfRichTextBoxAdv) -The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports selecting a portion of the document either through UI interactions by using mouse, touch, keyboard or through supported APIs. -The following sample code demonstrates how to retrieve text position from document using paragraph instance and offset value. +The [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) (SfRichTextBoxAdv) supports selecting a portion of the document through UI interactions (mouse, touch, keyboard) or through the [Selection](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_Selection) API. A [TextPosition](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.TextPosition.html) represents a position in the document as a paragraph instance plus an offset within that paragraph. +The following sample code demonstrates how to retrieve the text position from the document using a paragraph instance and an offset value. {% tabs %} {% highlight c# %} // Gets the first section of the document. @@ -31,8 +31,8 @@ Dim sectionAdv As SectionAdv = richTextBoxAdv.Document.Sections(0) {% highlight c# %} // Gets the first block from the section, which is a paragraph. ParagraphAdv paragraphAdv = sectionAdv.Blocks[0] as ParagraphAdv; -// Gets the text position of the specified paragraph at offset 24. -// TextPosition is returned as null, if no such paragraph or offset exists in the document. +// Gets the text position of the specified paragraph at offset 24. +// TextPosition is returned as null if no such paragraph or offset exists in the document. TextPosition startPosition = richTextBoxAdv.Document.GetTextPosition(paragraphAdv, 24); @@ -40,8 +40,8 @@ TextPosition startPosition = richTextBoxAdv.Document.GetTextPosition(paragraphAd {% highlight VB %} ' Gets the first block from the section, which is a paragraph. Dim paragraphAdv As ParagraphAdv = TryCast(sectionAdv.Blocks(0), ParagraphAdv) -' Gets the text position of the specified paragraph at offset 24. -' TextPosition is returned as null, if no such paragraph or offset exists in the document. +' Gets the text position of the specified paragraph at offset 24. +' TextPosition is returned as null if no such paragraph or offset exists in the document. Dim startPosition As TextPosition = richTextBoxAdv.Document.GetTextPosition(paragraphAdv, 24) @@ -71,21 +71,15 @@ Dim position As TextPosition = richTextBoxAdv.Document.GetTextPosition(paragraph {% endtabs %} -The following sample code demonstrates how to retrieve text position from document using hierarchical index. +The hierarchical index uses the following grammar depending on the block type: + +* **Paragraph** — Use the format `"section-index;block-index;offset-in-paragraph"`. Example: `"0;0;1"` returns the text position of the first paragraph of the first section at offset 1. +* **Table** — Use the format `"table-index;row-index;cell-index;block-index;offset-in-paragraph"`. Example: `"0;2;1;1;0;21"` returns the text position of the first block of the second cell of the second row of the table at the third block of the first section, at offset 21. +* **Comment** — Use the format `"paragraph-index;offset-in-paragraph;C;block-index;offset-in-paragraph"` where `C` indicates a comment. Example: `"0;3;16;C;2;6"` returns the text position of the third block of the comment that appears at offset 16 in the third paragraph of the first section, at offset 6. + +The following sample code demonstrates how to retrieve the text position from the document using the [GetTextPosition](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.DocumentAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_DocumentAdv_GetTextPosition_System_String_) method with a hierarchical index string. {% tabs %} {% highlight c# %} -/* -The hierarchical index should be given as "section-index;block-index;offset-in-paragraph" -If block in the index is paragraph, then next value is considered as offset and position is retrieved. -For example "0;0;1" gets text position of Paragraph (first block of first section) at the offset=1. -If block in the index is table, then next value is considered as row index and following value as cell index. -The value after cell is again a block index. Then the same process continues. -"table-index;row-index;cell-index;block-index;" -For example "0;2;1;1;0;21" gets text position of Paragraph at first block of second cell of second row of table (at third block of first section) at the offset=21. -If offset value is followed by "C" which stands for comment, then the comment is retrieved which is followed by block index in comment. Then the process of retrieving paragraph from block index continues. -paragraph-index;offset-in-paragraph;C;block-index;offset-in-paragraph -For example "0;3;16;C;2;6", gets text position of Paragraph at third block of comment (present at offset = 16 in paragraph at third block of first section) at the offset=6. -*/ // Gets the text position from the document based on hierarchical index. TextPosition position = richTextBoxAdv.Document.GetTextPosition("0;0;24"); /* Here text position returned should be first section's first block (which is paragraph) and offset=24. */ @@ -94,21 +88,9 @@ TextPosition position = richTextBoxAdv.Document.GetTextPosition("0;0;24"); {% endhighlight %} {% highlight VB %} ' -'The hierarchical index should be given as "section-index;block-index;offset-in-paragraph" -'If block in the index is paragraph, then next value is considered as offset and position is retrieved. -'For example "0;0;1" gets text position of Paragraph (first block of first section) at the offset=1. -'If block in the index is table, then next value is considered as row index and following value as cell index. -'The value after cell is again a block index. Then the same process continues. -'"table-index;row-index;cell-index;block-index;" -'For example "0;2;1;1;0;21" gets text position of Paragraph at first block of second cell of second row of table (at third block of first section) at the offset=21. -'If offset value is followed by "C" which stands for comment, then the comment is retrieved which is followed by block index in comment. Then the process of retrieving paragraph from block index continues. -'paragraph-index;offset-in-paragraph;C;block-index;offset-in-paragraph -'For example "0;3;16;C;2;6", gets text position of Paragraph at third block of comment (present at offset = 16 in paragraph at third block of first section) at the offset=6. -' - ' Gets the text position from the document based on hierarchical index. Dim position As TextPosition = richTextBoxAdv.Document.GetTextPosition("0;0;24") -' Here text position returned should be first section's first block (which is paragraph) and offset=24. +' Here text position returned should be first section's first block (which is paragraph) and offset=24. {% endhighlight %} @@ -176,7 +158,7 @@ N> You can select a text position within a comment with another text position wi ## Multi Selection -The SfRichTextBoxAdv also supports selecting different portions of the document at a time. The following code example demonstrates how to perform multi selection in SfRichTextBoxAdv. +The SfRichTextBoxAdv also supports selecting different portions of the document at a time. The following code example demonstrates how to perform multi selection in SfRichTextBoxAdv using the [SelectionRanges](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SelectionAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SelectionAdv_SelectionRanges) collection. {% tabs %} {% highlight c# %} // Retrieves the position of the first paragraph start. @@ -213,10 +195,14 @@ richTextBoxAdv.Selection.SelectionRanges.Add(startPosition2, endPosition2) ## Apply Formatting for selection -The SfRichTextBoxAdv supports the following format properties that can be applied for selection contents. +The SfRichTextBoxAdv supports the following format properties that can be applied to the selection content. Character Format-bold, italic, font size, font family, font color, highlight color, underline, strikethrough, subscript, and superscript. + Paragraph Format-before and after spacing, first line, left and right indenting, text justification, line spacing, and multilevel list. Selection Format-page size and page margin. + +### Subscript + The following sample code demonstrates how to apply subscript format for the selected content. {% tabs %} {% highlight c# %} @@ -233,6 +219,8 @@ richTextBoxAdv.Selection.CharacterFormat.BaselineAlignment = Syncfusion.Windows. {% endhighlight %} {% endtabs %} +### After spacing + The following sample code demonstrates how to apply after spacing for the selected paragraphs. {% tabs %} {% highlight c# %} @@ -250,6 +238,8 @@ richTextBoxAdv.Selection.ParagraphFormat.AfterSpacing = 24 {% endtabs %} +### Page margin + The following sample code demonstrates how to apply page margin for the selected sections. {% tabs %} {% highlight c# %} @@ -269,7 +259,10 @@ richTextBoxAdv.Selection.SectionFormat.PageMargin = New Thickness(96, 48, 96, 48 ## Binding Selection format properties -The SfRichTextBoxAdv provides support to bind the rich-text format options of selection content. +The SfRichTextBoxAdv supports binding the rich-text format options of the selection content. + +### Bold + The following code sample demonstrates how to bind the bold format option of SfRichTextBoxAdv. {% tabs %} {% highlight xaml %} @@ -302,7 +295,9 @@ toggleButton.SetBinding(ToggleButton.IsCheckedProperty, binding) {% endtabs %} -The following code sample demonstrates how to bind the bold format option of SfRichTextBoxAdv. +### Text alignment + +The following code sample demonstrates how to bind the text alignment option to a toggle button, using a converter. {% tabs %} {% highlight xaml %} @@ -344,17 +339,17 @@ The following keyboard shortcuts are supported by SfRichTextBoxAdv for navigatio The following keyboard shortcuts are supported by SfRichTextBoxAdv for selection.
Selection Shortcut
Description
CTRL + Right Arrow
Extends selection to one position forward.
CTRL + Left Arrow
Extends selection to one position backward.
CTRL + Down Arrow
Extends selection to the same position at next line.
CTRL + Up Arrow
Extends selection to the same position at previous line.
SHIFT + Home
Extends selection to start of the current line.
SHIFT + End
Extends selection to end of the current line.
CTRL + SHIFT + Home
Extends selection to the document start position.
CTRL + SHIFT + End
Extends selection to the document end position.
CTRL + SHIFT + Right
Extends selection to the current word end position.
CTRL + SHIFT + Left
Extends selection to the current word start position.
CTRL + SHIFT + Down
Extends selection to the current paragraph end position.
CTRL + SHIFT + Up
Extends selection to the current paragraph start position.
CTRL + A
Selects the entire document.
-## How to show blinking cursor and selection highlight even when the control lost focus +## Showing the caret and selection when the control loses focus -The SfRichTextBoxAdv control allows you to show the blinking cursor and selection highlight even when the control doesn't have focus. You can choose any one of the following selection visibility options: +The SfRichTextBoxAdv control allows you to show the blinking cursor and selection highlight even when the control does not have focus. You can choose any one of the following selection visibility options: -* **None** - Don't display neither caret nor selection highlight when the RichTextBox control doesn't have focus. +* **None** - Don't display neither caret nor selection highlight when the RichTextBox control does not have focus. -* **ShowCaret** - Displays the caret (blinking cursor) when the RichTextBox control doesn't have focus. +* **ShowCaret** - Displays the caret (blinking cursor) when the RichTextBox control does not have focus. -* **ShowSelection** - Displays the selection highlight when the RichTextBox control doesn't have focus. +* **ShowSelection** - Displays the selection highlight when the RichTextBox control does not have focus. -The following code example demonstrates how to display the selection highlight even when the RichTextBox control doesn't have focus. +The following code example demonstrates how to display the selection highlight even when the RichTextBox control does not have focus. {% tabs %} {% highlight xaml %} @@ -365,7 +360,7 @@ The following code example demonstrates how to display the selection highlight e {% highlight c# %} // Initializes a new instance of RichTextBoxAdv. SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv(); -// Displays the selection highlight when the RichTextBox control doesn't have focus. +// Displays the selection highlight when the RichTextBox control does not have focus. richTextBoxAdv.LostFocusBehavior = LostFocusBehavior.ShowSelection; @@ -374,7 +369,7 @@ richTextBoxAdv.LostFocusBehavior = LostFocusBehavior.ShowSelection; ' Initializes a new instance of RichTextBoxAdv. Dim richTextBoxAdv As New SfRichTextBoxAdv() -' Displays the selection highlight when the RichTextBox control doesn't have focus. +' Displays the selection highlight when the RichTextBox control does not have focus. richTextBoxAdv.LostFocusBehavior = LostFocusBehavior.ShowSelection @@ -384,9 +379,9 @@ richTextBoxAdv.LostFocusBehavior = LostFocusBehavior.ShowSelection N> This API is supported starting from release version v17.4.0.X. -## How to determine the editing context type +## Determining the editing context type -The SfRichTextBoxAdv control allows you to know the editing context type based on the selected content. The following are the editing context types: +The SfRichTextBoxAdv control allows you to know the editing context type based on the selected content through the [EditingContext](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SelectionAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SelectionAdv_EditingContext) and its [Type](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditingContext.html#Syncfusion_Windows_Controls_RichTextBoxAdv_EditingContext_Type) property of [EditingContextType](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.EditingContextType.html). The following are the editing context types: * **Text** - Denotes that the editing context is text @@ -401,8 +396,8 @@ The following code example demonstrates how to determine the editing context typ // Initializes a new instance of RichTextBoxAdv. SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv(); if (richTextBoxAdv.Selection.EditingContext.Type == EditingContextType.Text) - { - } +{ +} {% endhighlight %} @@ -417,11 +412,11 @@ End If {% endtabs %} -## How to delete the selected content - +## Deleting the selected content + The SfRichTextBoxAdv supports deleting the selected portion of the document either through UI command, keyboard or through supported APIs. -The following code sample demonstrates how to delete the selected portion of the document using the DeleteKeyCommand. +The following code sample demonstrates how to delete the selected portion of the document using the [DeleteKeyCommand](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SfRichTextBoxAdv_DeleteKeyCommand). {% tabs %} {% highlight Xaml %} @@ -431,7 +426,7 @@ The following code sample demonstrates how to delete the selected portion of the {% endtabs %} -The following code sample demonstrates how to delete the selected portion of the document using the Delete method. This method is valid only when the selection is non-empty, and it returns true if the selected content is deleted. Otherwise false. +The following code sample demonstrates how to delete the selected portion of the document using the [Delete](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SelectionAdv.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SelectionAdv_Delete) method. This method is valid only when the selection is non-empty, and it returns true if the selected content is deleted. Otherwise false. {% tabs %} {% highlight c# %} @@ -447,4 +442,10 @@ Dim isDeleted As Boolean = richTextBoxAdv.Selection.Delete() {% endtabs %} N> This API is supported starting from release version v18.2.0.X. -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. \ No newline at end of file +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 + +- [Commands in WPF RichTextBox](./Commands) +- [Document Structure in WPF RichTextBox](./Document-Structure) +- [Document Properties in WPF RichTextBox](./Document-Properties) \ No newline at end of file diff --git a/Document-Processing/Word/Word-Processor/wpf/Shapes.md b/Document-Processing/Word/Word-Processor/wpf/Shapes.md index 54647ede8b..1559a4411d 100644 --- a/Document-Processing/Word/Word-Processor/wpf/Shapes.md +++ b/Document-Processing/Word/Word-Processor/wpf/Shapes.md @@ -7,34 +7,45 @@ documentation: ug keywords: shapes, text-box --- # Shapes in WPF RichTextBox (SfRichTextBoxAdv) -Shapes are drawing objects that include a text box, rectangles, lines, curves, circles, etc. It can be preset or custom geometry. At present, [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) does not have support to insert shapes. however, if the document contains a shape while importing, it will be preserved properly. - -N> Starting from v18.3.0.x, the shape preservation is supported. +Shapes are drawing objects that include a text box, rectangles, lines, curves, circles, etc. They can be preset or custom geometry. Currently, [WPF RichTextBox](https://www.syncfusion.com/docx-editor-sdk/wpf-docx-editor) does not support inserting shapes. However, if the document contains a shape while importing, it is preserved properly. ## Supported shapes -The RichTextBox has preservation support for Text box and Rectangle shapes. +The RichTextBox has preservation support for the following shapes: + +* Text box +* Rectangle ![List of supported shapes in RichTextBox](Shapes_images/Supported_Shapes.PNG) ## Text box Shape -A text box is a rectangular area on the document where you can enter text. When you click in a text box, a flashing cursor will display indicating that you can begin typing. It allows you to enter multiple lines of text with all text formatting. +A text box is a rectangular area on the document where you can enter text. When you click in a text box, a flashing cursor is displayed, indicating that you can begin typing. It allows you to enter multiple lines of text with rich text formatting. ![Text box shape view in RichTextBox](Shapes_images/TextBox_Shape.PNG) ## Shape Resizer -The RichTextBox also supports a built-in shape resizer to resize the shapes present in the document. The shape resizer accepts both touch and mouse interactions. +The RichTextBox also supports a built-in shape resizer to resize the shapes present in the document. The shape resizer supports both touch and mouse interactions. ![Shape resizer view in RichTextBox](Shapes_images/Shape_Resizer.PNG) ## Text wrapping style -Text wrapping refers to how shapes fit with surrounding text in a document. Please [refer to this page](/wpf/richtextbox/text-wrapping-style) for more information about text wrapping styles available in Word documents. +Text wrapping refers to how shapes fit with surrounding text in a document. Please [refer to this page](./Text-Wrapping-Style) for more information about text wrapping styles available in Word documents. ## Positioning the shape -Starting from v19.1.0.x, RichTextBox preserves the position properties of the shape and displays the shape based on position properties. It does not support modifying the position properties. Whereas the shape will be automatically moved along with text edited if it is positioned relative to the line or paragraph. +RichTextBox preserves the position properties of the shape and displays the shape based on position properties. It does not support modifying the position properties. If the shape is positioned relative to a line or paragraph, it moves automatically as text is edited. + +> **Limitation:** Currently, the shape with text wrapping style `In-Line with Text` can only be dragged and dropped anywhere in the document. + +> **Version notes:** +> - Shape preservation is supported starting from v18.3.0.x. +> - The position properties are preserved starting from v19.1.0.x. + +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. -N> At present, the shape with text wrapping style `In-Line with Text` can only be dragged and dropped anywhere in the document. +## See Also -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. +- [Text Wrapping Style in WPF RichTextBox](./Text-Wrapping-Style) +- [Document Structure in WPF RichTextBox](./Document-Structure) +- [Commands in WPF RichTextBox](./Commands)