Saving and opening
Klaus Major
klaus at major-k.de
Mon Mar 29 12:49:07 EST 2004
Hi Michael,
> I am building a word program.how do I put a save and open function in
> it?
> Please help
in what format would you like to save?
To preserve formatting i would recommend HTML or RTF...
OK, you have a field 1 and you want to save its contents to a file on
disk:
...
ask file "Your promt here :-)..."
if the result <> "cancel" then
## 1. save as HTML
put the htmltext of fld 1 into url("file:" & it & ".html")
## or 2. save as RTF
## put the rtftext of fld 1 into url("file:" & it & ".rtf")
end if
...
To get a file into your field do this:
answer file "Select a file or *#&&0%..." with filter "*.html"
## WINDOWS ONLY, will only show files with that suffix
## or use: with filter "*rtf"
## will only show RTF-files...
if the result <> "cancel" then
## 1. open HTML
set the htmltext of fld 1 to url("file:" & it)
## or 2. open RTF
## set the rtftext of fld 1 to url("file:" & it)
end if
Hope that helps...
>> From Michael Miner
Regards
Klaus Major
klaus at major-k.de
www.major-k.de
More information about the use-livecode
mailing list