Current filter:
                                You should refresh the page.
                                  • [CLONED FROM [https://community.devexpress.com/blogs/eaf/archive/2018/08/03/xaf-enhanced-office-module-updated-learning-materials-and-more-v18-1-5.aspx]](CLONED FROM [https://community.devexpress.com/blogs/eaf/archive/2018/08/03/xaf-enhanced-office-module-updated-learning-materials-and-more-v18-1-5.aspx])
                                    I'm doing some testing with the RichTextPropertyEditor and have questions about Styles:
                                    (1) Are the styles stored in each individual document (using DOCX format)?
                                    (2) If so, will it ever be possible to have a global format (like the normal template in Word) so that styles can be made standard over multiple documents -- preferably the entire database?
                                    (3) Can the list of styles be extended through the UI?
                                    Thanks...

                                • Andrey K (DevExpress Support) 10.09.2018

                                  Hello,

                                  XAF uses the RichEditControl component as an integrated part of our Office Module and doesn't provide a specific mechanism for this scenario. As the behavior you asked for is related directly to the RichEditControl engine, I am forwarding your ticket to our RichEditControl team for a follow-up. They are able to provide you with the most suitable answer on how to achieve the required results. Please await a final response on your inquiry from them.
                                  As far as XAF is concerned, you can access a RichEditControl's instance within an XAF view as described at Access the RichEditControl. Let me know if you experience any further difficulties with the XAF integration.

                                  Thanks,
                                  Andrey

                                1 Solution

                                Creation Date Importance Sort by

                                Hi David,

                                You are correct. These styles are stored in the document model and saved along with other document content.

                                Attaching document templates is not currently supported in RichEditControl. While we have no immediate plans to implement this functionality, we may do so in the future. However, I cannot provide you with any promises or estimates at present.

                                As for adding new styles, you can extend the style list only in code. Please review the following help topic that describes how to operate with styles:
                                Document Styles

                                Show all comments
                                • David Shannon 10.09.2018

                                  Thanks, Ingvar,

                                  As an alternative, is it possible to set the base font programmatically when the document loads from the database and then lock down the font changing menu items (font name, size, font increase, font decrease)?  That would leave us with a fairly standard look but allow a full complement of annotations (bold, italic, color, etc.)  I basically want to prevent our analysis data from filling up with 22 pt Comic Sans.

                                • Ingvar (DevExpress Support) 10.10.2018

                                  Hi David,

                                  You can handle the RichEditControl.DocumentLoaded event and customize formatting using the approach described here:
                                  Text Formatting

                                  As for disabling certain operations, review the following topic:
                                  Restrictions and Protection

                                  Take special note of the "Restrict Using Document Elements" sub-topic.

                                • David Shannon 10.10.2018

                                  Hi Ingvar,

                                  Thanks for the pointers.  I've looked into your suggestions but have run across a problem.  I don't want to turn off all character formatting, I just want to do two things:

                                  (1) forbid the use of styles.  I have turned off DocumentCapabilities.CharacterStyle, ParagraphStyle, and TableStyle but the Style picker on the menu still appears.  Any suggestion on how to get rid of it?

                                  (2) disallow only changing the font name and font size (including Increase and Decrease font).  Apparently for this granularity I need to access RichEditControl.Options.DocumentCapabilities.CharacterFormattingDetailed, but I can't reach it in code. Any suggestions?

                                  Thanks...

                                • David Shannon 10.10.2018

                                  Update -- my message wasn't clear.  I can get to CharacterFormattingDetailed using reflection, but changes I make to FontName and FontSize don't seem to have any effect on the interface.  I can still change FontNameand FontSize in the editor.

                                • David Shannon 10.10.2018

                                  Additional Update: I found what may be a bug, or at least a UI inconsistency.

                                  Setting CharacterFormattingDetailed.FontName and .FontSize to DocumentCapability.Disabled does disable changes to FontName and FontSize, but only when doing so through the context menu. (That is, those two setting are grayed-out in the font-setting dialog that pops up.)

                                  However, the same two settings in the ribbon are not grayed-out and function the same as if the CharacterFormattingDetailed options had not been changed.  Perhaps the ribbon is not checking the CharacterFormattingDetailed options?

                                • Ingvar (DevExpress Support) 10.11.2018

                                  Hi David,

                                  The CharacterFormattingDetailed option set is for internal purposes only and intended for customizing items in the Font dialog. This option set does not affect in-Ribbon elements, which are controlled by CharacterFormatting.

                                  In this case, you can create custom command descendants to make these commands always disabled. See the following help topic to learn more about using custom commands:
                                  How to: Customize Built-in Command Using Service Substitution

                                  Here is a small example of using this approach:

                                  [C#]
                                  using DevExpress.ExpressApp; using DevExpress.ExpressApp.Office.Win; using DevExpress.Utils.Commands; using DevExpress.XtraRichEdit; using DevExpress.XtraRichEdit.Commands; using DevExpress.XtraRichEdit.Services; public class CustomRichTextServiceController : ViewController { protected override void OnActivated() { base.OnActivated(); RichTextServiceController controller = Frame.GetController<RichTextServiceController>(); if(controller != null) { controller.CustomizeRichEditControl += Controller_CustomizeRichEditControl; } } private void Controller_CustomizeRichEditControl(object sender, CustomizeRichEditEventArgs e) { IRichEditCommandFactoryService richEditCommandFactoryService = e.RichEditControl.GetService<IRichEditCommandFactoryService>(); MyICommandUIStateManagerService myService = new MyICommandUIStateManagerService(e.RichEditControl, richEditCommandFactoryService); e.RichEditControl.ReplaceService<IRichEditCommandFactoryService>(myService); } } public class MyICommandUIStateManagerService : IRichEditCommandFactoryService { private RichEditControl control; private IRichEditCommandFactoryService service; public MyICommandUIStateManagerService(RichEditControl control, IRichEditCommandFactoryService service) { this.control = control; this.service = service; } public RichEditCommand CreateCommand(RichEditCommandId id) { RichEditCommand richEditCommand; if(id == RichEditCommandId.ChangeFontName) { richEditCommand = new DisableChangeFontNameCommand(control); } else { richEditCommand = service.CreateCommand(id); } return richEditCommand; } } public class DisableChangeFontNameCommand : ChangeFontNameCommand { public DisableChangeFontNameCommand(DevExpress.XtraRichEdit.IRichEditControl control) : base(control) { } public override void UpdateUIState(ICommandUIState state) { state.Enabled = false; state.Visible = false; } }