Skip to content

Instantly share code, notes, and snippets.

@kenmlee
Created June 13, 2019 06:13
Show Gist options
  • Save kenmlee/ec1ba85bf4aca264deaccff1787e25b8 to your computer and use it in GitHub Desktop.
Save kenmlee/ec1ba85bf4aca264deaccff1787e25b8 to your computer and use it in GitHub Desktop.
public static void main(String[] args) throws Exception
{
HWPFDocument doc = new HWPFDocument(new FileInputStream(
"data/document.doc"));
List<Picture> pics = doc.getPicturesTable().getAllPictures();
for (int i = 0; i < pics.size(); i++)
{
Picture pic = (Picture) pics.get(i);
FileOutputStream outputStream = new FileOutputStream(
"data/apacheImages/" + "Apache_"
+ pic.suggestFullFileName());
outputStream.write(pic.getContent());
outputStream.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment