コード例 #1
0
ファイル: SlideManager.cs プロジェクト: ayumax/MDToPPTX
        public void WriteImage(PPTXImage Image)
        {
            if (System.IO.File.Exists(Image.ImageFilePath))
            {
                Image.Transform = NewTransform();

                using (System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(Image.ImageFilePath))
                {
                    // 1mm = 3.779528px(96dpi)
                    Image.Transform.SizeX = bitmap.Width / 3.779528f / 10.0f;
                    Image.Transform.SizeY = bitmap.Height / 3.779528f / 10.0f;
                }

                currentSlide.Images.Add(Image);

                SetContentTransform(Image.Transform);
            }
        }
コード例 #2
0
 public void WriteImage(PPTXImage Image)
 {
     Writer.WriteImage(Image);
 }
コード例 #3
0
ファイル: ImageSlideWriter.cs プロジェクト: ayumax/MDToPPTX
        public void AddImageContent(ShapeTree shapeTree1, uint ObjectID, PPTXImage Content)
        {
            Picture picture3 = new Picture();

            NonVisualPictureProperties nonVisualPictureProperties3 = new NonVisualPictureProperties();

            NonVisualDrawingProperties nonVisualDrawingProperties83 = new NonVisualDrawingProperties()
            {
                Id = ObjectID, Name = $"Content{ObjectID}"
            };

            A.NonVisualDrawingPropertiesExtensionList nonVisualDrawingPropertiesExtensionList5 = new A.NonVisualDrawingPropertiesExtensionList();

            nonVisualDrawingProperties83.Append(nonVisualDrawingPropertiesExtensionList5);

            NonVisualPictureDrawingProperties nonVisualPictureDrawingProperties3 = new NonVisualPictureDrawingProperties();

            A.PictureLocks pictureLocks3 = new A.PictureLocks()
            {
                NoChangeAspect = true
            };

            nonVisualPictureDrawingProperties3.Append(pictureLocks3);
            ApplicationNonVisualDrawingProperties applicationNonVisualDrawingProperties83 = new ApplicationNonVisualDrawingProperties();

            nonVisualPictureProperties3.Append(nonVisualDrawingProperties83);
            nonVisualPictureProperties3.Append(nonVisualPictureDrawingProperties3);
            nonVisualPictureProperties3.Append(applicationNonVisualDrawingProperties83);

            BlipFill blipFill3 = new BlipFill();

            A.Blip blip3 = new A.Blip()
            {
                Embed = ImageIDMap[Content.ImageFilePath]
            };

            A.BlipExtensionList blipExtensionList1 = new A.BlipExtensionList();

            blip3.Append(blipExtensionList1);

            A.Stretch       stretch3       = new A.Stretch();
            A.FillRectangle fillRectangle3 = new A.FillRectangle();

            stretch3.Append(fillRectangle3);

            blipFill3.Append(blip3);
            blipFill3.Append(stretch3);

            ShapeProperties shapeProperties70 = new ShapeProperties();


            A.PresetGeometry presetGeometry10 = new A.PresetGeometry()
            {
                Preset = A.ShapeTypeValues.Rectangle
            };
            A.AdjustValueList adjustValueList10 = new A.AdjustValueList();

            presetGeometry10.Append(adjustValueList10);

            A.Transform2D transform2D25 = SlideWriterHelper.CreateTransform2D(Content.Transform);
            if (transform2D25 != null)
            {
                shapeProperties70.Append(transform2D25);
            }

            shapeProperties70.Append(presetGeometry10);

            picture3.Append(nonVisualPictureProperties3);
            picture3.Append(blipFill3);
            picture3.Append(shapeProperties70);

            shapeTree1.Append(picture3);
        }