Aspose.Words.Examples.CSharp.Programming_Documents.Working_with_Styles.ExtractContentBasedOnStyles.RunsByStyleName C# (CSharp) Метод

RunsByStyleName() публичный статический Метод

public static RunsByStyleName ( Document doc, string styleName ) : ArrayList
doc Document
styleName string
Результат System.Collections.ArrayList
        public static ArrayList RunsByStyleName(Document doc, string styleName)
        {
            // Create an array to collect runs of the specified style.
            ArrayList runsWithStyle = new ArrayList();
            // Get all runs from the document.
            NodeCollection runs = doc.GetChildNodes(NodeType.Run, true);
            // Look through all runs to find those with the specified style.
            foreach (Run run in runs)
            {
                if (run.Font.Style.Name == styleName)
                    runsWithStyle.Add(run);
            }
            return runsWithStyle;
        }
        // ExEnd:RunsByStyleName