Solved

project's question...

Posted on 1998-02-17
6
128 Views
Last Modified: 2010-04-04
how to save a file  like .txt and
then let the user save as another format from the
  save file dialog such as .rtf, (all files)..etc?
  thus if i first save as .txt extension like jack.txt
 and then i save the same file as jack.rtf..the
  content of the 2 files will be the same and
  now i have jack.txt and jack.rtf... i am doing this feature
for my project..it looks like a bug to me..i can't save
a file .txt again as .rtf...:(
0
Comment
Question by:cooldude77
  • 3
  • 3
6 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1359441
Again,

Do you want this:

1 - You have a text in TRichEdit.
2 - When user selects .txt from savedialog you want to save it as text and put extention '.txt' to the end of filename.
3 - When user selects .rtf from savedialog you want to save it as REAL, ACTUAL rich text format and put extention '.rtf' to the end of filename.

Make clear these out please,
I am sure the problem is simple but we can not apprehend
Igor
0
 

Author Comment

by:cooldude77
ID: 1359442
yeah..u got my point..
if the user has a text file , he can also save it
as rich edit format..but the filename renames the same..
like jack.txt, jack.rtf
0
 
LVL 5

Accepted Solution

by:
inter earned 50 total points
ID: 1359443
Ok,

If you use Delphi 2.0+

1 - Put TRichEdit instead of TMemo in your MdiClient windows. OK?
2 - When the file extention is '.txt' (I am sure you now this now) save it as following (assume Trichedit instance is Editor)

...
  Editor.PlainText := True;
  Editor.SaveToFile('test.txt');
...
3 - When the file extention is '.rtf'  save it as following (assume Trichedit instance is Editor)

...
  Editor.PlainText := False;
  Editor.SaveToFile('test.rtf');
...

Bye!
Igor
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:cooldude77
ID: 1359444
i am using white memo now..
i cannot use richtext..it's part of the project requirement..

0
 
LVL 5

Expert Comment

by:inter
ID: 1359445
That bad news friend?

I wonder, who require you to do such a thing with TMemo? However it can be done for VERY plain text files manually. I once do it, but not that easy. Do you know file operations (opening streams, writing in them, formatting text?)? If not, I am sorry you'd better force the guy gives the project to use rich edit.

Comment Please
Igor
0
 

Author Comment

by:cooldude77
ID: 1359446
there is no way to do it?
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question