GroupDocs.Editor Cloud SDK 用于 Node.js,通过将 GroupDocs.Editor Cloud SDK 用于 Node.js 与 GroupDocs.Editor Cloud REST API 集成,支持在任何类型的 Node.js 应用程序中编辑广泛的流行文档格式。 您只需在任意 WYSIWYG HTML 编辑器中上传受支持的文档格式(Microsoft Word、Excel 电子表格、PowerPoint、TXT、HTML、XML),并在文档编辑后将其转换回原始格式,保持相同的外观。
GroupDocs.Editor Cloud SDK 用于 Node.js 构建在 GroupDocs.Editor Cloud REST API 之上,作为一层封装,通过管理底层请求和处理响应,为您节省宝贵的开发时间。开发者可以专注于在项目中仅编写所需的特定代码。
如果您正在寻找用于在云端标注文件的源代码,请查看 GroupDocs.Editor Cloud SDK for Node.js at GitHub。
您可以尝试 GroupDocs.Editor Low-Code Node.js APIs,没有任何限制。
GroupDocs.Editor Cloud 也提供 Docker 镜像,可用于 self-host 服务。或者,你可以使用 GroupDocs.Editor High-code APIs 来构建自己的服务,该技术目前驱动我们的 REST APIs。
//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
global.editApi = editor_cloud.EditApi.fromKeys(appSid, appKey);
global.fileApi = editor_cloud.FileApi.fromKeys(appSid, appKey);
// The document already uploaded into the storage.
// Load it into editable state
let fileInfo = new editor_cloud.FileInfo();
fileInfo.filePath = "WordProcessing/password-protected.docx";
fileInfo.password = "password";
let loadOptions = new editor_cloud.WordProcessingLoadOptions();
loadOptions.fileInfo = fileInfo;
loadOptions.outputPath = "output";
let loadResult = await editApi.load(new editor_cloud.LoadRequest(loadOptions));
// Download html document
let buf = await fileApi.downloadFile(new editor_cloud.DownloadFileRequest(loadResult.htmlPath));
let htmlString = buf.toString("utf-8");
// Edit something...
htmlString = htmlString.replace("Sample test text", "Hello world");
// Upload html back to storage
await fileApi.uploadFile(new editor_cloud.UploadFileRequest(loadResult.htmlPath, new Buffer(htmlString, "utf-8")));
// Save html back to docx
let saveOptions = new editor_cloud.WordProcessingSaveOptions();
saveOptions.fileInfo = fileInfo;
saveOptions.outputPath = "output/edited.docx";
saveOptions.htmlPath = loadResult.htmlPath;
saveOptions.resourcesPath = loadResult.resourcesPath;
let saveResult = await editApi.save(new editor_cloud.SaveRequest(saveOptions));
// Done.
console.log("Document edited: " + saveResult.path);