mirror of https://github.com/apache/poi.git
already fixed 48065 - Problems with save output of HWPF (losing formatting)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1143809 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7edecc34bf
commit
03ea58049c
|
@ -34,6 +34,7 @@
|
|||
|
||||
<changes>
|
||||
<release version="3.8-beta4" date="2011-??-??">
|
||||
<action dev="poi-developers" type="fix">48065 - Problems with save output of HWPF (losing formatting)</action>
|
||||
<action dev="poi-developers" type="fix">47563 - Exception when working with table</action>
|
||||
<action dev="poi-developers" type="fix">47287 - StringIndexOutOfBoundsException in CharacterRun.replaceText()</action>
|
||||
<action dev="poi-developers" type="fix">46817 - Regression: Text from some table cells missing</action>
|
||||
|
|
|
@ -691,6 +691,53 @@ public final class TestProblems extends HWPFTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* [RESOLVED FIXED] Bug 48065 - Problems with save output of HWPF (losing
|
||||
* formatting)
|
||||
*/
|
||||
public void test48065()
|
||||
{
|
||||
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile( "Bug48065.doc" );
|
||||
HWPFDocument doc2 = HWPFTestDataSamples.writeOutAndReadBack( doc1 );
|
||||
|
||||
Range expected = doc1.getRange();
|
||||
Range actual = doc2.getRange();
|
||||
|
||||
assertEquals(
|
||||
expected.text().replace( "\r", "\n" ).replaceAll( "\n\n", "\n" ),
|
||||
actual.text().replace( "\r", "\n" ).replaceAll( "\n\n", "\n" ) );
|
||||
|
||||
assertEquals( expected.numParagraphs(), actual.numParagraphs() );
|
||||
for ( int p = 0; p < expected.numParagraphs(); p++ )
|
||||
{
|
||||
Paragraph expParagraph = expected.getParagraph( p );
|
||||
Paragraph actParagraph = actual.getParagraph( p );
|
||||
|
||||
assertEquals( expParagraph.text(), actParagraph.text() );
|
||||
assertEquals( expParagraph.isInTable(), actParagraph.isInTable() );
|
||||
assertEquals( expParagraph.isTableRowEnd(),
|
||||
actParagraph.isTableRowEnd() );
|
||||
|
||||
if ( expParagraph.isInTable() && actParagraph.isInTable() )
|
||||
{
|
||||
Table expTable, actTable;
|
||||
try
|
||||
{
|
||||
expTable = expected.getTable( expParagraph );
|
||||
actTable = actual.getTable( actParagraph );
|
||||
}
|
||||
catch ( Exception exc )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assertEquals( expTable.numRows(), actTable.numRows() );
|
||||
assertEquals( expTable.numParagraphs(),
|
||||
actTable.numParagraphs() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug 50936 - HWPF fails to read a file
|
||||
*/
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue