--------------------------- Function TreeToText-------------------------- -- Args: -- -- TreeName: The Name of Tree Object. -- -- sChar: String char for items. -- -- IncludeNodeIndex : Include Nodeindex at the beginning of the string. -- -------------------------------------------------------------------------- function TreeToText(TreeName,sChar,IncludeNodeIndex) sChar = sChar or ""; TreeName = TreeName or "Tree1"; local a= 0; local b; txt=""; function node(t) local k; local c; local NodeIn; if type(t)=='table'then for x = 1,#t do strNodeIndex=t[x].NodeIndex; k = Tree.GetChildren(TreeName,strNodeIndex); if strNodeIndex:len()== 1 then c = 1; else c = Math.Floor(strNodeIndex:len()/2)+1; end if IncludeNodeIndex then NodeIn = strNodeIndex.."-"; else NodeIn=""; end txt = txt..NodeIn..string.rep(sChar,c)..t[x].Text.."\r\n"; if k then txt=node(k); end end return txt; end end repeat b = Tree.GetChildren(TreeName,tostring(a)); if b then txt=node(b); break; end until b==nil; return txt; end Debug.ShowWindow(true); Debug.Print(TreeToText("Tree1","*",true));