Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.
The DefaultFileName property specifies a file name that will be used when saving a newly created document. The DXRichEditDocumentSaveOptions.DefaultFormat property specifies a format for saving a newly created document. The file extension for the specified file format is added automatically.
To specify a name that is suggested in the SaveAs file dialog invoked via the SaveDocumentAsCommand command, use a Custom SaveAs Command technique illustrated in the following code snippet. The “C:\Temp\SavedDocument.rtf” name is the default file name specified for the Save As dialog.
PublicClass CustomRichEditCommandFactoryService
Implements IRichEditCommandFactoryService
PrivateReadOnly service As IRichEditCommandFactoryService
PrivateReadOnly control As RichEditControl
PublicSubNew(ByVal control As RichEditControl, ByVal service As IRichEditCommandFactoryService)
DevExpress.Utils.Guard.ArgumentNotNull(control, "control")
DevExpress.Utils.Guard.ArgumentNotNull(service, "service")
Me.control = control
Me.service = service
EndSubPublicFunction CreateCommand(ByVal id As RichEditCommandId) As RichEditCommand Implements IRichEditCommandFactoryService.CreateCommand
If id = RichEditCommandId.FileSaveAs ThenReturnNew CustomSaveDocumentAsCommand(control)
EndIfReturn service.CreateCommand(id)
EndFunctionEndClassPublicClass CustomSaveDocumentAsCommand
Inherits SaveDocumentAsCommand
PublicSubNew(ByVal control As IRichEditControl)
MyBase.New(control)
EndSubProtectedOverridesSub ExecuteCore()
Dim dialog As SaveFileDialog = New SaveFileDialog With {.Filter = "Rich Text Format Files (*.rtf)|*.rtf|All Files (*.*)|*.*", .FileName = "SavedDocument.rtf", .RestoreDirectory = True, .CheckFileExists = False, .CheckPathExists = True, .OverwritePrompt = True, .DereferenceLinks = True, .ValidateNames = True, .AddExtension = False, .FilterIndex = 1}
dialog.InitialDirectory = "C:\Temp"If dialog.ShowDialog() = DialogResult.OK ThenCType(Me.Control, RichEditControl).SaveDocument(dialog.FileName, DocumentFormat.Rtf)
EndIf'base.ExecuteCore();EndSubEndClass