We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Help Needed on some requirements

Hi,
We are currently using SfRichTextBoxAdv control. We need help to achieve the following:
1. Removing the shortcuts for opening, save, save as, etc. other than text editing shortcuts like bold, italic, underline, etc.
2. Showing only three font families rather than showing all while editing text.
3. Adding options like insert table, insert image in the context menu rather than using ribbon control?


Thanks in advance.

7 Replies

PS Premkumar Sundaramoorthy Syncfusion Team October 11, 2019 04:40 AM

Hi Sudip, 
  
  
We have achieved all your requirements and prepared sample for the same. It can be downloaded from the following location. 
 
Please let us know if you need any further assistance. 
  
  
Regards, 
Premkumar 



SU Sudip October 14, 2019 06:00 AM

Hello,
Thanks for your support. It will really help us.
I have one more query
1. How to set the default line spacing to 0.5?


SU Sudip October 14, 2019 08:51 AM

Hello,
Thanks for your cooperation. We have multiple instances of this control throughout my application. After implementing your solution we found that duplicate context menu is added in different instances.
Please let us know what technique we should follow to solve this problem.


PS Premkumar Sundaramoorthy Syncfusion Team October 15, 2019 02:31 AM

Hi Sudip, 
  
 
 
Regrading set the default line spacing to 0.5 
 
You can set the default line spacing to the control by changing the document paragraph property. Please refer the below code example. 
 
richTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
 
But as per the micro soft word standard the minimum value of Linespacing should be greater then equal to 0.9px. So, we couldn’t set this value 0.5, if you force set than it leads to text clipping issue. 
  
  
 
 
Regarding duplicate context menu is added in different instances 
 
We were able to reproduce reported issue. We will validate and get back to you with further details on October 17th, 2019. 
 
  
  
  
 
Regards, 
Premkumar


SU Sudip October 15, 2019 05:38 AM

Thanks for your solution.
Your provided code for line spacing is working when the editor does not have predefined text. 
If the editor has some predefined text, in spite of putting your provided line spacing code, the editor is taking more line spacing 



PS Premkumar Sundaramoorthy Syncfusion Team October 16, 2019 06:47 AM

Hi Sudip, 
If you want to apply the default line spacing for loaded document and new document, please set the value in both the control Loaded event and Document changed event. Please refer the below code sample. 
 
//Hook the control loaded event 
sfRichTextBox.Loaded += SfRichTextBox_Loaded; 
//Hook the document changed event 
sfRichTextBox.DocumentChanged += SfRichTextBox_DocumentChanged; 
//Occurs when the element is laid out, rendered, and ready for interaction. 
private void SfRichTextBox_Loaded(object sender, RoutedEventArgs e) 
{ 
sfRichTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
} 
 
//Occurs when the document is changed in this control 
private void SfRichTextBox_DocumentChanged(object obj,DocumentChangedEventArgs args) 
{ 
//Sets the line height as exactly 0.9 pixels within the document default paragraph format. 
sfRichTextBox.Document.ParagraphFormat.LineSpacing = 0.9; 
} 
 
 
Note:  For loaded document, default format is applied only if the Linespacing property of paragraph format is not defined. If it is defined in that loaded document, then control use that value. 
For your information: Linespacing behaviour in RichTextBox 
 
Here the line spacing is work more like line height.  
 
Linespacing type 
behaviour 
LineSpacingType.AtLeast 
(Minimum Line Height) 
 
 
 
Specifies that the height of the line shall be at least the 
value specified, but might be expanded to fit its 
content as needed. 
LineSpacingType.Exactly 
(Exact Line Height) 
 
 
 
 
 
Specifies that the height of the line shall be exactly the 
value specified, regardless of the size of the contents 
of the contents. 
 
If the contents are too large for the specified height, 
then they shall be clipped as necessary. 
LineSpacingType.Multiple 
 
 
This will multiple the line height with line spacing value. 
 
For example, consider  
Type = Multiple 
Line height = 10 
Line spacing = 2 
 
Than the actual space added between two line is 10 * 2 = 20. 
So, if you want to set small value. set line space like 1 or 0.9 
 




Regards, 
Premkumar


PS Premkumar Sundaramoorthy Syncfusion Team October 17, 2019 05:57 AM

Hi Sudip, 
  
Thank you for your patience,  
 
We have resolved the issue duplicate context menu is added in different instances. Please find the modified sample from the below location.  
 
 
Please let us know if you need any further assistance. 
  
Regards, 
Premkumar 


Loader.
Live Chat Icon For mobile
Up arrow icon