LotusNotes 8.5-使用按钮向表中添加一行 [英] LotusNotes 8.5 - Adding a row to a table with a button

查看:146
本文介绍了LotusNotes 8.5-使用按钮向表中添加一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名实习生,目前正在学习LotusNotes,所以现在还不太流利.

I am an intern and learning LotusNotes currently, so am not very fluent with it yet.

我的问题是,我该如何编程一个操作按钮以将行添加到LotusNotes 8.5中的现有表中?

My question is, how can I program an action button to add a row to an existing table in LotusNotes 8.5?

我尝试了以下代码,但对我而言无效,

I have tried the following code, but it has not worked for me,

Sub Click(Source As Button)
Dim uiw As New NotesUIWorkspace
Dim uidoc As NotesUIDocument 
Set uidoc = uiw.CurrentDocument
Dim doc As NotesDocument
Set doc = uidoc.Document    

Dim Body As NotesRichTextItem
Set body = doc.GetFirstItem("Body")
If body Is Nothing Then
Msgbox "Click on the Reset the demo action to create the table first."
End If

Dim rows As Integer, rownumber As Integer, numrowstoadd As Integer
Dim strrownumber As String, strrowstoadd As String

Dim rtnav As NotesRichTextNavigator 
Set rtnav = body.CreateNavigator 
Dim rttable As NotesRichTextTable
Set rttable = rtnav.GetFirstElement(RTELEM_TYPE_TABLE)
If rttable Is Nothing Then
Msgbox "No table created - use the Reset the demo action first."
Else
rows=rttable.RowCount
strrowstoadd = Inputbox("Enter the number of rows to add.")
If Isnumeric( strrowstoadd ) Then
numrowstoAdd = Cint(strrowstoAdd)
If numrowstoAdd <= 0 Then
Msgbox "Enter a number greater than zero."
Exit Sub
End If
Else
Msgbox ("Enter a integer number only.")
Exit Sub
End If

strrownumber = Inputbox("Enter the number corresponding to the row to start adding at, no greater than " & rows & ".")
If Isnumeric( strrownumber ) Then
rownumber = Cint(strrownumber)
If rownumber < 0 Or rownumber > rows Then
Msgbox ("You entered too high a number or a number less than zero, try again.")
Exit Sub
End If
Else
Msgbox ("Enter a integer number only.")
Exit Sub
End If

Call rttable.AddRow(numrowstoadd, rownumber)    
End If  

doc.save True, True
uidoc.Close
Call uiw.EditDocument(False,doc)
End Sub


任何帮助都会很棒.谢谢!


Any help would be great. Thanks!

推荐答案

如果不仔细查看代码,我相信您面临的基本问题很可能是NotesRichText类是我们所谓的代码"的一部分的事实. Notes的后端类".这意味着它是代表其存储格式的NSF文件的内存中版本的对象之一,并且与前端类"不同.这些是代表用户查看和编辑的数据的对象.您可以使用所有NotesUI的前缀NotesUI从后端类告诉前端.

Without taking a detailed look at your code, I believe the fundamental problem you are facing is most likely the fact that the NotesRichText class is part of what we call the "back end classes" for Notes. That means that it is one of the objects that represents the in-memory version of data from an NSF file in its storage format, and this is not the same as the "front end classes". Those are objects that represent the data that the user sees and edits. You can tell the front end from back end classes by the prefix NotesUI for all the front end classes.

问题是,对于富文本,前端类和后端中的对象保持同步 ,这意味着您对NotesRichText对象所做的更改确实发生在内存中,并且如果调用NotesDocument.save(),它们将保存到NSF文件中,但是在执行某些操作以从后端重新加载前端数据之前,它们不会反映在屏幕上看到的内容中.这是

The thing is, the objects in the front end classes and back end are kept synchronized except for rich text, and what that means is that changes that you make to NotesRichText objects do occur in memory, and the are saved to the NSF file if you call NotesDocument.save(), but they are not reflected in what you see on the screen until you do something to reload the front end data from the back end. Here's a link to a wiki page that demonstrates a technique for doing that.

这篇关于LotusNotes 8.5-使用按钮向表中添加一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