on 06-14-2004 7:21 PM
Hi, I would like to know if it is possible to do the following and how to do it:
1- Create a new attribute for a context node that is not defined at design time;
2- Create a new node that is not defined at design time;
3- Bind a model class to a node at runtime;
I searched for answers in this forum and the documentation but I did not find any complete information.
Thanks and regards,
Barthelemy
It is certainly possible.
Try the following code snippet:
IWDNodeInfo nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("TestNode", null, true, true, false, true, false, true, null, null, null);
//If you want to bind the node to a model node then the
//second argument to the above method should be the
//model class
IWDAttributeInfo testAttrib = wdContext.wdGetAPI().getRootNodeInfo().getChild("TestNode").addAttribute("testAttrib", "ddic:com.sap.dictionary.string");
IWDNodeElement testNode = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION).getCurrentElement();
IWDNode testNode2 = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION);
//Now you can bind testNode with the Model Node
//You can also set a value to the newly created attribute
testNode.setAttributeValue("testAttrib", new String("Value"));
Hope this helps.
Shakeel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.