technofantasy

博客园 首页 新随笔 联系 订阅 管理
  22 随笔 :: 16 文章 :: 75 评论 :: 39377 阅读

Properties - all sizes are in twips
 xLeft - Position of the left edge of the table
 isCentered - Set to True to center the table
 Rows - Sets or returns the number of rows in the table
 Columns - Sets or returns the number of columns in the table
 Row - An Array of Rows (1 to Rows)
 Column - An Array of columns (1 to Columns)
  Column(i).xWidth - Width of the ith column
 Cell - A 2-d Array of Cells (1 to Rows, 1 to Columns)
  Cell(r, c).Contents - Sets or returns the contents of the cell

Methods
 InsertTable(RTB As RichTextBox) - Inserts the table into the RichTextBox
                         at the currrent cursor position.

代码下载地址:
http://www.applevb.com/RTFtable.zip

使用范例:

Option Explicit

Dim RTFtable As clsRTFtable
Private Declare Function LockWindowUpdate Lib "user32" ( _
    
ByVal hwndLock As Long _
As Long

Private Sub Command1_Click()
  
Dim i As Integer
  
Set RTFtable = New clsRTFtable
  
'stop flicker
  Call LockWindowUpdate(RichTextBox1.hWnd)
  
  
For i = 1 To 5
  
With RTFtable
    
'set the size of the table
    .Columns = 3
    .Rows 
= 2
    
'fill the cells
    'Row 1
    .Cell(11).Contents = "Row 1"
    .Cell(
12).Contents = "Column2"
    .Cell(
13).Contents = "Column3"

    
'Row 2
    .Cell(21).Contents = "Row2"
    .Cell(
22).Contents = "R2C2"
    .Cell(
23).Contents = "R2C3"
    
'do we want to center it on the page?
    .isCentered = True
    
    
'insert the table at the current cursor postion
    .InsertTable RichTextBox1
  
End With
  
Next i
    
Call LockWindowUpdate(0)

End Sub
posted on   陈锐  阅读(2439)  评论(1编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
点击右上角即可分享
微信分享提示