当前位置: 首页>>代码示例>>C#>>正文


C# Presentation.Save方法代码示例

本文整理汇总了C#中Presentation.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Presentation.Save方法的具体用法?C# Presentation.Save怎么用?C# Presentation.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Presentation的用法示例。


在下文中一共展示了Presentation.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations_Transitions();

            // ExStart:ManagingBetterSlideTransitions
            // Instantiate Presentation class to load the source presentation file
            using (Presentation presentation = new Presentation(dataDir + "AccessSlides.pptx"))
            {
                // Apply circle type transition on slide 1
                presentation.Slides[0].SlideShowTransition.Type = TransitionType.Circle;

                // Set the transition time of 3 seconds
                presentation.Slides[0].SlideShowTransition.AdvanceOnClick = true;
                presentation.Slides[0].SlideShowTransition.AdvanceAfterTime = 3000;

                // Apply comb type transition on slide 2
                presentation.Slides[1].SlideShowTransition.Type = TransitionType.Comb;

                // Set the transition time of 5 seconds
                presentation.Slides[1].SlideShowTransition.AdvanceOnClick = true;
                presentation.Slides[1].SlideShowTransition.AdvanceAfterTime = 5000;

                // Write the presentation to disk
                presentation.Save("SampleTransition_out.pptx", SaveFormat.Pptx);
            
                // ExEnd:ManagingBetterSlideTransitions
                // Write the presentation to disk
                presentation.Save(dataDir + "BetterTransitions_out.pptx", SaveFormat.Pptx);
            }
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:31,代码来源:ManagingBetterSlideTransitions.cs

示例2: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations();

            //Instantiate Presentation class that represents a presentation file
            using (Presentation pres = new Presentation(dataDir + "BetterSlideTransitions.pptx"))
            {

                //Apply circle type transition on slide 1
                pres.Slides[0].SlideShowTransition.Type = TransitionType.Circle;

                //Set the transition time of 3 seconds
                pres.Slides[0].SlideShowTransition.AdvanceOnClick = true;
                pres.Slides[0].SlideShowTransition.AdvanceAfterTime = 3000;

                //Apply comb type transition on slide 2
                pres.Slides[1].SlideShowTransition.Type = TransitionType.Comb;

                //Set the transition time of 5 seconds
                pres.Slides[1].SlideShowTransition.AdvanceOnClick = true;
                pres.Slides[1].SlideShowTransition.AdvanceAfterTime = 5000;

                //Apply zoom type transition on slide 3
                pres.Slides[2].SlideShowTransition.Type = TransitionType.Zoom;

                //Set the transition time of 7 seconds
                pres.Slides[2].SlideShowTransition.AdvanceOnClick = true;
                pres.Slides[2].SlideShowTransition.AdvanceAfterTime = 7000;

                //Write the presentation to disk
                pres.Save(dataDir + "SampleTransition.pptx", SaveFormat.Pptx);

            }
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:35,代码来源:BetterSlideTransitions.cs

示例3: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Load the desired the presentation             
            Presentation pres = new Presentation(dataDir + "RemoveNodeSpecificPosition.pptx");

            // Traverse through every shape inside first slide
            foreach (IShape shape in pres.Slides[0].Shapes)
            {
                // Check if shape is of SmartArt type
                if (shape is Aspose.Slides.SmartArt.SmartArt)
                {
                    // Typecast shape to SmartArt
                    Aspose.Slides.SmartArt.SmartArt smart = (Aspose.Slides.SmartArt.SmartArt)shape;

                    if (smart.AllNodes.Count > 0)
                    {
                        // Accessing SmartArt node at index 0
                        Aspose.Slides.SmartArt.ISmartArtNode node = smart.AllNodes[0];

                        if (node.ChildNodes.Count >= 2)
                        {
                            // Removing the child node at position 1
                            ((Aspose.Slides.SmartArt.SmartArtNodeCollection)node.ChildNodes).RemoveNode(1);
                        }

                    }
                }
            }

            // Save Presentation
            pres.Save(dataDir + "RemoveSmartArtNodeByPosition_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:35,代码来源:RemoveNodeSpecificPosition.cs

示例4: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Instantiate presentation object
            using (Presentation presentation = new Presentation())
            {

                // Load Image to be added in presentaiton image collection
                Image img = new Bitmap(dataDir + "aspose-logo.jpg");
                IPPImage image = presentation.Images.AddImage(img);

                // Add picture frame to slide
                IPictureFrame pf = presentation.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 50, 50, 100, 100, image);

                // Setting relative scale width and height
                pf.RelativeScaleHeight = 0.8f;
                pf.RelativeScaleWidth = 1.35f;

                // Save presentation
                presentation.Save(dataDir + "Adding Picture Frame with Relative Scale_out.pptx", SaveFormat.Pptx);
            }
           

        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:26,代码来源:AddRelativeScaleHeightPictureFrame.cs

