I am using the library Apache-POI for my app. Specifically, POIshadow-all (ver. 3.17) for reading a Word document. I am successfully extracting every paragraph as follows:
what I actually need is extract every line, as follows:
The code to extract every paragraph is this:
try {
val fis = FileInputStream(path.path + "/" + document)
val xdoc = XWPFDocument(OPCPackage.open(fis))
val paragraphList: MutableList<XWPFParagraph> = xdoc.paragraphs
private val newParagraph = paragraph.createRun()
...
for (par in paragraphList) {
var currentParagraph = par.text
Log.i("TAG","current: $currentParagraph")
...
The variable currentParagraph returns a whole paragraph, as expected. However, I would need a variable named currentLine which returns a single line.
I've research about this issue in stackoverflow and other sites. I've found some proposals but none of them works for me. I also tried get dates by ctr and using XWPFRun, without any success.
I would be grateful for any recommendation on how to proceed.
Thanks in advance for your help.
apache poi
cannot detect this because it does not rendering the text. Or is there any explicit line break set behind "Would"? If so then detecting that line break would be possible. – DamalisApache poi
is not rendering the page. So it cannot know that the text line is full after the word "Would" and the default text flow puts the word "you" into an new line. – Damalis