The other issue is that you may not know how many lines there are in the
document until it has been rendered. As far as I am aware, Word does not
store the text in it's files as a series of lines, rather the text simply
ruins on and on within the file. Only when it is rendered into a document is
the text 'split' onto or into a specific number of lines. So, in order to
write this information into the file as POI creates it, you will need to
create to determine how many lines the text will occupy when converted into
a human readable form.

The other wrinkle is that this value can vary. Think what is likely to
happen if you are creating a document using Word itself. Imagine that on
your machine, the 'Normal' style uses Arial at ten points, in this case the
finished document will occupy, for the sake of argument, twenty six lines.
Now, what will happen if someone else opens that same document on a machine
where the 'Normal' style is Times New Roman at twelve points? If you start
to add images and have text flowing around them for example, them the
problem becomes more complex again.

It may well be that there is no easy - or even practical - way to populate
this property using POI. To shoot myself in the foot, you might be able to
use Java's print rendering capabilites to take a stab at building a line
count calculator but I would not expect this to be a simple task.
Furthermore, I suspect it would be hard to create a tool that agreed with
Word 100% of the time.

As with all of these things, I could very well be wrong.



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Getting-the-line-count-of-docx-file-created-using-POI-3-10-tp5719024p5719031.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to