Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

ASPxRichEdit - How to implement the Format Painter functionality

$
0
0

Currently, ASPxRichEdit doesn't provide the Format Painter feature out of the box. This example illustrates a possible solution to implement this functionality in a custom way by using custom ribbon buttons and the ASPxRichEdit's client-side API.

For this purpose, handle the editor's client-side CustomCommandExecuted event to check if a custom ribbon item is clicked, and get the font and paragraph formatting applied to the currently selected content via the changeFontFormatting.getState()changeParagraphFormatting.getState() commands.
To achieve the behavior similar to that the MS Word Format Painter's provides, the ASPxRichEdit selection is changed programmatically to select only the selected text's first symbol before calling corresponding commands in order to get its formatting as the formatting of the selected interval. After retrieving formatting information for this symbol, the control's selection is restored to its original state.
After that, the saved formatting can be applied to the new selected content on a ribbon item click via the changeFontFormatting and changeParagraphFormatting commands.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>