在我的xPage上使用SSJS时,我在填写表时遇到问题。
我用来创建然后导航到表的代码是
var user = session.getEffectiveUserName();
var doc = database.createDocument();
var rtitem:NotesRichTextItem = doc.createRichTextItem("Body");
doc.Form = "Memo";
doc.replaceItemValue("SendTo", user)
doc.replaceItemValue("Subject","Renewal forms received");
var i:Double = sessionScope.unidArray.size();
rtitem.appendTable(i,12);
var rtnav = rtitem.createNavigator();
rtnav.findFirstElement(RTELEM_TYPE_TABLE);
rtnav.findFirstElement(RTELEM_TYPE_TABLECELL);
try{
for(v=0;v<i;v++){
print("v is " + v);
for(j=3;j<=14;j++){
rtitem.beginInsert(rtnav);
rtitem.appendText(sessionScope.unidArray(v,j));
rtitem.endInsert();
rtnav.findNextElement(RTELEM_TYPE_TABLECELL);
}
}
}catch(e){
print("error " + e);
}
我得到的错误是
Script interpreter error, line=18, col=24: [ReferenceError] 'RTELEM_TYPE_TABLE' not found
16: print("3");
17: var rtnav = rtitem.createNavigator();
-> 18: rtnav.findFirstElement(RTELEM_TYPE_TABLE);
我尝试过使用
rtitem.RTELEM_TYPE_TABLE
上面第18行的也会引发错误。
对于我做错的任何建议都将不胜感激。
由于
格雷姆
答案 0 :(得分:1)
尝试使用 lotus.domino.RichTextItem.RTELEM_TYPE_TABLECELL (好)或将7作为参数传递(坏)
考试1:
rtnav.findNextElement(lotus.domino.RichTextItem.RTELEM_TYPE_TABLE);
rtnav.findNextElement(lotus.domino.RichTextItem.RTELEM_TYPE_TABLECELL);
考试2:
rtnav.findNextElement(1); // table
rtnav.findNextElement(7); // table cell
所有常数:
// Field descriptor #5 I
public static final int RT_FIND_CASEINSENSITIVE = 1;
// Field descriptor #5 I
public static final int RT_FIND_PITCHINSENSITIVE = 2;
// Field descriptor #5 I
public static final int RT_FIND_ACCENTINSENSITIVE = 4;
// Field descriptor #5 I
public static final int RT_REPL_PRESERVECASE = 8;
// Field descriptor #5 I
public static final int RT_REPL_ALL = 16;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TABLE = 1;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TEXTRUN = 3;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TEXTPARAGRAPH = 4;
// Field descriptor #5 I
public static final int RTELEM_TYPE_DOCLINK = 5;
// Field descriptor #5 I
public static final int RTELEM_TYPE_SECTION = 6;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TABLECELL = 7;
// Field descriptor #5 I
public static final int RTELEM_TYPE_FILEATTACHMENT = 8;
// Field descriptor #5 I
public static final int RTELEM_TYPE_OLE = 9;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TEXTPOSITION = 10;
// Field descriptor #5 I
public static final int RTELEM_TYPE_TEXTSTRING = 11;