If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

安装
该软件包在Packagist可用,可以通过执行以下命令通过 Composer 安装:
composer require groupdocscloud/groupdocs-editor-cloud

要求
依赖关系
SDK需要以下软件包:
| Package | Constraint |
|---|
| guzzlehttp/guzzle | ^6.5.8 or ^7.4.5 |
| ext-curl | * |
| ext-json | * |
| ext-mbstring | * |
快速入门
获取您的 API 凭证
要使用GroupDocs.Editor Cloud,请在GroupDocs.Cloud Dashboard注册并获取您的Client ID和Client Secret。
初始化API
使用以下代码开始使用GroupDocs.Editor Cloud SDK for PHP:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$editApi = new GroupDocs\Editor\EditApi($configuration);
请参阅 CommonUtils.php 中的完整示例。
编辑 Word 文档
初始化后,使用此基本示例来加载受密码保护的 Word 文档,编辑其 HTML 表示形式,然后保存结果。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Editor\Model;
use GroupDocs\Editor\Model\Requests;
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$editApi = new GroupDocs\Editor\EditApi($configuration);
$fileApi = new GroupDocs\Editor\FileApi($configuration);
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("WordProcessing/password-protected.docx");
$fileInfo->setPassword("password");
$loadOptions = new Model\WordProcessingLoadOptions();
$loadOptions->setFileInfo($fileInfo);
$loadOptions->setOutputPath("output");
$loadResult = $editApi->load(new Requests\loadRequest($loadOptions));
$htmlFile = $fileApi->downloadFile(new Requests\downloadFileRequest($loadResult->getHtmlPath()));
$html = file_get_contents($htmlFile->getRealPath());
$html = str_replace("Sample test text", "Hello world", $html);
file_put_contents($htmlFile->getRealPath(), $html);
$fileApi->uploadFile(new Requests\uploadFileRequest($loadResult->getHtmlPath(), $htmlFile->getRealPath()));
$saveOptions = new Model\WordProcessingSaveOptions();
$saveOptions->setFileInfo($fileInfo);
$saveOptions->setOutputPath("output/edited.docx");
$saveOptions->setHtmlPath($loadResult->getHtmlPath());
$saveOptions->setResourcesPath($loadResult->getResourcesPath());
$saveResult = $editApi->save(new Requests\saveRequest($saveOptions));
echo "Document edited: " . $saveResult->getPath() . "\n";
请参阅 EditWordProcessingDocument.php 中的完整示例。
编辑电子表格文档
此示例加载 XLSX 文件的第一个工作表,编辑其 HTML 内容,并保存电子表格。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Editor\Model;
use GroupDocs\Editor\Model\Requests;
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$editApi = new GroupDocs\Editor\EditApi($configuration);
$fileApi = new GroupDocs\Editor\FileApi($configuration);
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("Spreadsheet/four-sheets.xlsx");
$loadOptions = new Model\SpreadsheetLoadOptions();
$loadOptions->setFileInfo($fileInfo);
$loadOptions->setOutputPath("output");
$loadOptions->setWorksheetIndex(0);
$loadResult = $editApi->load(new Requests\loadRequest($loadOptions));
$htmlFile = $fileApi->downloadFile(new Requests\downloadFileRequest($loadResult->getHtmlPath()));
$html = file_get_contents($htmlFile->getRealPath());
$html = str_replace("This is sample sheet", "This is sample sheep", $html);
file_put_contents($htmlFile->getRealPath(), $html);
$fileApi->uploadFile(new Requests\uploadFileRequest($loadResult->getHtmlPath(), $htmlFile->getRealPath()));
$saveOptions = new Model\SpreadsheetSaveOptions();
$saveOptions->setFileInfo($fileInfo);
$saveOptions->setOutputPath("output/edited.xlsx");
$saveOptions->setHtmlPath($loadResult->getHtmlPath());
$saveOptions->setResourcesPath($loadResult->getResourcesPath());
$saveResult = $editApi->save(new Requests\saveRequest($saveOptions));
echo "Document edited: " . $saveResult->getPath() . "\n";
请参阅 EditSpreadsheetDocument.php 中的完整示例。
获取文档信息
检索受密码保护的 Word 文档的页数。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Editor\Model;
use GroupDocs\Editor\Model\Requests;
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$infoApi = new GroupDocs\Editor\InfoApi($configuration);
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("WordProcessing/password-protected.docx");
$fileInfo->setPassword("password");
$response = $infoApi->getInfo(new Requests\getInfoRequest($fileInfo));
echo "Page Count = " . $response->getPageCount() . "\n";
请参阅 GetDocumentInformation.php 中的完整示例。
获取支持的文件类型
检索支持的文件格式。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$infoApi = new GroupDocs\Editor\InfoApi($configuration);
$response = $infoApi->getSupportedFileFormats();
foreach ($response->getFormats() as $format) {
echo $format->getFileFormat() . " - " . $format->getExtension() . "\n";
}
请参阅 GetSupportedFileTypes.php 中的完整示例。
GitHub 上的示例
GroupDocs.Editor Cloud PHP 示例 存储库包含可立即运行的示例,涵盖:
| Category | Examples |
|---|
| 文件类型 | 支持的文件类型 |
| 文档信息 | 文档信息、许可证消耗 |
| 编辑操作 — Word | 编辑文字处理文档,包括受密码保护的文件 |
| 编辑操作 — 电子表格 | 编辑电子表格文档并选择工作表 |
| 编辑操作 — 演示文稿 | 编辑演示文稿文档并选择幻灯片 |
| 编辑操作 — DSV | 编辑分隔符分隔值文档 |
| 编辑操作 — 文本 | 编辑纯文本文档 |
如何运行示例
- 克隆或下载示例存储库
- 编辑
Examples/CommonUtils.php并设置ClientId和ClientSecret
3.进入Examples目录
4.运行composer update
5.执行php RunExamples.php
欲了解更多详情,请访问Getting Started。

标签
Document Editing API | PHP Cloud API | GroupDocs.Editor Cloud | REST API | Word Processing Formats | Spreadsheet Formats | Presentation Formats | Text Formats | CSV Files | DOCX Documents | XLSX Documents | PPTX Presentations | Password-Protected Files | Cloud Storage Integration | Document Info Retrieval | File Operations | WYSIWYG Editing | Multi-Platform Support | Secure API Access | HTML Editing | Cross-platform API