A routine to insert tables in Richtextbox
This is a routine that add a table to the current selection in a RichTextBox. I didn't find how can I do this on the web, so I made it by looking on the rtf Specification. I expect that this would be helpfull for those who are using RTB. If you find how to fix the problems i found please send me your work. (Sorry for my english ;) )
Original Author: Mario Villanueva
Code
Public Sub InsertTable(Rtb as RichTextBox, vRows as integer,vCols as integer)
Dim A As String, i As Integer, j As Integer
A = "{
tf1ansiansicpg1252deff0" & _
"{fonttbl{f0fromanfprq2fcharset0 Times New Roman;}}" & _
"viewkind4uc1 rowd rqc rgaph108 rleft-8" & _
" rbrdrtrdrsrdrw10" & _
" rbrdrlrdrsrdrw10" & _
" rbrdrbrdrsrdrw10" & _
" rbrdrrrdrsrdrw10"
For i = 1 To vCols
A = A & "clbrdrtrdrw15rdrs" & _
"clbrdrlrdrw15rdrs" & _
"clbrdrbrdrw15rdrs" & _
"clbrdrrrdrw15rdrs" & _
"cellx" & _
CStr((ScaleX(Rtb.Width, Rtb.Parent.ScaleMode, vbTwips) vCols * 2) * i) & _
"clbrdrt"
Next
A = A & "pardintbllang3082f0fs24"
For i = 1 To vRows
A = A & "intblclmrg"
For j = 1 To vCols
A = A & "cell"
Next
A = A & "
ow"
Next
A = A & "}"
Rtb.SelText = A
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.