久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

如何調用shapesApi接口操作Word形狀

這篇文章主要為大家詳細介紹了調用shapesApi接口操作Word形狀的方法,圖文詳解容易學習,非常適合初學者入門,感興趣的小伙伴們可以參考一下。

成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站建設、網(wǎng)站設計與策劃設計,善左網(wǎng)站建設哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設10年,網(wǎng)設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:善左等地區(qū)。善左做網(wǎng)站價格咨詢:18982081108

步驟一:dll文件獲取及導入。通過官網(wǎng)本地下載SDK文件包。(須在e-iceblue中國官網(wǎng)在線編輯板塊中注冊賬號并登錄)

如何調用shapesApi接口操作Word形狀

下載后,解壓文件,將Spire.Cloud.Word.Sdk.dll文件及其他三個dll添加引用至VS程序;或者在程序中通過Nuget搜索下載,直接導入所有dll。dll引用結果如下圖所示:
如何調用shapesApi接口操作Word形狀
步驟二:App ID及Key獲取。在“我的應用”板塊中創(chuàng)建應用以獲得App ID及App Key。
如何調用shapesApi接口操作Word形狀
步驟三:源文檔上傳。在“文檔管理”板塊,上傳源文檔。這里可以建文件夾,將文檔存放在文件夾下。不建文件夾時,源文檔及結果文檔直接保存在根目錄。本文示例中,建了兩個文件夾,分別用于存放源文檔及結果文檔。(云平臺提供免費1 萬次調用次數(shù)和 2G 文檔內存)
如何調用shapesApi接口操作Word形狀


C# 代碼示例
1. 添加形狀到Word

using System;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Model;

namespace AddShape
{
    class Program
    {
        static string appId = "App ID";
        static string appKey = "App Key";
        static void Main(string[] args)
        {
            //配置AppID和AppKey
            Configuration wordConfiguration = new Configuration(appId, appKey);

            //實例化ShapesApi類
            ShapesApi shapesApi = new ShapesApi(wordConfiguration);

            string name = "test.docx";//源文檔
            string paragraphPath = "sections/0/paragraphs/0";//段落路徑
            int indexInParagraph = 1;//添加形狀的段落
            string folder = "input";//源文檔所在文件夾
            string storage = null;//使用冰藍云配置的2G空間存貯文檔,可設置為null
            string password = null;//源文檔密碼

            //設置形狀屬性(包括形狀類型、位置、填充顏色、旋轉方向、邊框寬度/顏色、文本環(huán)繞類型/方式
            ShapeFormat shapeProperties = new ShapeFormat(50, 50, ShapeFormat.ShapeTypeEnum.Star)
            {
                HorizontalOrigin = ShapeFormat.HorizontalOriginEnum.Page,
                VerticalOrigin = ShapeFormat.VerticalOriginEnum.Page,
                VerticalPosition = 40,
                HorizontalPosition = 230,
                FillColor = new Color(255, 69, 0),
                Rotation = 45,
                StrokeWeight = 2,
                StrokeColor = new Color(255, 255, 0),
                TextWrappingType = ShapeFormat.TextWrappingTypeEnum.Both,
                TextWrappingStyle = ShapeFormat.TextWrappingStyleEnum.InFrontOfText,
                ZOrder = 1
            };
            string destFilePath = "output/AddShape.docx";//結果文檔路徑

            //調用方法添加形狀
            shapesApi.AddShape(name, paragraphPath, shapeProperties, folder, storage, indexInParagraph, password, destFilePath);
        }
    }
}

形狀添加效果:
如何調用shapesApi接口操作Word形狀

2. 刪除Word中的形狀

using System;
using Spire.Cloud.Word.Sdk.Api;
using Spire.Cloud.Word.Sdk.Client;

namespace DeleteShape
{
    class Program
    {
        static string appId = "App ID";
        static string appKey = "App Key";
        static void Main(string[] args)
        {
            //配置AppID和AppKey
            Configuration wordConfiguration = new Configuration(appId, appKey);

            //實例化ShapesApi類
            ShapesApi shapesApi = new ShapesApi(wordConfiguration);

            string name = "AddShape.docx";//源文檔
            string paragraphPath = "sections/0/paragraphs/0";//段落路徑
            int index = 0;//要刪除形狀的索引
            string folder = "output";//源文檔所在文件夾
            string storage = null;//使用冰藍云配置的2G空間存貯文檔,可設置為null
            string password = null;//源文檔密碼

            string destFilePath = "output/DeleteShape.docx";//結果文檔路徑

            //調用方法刪除形狀
            shapesApi.DeleteShape(name, paragraphPath, index, folder, storage, password, destFilePath);
        }
    }
}

形狀刪除效果:
如何調用shapesApi接口操作Word形狀
3. 讀取Word形狀屬性

using System;
using Spire.Cloud.Word.Sdk.Client;
using Spire.Cloud.Word.Sdk.Api;

namespace GetShapeProperties
{
    class Program
    {
        static string appId = "App ID";
        static string appKey = "App Key";
        static void Main(string[] args)
        {
            //配置AppID和AppKey
            Configuration wordConfiguration = new Configuration(appId, appKey);

            //實例化ShapesApi類
            ShapesApi shapesApi = new ShapesApi(wordConfiguration);

            string name = "AddShape.docx";//源文檔
            string paragraphPath = "sections/0/paragraphs/0"; 
            int index = 0;//讀取的形狀索引
            string folder = "output";//源文檔所在文件夾
            string storage = null;//使用冰藍云配置的2G空間存貯文檔,可設置為null
            string password = null;//源文檔密碼

            //讀取屬性
            System.Console.WriteLine(shapesApi.GetShapeProperties(name, paragraphPath, index, folder, storage, password));
            System.Console.ReadLine();

        }
    }
}

屬性讀取結果:
如何調用shapesApi接口操作Word形狀

以上就是調用shapesApi接口操作Word形狀方法的詳細介紹,看完之后是否有所收獲呢?如果想了解更多相關內容,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊!

分享標題:如何調用shapesApi接口操作Word形狀
本文鏈接:http://sd-ha.com/article28/jsjsjp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設計、靜態(tài)網(wǎng)站、云服務器ChatGPT、網(wǎng)站建設、面包屑導航

廣告

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

營銷型網(wǎng)站建設