We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bookmark setText error

How can i set bookmark text from header & table in the document!


Some bookmark is from table which is in the header ,and include some bookmark is form paragraph。

something like this:

Document doc = new Document(“c:\Sample.doc”);
//store bookmark value
Map<String,String> custMapVals = new HashMap<String,String>();
//ex bookmark & value
custMapVals.put(“bookmark_1”,“a”);
custMapVals.put(“bookmark_2”,“b”);
custMapVals.put(“bookmark_3”,“c”);

BookmarkCollection bookmarkCol=doc.getRange().getBookmarks();
for (Iterator ter = bookmarkCol.iterator(); ter.hasNext():wink: {
Bookmark objBm = (Bookmark) ter.next();
if(objBm!=null){
objBm.setText(custMapVals.get(objBm.getName()));
}
}

when is run to this “objBm.setText(custMapVals.get(objBm.getName()));” , then it throw error for this:


java.lang.IllegalArgumentException: Start and end node should have the same grand parent.
at com.aspose.words.CompositeNode.a(CompositeNode.java:651)
at com.aspose.words.Bookmark.setText(Bookmark.java:81)
at com.csair.tdms.MSL.MSLBC.doWriteValue2BookMark(MSLBC.java:117)
at com.csair.tdms.MSL.MSLBC.doCreate(MSLBC.java:64)
at com.csair.tdms.MSL.MSLComponents.createConfirm(MSLComponents.java:48)
at com.csair.tdms.MSL.MSLContainer.createConfirm(MSLContainer.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.documentum.web.form.FormProcessor.invokeMethod(FormProcessor.java:1633)
at com.documentum.web.form.FormProcessor.invokeMethod(FormProcessor.java:1487)
at com.documentum.web.form.FormProcessor.fireActionEvent(FormProcessor.java:1303)
at com.documentum.web.form.RecallOperation.execute(RecallOperation.java:101)
at com.documentum.web.form.FormProcessor.processAction(FormProcessor.java:113)
at com.documentum.web.form.FormAction.processAction(FormAction.java:107)
at com.documentum.web.env.WDKController.doStartRequest(WDKController.java:194)
at com.documentum.web.env.WDKController.processRequest(WDKController.java:95)
at com.documentum.web.env.WDKController.doFilter(WDKController.java:86)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)


sincerely,tks…
Hi Justic,

Thank you for inquiry. First off, please try to use the latest version at your end and see if it resolves your issue. However, if it still doesn't resolve your issue then please share input document for further investigation. Moreover, i did not observe this problem on my end. I have attached input/output documents.

I hope this will help.