Page loading

Share your opinion
What do you think about gambaslinux.fr?
 
Interesting
It miss some informations
Excellent website
Results
WIDGETS GAMBAS
GAMBAS 3 SOFTWARES
TUTORIALS
Library
Use File - RTF files

OPEN,EDIT,SAVE RTF FILE

 


 

rtffile.png
 
hye,
Today, we will modfy a rtf file, the microsoft text format file.
We replace a string "aaaaaa" inside the file by your name.
For this example we 'll make a application:

1)Open the sample file in the application path and copy all the file in the textarea with this code :

PUBLIC SUB bopen_Click()
Dialog.Filter = ["*.rtf", "Fichiers RTF", ".RTF", "Fichiers RTF"]
Dialog.Title = "Ouvrir unfichier"
Dialog.Path = Application.Path
IF Dialog.OpenFile() THEN RETURN
TextArea1.Text = File.Load(Dialog.Path)
END


2) Write your name in the textbox and clic edit text will replace the "aaaaaa" strin in the textarea with this code :

PUBLIC SUB bedit_Click()
TextArea1.Text = Replace$(TextArea1.Text, "aaaaaa", TextBox1.Text)
END




3) The new file named mynewfile.rtf will be saved in the application path with this code :

PUBLIC SUB bsave_Click()
DIM fichier2 AS File
fichier2 = OPEN Application.Path & "/mynewfile.rtf" FOR CREATE 
PRINT #fichier2, TextArea1.Text
CLOSE #fichier2
Message.Info("Allez dans le repertoire de l'application, un nouveau fichier mynewfile.rtf est créé, le texte est remplacé. CQFD")
Message.Info("Explore the application path directory. a new file mynewfile.rtf is created.The text is replaced.Yeah!")
END


Now, explore the application path and  open the new file with ooo. the string is replaced. That's right !
thanks for your attention
Have a good day
 


Creation date : 30/12/2011 @ 11:30
Last update : 30/12/2011 @ 11:32
Category : Use File
Page read 4445 times


Print the article Print the article


react.gifReactions to this article

Nobody gave a comment yet.
Be the first one to do it!


QUICK MENU
SEARCH




LANGUAGE
COMPONENTS
Other
LANGUAGE
Where, who?
VISITS

   visitors

   visitors online

ARCHIVES GAMBAS 1/2
^ Top ^