国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語(yǔ)言|JavaScript|易語(yǔ)言|vb.net|

服務(wù)器之家 - 編程語(yǔ)言 - C# - C#如何添加PPT背景

C#如何添加PPT背景

2022-02-27 15:41E-iceblue C#

這篇文章主要為大家詳細(xì)介紹了C#如何添加PPT背景,添加純色背景、漸變色背景、圖片背景等,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

我們?cè)趧?chuàng)建powerpoint文檔時(shí),系統(tǒng)默認(rèn)的幻燈片是空白背景的,很多時(shí)候我們需要自定義幻燈片背景,以達(dá)到美觀的文檔效果。在下面的示例中將介紹給powerpoint幻燈片設(shè)置背景的方法,主要包含以下三個(gè)部分:

  • 添加純色背景
  • 添加漸變色背景
  • 添加圖片作為背景

所需工具

free spire.presentation for .net 版本3.3 (社區(qū)版)

示例代碼(供參考)

步驟 1 :添加如下using指令

?
1
2
3
using spire.presentation;
using spire.presentation.drawing;
using system.drawing;

步驟 2 :創(chuàng)建文檔

?
1
2
presentation ppt = new presentation();
ppt.loadfromfile("test.pptx");

步驟 3 :添加純色背景

?
1
2
3
4
//設(shè)置文檔的背景填充模式為純色填充
ppt.slides[0].slidebackground.type = backgroundtype.custom;
ppt.slides[0].slidebackground.fill.filltype = fillformattype.solid;
ppt.slides[0].slidebackground.fill.solidcolor.color = color.pink;

步驟 4 :添加漸變背景色

?
1
2
3
4
5
//設(shè)置文檔的背景填充模式為漸變色填充
ppt.slides[1].slidebackground.type = backgroundtype.custom;
ppt.slides[1].slidebackground.fill.filltype = fillformattype.gradient;
ppt.slides[1].slidebackground.fill.gradient.gradientstops.append(0f, knowncolors.yellow);
ppt.slides[1].slidebackground.fill.gradient.gradientstops.append(1f, knowncolors.orange);

步驟 5 :添加圖片作為背景

?
1
2
3
4
5
6
7
8
//設(shè)置幻燈片背景色為圖片背景
ppt.slides[2].slidebackground.type = spire.presentation.drawing.backgroundtype.custom;
ppt.slides[2].slidebackground.fill.filltype = fillformattype.picture;
ppt.slides[2].slidebackground.fill.picturefill.filltype = picturefilltype.stretch;
//加載圖片作為幻燈片背景
image img = image.fromfile("green.png");
iimagedata image = ppt.images.append(img);
ppt.slides[2].slidebackground.fill.picturefill.picture.embedimage = image;

步驟6 :保存文件

?
1
2
ppt.savetofile("result.pptx", fileformat.pptx2010);
system.diagnostics.process.start("result.pptx");

完成代碼后,調(diào)試運(yùn)行程序,生成文件,如下:

C#如何添加PPT背景

全部代碼:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using spire.presentation;
using spire.presentation.drawing;
using system.drawing;
 
namespace addbackground_ppt
{
  class program
  {
    static void main(string[] args)
    {
      //實(shí)例化presentation類,加載powerpoint文檔
      presentation ppt = new presentation();
      ppt.loadfromfile("test.pptx");
 
      //設(shè)置文檔的背景填充模式為純色填充
      ppt.slides[0].slidebackground.type = backgroundtype.custom;
      ppt.slides[0].slidebackground.fill.filltype = fillformattype.solid;
      ppt.slides[0].slidebackground.fill.solidcolor.color = color.pink;
 
      //設(shè)置文檔的背景填充模式為漸變色填充
      ppt.slides[1].slidebackground.type = backgroundtype.custom;
      ppt.slides[1].slidebackground.fill.filltype = fillformattype.gradient;
      ppt.slides[1].slidebackground.fill.gradient.gradientstops.append(0f, knowncolors.yellow);
      ppt.slides[1].slidebackground.fill.gradient.gradientstops.append(1f, knowncolors.orange);
 
      //設(shè)置幻燈片背景色為圖片背景
      ppt.slides[2].slidebackground.type = spire.presentation.drawing.backgroundtype.custom;
      ppt.slides[2].slidebackground.fill.filltype = fillformattype.picture;
      ppt.slides[2].slidebackground.fill.picturefill.filltype = picturefilltype.stretch;
      //加載圖片作為幻燈片背景
      image img = image.fromfile("green.png");
      iimagedata image = ppt.images.append(img);
      ppt.slides[2].slidebackground.fill.picturefill.picture.embedimage = image;
 
      //保存并打開(kāi)文檔
      ppt.savetofile("result.pptx", fileformat.pptx2010);
      system.diagnostics.process.start("result.pptx");
    }
  }
}

本文完。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:https://www.cnblogs.com/Yesi/archive/2018/07/26/9369849.html

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 国产成人在线视频 | 国产精品2区 | 国内精品一区二区三区 | 性视频网站免费 | 在线中文| 欧美日韩中文字幕 | 中文字幕在线免费看 | 日本在线免费视频 | 一区二区三区免费在线 | 国产亚洲精品精品国产亚洲综合 | 亚洲精品一区二区网址 | 久久久精品国产 | 二区在线视频 | 伊人伊人伊人 | 日韩高清中文字幕 | 日韩福利视频 | 最近免费中文字幕大全免费版视频 | 91免费看网站| 综合在线视频 | 成人乱人乱一区二区三区 | 成人h动漫精品一区二区樱花 | www.久| 国产精品中文字幕在线 | 亚洲成人一区二区三区 | 免费一看一级毛片 | 久久久精品网站 | 日韩欧美一区二区中文字幕 | 在线免费观看av的网站 | 中文字幕日韩欧美 | 91cn国产在线 | 狠狠搞狠狠干 | 91在线精品一区二区 | 日韩成人av在线 | 亚洲综合大片69999 | 欧美日韩伊人 | 91精品国产一区二区 | 日韩高清一区二区 | 激情小视频 | 亚洲啪啪 | 国产在线拍揄自揄拍视频 | 国产激情在线观看 |