如何使用VBA在Lotus中自动调整表列的大小?
我正在编写一个VBA脚本来创建并通过电子邮件发送数据表。虽然它确实有效,但也很丑陋。我想做的一件事是调整这些列的大小,这样它们就不会占用整个页面的宽度 “autosize column”选项会很好,只是我在API中没有看到任何地方。或者,我可以手动设置每列的宽度。有人能告诉我需要添加什么代码吗如何使用VBA在Lotus中自动调整表列的大小?,vba,lotus-notes,Vba,Lotus Notes,我正在编写一个VBA脚本来创建并通过电子邮件发送数据表。虽然它确实有效,但也很丑陋。我想做的一件事是调整这些列的大小,这样它们就不会占用整个页面的宽度 “autosize column”选项会很好,只是我在API中没有看到任何地方。或者,我可以手动设置每列的宽度。有人能告诉我需要添加什么代码吗 Dim rtNav As NotesRichTextNavigator Dim rtTbl As NotesRichTextTable Dim TblHeader_FontStyle As NotesRi
Dim rtNav As NotesRichTextNavigator
Dim rtTbl As NotesRichTextTable
Dim TblHeader_FontStyle As NotesRichTextStyle
Dim TblBody_BackgroundStyle As NotesRichTextStyle
Dim TblHeader_BackgroundStyle As NotesColorObject
Dim TblBody_FontStyle As NotesColorObject
Sub AppendTable()
'Define styles
Set TblHeader_BackgroundStyle = NtSession.CreateColorObject
TblHeader_BackgroundStyle.NotesColor = COLOR_DARK_BLUE
Set TblHeader_FontStyle = NtSession.CreateRichTextStyle
TblHeader_FontStyle.NotesColor = COLOR_WHITE
TblHeader_FontStyle.FontSize = 8
Set TblBody_FontStyle = NtSession.CreateColorObject
TblBody_FontStyle.NotesColor = COLOR_WHITE
Set TblBody_BackgroundStyle = NtSession.CreateRichTextStyle
TblBody_BackgroundStyle.NotesColor = COLOR_BLACK
TblBody_BackgroundStyle.FontSize = 10
'-----------------------------------------------------
'Make table structure
NtBod.AppendTable lRowCount:=1, lColumnCount:=5
Set rtNav = NtBod.CreateNavigator
Set rtTbl = rtNav.GetFirstElement(RTELEM_TYPE_TABLE)
rtTbl.Style = TABLESTYLE_TOP
Call NtBod.AppendStyle(TblHeader_FontStyle)
Call rtTbl.SetColor(TblHeader_BackgroundStyle)
rtNav.FindFirstElement (RTELEM_TYPE_TABLECELL)
'The rest of the procedure to navigate the table and insert the data goes here
AppendTable
方法中有一个参数,用于指定每列的样式,包括宽度
从AppendTable方法文档中:
召唤
notesRichTextItem.附录表(行%,
列%[,标签][,左边距&]
[,rtpsStyleArray])
参数:行%整数。表中的行数 列%Integer。表中的列数 标签字符串类型的数组。可选。选项卡的标签文本 桌子数组元素的数目 必须等于行数。 省略此参数会附加一个 基本表格。包括这个参数 附加一个选项卡式表 左边距和长边距。可选。表格的左边距(以twips为单位)。 默认值为1440。以下 常数可用:
- 尺一厘米(567)
- 尺一英寸(1440)
AppendTable
方法中有一个参数,用于指定每列的样式,包括宽度
从AppendTable方法文档中:
召唤
notesRichTextItem.附录表(行%,
列%[,标签][,左边距&]
[,rtpsStyleArray])
参数:行%整数。表中的行数 列%Integer。表中的列数 标签字符串类型的数组。可选。选项卡的标签文本 桌子数组元素的数目 必须等于行数。 省略此参数会附加一个 基本表格。包括这个参数 附加一个选项卡式表 左边距和长边距。可选。表格的左边距(以twips为单位)。 默认值为1440。以下 常数可用:
- 尺一厘米(567)
- 尺一英寸(1440)
这就是我要找的。我已经有一段时间没写这段代码了,所以我有点生疏了。这就是我要找的。我有一段时间没写这段代码了,所以我有点生疏了。