I want to do server side extraction of document statistics in all document
types supported by Open Office Writer on a Linux server. The statistics I am
interested in is the word count, character count and number of pages. Are
you aware of any way in which this can be achieved using Open Office?

Just to give you an idea of what I am interested in I have included the php
code for extracting the word count using Microsoft Word .com objects.

thanks,
Andreas


The code for counting word in Microsoft Word documents using Microsoft Word
.com objects is

<?php
ini_set('com.autoregister_casesensitive', 1); // Optional. When set
wdPropertyWords does NOT equal WDPROPERTYWORDS
ini_set('com.autoregister_typelib', 1); // Auto registry the loaded
typelibrary - allows access to constants.
ini_set('com.autoregister_verbose', 0); // Suppress Warning:
com::com(): Type library constant emptyenum is already defined in $s
on line %d messages.

$o_Word = new COM('Word.Application') or die('Cannot load MS Word');
$o_Word->Visible = 0;

$o_Doc = $o_Word->Documents->Open('z:/5words.doc');
echo 'There are ', $o_Doc->BuiltInDocumentProperties(wdPropertyWords),
' word(s) in this document.';
$o_Doc->Close(False);
$o_Word->Quit();
unset($o_Doc);
unset($o_Word);

Reply via email to