Contador de línea de archivo PHP Word
Frecuentes
Visto 401 veces
0
I need to make a PHP function that will count the number of lines in a Word File (.doc, docx)
This code does not seem to work correctly for me :
$name = 'test.doc';
$line_count = count(file($name));
echo $line_count
My guess is that this script does not work well with .doc or .docx but works good in .txt files. Are there any alternatives available out there? Tnx!
1 Respuestas
0
Solo .docx
can be opened with simple PHP
ya que es un zip
archivo:
$zip = new ZipArchive;
if ($zip->open('test.docx') === TRUE) {
$xml = $zip->getFromName('docProps/app.xml');
$zip->close();
} else {
$xml = false;
}
if($xml){
$xml = simplexml_load_string($xml);
echo $xml->Lines;
}
Respondido 24 ago 12, 07:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php html file count or haz tu propia pregunta.
Uhmm, I don't think you can do that with a .doc file, as it is a Microsoft Office file and it's contents are not simple text. - Mihai Iorga
I really hope you are not implying that there is no solution available :(( - AJ Naidas
davidwalsh.name/read-pdf-doc-file-php maybe this can help you. - smottt