Ejemplo n.º 1
0
        public static void FormatBlPoint(SlidePart slidePart)
        {
            IEnumerable <Shape> bulletPointShapes = slidePart.Slide.Descendants <Shape>().Where(d => d.Descendants <NonVisualDrawingProperties>().Where(e => e.Name.InnerText.Contains(Constants._TEXTBOX_)).Count() > 0);

            foreach (Shape shape in bulletPointShapes)
            {
                IEnumerable <D.Paragraph> paragraphs = shape.Descendants <D.Paragraph>().Where(d => d.Descendants <D.ParagraphProperties>().Count() > 0);
                foreach (D.Paragraph paragraph in paragraphs)
                {
                    D.ParagraphProperties paragProps = paragraph.Descendants <D.ParagraphProperties>().FirstOrDefault();
                    if (paragProps != default(D.ParagraphProperties))
                    {
                        D.BulletFont bulletFont = paragProps.Descendants <D.BulletFont>().FirstOrDefault();
                        if (bulletFont != default(D.BulletFont))
                        {
                            bulletFont.CharacterSet = 0;
                            bulletFont.PitchFamily  = 34;
                            bulletFont.Typeface     = "Arial";
                        }

                        D.CharacterBullet characterBullet = paragProps.Descendants <D.CharacterBullet>().FirstOrDefault();

                        if (characterBullet != default(D.CharacterBullet))
                        {
                            characterBullet.Char = new DocumentFormat.OpenXml.StringValue("•");
                        }
                        else
                        {
                            D.AutoNumberedBullet autoNumberedBullet = paragProps.Descendants <D.AutoNumberedBullet>().FirstOrDefault();
                            if (autoNumberedBullet != default(D.AutoNumberedBullet))
                            {
                                autoNumberedBullet.Remove();
                                slidePart.Slide.Save();
                            }
                            characterBullet = new D.CharacterBullet()
                            {
                                Char = new DocumentFormat.OpenXml.StringValue("•")
                            };
                            paragProps.AppendChild(characterBullet);
                        }
                        D.Run run = paragraph.Descendants <D.Run>().FirstOrDefault();
                        run.RunProperties.Italic    = false;
                        run.RunProperties.Bold      = false;
                        run.RunProperties.Underline = D.TextUnderlineValues.None;
                    }
                }
            }
            slidePart.Slide.Save();
        }
Ejemplo n.º 2
0
        private string ParseColorHex()
        {
            if (Type == BulletType.None)
            {
                throw new RuntimeDefinedPropertyException(BulletIsNotDefinedErrorMsg);
            }

            var srgbClrElements = _xmlParagraphProperties.Descendants <A.RgbColorModelHex>();

            if (srgbClrElements.Any())
            {
                return(srgbClrElements.Single().Val);
            }

            return(null);
        }
Ejemplo n.º 3
0
        private string ParseColorHex()
        {
            if (Type == BulletType.None)
            {
                return(null);
            }

            IEnumerable <A.RgbColorModelHex> aRgbClrModelHexCollection =
                _aParagraphProperties.Descendants <A.RgbColorModelHex>();

            if (aRgbClrModelHexCollection.Any())
            {
                return(aRgbClrModelHexCollection.Single().Val);
            }

            return(null);
        }