1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      C#怎么設(shè)置、刪除、讀取Word文檔背景

      這篇文章主要講解了“C#怎么設(shè)置、刪除、讀取Word文檔背景”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“C#怎么設(shè)置、刪除、讀取Word文檔背景”吧!

      目前成都創(chuàng)新互聯(lián)公司已為上千的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬空間、網(wǎng)站運(yùn)營(yíng)、企業(yè)網(wǎng)站設(shè)計(jì)、文縣網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。

      Spire.Cloud.Word.Sdk提供了接口SetBackgroudColor()、SetBackgroudImage()、DeleteBackground()、GetBackgroudColor()用于設(shè)置、刪除及讀取Word文檔背景。本文將以C#程序?yàn)槔菔救绾蝸碚{(diào)用API接口實(shí)現(xiàn)以上內(nèi)容操作。

      必要步驟:

      步驟一:dll文件獲取及導(dǎo)入。通過官網(wǎng) 下載SDK文件包。

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      下載后,解壓文件,將Spire.Cloud.Word.Sdk.dll文件及其他三個(gè)dll添加引用至VS程序(如下圖);或者在程序中通過Nuget搜索安裝,直接導(dǎo)入。

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      步驟二:App ID及Key獲取。在 云端創(chuàng)建賬號(hào),并在“我的應(yīng)用”板塊中創(chuàng)建應(yīng)用以獲得App ID及App Key。

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      步驟三:源文檔上傳。在“文檔管理”板塊,上傳源文檔。這里如果想方便文檔管理,可以新建文件夾,將源文檔及結(jié)果文檔分別保存至相應(yīng)的文件夾下。不建文件夾時(shí),源文檔及結(jié)果文檔直接保存在根目錄。本文示例中,建了兩個(gè)文件夾,分別用于存放源文檔及結(jié)果文檔。

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      【示例1】設(shè)置背景顏色

      using Spire.Cloud.Word;
      using Spire.Cloud.Word.Sdk.Api;
      using Spire.Cloud.Word.Sdk.Client;
      using Spire.Cloud.Word.Sdk.Model;
      using System;
       
      namespace BackgroundColor
      {
          class Program
          {
              static String appId = "App ID";
              static String appKey = "App Key";
              static void Main(string[] args)
              {
                  //配置賬號(hào)信息
                  Configuration wordConfiguration = new Configuration(appId, appKey);
       
                  //創(chuàng)建BackgroundApi實(shí)例
                  BackgroundApi backgroundApi = new BackgroundApi(wordConfiguration);
                  
                  //源文檔
                  var fileName = "testfile.docx";            
                  string name = fileName;
       
                  //源文檔所在文件夾,若沒有文件夾則設(shè)置為null
                  string folder = "input";
       
                  //設(shè)置背景顏色RGB值
                  Color color = new Color(255, 255, 205);
       
                  //設(shè)置文檔密碼,如果沒有密碼,則設(shè)置為null
                  string password = null;
       
                  //使用冰藍(lán)云配置的2G空間存貯文檔,可設(shè)置為null
                  string storage = null;
       
                  //設(shè)置生成文檔的路徑及文檔名稱
                  string destFilePath = "output/BackgroundColor.docx";
       
                  //調(diào)用方法設(shè)置背景顏色
                  backgroundApi.SetBackgroudColor(name,color, folder, storage, password, destFilePath);            
              }
          }
      }

      背景顏色設(shè)置結(jié)果:

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      【示例2】設(shè)置背景圖片

      using Spire.Cloud.Word.Sdk;
      using Spire.Cloud.Word.Sdk.Api;
      using Spire.Cloud.Word.Sdk.Client;
      using System;
       
       
      namespace BackgroundImg
      {
          class Program
          {
              static String appId = "App ID";
              static String appKey = "App Key";
              static void Main(string[] args)
              {
                  //配置賬號(hào)信息
                  Configuration wordConfiguration = new Configuration(appId, appKey);
       
                  //創(chuàng)建BackgroundApi實(shí)例
                  BackgroundApi backgroundApi = new BackgroundApi(wordConfiguration);
       
                  //源文檔及圖片
                  var fileName = "testfile.docx";
                  var imageName = "ss.png";
                  string name = fileName;
       
                  //源文檔所在文件夾,若沒有文件夾則設(shè)置為null
                  string folder = "input";
                  string imagePath = "input" + "/"+ imageName;
       
                  //設(shè)置文檔密碼,如果沒有密碼,則設(shè)置為null
                  string password = null;
       
                  //使用冰藍(lán)云配置的2G空間存貯文檔,可設(shè)置為null
                  string storage = null;
       
                  //設(shè)置生成文檔的路徑及文檔名稱
                  string destFilePath = "output/BackgroundImg.docx";
       
                  //調(diào)用方法設(shè)置背景
                  backgroundApi.SetBackgroudImage(name, imagePath, folder, storage, password, destFilePath);
              }
          }
      }

      背景圖片設(shè)置效果:

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      【示例3】刪除背景(包括背景顏色及背景圖片)

      using Spire.Cloud.Word.Sdk;
      using Spire.Cloud.Word.Sdk.Api;
      using Spire.Cloud.Word.Sdk.Client;
      using System;
       
      namespace DeleteBackground
      {
          class Program
          {
              static String appId = "App ID";
              static String appKey = "App Key";
              static void Main(string[] args)
              {
                  //配置賬號(hào)信息
                  Configuration wordConfiguration = new Configuration(appId, appKey);
       
                  //創(chuàng)建BackgroundApi實(shí)例
                  BackgroundApi backgroundApi = new BackgroundApi(wordConfiguration);
       
                  //源文檔
                  var fileName = "BackgroundImg.docx";
                  string name = fileName;
       
                  //源文檔所在文件夾,若沒有文件夾則設(shè)置為null
                  string folder = "output";
       
                  //設(shè)置文檔密碼,如果沒有密碼,則設(shè)置為null
                  string password = null;
       
                  //使用冰藍(lán)云配置的2G空間存貯文檔,可設(shè)置為null
                  string storage = null;
       
                  //設(shè)置生成文檔的路徑及文檔名稱
                  string destFilePath = "output/DeleteBackground.docx";
       
                  //調(diào)用方法刪除文檔中背景
                  backgroundApi.DeleteBackground(name, password, folder, storage, destFilePath);
              }
          }
      }

      文檔背景刪除效果:

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      【示例4】讀取背景顏色

      using Spire.Cloud.Word.Sdk.Api;
      using Spire.Cloud.Word.Sdk.Client;
      using Spire.Cloud.Word.Sdk.Model;
      using System;
       
      namespace GetBackground
      {
          class Program
          {
              static String appId = "App ID";
              static String appKey = "App Key";
              static void Main(string[] args)
              {
                  //配置賬號(hào)信息
                  Configuration wordConfiguration = new Configuration(appId, appKey);
       
                  //創(chuàng)建BackgroundApi實(shí)例
                  BackgroundApi backgroundApi = new BackgroundApi(wordConfiguration);
       
                  //源文檔
                  var fileName = "BackgroundColor.docx";         
                  string name = fileName;            
       
                  //源文檔密碼,若無密碼可設(shè)置為null
                  string password = null;
       
                  //源文檔所在文件夾,若沒有文件夾則設(shè)置為null
                  string folder = "output";
       
                  //使用冰藍(lán)云配置的2G空間存貯文檔,可設(shè)置為null
                  string storage = null;
                  
                  //獲取文檔背景色
                  System.Console.WriteLine(backgroundApi.GetBackgroudColor(name, password, folder, storage));
                  System.Console.ReadLine();       
              }
          }
      }

      背景色讀取結(jié)果:

      C#怎么設(shè)置、刪除、讀取Word文檔背景

      感謝各位的閱讀,以上就是“C#怎么設(shè)置、刪除、讀取Word文檔背景”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)C#怎么設(shè)置、刪除、讀取Word文檔背景這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!


      網(wǎng)站名稱:C#怎么設(shè)置、刪除、讀取Word文檔背景
      標(biāo)題鏈接:http://www.ef60e0e.cn/article/gpcppc.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        锡林郭勒盟| 丽水市| 九台市| 河池市| 泽州县| 页游| 龙门县| 连云港市| 成都市| 梨树县| 奉贤区| 萨迦县| 灌阳县| 固始县| 黄冈市| 屏东市| 迁安市| 嵊泗县| 兴海县| 龙江县| 通辽市| 英德市| 徐汇区| 霍州市| 北辰区| 包头市| 泸定县| 凌海市| 赤城县| 申扎县| 浠水县| 安仁县| 丰台区| 托里县| 横山县| 四子王旗| 东丰县| 巫溪县| 额尔古纳市| 景洪市| 大城县|