Solved

project's question...

Posted on 1998-02-17
6
126 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now