|
-
Sep 1st, 2000, 09:00 PM
#1
I posted an article earlier on saving a cgi script using richtextbox it loses all of its formatting because CGI doesnt use the vbcrlf formatting instead it uses only a linefeed if Im correct..Displayed as a /n in cgi. If im wrong correct me on this..But anyways I want to be able to save a cgi script using richtextbox in its native format without losing any formatting and open it again so it keeps its format. Right now when I save I lose all linefeeds and all the text is on one line..Can someone please help me with this?
It seems when it opens back up the text doesnt even contain vblf or vbcr at all..So I cant really get it back to its original format and the the script is corrupt..
-
Sep 1st, 2000, 09:03 PM
#2
What actions do you perform on the text before saving it?
And what kind of actions after loading it?
-
Sep 1st, 2000, 09:06 PM
#3
I dont apply any..Once you get the text in ANSI format such as how Textpad can save in ANSI format you dont need to do anything to load the cgi script in normal format..Also the first time I load the script it looks fine but its when I save it that it loses all of its proper formatting..I need to figure out what the program Textpad or notepad in windows 2000 mean when they say Encode: ANSI below filetypes in the save dialog....That seems to fix the problem straight off
-
Sep 1st, 2000, 09:12 PM
#4
How do you save the file?
I mean, if you can, post the code that saves the file.
-
Sep 1st, 2000, 09:16 PM
#5
Code:
Public Sub ShowSave()
Dim CmdDlg As New cCommonDialog
Set CmdDlg = New cCommonDialog
CmdDlg.Filter = cFilters
If ActiveForm.txtMain.FileName = "" Then
If Left(ActiveForm.Caption, 1) = "*" Then
CmdDlg.FileName = Right(ActiveForm.Caption, Len(ActiveForm.Caption) - 1)
Else
CmdDlg.FileName = ActiveForm.Caption
End If
Else
CmdDlg.FileName = ActiveForm.txtMain.FileName
End If
CmdDlg.DialogTitle = "Save Script"
CmdDlg.ShowSave
If CmdDlg.FileName = "" Then Exit Sub
ActiveForm.txtMain.SaveFile CmdDlg.FileName, rtfText
ActiveForm.txtMain.LoadFile CmdDlg.FileName, rtfText
ActiveForm.Caption = FileGetName(CmdDlg.FileName)
AddRecentList CmdDlg.FileName
ActiveForm.txtChanged = tsfalse
Set CmdDlg = Nothing
End Sub
-
Sep 1st, 2000, 09:28 PM
#6
Try using Open...Close instead of using the SaveFile method:
Code:
Dim hFile As Long
hFile = FreeFile
Open CmdDlg.FileName For Output As hFile
Print #hFile, ActiveForm.txtMain.Text
Close
This way you know the file is saved EXACTLY as it appears in the rtf box.
Similarly you can use the same method to read the file.
Try it and let me know.
-
Sep 1st, 2000, 09:42 PM
#7
I gotta go to sleep, it's almost 6:00am here.
I'll check this thread tomorrow.
Good night.
-
Sep 1st, 2000, 09:49 PM
#8
Yeah I was gonna try that eventually hehe...It seemed to have worked .. I will do some further testing to see if this works for all cgi scripts =]
-
Sep 2nd, 2000, 01:39 AM
#9
Glad I could help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|