Created
June 13, 2019 06:15
-
-
Save kenmlee/4f78af05bad884f058742d50add6bf4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws Exception | |
{ | |
String dataPath = "src/featurescomparison/workingwithimages/extractimagesfromdocument/data/"; | |
HWPFDocument doc = new HWPFDocument(new FileInputStream( | |
dataPath + "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( | |
dataPath + "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