PHP Classes
elePHPant
Icontem

I need php class which converts word format to html: I need php class which converts word format to html

Recommend this page to a friend!
  All requests RSS feed  >  I need php class which converts word ...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

I need php class which converts word format to html

Edit

Picture of Amid Nalib by Amid Nalib - 1 year ago (2015-02-06)

I need php class which converts word format to html

This request is clear and relevant.
This request is not clear or is not relevant.

0

I need php class or script which converts word format to html with formatting. Please, help=)

Ask clarification

1 Recommendation

Forms generation and validation: HTML forms generation and validation.

This recommendation solves the problem.
This recommendation does not solve the problem.

-2

Picture of Amid Nalib by Amid Nalib Reputation -20 - 1 year ago (2015-02-06) Comment

function docx2text($filename) {

	return getTextFromZippedXML($filename, "word/document.xml");
}

function getTextFromZippedXML($archiveFile, $contentFile) {
	// Создаёт "реинкарнацию" zip-архива...
	$zip = new ZipArchive;
	// И пытаемся открыть переданный zip-файл
	if ($zip->open($archiveFile)) {
	    // В случае успеха ищем в архиве файл с данными
	    if (($index = $zip->locateName($contentFile)) !== false) {
		// Если находим, то читаем его в строку
		$content = $zip->getFromIndex($index);
		// Закрываем zip-архив, он нам больше не нужен
		$zip->close();

		// После этого подгружаем все entity и по возможности include'ы других файлов
		// Проглатываем ошибки и предупреждения
		$xml = DOMDocument::loadXML($content, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING);
		// После чего возвращаем данные без XML-тегов форматирования

		return strip_tags($xml->saveXML());
	    }
	    $zip->close();
	}
	// Если что-то пошло не так, возвращаем пустую строку
	return "";
}
  • 2 Comments
  • 1. Picture of Manuel Lemos by Manuel Lemos package author package author - 1 year ago (2015-02-06) Reply

    This is not a recommended class for the problem.

  • 2. Picture of vinay by vinay - 1 year ago (2015-05-02) Reply

    not recommended solution


Recommend package
: 
: