コード例 #1
0
        public static void ContainsNoSmokingShapeWithText(string filePath, string expectedText)
        {
            using (PresentationDocument document = PresentationDocument.Open(filePath, false))
            {
                var shape = document.GetShapeByType(ShapeTypeValues.NoSmoking);
                var text  = "";
                var runs  = shape.TextBody.Descendants <Run>();

                if (runs != null && runs.Count() > 0)
                {
                    foreach (var run in runs)
                    {
                        if (run != null)
                        {
                            text += run.Text.Text;
                        }
                    }
                }
                Assert.AreEqual(expectedText, text);
            }
        }