1 Reply Latest reply on Sep 4, 2014 11:33 PM by JoH

    Process XML attributes of all tables in a structured document

    wolfgangappel

      Hi all,

       

      I try to process the XML attributes of all tables in a structured document.

      When I use SelectedTbl everything works fine for the selected table and the attributes of the tabelle Element are written correctly to the Console.

       

      doc = app.ActiveDoc;

      table = doc.SelectedTbl;

      if (table.TblElement)

      {

          Console('Elementname: ' + table.TblElement.ElementDef.Name);

          tblEle = table.Element;

          attrs = tblEle.GetAttributes();

          for (i = 0; i < attrs.len; i++) {

              aName = attrs[i].name;

              aWert = attrs[i].values;

              Console( "     " + aName + "    " + aWert);     

          }

      }

       

      However when I use GetText(Constants.FTI_TblAnchor) to walk through all tables of the documens neither ElementDef.Name nor Attributes are processed.

       

      var flow = doc.FirstFlowInDoc;

      var textItems = flow.GetText(Constants.FTI_TblAnchor);

      while(iTab<textItems.length) {

      table = textItems[iTab].obj;

      if (table.TblElement)

      {

          Console('Elementname: ' + table.TblElement.ElementDef.Name);

          tblEle = table.Element;

          attrs = tblEle.GetAttributes();

          for (i = 0; i < attrs.len; i++) {

              aName = attrs[i].name;

              aWert = attrs[i].values;

              Console( "     " + aName + "    " + aWert);     

          }

      }

      }

       

      Any Suggestions?

      Yours

      Wolfgang