Cloud REST API para editar rápidamente todos los formatos de documentos populares en cualquier tipo de aplicación PHP sin instalar software externo.
Empiza la prueba gratuitaGroupDocs.Editor Cloud SDK para PHP admite la edición y manipulación de una gran cantidad de formatos de archivo de documentos populares dentro de aplicaciones PHP. Simplemente integra GroupDocs.Editor Cloud SDK para PHP con GroupDocs.Editor Cloud REST API, sube el documento compatible en cualquier editor WYSIWYG de terceros HTML, manipula el documento y guárdalo de nuevo en el formato original sin alterar su apariencia después de la edición. La biblioteca del editor PHP admite una variedad de formatos de documentos, incluyendo Microsoft Word (DOC, DOCX, WordML), Excel (XLS, XLSX, SpreadsheetML), Presentaciones (PPT, PPTX), HTML, XML, TXT y OpenDocument.
GroupDocs.Editor Cloud SDK para PHP está construida como una capa sobre GroupDocs.Editor Cloud REST API que ahorra tiempo valioso de desarrollo al gestionar solicitudes de bajo nivel y manejar respuestas. Puedes centrarte en escribir el código específico solo cuando lo necesites en el proyecto.
Consulta GroupDocs.Editor Cloud SDK para PHP en GitHub si buscas el código fuente para anotar el archivo en la nube.
Puedes probar GroupDocs.Editor Low-Code PHP APIs sin ninguna limitación.
GroupDocs.Editor Cloud también está disponible como imagen Docker que puede usarse para self-host el servicio. O puedes crear tus propios servicios usando GroupDocs.Editor High-code APIs que actualmente impulsan nuestro REST APIs.
//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
$AppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$AppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid($AppSid);
$configuration->setAppKey($AppKey);
$editApi = new GroupDocs\Editor\EditApi($configuration);
$fileApi = new GroupDocs\Editor\FileApi($configuration);
// The document already uploaded into the storage
// Load it into editable state
$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));
// Download html document
$htmlFile = $fileApi->downloadFile(new Requests\downloadFileRequest($loadResult->getHtmlPath()));
$html = file_get_contents($htmlFile->getRealPath());
// Edit something...
$html = str_replace("This is sample sheet", "This is sample sheep", $html);
// Upload html back to storage
file_put_contents($htmlFile->getRealPath(), $html);
$uploadRequest = new Requests\uploadFileRequest($loadResult->getHtmlPath(), $htmlFile->getRealPath());
$fileApi->uploadFile($uploadRequest);
// Save html back to xlsx
$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));
// Done.
echo "Document edited: " . $saveResult->getPath();