Ejemplo n.º 1
0
        private void ShapeIsPicture(PageLayer _page, pp.Shape _shape, EAnimation _animation, string _idShape)
        {
            EImageContent eImage = new EImageContent();

            eImage.Name       = "Image";
            eImage.ID         = _idShape;
            eImage.Width      = _shape.Width * Utils.tlw;
            eImage.Height     = _shape.Height * Utils.tlh;
            eImage.Top        = _shape.Top * Utils.tlh;
            eImage.Left       = _shape.Left * Utils.tlw;
            eImage.Angle      = _shape.Rotation;
            eImage.ZOder      = (int)_shape.ZOrderPosition;
            eImage.Animations = _animation;
            eImage.RectCrop   = new ESuperPoint();
            var lstPic = Utils.slidePart.Slide.Descendants <DocumentFormat.OpenXml.Presentation.Picture>().Select(p => p);

            P.Picture picTag    = GetPictureTag(lstPic, _shape.Id.ToString());
            string    rID       = picTag.BlipFill.Blip.Embed.Value;
            ImagePart part      = (ImagePart)Utils.slidePart.GetPartById(rID);
            string    pathImage = Path.Combine((System.Windows.Application.Current as IAppGlobal).DocumentTempFolder, ObjectElementsHelper.RandomString(13) + Path.GetExtension(part.Uri.ToString()));

            Utils.CopyStream(part.GetStream(), pathImage);
            eImage.Image      = new Image();
            eImage.Image.Path = pathImage;
            _page.Children.Add(eImage);
        }
Ejemplo n.º 2
0
        private void ShapeToImage(PageLayer _page, pp.Shape _shape, EAnimation _animation, string _idShape)
        {
            EImageContent eImage = new EImageContent();

            eImage.ID         = _idShape;
            eImage.Width      = _shape.Width * Utils.tlw;
            eImage.Height     = _shape.Height * Utils.tlh;
            eImage.Top        = _shape.Top * Utils.tlh;
            eImage.Left       = _shape.Left * Utils.tlw;
            eImage.Angle      = _shape.Rotation;
            eImage.ZOder      = (int)_shape.ZOrderPosition;
            eImage.Animations = _animation;
            eImage.RectCrop   = new ESuperPoint();
            //Export Shape ra ảnh
            string pathImage = Path.Combine((System.Windows.Application.Current as IAppGlobal).DocumentTempFolder, ObjectElementsHelper.RandomString(13) + ".png");

            _shape.Export(pathImage, pp.PpShapeFormat.ppShapeFormatPNG, 0, 0, pp.PpExportMode.ppScaleXY);
            eImage.Image      = new Image();
            eImage.Image.Path = pathImage;
            _page.Children.Add(eImage);
        }