using Spire.Presentation; using Spire.Presentation.Drawing;
Presentation presentation = new Presentation(); presentation.Slides.Append();
string ImageFile = @"C:\Users\Administrator\Pictures\01.jpg"; RectangleF rect = new RectangleF(350, 100, 300, 250); presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect); presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
RectangleF rect2 = new RectangleF(50, 100, 300, 250);
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, rect2);
shape.Fill.FillType = FillFormatType.None;
shape.ShapeStyle.LineColor.Color = Color.White;
//添加文本到形状中
shape.TextFrame.Text = "大熊猫是哺乳动物,已在地球上生存了至少800万年,被誉为活化石和中国国宝,世界自然基金会的形象大使,是世界生物多样性保护的旗舰物种。据第三次全国大熊猫野外种群调查,全世界野生大熊猫已不足1600只,属于中国国家一级保护动物。";
TextRange textRange = shape.TextFrame.TextRange;
shape.TextFrame.Paragraphs[0].Alignment = TextAlignmentType.Left;
//设置文本字体
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Black;
textRange.LatinFont = new TextFont("Arial Black"
presentation.SaveToFile(@"C:\Users\Administrator\Desktop\result.pptx ", FileFormat.Pptx2010); System.Diagnostics.Process.Start(@"C:\Users\Administrator\Desktop\result.pptx ");
using System;
using System.Drawing;
using System.Windows.Forms;
using Spire.Presentation;
using Spire.Presentation.Drawing;
namespace InsertimageinPowerPointFille
{
public partial class Form : Form
{
public Form()
{
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
//新建PPT
Presentation presentation = new Presentation();
presentation.Slides.Append();
//插入第一张图片到第一张幻灯片
string ImageFile = @"C:\Users\Administrator\Pictures\.jpg";
RectangleF rect = new RectangleF(, , , );
presentation.Slides[].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
presentation.Slides[].Shapes[].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
//添加形状
RectangleF rect = new RectangleF(, , , );
IAutoShape shape = presentation.Slides[].Shapes.AppendShape(ShapeType.Rectangle, rect);
shape.Fill.FillType = FillFormatType.None;
shape.ShapeStyle.LineColor.Color = Color.White;
//添加文本到形状中
shape.TextFrame.Text = "大熊猫是哺乳动物,已在地球上生存了至少万年,被誉为活化石和中国国宝,世界自然基金会的形象大使,是世界生物多样性保护的旗舰物种。据第三次全国大熊猫野外种群调查,全世界野生大熊猫已不足只,属于中国国家一级保护动物。";
TextRange textRange = shape.TextFrame.TextRange;
shape.TextFrame.Paragraphs[].Alignment = TextAlignmentType.Left;
//设置文本字体
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Black;
textRange.LatinFont = new TextFont("Arial Black");
//插入第二张图片到第二张幻灯片
string ImageFile = @"C:\Users\Administrator\Pictures\.jpg";
RectangleF rect = new RectangleF(, , , );
presentation.Slides[].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
presentation.Slides[].Shapes[].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
//添加形状
RectangleF rect = new RectangleF(, , , );
IAutoShape shape = presentation.Slides[].Shapes.AppendShape(ShapeType.Rectangle, rect);
shape.Fill.FillType = FillFormatType.Solid;
shape.Fill.FillType = FillFormatType.None;
shape.ShapeStyle.LineColor.Color = Color.White;
//添加文本到形状中
shape.TextFrame.Text = "黑白相间的外表,有利隐蔽在密林的树上和积雪的地面而不易被天敌发现。相对锋利的爪和发达有力的前后肢,有利于大熊猫能快速爬上高大的乔木。";
TextRange textRange = shape.TextFrame.TextRange;
//设置文本字体
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Blue;
textRange.LatinFont = new TextFont("Arial Black");
//保存文件
presentation.SaveToFile(@"C:\Users\Administrator\Desktop\result.pptx ", FileFormat.Pptx);
System.Diagnostics.Process.Start(@"C:\Users\Administrator\Desktop\result.pptx ");
}
}
}
using Spire.Presentation;
Presentation ppt = new Presentation(); ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\result.pptx");
for (int i = 0; i < ppt.Images.Count; i++)
{
Image image = ppt.Images[i].Image;
image.Save(string.Format(@"..\..\Images{0}.png", i));
}
using System;
using System.Drawing;
using System.Windows.Forms;
using Spire.Presentation;
namespace ExtractImagesfromPPT
{
public partial class Form : Form
{
public Form()
{
InitializeComponent();
}
private void button_Click(object sender, EventArgs e)
{
Presentation ppt = new Presentation();
ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\result.pptx");
for (int i = ; i < ppt.Images.Count; i++)
{
Image image = ppt.Images[i].Image;
image.Save(string.Format(@"..\..\Images{}.png", i));
}
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有