Example #1
0
        public SCImage FromSlidePart(SlidePart slidePart, OpenXmlCompositeElement compositeElement)
        {
            P.Shape    pShape          = (P.Shape)compositeElement;
            A.BlipFill aBlipFill       = pShape.ShapeProperties.GetFirstChild <A.BlipFill>();
            SCImage    backgroundImage = TryFromBlipFill(slidePart, aBlipFill);

            return(backgroundImage);
        }
Example #2
0
 internal SlidePicture(
     SCSlide slide,
     string blipRelateId,
     ShapeContext spContext,
     P.Picture pPicture) : base(slide, pPicture)
 {
     Image   = new SCImage(Slide.SlidePart, blipRelateId);
     Context = spContext;
 }
Example #3
0
        public void Background_ImageIsNull_WhenTheSlideHasNotBackground()
        {
            // Arrange
            ISlide slide = _fixture.Pre009.Slides[1];

            // Act
            SCImage backgroundImage = slide.Background;

            // Assert
            backgroundImage.Should().BeNull();
        }
Example #4
0
        private static SCImage TryFromBlipFill(SlidePart slidePart, A.BlipFill aBlipFill)
        {
            SCImage backgroundImage = null;
            var     blipRelateId    = aBlipFill?.Blip?.Embed?.Value; // try to get blip relationship ID

            if (blipRelateId != null)
            {
                backgroundImage = new SCImage(slidePart, blipRelateId);
            }

            return(backgroundImage);
        }
Example #5
0
        public SCImage FromSlidePart(SlidePart slidePart)
        {
            SCImage backgroundImage = null;

            P.Background pBackground = slidePart.Slide.CommonSlideData.Background;
            if (pBackground != null)
            {
                A.BlipFill aBlipFill = pBackground.Descendants <A.BlipFill>().SingleOrDefault();
                backgroundImage = TryFromBlipFill(slidePart, aBlipFill);
            }

            return(backgroundImage);
        }