Correctly handle the last paragraph via a fix to TableCell - patch from bug #44292
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@615190 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c0d830822
commit
159a3b3bcb
@ -36,6 +36,7 @@
|
||||
|
||||
<!-- Don't forget to update status.xml too! -->
|
||||
<release version="3.0.2-FINAL" date="2008-??-??">
|
||||
<action dev="POI-DEVELOPERS" type="fix">44292 - Correctly process the last paragraph in a word file</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<!-- Don't forget to update changes.xml too! -->
|
||||
<changes>
|
||||
<release version="3.0.2-FINAL" date="2008-??-??">
|
||||
<action dev="POI-DEVELOPERS" type="fix">44292 - Correctly process the last paragraph in a word file</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">44254 - Avoid some unread byte warnings, and properly understand DVALRecord</action>
|
||||
<action dev="POI-DEVELOPERS" type="add">Add another formula evaluation method, evaluateFormulaCell(cell), which will re-calculate the value for a formula, without affecting the formula itself.</action>
|
||||
<action dev="POI-DEVELOPERS" type="fix">41726 - Fix how we handle signed cell offsets in relative areas and references</action>
|
||||
|
@ -58,7 +58,7 @@ public class TableRow
|
||||
p = getParagraph(end);
|
||||
s = p.text();
|
||||
}
|
||||
_cells[cellIndex] = new TableCell(start, end, this, levelNum,
|
||||
_cells[cellIndex] = new TableCell(start, end+1, this, levelNum,
|
||||
_tprops.getRgtc()[cellIndex],
|
||||
_tprops.getRgdxaCenter()[cellIndex],
|
||||
_tprops.getRgdxaCenter()[cellIndex+1]-_tprops.getRgdxaCenter()[cellIndex]);
|
||||
|
BIN
src/scratchpad/testcases/org/apache/poi/hwpf/data/Bug44292.doc
Normal file
BIN
src/scratchpad/testcases/org/apache/poi/hwpf/data/Bug44292.doc
Normal file
Binary file not shown.
@ -74,4 +74,34 @@ public class TestProblems extends TestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for TableCell not skipping the last paragraph
|
||||
*/
|
||||
public void testTableCellLastParagraph() throws Exception {
|
||||
HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/Bug44292.doc"));
|
||||
Range r = doc.getRange();
|
||||
|
||||
//get the table
|
||||
Paragraph p = r.getParagraph(0);
|
||||
Table t = r.getTable(p);
|
||||
|
||||
//get the only row
|
||||
TableRow row = t.getRow(0);
|
||||
|
||||
//get the first cell
|
||||
TableCell cell = row.getCell(0);
|
||||
// First cell should have one paragraph
|
||||
assertEquals(1, cell.numParagraphs());
|
||||
|
||||
//get the second
|
||||
cell = row.getCell(1);
|
||||
// Second cell should be detected as having two paragraphs
|
||||
assertEquals(2, cell.numParagraphs());
|
||||
|
||||
//get the last cell
|
||||
cell = row.getCell(2);
|
||||
// Last cell should have one paragraph
|
||||
assertEquals(1, cell.numParagraphs());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user