示例5: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            // Instantiate PrseetationEx class that represents the PPTX
            using (Presentation pres = new Presentation())
            {

                // Get the first slide
                ISlide sld = pres.Slides[0];

                // Add Video Frame
                IVideoFrame vf = sld.Shapes.AddVideoFrame(50, 150, 300, 150, dataDir+ "video1.avi");

                // Set Play Mode and Volume of the Video
                vf.PlayMode = VideoPlayModePreset.Auto;
                vf.Volume = AudioVolumeMode.Loud;

                //Write the PPTX file to disk
                pres.Save(dataDir + "VideoFrame_out.pptx", SaveFormat.Pptx);
            }

            
            
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:31,代码来源:AddVideoFrame.cs

示例6: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            //Creating a presentation instance
            Presentation pres = new Presentation();

            //Access the presentation slide
            ISlide slide = pres.Slides[0];

            //Add Smart Art IShape
            ISmartArt smart = slide.Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);

            //Accessing the SmartArt node at index 0
            ISmartArtNode node = smart.AllNodes[0];

            //Adding new child node at position 2 in parent node
            SmartArtNode chNode = (SmartArtNode)((SmartArtNodeCollection)node.ChildNodes).AddNodeByPosition(2);

            //Add Text
            chNode.TextFrame.Text = "Sample Text Added";

            //Save Presentation
            pres.Save(dataDir+ "AddSmartArtNodeByPosition.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:31,代码来源:AddNodesSpecificPosition.cs

示例7: ApplyThemeToPresentation

        public static void ApplyThemeToPresentation(string presentationFile, string outputFile)
        {
            //Instantiate Presentation class to load the source presentation file
            Presentation srcPres = new Presentation(presentationFile);

            //Instantiate Presentation class for destination presentation (where slide is to be cloned)
            Presentation destPres = new Presentation(outputFile);

            //Instantiate ISlide from the collection of slides in source presentation along with
            //master slide
            ISlide SourceSlide = srcPres.Slides[0];

            //Clone the desired master slide from the source presentation to the collection of masters in the
            //destination presentation
            IMasterSlideCollection masters = destPres.Masters;
            IMasterSlide SourceMaster = SourceSlide.LayoutSlide.MasterSlide;

            //Clone the desired master slide from the source presentation to the collection of masters in the
            //destination presentation
            IMasterSlide iSlide = masters.AddClone(SourceMaster);

            //Clone the desired slide from the source presentation with the desired master to the end of the
            //collection of slides in the destination presentation
            ISlideCollection slds = destPres.Slides;
            slds.AddClone(SourceSlide, iSlide, true);

            //Clone the desired master slide from the source presentation to the collection of masters in the//destination presentation
            //Save the destination presentation to disk
            destPres.Save(outputFile, SaveFormat.Pptx);
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:30,代码来源:Program.cs

示例8: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            // Instantiate Prseetation class that represents the PPTX
            using (Presentation pres = new Presentation())
            {

                // Get the first slide
                ISlide sld = pres.Slides[0];

                // Add autoshape of rectangle type
                IShape shp = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 150, 75, 150);

                // Set the fill type to Pattern
                shp.FillFormat.FillType = FillType.Pattern;

                // Set the pattern style
                shp.FillFormat.PatternFormat.PatternStyle = PatternStyle.Trellis;

                // Set the pattern back and fore colors
                shp.FillFormat.PatternFormat.BackColor.Color = Color.LightGray;
                shp.FillFormat.PatternFormat.ForeColor.Color = Color.Yellow;

                //Write the PPTX file to disk
                pres.Save(dataDir + "RectShpPatt_out.pptx", SaveFormat.Pptx);
            }
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:34,代码来源:FillShapesPattern.cs

示例9: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Tables();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            Presentation pres = new Presentation();

            ISlide slide = pres.Slides[0];
            double[] colWidth = { 100, 50, 30 };
            double[] rowHeight = { 30, 50, 30 };

            ITable table = slide.Shapes.AddTable(100, 100, colWidth, rowHeight);

            table.Rows.RemoveAt(1, false);
            table.Columns.RemoveAt(1, false);


            pres.Save(dataDir + "TestTable_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);


        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:26,代码来源:RemovingRowColumn.cs

示例10: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            //Instantiate a Presentation object that represents a PPTX file
            using (Presentation pres = new Presentation(dataDir + "ParagraphsAlignment.pptx"))
            {

                //Accessing first slide
                ISlide slide = pres.Slides[0];

                //Accessing the first and second placeholder in the slide and typecasting it as AutoShape
                ITextFrame tf1 = ((IAutoShape)slide.Shapes[0]).TextFrame;
                ITextFrame tf2 = ((IAutoShape)slide.Shapes[1]).TextFrame;

                //Change the text in both placeholders
                tf1.Text = "Center Align by Aspose";
                tf2.Text = "Center Align by Aspose";

                //Getting the first paragraph of the placeholders
                IParagraph para1 = tf1.Paragraphs[0];
                IParagraph para2 = tf2.Paragraphs[0];

                //Aligning the text paragraph to center
                para1.ParagraphFormat.Alignment = TextAlignment.Center;
                para2.ParagraphFormat.Alignment = TextAlignment.Center;

                //Writing the presentation as a PPTX file
                pres.Save(dataDir + "Centeralign.pptx", SaveFormat.Pptx);
            }
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:32,代码来源:ParagraphsAlignment.cs

示例11: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            //Instantiate Presentation class that represents the PPTX
            using (Presentation pres = new Presentation())
            {

                //Get the first slide
                ISlide sld = pres.Slides[0];

                //Instantiate the ImageEx class
                System.Drawing.Image img = (System.Drawing.Image)new Bitmap(dataDir+ "aspose-logo.jpg");
                IPPImage imgx = pres.Images.AddImage(img);

                //Add Picture Frame with height and width equivalent of Picture
                IPictureFrame pf = sld.Shapes.AddPictureFrame(ShapeType.Rectangle, 50, 150, imgx.Width, imgx.Height, imgx);

                //Apply some formatting to PictureFrameEx
                pf.LineFormat.FillFormat.FillType = FillType.Solid;
                pf.LineFormat.FillFormat.SolidFillColor.Color = Color.Blue;
                pf.LineFormat.Width = 20;
                pf.Rotation = 45;

                //Write the PPTX file to disk
                pres.Save(dataDir+ "RectPicFrameFormat.pptx", SaveFormat.Pptx);
            }
        }
开发者ID:nausherwan-aslam,项目名称:Aspose_Slides_NET,代码行数:34,代码来源:PictureFrameFormatting.cs

示例12: Main

        static void Main(string[] args)
        {
            string FileName = @"E:\Aspose\Aspose Vs VSTO\Aspose.Slides Vs VSTO Presentations v 1.1\Sample Files\Removing Row Or Column in Table.pptx";
            string ImageFile = @"E:\Aspose\Aspose Vs VSTO\Aspose.Slides Vs VSTO Presentations v 1.1\Sample Files\AsposeLogo.jpg";

            Presentation MyPresentation = new Presentation(FileName);

            //Get First Slide
            ISlide sld = MyPresentation.Slides[0];

            //Creating a Bitmap Image object to hold the image file
            System.Drawing.Bitmap image = new Bitmap(ImageFile);

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

            foreach (IShape shp in sld.Shapes)
                if (shp is ITable)
                {
                    ITable tbl = (ITable)shp;

                    //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
            MyPresentation.Save(FileName, Export.SaveFormat.Pptx);
        }
开发者ID:horazius17,项目名称:Aspose_Slides_NET,代码行数:29,代码来源:Program.cs

示例13: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Shapes();

            // Instantiate Presentation class that represents the PPTX
            Presentation pres = new Presentation();

            // Get the first slide
            ISlide sld = pres.Slides[0];

            // Add autoshape of rectangle type
            IShape shp1 = sld.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 40, 150, 50);
            IShape shp2 = sld.Shapes.AddAutoShape(ShapeType.Moon, 160, 40, 150, 50);
            shp2.FillFormat.FillType = FillType.Solid;
            shp2.FillFormat.SolidFillColor.Color = Color.Gray;

            for (int i = 0; i < sld.Shapes.Count; i++)
            {
                var shape = sld.Shapes[i] as AutoShape;
                if (shape != null)
                {
                    AutoShape ashp = shape;
                    ashp.AlternativeText = "User Defined";
                }
            }

            // Save presentation to disk
            pres.Save(dataDir + "Set_AlternativeText_out.pptx", SaveFormat.Pptx);

        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:31,代码来源:SetAlternativeText.cs

示例14: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Slides_Presentations_Background();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

            // Instantiate the Presentation class that represents the presentation file
            using (Presentation pres = new Presentation())
            {

                // Set the background color of the Master ISlide to Forest Green
                pres.Masters[0].Background.Type = BackgroundType.OwnBackground;
                pres.Masters[0].Background.FillFormat.FillType = FillType.Solid;
                pres.Masters[0].Background.FillFormat.SolidFillColor.Color = Color.ForestGreen;

                // Write the presentation to disk
                pres.Save(dataDir + "SetSlideBackgroundMaster_out.pptx", SaveFormat.Pptx);

            }
 
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:25,代码来源:SetSlideBackgroundMaster.cs

示例15: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_Text();

            // Create Empty presentation instance// Create Empty presentation instance
            using (Presentation pres = new Presentation())
            {
                // Acesss the default first slide of presentation
                ISlide slide = pres.Slides[0];

                // Adding the AutoShape to accomodate the HTML content
                IAutoShape ashape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, pres.SlideSize.Size.Width - 20, pres.SlideSize.Size.Height - 10);

                ashape.FillFormat.FillType = FillType.NoFill;

                // Adding text frame to the shape
                ashape.AddTextFrame("");

                // Clearing all paragraphs in added text frame
                ashape.TextFrame.Paragraphs.Clear();

                // Loading the HTML file using stream reader
                TextReader tr = new StreamReader(dataDir + "file.html");

                // Adding text from HTML stream reader in text frame
                ashape.TextFrame.Paragraphs.AddFromHtml(tr.ReadToEnd());

                // Saving Presentation
                pres.Save(dataDir + "output_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

            }
 
        }
开发者ID:aspose-slides,项目名称:Aspose.Slides-for-.NET,代码行数:34,代码来源:ImportingHTMLText.cs


注:本文中的Presentation.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。