Ejemplo n.º 1
0
        public static void FormatTitle(SlidePart slidePart)
        {
            if (slidePart == null)
            {
                throw new ArgumentNullException("presentationDocument");
            }

            if (slidePart.Slide != null)
            {
                Shape titleShape = slidePart.Slide.Descendants <Shape>().Where(d => IsTitleShape(d) && d.InnerText.Contains(Constants._INPUTSLIDE_)).FirstOrDefault();
                if (titleShape != default(Shape))
                {
                    D.Paragraph paragraph = titleShape.TextBody.Descendants <D.Paragraph>().FirstOrDefault();
                    if (paragraph != default(D.Paragraph))
                    {
                        D.Run run = paragraph.Descendants <D.Run>().FirstOrDefault();
                        run.Text = new D.Text(Constants._OUTPUTSLIDE_);
                        paragraph.InsertAt(new D.ParagraphProperties()
                        {
                            Alignment = D.TextAlignmentTypeValues.Center
                        }, 0);
                        run.RunProperties.InsertAt(new D.ComplexScriptFont()
                        {
                            CharacterSet = -78, PitchFamily = 2, Typeface = "Beirut"
                        }, 0);
                        run.RunProperties.InsertAt(new D.LatinFont()
                        {
                            CharacterSet = -78, PitchFamily = 2, Typeface = "Beirut"
                        }, 0);
                    }
                }
            }
        }