Aspose.Slides.Examples.CSharp.Tables.AddImageinsideTableCell.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // For complete examples and data files, please go to https:// Github.com/aspose-slides/Aspose.Slides-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Tables();

            // Instantiate Presentation class object
            Presentation presentation = new Presentation();

            // Access first slide
            ISlide islide = presentation.Slides[0];

            // Define columns with widths and rows with heights
            double[] dblCols = { 150, 150, 150, 150 };
            double[] dblRows = { 100, 100, 100, 100, 90 };

            // Add table shape to slide
            ITable tbl = islide.Shapes.AddTable(50, 50, dblCols, dblRows);

            // Creating a Bitmap Image object to hold the image file
            Bitmap image = new Bitmap(dataDir + "aspose-logo.jpg");

            // Create an IPPImage object using the bitmap object
            IPPImage imgx1 = presentation.Images.AddImage(image);

            // Add image to first table cell
            tbl[0, 0].FillFormat.FillType = FillType.Picture;
            tbl[0, 0].FillFormat.PictureFillFormat.PictureFillMode = PictureFillMode.Stretch;
            tbl[0, 0].FillFormat.PictureFillFormat.Picture.Image = imgx1;

            // Save PPTX to Disk
            presentation.Save(dataDir + "Image_In_TableCell_out.pptx", SaveFormat.Pptx);

        }
    }
AddImageinsideTableCell