<?php
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use PhpOffice\PhpWord\IOFactory;

try {
    $filePath = JPATH_ROOT . '/edocmanviewer/'.$this->documenturl;
    $phpWord = IOFactory::load($filePath);

    $htmlWriter = IOFactory::createWriter($phpWord, 'HTML');

	header('Content-Type: text/html');
    ob_start();
    $htmlWriter->save('php://output');
    $htmlContent = ob_get_clean();

    echo $htmlContent;

} catch (Exception $e) {
    echo "Error loading file: " . $e->getMessage();
}

