Hi,
I have a need to save and open as rtf only file with different file extension, I'm using richviewaction
Any idea on how do that, or remove all types except rtf with different file extension .
I tried custom filter , saved ok, but I can't open it because doesn't know the format to open with.
Thanks
Save rtf with different ext
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Save rtf with different ext
RichViewActions do not allow changing a file extension and a filter string for RTF (only for RVF and XML).
So using a custom format is the only option.
Property settings:
rvActionOpen1.Filter = [ffiCustom]
rvActionOpen1.CustomFilter = 'My Files|*.my'
rvActionSaveAs1.Filter = [ffeCustom]
rvActionSaveAs1.CustomFilter = 'My Files|*.my'
rvActionSave1.LostFormatWarning = []
RVAControlPanel1.DefaultExt = 'my'
RVAControlPanel1.DefaultFileFormat = ffeCustom
RVAControlPanel1.DefaultFileName = 'Untitled.my'
The code in RVAControlPanel1.OnCustomFileOperation event:
So using a custom format is the only option.
Property settings:
rvActionOpen1.Filter = [ffiCustom]
rvActionOpen1.CustomFilter = 'My Files|*.my'
rvActionSaveAs1.Filter = [ffeCustom]
rvActionSaveAs1.CustomFilter = 'My Files|*.my'
rvActionSave1.LostFormatWarning = []
RVAControlPanel1.DefaultExt = 'my'
RVAControlPanel1.DefaultFileFormat = ffeCustom
RVAControlPanel1.DefaultFileName = 'Untitled.my'
The code in RVAControlPanel1.OnCustomFileOperation event:
Code: Select all
procedure TForm3.RVAControlPanel1CustomFileOperation(Sender: TrvAction;
Edit: TCustomRichViewEdit; const FileName: TRVUnicodeString;
Operation: TRVAFileOperation; var SaveFormat: TrvFileSaveFilter;
var CustomFilterIndex: Integer; var Success: Boolean);
begin
case Operation of
rvafoOpen:
// This example assumes that there is only one custom open format,
// so it does not check CustomFilterIndex (it must be 1)
Success := Edit.LoadRTF(FileName);
rvafoSave:
// This example assumes that there is only one custom save format,
// so it does not check CustomFilterIndex (it must be 1)
Success := Edit.SaveRTF(FileName, False);
end;
end;
Re: Save rtf with different ext
As always, you are the best, thank you so much that worked the way I needed
Thanks again for your superb support and tools
Thanks again for your superb support and tools