1

I am using XWPF to read .docx file which contain a table. In this table I get row then cell then I add a paragraph inside and in this paragraph I add multiple Run (with different style of font)

My question is (I know I don’t have posibility to get when word add new page or it is out of scope to me...?) But what I want achieve is get current height in my loop of the tableRow or tableCell is this possible? I mean something like this squelette code

XWPFTableRow r = ...;
For(...){
  r.getCell(0).addNewParagraph(0).newRun().setText(...);

  // at this step of programm I want height of each cell and each paragraph, 
  // is this possible? Because each iteration my table row height increment..
}

I tried tableRow.getHeight() to get row height but it get always 0, someone have idea to get row or cell or paragraph height?

Community
  • 1
  • 1
ebeg
  • 418
  • 1
  • 4
  • 17
  • 2
    As I understand it, the library you're working with accesses the Word document via the Office Open XML file format - the document is not opened in the Word application? If that's the case then it's not possible to get any height information - that is calculated by the Word application on-the-fly, while editing the document. – Cindy Meister Nov 07 '18 at 16:56
  • This question is answered correctly by Cindy Meister's comment. But your implicit question about having control over pages in Word might be solvable using different approaches of [Keep text together](https://support.office.com/en-us/article/keep-text-together-af94e5b8-3a5a-4cb0-9c53-dea56b43d96d) in Word. Do trying it in Word's GUI and then try the choosen approach using `apache poi`. Do asking a concrete question if you are stuck. – Axel Richter Nov 08 '18 at 06:52

0 Answers0