翻譯|使用教程|編輯:李顯亮|2020-09-21 09:59:30.667|閱讀 230 次
概述:云端Office處理工具Spire.Cloud.Word Java SDK給開發(fā)人員提供了WordDocumentApi接口,支持創(chuàng)建Word文檔和獲取文檔對象。本文將介紹如何調(diào)用WordDocumentApi接口創(chuàng)建Word文檔。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
你在尋找一款既能在線編輯office文件,又能實現(xiàn)與web應(yīng)用程序?qū)拥能浖幔亢们桑{(lán)公司最新推出Spire.Cloud,搭載了基于云端的Office在線編輯器和WEB API開發(fā)接口,既能安全穩(wěn)定地實現(xiàn)WEB網(wǎng)頁端在線查看、編輯Office文檔;又能在服務(wù)器端通過代碼調(diào)用接口簡單高效地實現(xiàn)讀寫Office文檔內(nèi)容。
Spire.Cloud.Word Java SDK給開發(fā)人員提供了WordDocumentApi接口,支持創(chuàng)建Word文檔和獲取文檔對象。你可以點擊下載Spire.Cloud Web SDK。
本文將介紹如何調(diào)用WordDocumentApi接口創(chuàng)建Word文檔。
首先:通過Maven倉庫安裝Spire.Cloud.SDK jar包,其次,需要在冰藍(lán)云官網(wǎng) (//cloud.e-iceblue.cn) 注冊賬號,創(chuàng)建我的應(yīng)用程序,獲得 APP ID 及 App Key。。
import spire.cloud.word.sdk.client.*; import spire.cloud.word.sdk.client.api.WordDocumentApi; public class CloudWord { static String appId = "App ID"; static String appKey = "App Key"; static String baseUrl = "http://api.e-iceblue.cn"; //配置App ID和App Key static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl); //新建WordDocumentApi實例 static WordDocumentApi wordDocumentApi = new WordDocumentApi(wordConfiguration); public static void main(String[] args) throws ApiException { //設(shè)置文檔格式為.docx,也支持doc, rtf, wordml, docm, dotx, dot, dotm String fileFormat = "docx"; //設(shè)置文檔名稱 String name = "newDocument"; //設(shè)置文件夾名稱 String destFolder = "output"; //使用冰藍(lán)云配置的2G空間存貯文檔,可設(shè)置為null String storage = null; //創(chuàng)建Word文檔并保存到指定路徑 wordDocumentApi.createDocument(fileFormat, name, destFolder, storage); } }
使用Spire.Cloud在線編輯打開生成的空白文檔效果圖:
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn