Use Aspose Cloud PHP SDK to Work with Mailmerge, Sections, Paragraphs, Runs, Page Setup and Fonts in Word Documents

Share on FacebookTweet about this on TwitterShare on LinkedIn

Aspose Cloud PHP SDK

We are pleased to announce the release of Aspose Cloud PHP SDK as per Aspose Cloud 1.1.7.1. With this new release it is possible to create, read, manipulate and export features are greatly improved. You can extract sections, paragraphs, runs, page setup and fonts and update page setup and font in a Word document. Read more

New Aspose.Words Methods

As per the latest version of Aspose Cloud 1.1.7.1, we’ve implemented the following functions to the Aspose Cloud PHP SDK:

  • Save Word documents as other formats – This feature allows you to save Word documents as DOC, DOCX, DOCM, DOT, DOTX, DOTM, OOXML, HTML, HTMLFixed, WordML, MHTML, ODT, PDF, XPS, TIFF, EPUB, image and several other formats. Now this feature also supports export to XAML_FIXED format. You can use the saveAs resource and send a POST request (specifying save options in the request body) to convert to any supported format.
  • Split Word documents – This feature allows you to split all or specific pages of a Word document to many formats. This feature was already supported but now it supports split to XAML_FIXED format. You can use splitDocument resource and send a POST request to split to any supported format.
  • Get all sections – This feature allows you to get a list of all sections present in a Word document. You can use the sections resource and send a GET request to get this list.
  • Get a specific section – This feature allows you to get any section from a Word document. You can use the section resource and send a GET request to get a section.
  • Get all paragraphs – This feature allows you to get a list of all paragraphs present in a Word document. You can use the paragraphs resource and send a GET request to get this list.
  • Get a specific paragraph – This feature allows you to get any paragraph from a Word document. You can use the paragraph resource and send a GET request to get a paragraph.
  • Get a specific run – This feature allows you to get any run of any paragraph from a Word document. You can use the run resource and send a GET request to get a run.
  • Get font information – This feature allows you to get font information from any run of a paragraph. You can use the font resource and send a GET request for this purpose.
  • Update a run’s font – This feature allows you to update font of any run in a Word document. You can use the font resource and send a POST request (specifying font options in the request body) to update font.
  • Get page setup information – This feature allows you to get page setup information from any section of a Word document. You can use the pageSetup resource and send a GET request for this purpose.
  • Update page setup – This feature allows you to update page setup of any section in a Word document. You can use the pageSetup resource and send a POST request (specifying page setup options in the request body) to update page setup.
  • Get mustache field names – This feature allows you to get mail merge and mustache field names. You can use the mailMergeFieldNames resource and send a GET request (passing useNonMergeFields parameter in the request URI) to get all merge fields including mustache fields.

Code Snippets

Sample Code Aspose.Words  – Save Word Documents as Other Formats

use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Words\Document;

AsposeApp::$appSID = '******';
AsposeApp::$appKey = '******';
AsposeApp::$outPutLocation = "******";

// Create object of document class
$document = new Document('AsposeDOC.docx');

// Provide Options
$xml_string =
"<PDFSaveOptions>
<SaveFormat>pdf</SaveFormat>
<FileName>Output_qazi.pdf</FileName>
<ImageCompression>Jpeg</ImageCompression>
<JpegQuality>70</JpegQuality>
<TextCompression>Flate</TextCompression>
</PDFSaveOptions>";
$document->saveAs($xml_string,'MainDocument.docx');

Sample Code Aspose.Words  – Get Paragraphs

use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Words\Document;

AsposeApp::$appSID = '******';
AsposeApp::$appKey = '******';

// Create object of document class
$document = new Document('MainDocument.docx');

$document->getParagraphs('MainDocument.docx');

Download

Start a Free Trial Today

Start a free trial today – all you need is to sign up with Aspose Cloud service. Once you have signed up, you are ready to try powerful file processing features offered by Aspose Cloud.