1 2 17 18 package org.apache.poi.hwpf.usermodel; 19 20 import java.util.ArrayList ; 21 22 public class Table 23 extends Range 24 { 25 ArrayList _rows; 26 27 Table(int startIdx, int endIdx, Range parent, int levelNum) 28 { 29 super(startIdx, endIdx, Range.TYPE_PARAGRAPH, parent); 30 _rows = new ArrayList (); 31 int numParagraphs = numParagraphs(); 32 33 int rowStart = 0; 34 int rowEnd = 0; 35 36 while (rowEnd < numParagraphs) 37 { 38 Paragraph p = getParagraph(rowEnd); 39 rowEnd++; 40 if (p.isTableRowEnd() && p.getTableLevel() == levelNum) 41 { 42 _rows.add(new TableRow(rowStart, rowEnd, this, levelNum)); 43 rowStart = rowEnd; 44 } 45 } 46 } 47 48 public int numRows() 49 { 50 return _rows.size(); 51 } 52 53 public int type() 54 { 55 return TYPE_TABLE; 56 } 57 58 public TableRow getRow(int index) 59 { 60 return (TableRow)_rows.get(index); 61 } 62 } 63 | Popular Tags |