in reply to Number of lines and characters
That code is going to count the number of newline characters in your file, which in the case of a Word doc is next to meaningless.
To do this right, you'll have to open the file with Word itself (using Win32::OLE), and then either use the Document properties, or walk through the document a paragraph or word at a time, using one of the iterators over the document. You can get an estimate from that, but not a real "line count" -- that depends on how the document's rendered by the printer, not the document itself. Hmm, you may be able to use the Print Preview.... /me slaps self
I've used the Win32 modules for stuff like this, but never with Word, so I can't vouch for how well this will work. But in general you'll need a decent understanding of the Word object model (start the Visual Basic Editor and bring up the Object Browser).
And, yes, it's very tedious programming....
|
|---|