cancel
Showing results for 
Search instead for 
Did you mean: 

How to Export to Excel a Dynamic Node?

Former Member
0 Kudos

Hi all,

I would to know how it's possible to export in Excel a dynamic Node, created in the wdDoModify() method.

I'd seen the tutorial TutWD_ExcelExport in wich the public method for exportation into Excel 2003 accepts in input a IWDNode attribute, but I can't pass him a dynamic node that I'd created and manipulated in the wdDoModify() method.

How can I do???

Thanks to all.

Gianluca Barile

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi Gianluca,

Did you see the code from tutorial?


  private Map getProductColumnInfos() {
    Map columnInfosMap = new HashMap();  
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.QUANTITY, "Quantity");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.ARTICLE, "Article");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.COLOR, "Color");
    columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.PRICE, "Price in EURO");
    columnInfosMap.put(
      IPrivateTableCompBasketView.IProductsElement.TOTAL__PER__ARTICLE,
      "Total Per Article In Euro");
    return columnInfosMap;
  }

So, columnInfosMap should contain string pairs with attribute name as key and header title as value.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Yes, I've seen the code.

The problem is that my Node has a non specified number of attributes and It lives only at runtime.

my Node has 3 + N attributes at runtime where N is specified from the user.

Of course how can I have a pairs Name Attribute, Key from the IWDNode and IWDNodeElement intefaces????

I hope that you had undestand me.

What can I do??

Message was edited by: Gianluca Barile

former_member182372
Active Contributor
0 Kudos
	final IWDNode dynTabNode   = (IWDNode)wdContext.getChildNode("GrigliaComparativa", 0);
	final Map columnInfosMap   = new HashMap();  
	final IWDNodeInfo nodeInfo = dynTabNode.getNodeInfo();
	for (Iterator iter = nodeInfo.iterateAttributes(); iter.hasNext();) {
		final IWDAttributeInfo attributeInfo = (IWDAttributeInfo) iter.next();
		columnInfosMap.put(attributeInfo.getName(), attributeInfo.getName());
	}

Answers (2)

Answers (2)

Former Member
0 Kudos

Answered.

Former Member
0 Kudos

I've implemented the following code (but it doesn't work)

in wdDoModify() method:

....

IWDNodeInfo nodeinfo = wdContext.getNodeInfo();
		
IWDNodeInfo grigliaComparativaNode = nodeinfo.addChild("GrigliaComparativa",null,true,true,true,false,false,true,null,null,null);
		
IWDAttributeInfo nominativo = grigliaComparativaNode.addAttribute("Nominativo","com.sap.dictionary.string");
IWDAttributeInfo periodoDa = grigliaComparativaNode.addAttribute("Da","com.sap.dictionary.string");
IWDAttributeInfo periodoA = grigliaComparativaNode.addAttribute("A","com.sap.dictionary.string");
IWDAttributeInfo[] v = new IWDAttributeInfo[50];
for (int i = 0; i < wdContext.nodeT_Body_Elements().size(); i++)
v<i> = grigliaComparativaNode.addAttribute("V"+i,"com.sap.dictionary.string");

....

IWDNode dynTabNode = (IWDNode)wdContext.getChildNode("GrigliaComparativa",0);
		
Map columnInfosMap = new HashMap();  
dynTabNode.moveFirst();
do{
 IWDNodeElement dynTabElem = (IWDNodeElement)dynTabNode.getCurrentElement();
			columnInfosMap.put(dynTabElem.getClass().getName(),dynTabElem.getClass().getName().toString());
		}while(dynTabNode.moveNext()!=null);

		wdThis.wdGetExcelExportCompInterface().exportToExcel2003(dynTabNode , columnInfosMap); 

Message was edited by: Gianluca Barile

Message was edited by: Gianluca Barile