0
votes

I am having a problem filling in a table when using SSJS on my xPage.

The code I am using to create and then navigate to the table is

    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);
}

The error I am getting is

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);

I have tried using

rtitem.RTELEM_TYPE_TABLE

at line 18 above that throws up an error as well.

Any suggestions on what I am doing wrong would be appreciated.

Thanks

Graeme

1

1 Answers

2
votes

Try use lotus.domino.RichTextItem.RTELEM_TYPE_TABLECELL(good) or pass 7 as parameter(bad)

exam 1:

rtnav.findNextElement(lotus.domino.RichTextItem.RTELEM_TYPE_TABLE);
rtnav.findNextElement(lotus.domino.RichTextItem.RTELEM_TYPE_TABLECELL);

exam 2:

rtnav.findNextElement(1); // table
rtnav.findNextElement(7); // table cell

All constants:

 // 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;