문제

I am trying to modify the existing code which converts MS word documents to text using apache POI. I am new to this Apache POI API. There is GetTableLevel() method of org.apache.poi.hwpf.usermodel.Paragraph class which returns some integer value.

For some table, this method returns value 1 and for some other tables it returns 0. I am not able to understand this behaviour.

I looked at JavaDoc of this API here but there is no description about the return values of this method.

Can anyone please tell me what are the possible return values of this method?

Here is code snippet which calls the GetTableLevel() method :

for (int x = 0; x < lenParagraph; x++) {
    Paragraph paragraph = range.getParagraph(x);
    int tableLevel = paragraph.getTableLevel();

Please enlighten !!!

도움이 되었습니까?

다른 팁

paragraph.getTableLevel() returns the nesting level (aka "table depth") of a table. For paragraphs which are not part of a table this call always yields 0 - and in addition paragraph.isInTable() will return false. A return value of 1 indicates an ordinary (top level) table. All values n>1 represent a table which is nested n-1 times within another (parent) table.

For more details see [MS-DOC, Section 2.4.3].

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top