首页betway必威体育app官网 › C#/VBbetway必威体育app官网.NET 向PowerPoint文书档案插入录制

C#/VBbetway必威体育app官网.NET 向PowerPoint文书档案插入录制

 

Spire.Presentation for
.NET是一款专业的PowerPoint包容组件,使开发职员能够在.NET平台(C#,VB.NET,ASP.NET)上成立,读,写,修改,转换和打印PowerPoint文档,并且不需求设置Microsoft
PowerPoint软件。Spire.Presentation for .NET
匡助的格式有PPT,PPS,PPTX及PPSX。它提供了不少实用的功力,如管理文件,图像,形状,表格,动画,音频和录像等。别的,它还支持将幻灯片导出为EMF,JPG,TIFF,PDF等格式。

betway必威体育app官网 1                       

上边是事无巨细步骤:

一切代码:

步骤2:使用presentation.Slides[0].Shapes.AppendVideoMedia()方法来插入摄像。

今昔,Microsoft Office
PowerPoint在大家常常生活中的应用已经很普遍了,利用Microsoft Office
PowerPoint不仅能够创立示范文稿,还足以在互连网上进行面对面会议、远程会议或在网上给观众展现演示文稿等。那么,怎么着做出有趣、生动、美观的PowerPoint文档呢?在那之中三个很好的挑三拣四正是向文书档案中插入录像。那样能够使读者更好地明白文书档案的始末,增添读者的兴味。那么开发者怎样通过编制程序的办法来落到实处这一效率吗?本文将给我们分享什么接纳免费版PowerPoint组件—betway必威体育app官网,Spire.Presentation以C#/VB.NET编制程序的格局来向PPT文档插入摄像。

瞩目:在创设项目后,添加相关.dll文件作为项目引用。

Presentation presentation = new Presentation();

C#:

IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 150, 600, 250));  //用户可以根据自己的需要来设置参数的大小

presentation.SaveToFile("video.pptx", FileFormat.Pptx2010);
Imports System.Drawing
Imports System.IO
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Module Module1

    Sub Main()
        Dim presentation As New Presentation()

        '设置背景图片
        Dim ImageFile As String = "花朵.jpg"
        Dim rect As New RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height)
        presentation.Slides(0).Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect)
        presentation.Slides(0).Shapes(0).Line.FillFormat.SolidFillColor.Color = Color.FloralWhite

        presentation.Slides(0).Shapes.AppendVideoMedia("小毛驴.mp4", New RectangleF(100, 100, 20, 20))

        Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 150, 600, 250))
        shape.ShapeStyle.LineColor.Color = Color.White
        shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None
        shape.AppendTextFrame("我有一只小毛驴我从来也不骑,有一天我心血来潮骑着去赶集,")

        shape.TextFrame.Paragraphs.Append(New TextParagraph())
        shape.TextFrame.Paragraphs(1).TextRanges.Append(New TextRange("我手里拿着小皮鞭我心里正得意,不知怎么哗啦啦啦我摔了一身泥。"))
        For Each para As TextParagraph In shape.TextFrame.Paragraphs
            para.TextRanges(0).LatinFont = New TextFont("Arial Rounded MT Bold")
            para.TextRanges(0).Fill.FillType = FillFormatType.Solid
            para.TextRanges(0).Fill.SolidColor.Color = Color.Black
            para.Alignment = TextAlignmentType.Left
            para.Indent = 35
        Next

        presentation.SaveToFile("video.pptx", FileFormat.Pptx2010)
        System.Diagnostics.Process.Start("video.pptx")
    End Sub

End Module

效果图:

代码片段:

VB.NET:

 

步骤3:累加形象来显示文本并保留PPT文书档案。

步骤1:新建三个PPT文档。

 

有亟待的对象能够从E-iceblue官网下载安装。

presentation.Slides[0].Shapes.AppendVideoMedia(@"小毛驴.mp4", new RectangleF(100, 100, 20, 20));  //用户可以根据自己的需要来设置参数的大小

Spire.Presentation简介

using System.Drawing;

using System.IO;

using Spire.Presentation;

using Spire.Presentation.Drawing;

namespace InsertVideo

{

    class Program

    {

        static void Main(string[] args)

        {

            Presentation presentation = new Presentation();



            //设置背景图片

            string ImageFile = @"花朵.jpg";

            RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);

            presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);

            presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;



            presentation.Slides[0].Shapes.AppendVideoMedia(@"小毛驴.mp4", new RectangleF(100, 100, 20, 20));



            IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 150, 600, 250));

            shape.ShapeStyle.LineColor.Color = Color.White;

            shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;

            shape.AppendTextFrame("我有一只小毛驴我从来也不骑,有一天我心血来潮骑着去赶集,");



            shape.TextFrame.Paragraphs.Append(new TextParagraph());

            shape.TextFrame.Paragraphs[1].TextRanges.Append(new TextRange("我手里拿着小皮鞭我心里正得意,不知怎么哗啦啦啦我摔了一身泥。"));

            foreach (TextParagraph para in shape.TextFrame.Paragraphs)

            {

                para.TextRanges[0].LatinFont = new TextFont("Arial Rounded MT Bold");

                para.TextRanges[0].Fill.FillType = FillFormatType.Solid;

                para.TextRanges[0].Fill.SolidColor.Color = Color.Black;

                para.Alignment = TextAlignmentType.Left;

                para.Indent = 35;

            }



            presentation.SaveToFile("video.pptx", FileFormat.Pptx2010);

            System.Diagnostics.Process.Start("video.pptx");

        }

    }

}

转载本站文章请注明出处:bway883.com https://www.piworx.com/?p=6265

上一篇:

下一篇:

相关文章

网站地图xml地图