Spire.Cloud提供了四种语言的SDK(包括.NET、Java、python、PHP),你可以Spire.Cloud Web SDK。
步骤1:dll文件获取及引用。下载获取Spire.Cloud.Word.SDK package,并将Spire.Cloud.Word.Sdk.dll及其依赖项的dll添加引用至程序(如下图)
步骤2:ID及Key获取。在冰蓝云 页注册账 并登陆,在“我的应用”板块创建应用程序,获得 App ID 及 App Key。

步骤4:在.NET程序中编写代码操作input文件夹下的文档。
具体代码操作方法,请参考以下内容。
示例1:添加形状
using System;using Spire.Cloud.Word.Sdk.Api;using Spire.Cloud.Word.Sdk.Client;namespace AddParagraph{ class Program { static String appId = "App ID"; static String appKey = "App Key"; static void Main(string[] args) { //配置App ID和App Key Configuration configuration = new Configuration(appId, appKey); //初始化ParagraphsApi对象 ParagraphsApi paragraphsApi = new ParagraphsApi(configuration); //现有文档名称 string fileName = "示例文档.docx"; //选择需要插入段落的章节(section) string nodePath = "sections/0"; //存放现有文档的文件夹,如果没有文件夹则为null string folder = "input"; //使用冰蓝云配置的2G空间存贮文档,可设置为null string storage = null; //插入段落的位置 int indexOfParagraph = 2; //文档的打开密码 string password = null; //添加段落的文字 string text = "这是新加的段落"; //设置生成文档的路径及名称 string destFilePath = "output/添加段落.docx"; //通过AddParagraph方法添加段落 paragraphsApi.AddParagraph(fileName, nodePath, folder, storage, indexOfParagraph, password, text, destFilePath); } }}

示例2:删除形状
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) { //配置App ID和App Key Configuration configuration = new Configuration(appId, appKey); //初始化ShapesApi对象 ShapesApi shapesApi = new ShapesApi(configuration); //现有文档名称 string fileName = "示例文档.docx"; //段落的路径 string paragraphPath = "sections/0/paragraphs/0"; //要删除形状的索引 int shapeIndex = 0; //存放现有文档的文件夹,如果没有文件夹则为null string folder = "input"; //使用冰蓝云配置的2G空间存贮文档,可设置为null string storage = null; //文档的打开密码 string password = null; //设置生成文档的路径及名称 string destFilePath = "output/删除形状.docx"; //根据索引删除指定形状 shapesApi.DeleteShape(fileName, paragraphPath, shapeIndex, folder, storage, password, destFilePath); } }}
是E-iceblue官方友好合作伙伴,如果您对Spire.Cloud感兴趣或需要临时License,可以联系在线客服了解具体授权价格和使用机制。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!