public static TOCBranch GetFromDocument(EMDocument linkedDocument, int startLevel, int endLevel) { var root = new TOCBranch(); linkedDocument.Data.ForEachWithContext( new TOCTreeBuildingContext( (header, includesStack) => { var level = header.GetLevelWithOffsets(includesStack); if (level >= startLevel && level <= endLevel) { root.Add(level, header.Text, "#" + header.UniqueKey); } })); root.DeleteNonRootVirtualBranches(); return(root); }
public static TOCBranch GetFromDocument(EMDocument linkedDocument, int startLevel, int endLevel) { var root = new TOCBranch(); linkedDocument.Data.ForEachWithContext( new TOCTreeBuildingContext( (header, includesStack) => { var level = header.GetLevelWithOffsets(includesStack); if(level >= startLevel && level <= endLevel) { root.Add(level, header.Text, "#" + header.UniqueKey); } })); root.DeleteNonRootVirtualBranches(); return root; }
private TOCBranch GetTOCTree(int startLevel, int endLevel) { return(TOCBranch.GetFromDocument(linkedDocument, startLevel, endLevel)); }