0

在我的 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 行也会引发错误。

任何关于我做错了什么的建议将不胜感激。

谢谢

格雷姆

4

1 回答 1

2

尝试使用lotus.domino.RichTextItem.RTELEM_TYPE_TABLECELL(好)或传递 7 作为参数(坏)

考试一:

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;
于 2016-11-24T11:04:39.393 回答