Fix bug #46043 - correctly write out HPSF properties with HWPF
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@713393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
af7f84c27e
commit
5da1e72cad
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<!-- Don't forget to update status.xml too! -->
|
<!-- Don't forget to update status.xml too! -->
|
||||||
<release version="3.5-beta4" date="2008-??-??">
|
<release version="3.5-beta4" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">46043 - correctly write out HPSF properties with HWPF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF</action>
|
<action dev="POI-DEVELOPERS" type="add">45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
|
<action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
|
<action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
|
||||||
|
@ -34,9 +34,10 @@
|
|||||||
<!-- Don't forget to update changes.xml too! -->
|
<!-- Don't forget to update changes.xml too! -->
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.5-beta4" date="2008-??-??">
|
<release version="3.5-beta4" date="2008-??-??">
|
||||||
|
<action dev="POI-DEVELOPERS" type="fix">46043 - correctly write out HPSF properties with HWPF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="add">45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF</action>
|
<action dev="POI-DEVELOPERS" type="add">45973 - added CreationHelper.createFormulaEvaluator(), implemeted both for HSSF and XSSF</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
|
<action dev="POI-DEVELOPERS" type="fix">46182 - fixed Slideshow.readPictures() to skip pictures with invalid headers</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
|
<action dev="POI-DEVELOPERS" type="fix">46137 - Handle odd files with a ContinueRecord after EOFRecord</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
|
<action dev="POI-DEVELOPERS" type="fix">Fixed problem with linking shared formulas when ranges overlap</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
|
<action dev="POI-DEVELOPERS" type="fix">45784 - More fixes to SeriesTextRecord</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>
|
<action dev="POI-DEVELOPERS" type="fix">46033 - fixed TableCell to correctly set text type</action>
|
||||||
|
@ -552,6 +552,7 @@ public class HWPFDocument extends POIDocument
|
|||||||
pfs.createDocument(new ByteArrayInputStream(mainBuf), "WordDocument");
|
pfs.createDocument(new ByteArrayInputStream(mainBuf), "WordDocument");
|
||||||
pfs.createDocument(new ByteArrayInputStream(tableBuf), "1Table");
|
pfs.createDocument(new ByteArrayInputStream(tableBuf), "1Table");
|
||||||
pfs.createDocument(new ByteArrayInputStream(dataBuf), "Data");
|
pfs.createDocument(new ByteArrayInputStream(dataBuf), "Data");
|
||||||
|
writeProperties(pfs);
|
||||||
|
|
||||||
pfs.writeFilesystem(out);
|
pfs.writeFilesystem(out);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,10 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf;
|
package org.apache.poi.hwpf;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
|
||||||
@ -30,9 +34,7 @@ public abstract class HWPFTestCase
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp()
|
protected void setUp() throws Exception {
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
super.setUp();
|
super.setUp();
|
||||||
/**@todo verify the constructors*/
|
/**@todo verify the constructors*/
|
||||||
_hWPFDocFixture = new HWPFDocFixture(this);
|
_hWPFDocFixture = new HWPFDocFixture(this);
|
||||||
@ -40,13 +42,20 @@ public abstract class HWPFTestCase
|
|||||||
_hWPFDocFixture.setUp();
|
_hWPFDocFixture.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tearDown()
|
protected void tearDown() throws Exception {
|
||||||
throws Exception
|
if(_hWPFDocFixture != null) {
|
||||||
{
|
_hWPFDocFixture.tearDown();
|
||||||
_hWPFDocFixture.tearDown();
|
}
|
||||||
|
|
||||||
_hWPFDocFixture = null;
|
_hWPFDocFixture = null;
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HWPFDocument writeOutAndRead(HWPFDocument doc) throws IOException {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
doc.write(baos);
|
||||||
|
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
|
||||||
|
HWPFDocument newDoc = new HWPFDocument(bais);
|
||||||
|
return newDoc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,9 @@ package org.apache.poi.hwpf.usermodel;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.poi.EncryptedDocumentException;
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
|
import org.apache.poi.hwpf.HWPFTestCase;
|
||||||
import org.apache.poi.hwpf.model.StyleSheet;
|
import org.apache.poi.hwpf.model.StyleSheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -30,13 +29,10 @@ import org.apache.poi.hwpf.model.StyleSheet;
|
|||||||
*
|
*
|
||||||
* @author Nick Burch (nick at torchbox dot com)
|
* @author Nick Burch (nick at torchbox dot com)
|
||||||
*/
|
*/
|
||||||
public class TestProblems extends TestCase {
|
public class TestProblems extends HWPFTestCase {
|
||||||
|
|
||||||
private String dirname = System.getProperty("HWPF.testdata.path");
|
private String dirname = System.getProperty("HWPF.testdata.path");
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ListEntry passed no ListTable
|
* ListEntry passed no ListTable
|
||||||
*/
|
*/
|
||||||
@ -165,4 +161,14 @@ public class TestProblems extends TestCase {
|
|||||||
// Good
|
// Good
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testWriteProperties() throws Exception {
|
||||||
|
HWPFDocument doc = new HWPFDocument(new FileInputStream(
|
||||||
|
new File(dirname, "SampleDoc.doc")));
|
||||||
|
assertEquals("Nick Burch", doc.getSummaryInformation().getAuthor());
|
||||||
|
|
||||||
|
// Write and read
|
||||||
|
HWPFDocument doc2 = writeOutAndRead(doc);
|
||||||
|
assertEquals("Nick Burch", doc.getSummaryInformation().getAuthor());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user