Update Fields in PHP

Aspose.Words - Update Fields

To update fields of Word Document using Aspose.Words Java Apis in Php, simply invoke updateFields of Document object.

Php Code

$doc = new Java("com.aspose.words.Document");

// Use the document builder to insert some content and fields.
$builder = new Java("com.aspose.words.DocumentBuilder",$doc);

// Insert a table of contents at the beginning of the document.
$builder->insertTableOfContents("\\o \"1-3\" \\h \\z \\u");
$builder->writeln();

// Insert some other fields.
$builder->write("Page: ");
$builder->insertField("PAGE");
$builder->write(" of ");
$builder->insertField("NUMPAGES");
$builder->writeln();

// Call the method below to update the TOC.
$doc->updateFields();

Download Running Code

Download Update Fields (Aspose.Words) from any of the below mentioned social coding sites: