https://issues.apache.org/bugzilla/show_bug.cgi?id=51834
Bug #: 51834
Summary: Opening and Writing .doc file results in corrupt
document
Product: POI
Version: 3.8-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: major
Priority: P2
Component: HWPF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 27508
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27508
Opening and re-writing this file corrupts the output
This code run against the attached document results in a corrupt word document
that crashes MSWord 2003 and 2007 refuses to open.
private void start() throws FileNotFoundException, IOException {
POIFSFileSystem fsfilesystem = null;
HWPFDocument hwpfdoc = null;
InputStream resourceAsStream =
getClass().getResourceAsStream("/com/blackbox/admin/templates/rma.doc");
try {
fsfilesystem = new POIFSFileSystem(resourceAsStream );
hwpfdoc = new HWPFDocument(fsfilesystem);
FileOutputStream fos = new FileOutputStream(new
File("C:\\temp\\newTemplate.doc"));
hwpfdoc.write(fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Opened");
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]