PHP code example of gyselroth / docx-tidy

1. Go to this page and download the library: Download gyselroth/docx-tidy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gyselroth / docx-tidy example snippets




use DocxTidy\DocxTidy;

// tidy a DOCX file
(new DocxTidy())->tidyDocx('path/to/your.docx');



use DocxTidy\DocxTidy;

// read DOCX XML, e.g. "document.xml" / "header1.xml" / etc
$xml = file_get_contents('path/to/your_unzipped_docx/word/document.xml');

// tidy DOCX XML string
$xml = (new DocxTidy())->tidyXml($xml);