java - How to get the index value of an object using ContentAccessor? -
let's i'm trying add content control figure captions.if figure caption has cc need index value of sdtrun para , delete sdtrun after retaining text value. re-insert text value para using index value of sdtrun.
int sdtcount = 0; int indexsdt = 0; list<string> text1 = new arraylist<string>(); list<object> objects = p.getcontent(); classfinder sdts = new classfinder(sdtrun.class); new traversalutil(p, sdts); stringbuilder sd = new stringbuilder(); (object o : sdts.results) { sdtrun sdtrun = (sdtrun) o; if (sdtrun.getparent() instanceof p) { contentaccessor ca = (contentaccessor) sdtrun.getparent(); indexsdt = ca.getcontent().indexof(sdtrun); classfinder text2 = new classfinder(text.class); new traversalutil(sdtrun, text2); (object o1 : text2.results) { text tex = (text) o1; sd.append(((text) tex).getvalue()); } text1.add(sd.tostring()); sd.delete(0, sd.length()); system.out.println(text1.get(sdtcount) + "indexsdt:" + indexsdt + "ca size" + ca.getcontent().size()); sdtcount++; ca.getcontent().remove(indexsdt); } }
here i'm getting -1 value sdtindex.
Comments
Post a Comment