• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

number of lines in a document

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
How can I find out the number of lines in a Microsoft word document file. Is it possible through java? How can I get the number of lines in it. If any one knows the solution, please give the reply for this.
thank you
Anil
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anil,
Try java.io.* package. There are plenty of classes to manipulate.
Initially, u get the file object and pass it FileInput Stream and try using class named LineNumberReader....and methods thereof
Cheers
Murali

Originally posted by Anil Sadineni:
Hi All,
How can I find out the number of lines in a Microsoft word document file. Is it possible through java? How can I get the number of lines in it. If any one knows the solution, please give the reply for this.
thank you
Anil


 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
short answer:
no
long answer:
maybe, but not likely.
here's why.
the # of lines in a word*.doc is relative.
why do you even want to do this? you ask a lot of questions...
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


why do you even want to do this? you ask a lot of questions...


Dickster,
I think Anil's right to ask that question (even a lot of them) is very legitimate !!! Anyway, that's what Javaranch is out there for !
If Anil wants to count the lines of Word documents, it's his problem and we are free to help him or not!


------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anil Sadineni:
Hi All,
How can I find out the number of lines in a Microsoft word document file. Is it possible through java? How can I get the number of lines in it. If any one knows the solution, please give the reply for this.


Yes you can, but it's not easily. Using the java.io package you can access the file and read in the data, as murali suggested. However, you're on your own to parse the data to determine what the lines are. This means you need to find out what the file enocding is, remove the document information so you just have the content, and then you must parse the content. That's probably not so easy.
(Actually, I think the number of lines might be some document data stored in the word file, so maybe you only need to figure out what the encoding is, and then just look for that piece of data.)

--Mark
 
dickster
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


you ask a lot of questions...


Oops, sorry, this actually was a rhetorical question to myself as I tried to figure out if there is a really easy way to do this, and I can't see it (numlines is part of the stats in the *.doc's properties)...
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe http://www.redbrick.dcu.ie/~bob/Tech/wword8.html may help
I saw some mentions to "line numbers" so it might be worth investigating the link !
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform

[This message has been edited by Valentin Crettaz (edited November 13, 2001).]
 
Anil Sadineni
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for all your replies,
The problem with .doc file is with its format. If we can communicate with 'com' object written in vb or vc, the problem may be solved. But I don't know how to communicate wuth COM object. Please help me regarding this.
thakns again to all

Anil
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic