欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

C#如何基于Spire.Cloud.Word添加Word水印

這篇文章將為大家詳細(xì)講解有關(guān)C#如何基于Spire.Cloud.Word添加Word水印,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括沙坡頭網(wǎng)站建設(shè)、沙坡頭網(wǎng)站制作、沙坡頭網(wǎng)頁制作以及沙坡頭網(wǎng)絡(luò)營(yíng)銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,沙坡頭網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到沙坡頭省份的部分城市,未來相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

概述

Spire.Cloud.Word提供了watermarksApi接口可用于添加水印,包括添加文本水?。⊿etTextWatermark)、圖片水?。⊿etImageWatermark),本文將對(duì)此做詳細(xì)介紹。

關(guān)于Spire.Cloud

Spire.Cloud是云端 Office 文檔處理軟件,支持在線創(chuàng)建、編輯、保存和打印 Office (Word / Excel / PPT) 文檔,支持 .NET、Java、PHP、Python、JavaScript 等多種編程語言,可操作包括DOC、DOCX、XLS、XLSX、PPT、PPTX、PDF等格式的文檔。

可調(diào)用Spire.Cloud Web API SDK 提供的接口對(duì) Word、Excel、PPT、PDF 文檔進(jìn)行操作,本文以在VS程序中通過調(diào)用Spire.Cloud.Word.SDK來操作Word文檔為例,添加水印。

具體步驟:

步驟1:dll文件獲取及引用。

方法1:通過官網(wǎng)下載Spire.Cloud.Word.Sdk 。

方法2:通過Nuget網(wǎng)站下載獲取Spire.Cloud.Word.SDK package,并將Spire.Cloud.Word.Sdk.dll及其依賴項(xiàng)的dll添加引用至程序(如下圖);或者在VS程序中通過Nuget搜索安裝,具體步驟可參考這里。

C#如何基于Spire.Cloud.Word添加Word水印

步驟2:ID及Key獲取。在冰藍(lán)云網(wǎng)頁注冊(cè)賬號(hào)并登陸,在“我的應(yīng)用”板塊創(chuàng)建應(yīng)用程序,獲得 App ID 及 App Key。

步驟3:文件路徑設(shè)置。在冰藍(lán)云網(wǎng)頁“我的文檔”板塊,分別建立input和output兩個(gè)文件夾,并將測(cè)試的Word文檔和圖片添加在input文件夾下。通過VS代碼程序,生成的帶水印的Word文檔會(huì)直接保存至output文件夾下。具體代碼操作方法,請(qǐng)參考以下內(nèi)容。

 【示例1】添加Word文本水印

using Spire.Cloud.Word.Sdk;
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Model;
using System;
 
namespace txtwatermark
{
    class Program
    {
        
        static String appId = "應(yīng)用程序App ID";
        static String appKey = "應(yīng)用程序App Key";
        static void Main(string[] args)
        {
            //配置賬號(hào)信息
            Configuration wordConfiguration = new Configuration(appId, appKey);
 
            //創(chuàng)建TablesApi實(shí)例
            WatermarksApi watermarksApi = new WatermarksApi(wordConfiguration);
 
            //設(shè)置文件夾、測(cè)試文檔、水印字樣及水印樣式等
            string inputfolder = "input";
            string storage = null;
            string password = null;
            var document = "testfile.docx";
            string name = document;
            TextWatermark body = new TextWatermark("Watermark")
            {
                Layout = TextWatermark.LayoutEnum.Diagonal,                
                Font = new Font(60, "宋體")
                {
                    Color = new Color(100, 100, 100)
                }
            };
 
            //調(diào)用SetTextWatermark接口添加文本水印到Word文檔 ,并保存到指定文件路徑
            string destFilePath = "output/SetTextWatermark.docx";
            watermarksApi.SetTextWatermark(name, body, inputfolder, storage, password, destFilePath);
 
        }
    }
}

文本水印添加效果:

C#如何基于Spire.Cloud.Word添加Word水印

【示例2】添加圖片水印

using Spire.Cloud.Word.Sdk;
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;
using System;
 
namespace ImgWatermark
{
    class Program
    {
        static String appId = "應(yīng)用程序App ID ";
        static String appKey = "應(yīng)用程序App Key ";
        static void Main(string[] args)
        {
            //配置賬號(hào)信息
            Configuration wordConfiguration = new Configuration(appId, appKey);
 
            //創(chuàng)建TablesApi實(shí)例
            WatermarksApi watermarksApi = new WatermarksApi(wordConfiguration);
 
            //設(shè)置文件夾、測(cè)試文檔、用于水印的圖片及水印樣式等
            string inputfolder = "input";
            string storage = null;
            int scaling = 120;
            bool washout = true;
            string password = null;
 
            var document = "testfile.docx";
            string name = document;
            string imagePath = "input/logo.png";
            
 
            //調(diào)用SetImageWatermark接口添加圖片水印到Word文檔 ,并保存到指定文件路徑
            string destFilePath = "output/SetImageWatermark.docx";
            watermarksApi.SetImageWatermark(name, imagePath, inputfolder, storage, scaling, washout, password, destFilePath);
        }
    }
}

圖片水印添加效果:

C#如何基于Spire.Cloud.Word添加Word水印

關(guān)于“C#如何基于Spire.Cloud.Word添加Word水印”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

文章題目:C#如何基于Spire.Cloud.Word添加Word水印
網(wǎng)頁鏈接:http://chinadenli.net/article4/pipcie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營(yíng)銷、自適應(yīng)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、商城網(wǎng)站、網(wǎng)站策劃、品牌網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化