|
-
Jan 11th, 2000, 04:59 AM
#1
Thread Starter
Hyperactive Member
this is associated with my paragraph indent topic.
Using a rich text box I can get the indention I need. my question is how can I save the contents of the rich text box one line at a time. I would need to convert any indention to spaces.
I need it a line at a time so that I can place a return at the end of each line.
------------------
I am so skeptacle, I can hardly believe it!
-
Jan 11th, 2000, 05:20 AM
#2
Try something like:
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_GETLINE = &HC4
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1
Private Sub Command1_Click()
Dim iFile As Integer
Dim lLines As Long
Dim lIndex As Long
Dim sLine As String
Dim lLen As Long
Dim lHwnd As Long
iFile = FreeFile
lHwnd = RichTextBox1.hwnd
Open "C:\Saved.txt" For Output As iFile
For lLines = 0 To SendMessage(lHwnd, EM_GETLINECOUNT, 0&, ByVal 0&) - 1
lIndex = SendMessage(lHwnd, EM_LINEINDEX, lLines, ByVal 0&)
lLen = SendMessage(lHwnd, EM_LINELENGTH, lIndex, ByVal 0&)
sLine = Space(lLen)
Call SendMessage(lHwnd, EM_GETLINE, lLines, ByVal sLine)
Print #iFile, Left$(sLine, lLen)
Next
Close iFile
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 11th, 2000, 05:51 AM
#3
Thread Starter
Hyperactive Member
thanks for your time Aaron Young. When I run the code it looses the indentions.
If I have a six line paragraph that is indented only the first line is indented and the rest fill the line.
The RichTextBox looks like this
the RTB is only this wide----|
Section Title:
this is an example of how
the text looks on the
screen. but I cant save it
as a text file!
and the text file looks like this:
Section Title:
this is an example of how
the text looks on the screen.
but I cant save it as a text
file!
in the text file the paragraph is indented by a tab.
thank you Aaron for your help and I appreciate your time.
------------------
I am so skeptacle, I can hardly believe it!
[This message has been edited by badgers (edited 01-11-2000).]
-
Jan 13th, 2000, 03:57 AM
#4
Thread Starter
Hyperactive Member
in this API call is is possible to determine if the line is indented. I have stepped through the code and the text that gets returned does not seem to have any characters in it. Is there a different API call to determine if a specific line has been indented so that when I read the line I can add spaces to the front of it? Also, it would help to know how much indention there is, ie two levels of indention or one
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
|