save RTF in file

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
WXT
Posts: 3
Joined: Thu Oct 29, 2015 12:23 am

save RTF in file

Post by WXT » Thu Oct 29, 2015 12:32 am

Good day all,
I trying to save RTF in pc file but I cn save my RTF header name but all the time when I open it it empty inside
code

global gEditorField
on preopencard
put "status" into field "statusField"
end preOpenCard

on openCard
put the RTFText of field "editorField" into gEditorField
end openCard

on buttonPushedBack
uploadEditField
end buttonPushedBack

on uploadEditField
if the rtftext of field "editorfield" is gEditorField then
go to card "report"
exit uploadEditField
end if
put field "namefield" into tname
if tname is not in field "listfield" of card"report" then
put "üploading" into field "statusfield"of card "edit report"
put the rtftext of field "editorField"into URL ("file:C:\Users\Live code\Desktop\BPV\report\"& tname & ".rtf")
put cr & tname after field "listfield" of card "report"
put field "listfield" of card "report" into URL ("file:C:\Users\Live code\Desktop\BPV\report\list.txt")
else
put "uploading" into field "statusfield" of card "edit report"
put the rtftext of field "editorField" into url ("file:C:\Users\Live code\Desktop\BPV\report\" & tname & ".rtf")
answer "upload complate"
end if
go to card "report"
end uploadEditField

why it don't save what I write inside the field
thanx
Attachments
Capture-2.PNG
here in the field its empty
Capture-1.PNG
list of file and it show all what I creat

Klaus
Posts: 12285
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: save RTF in file

Post by Klaus » Thu Oct 29, 2015 2:28 pm

Hi WXT,

1. welcome to the forum! :D

2. Looks like you discovered a bug!
I also checked this and you are correct, there is a lot of text missing in the resulting file!

I created a bug report:
http://quality.runrev.com/show_bug.cgi?id=16308

EDIT: It just has been confirmed as a bug!


Best

Klaus

WXT
Posts: 3
Joined: Thu Oct 29, 2015 12:23 am

Re: save RTF in file

Post by WXT » Thu Oct 29, 2015 8:36 pm

thanx for replaying glad to help by accident :)
------
so any help to make it work ?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5598
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: save RTF in file

Post by richmond62 » Thu Oct 29, 2015 9:10 pm

I think you are making things very complicated.

Here is a stack that took me 5 minutes.
RTFX.png
RTFX.png (8.05 KiB) Viewed 1014 times
with this script in the button "Export to RTF":

on mouseUp
set the useUnicode to true
ask file "Choose where you wish to export your text"
if the result = "cancel"
then exit mouseUp
else
put the RTFtext of fld "fff" into url("file:" & it & ".rtf")
get the longFilePath of it
set the itemDelimiter to slash
set the defaultFolder to item 1 to -2 of the longFilePath of it
end if
end mouseUp

I have attached the stack so you can play with it.
Attachments
RTFX.zip
Here is the stack
(850 Bytes) Downloaded 73 times

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”