aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/Mammoth.java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-02-13 22:38:53 +0000
committerMichael Williamson <mike@zwobble.org>2016-02-13 22:38:53 +0000
commit8d01886d494d8251c0825ca7d6df214d19415325 (patch)
tree4a6755fff27f997c815418dabba20840aafd2322 /src/main/java/org/zwobble/mammoth/Mammoth.java
parent6ae918357de9c9ff0b84e70016ea08aefeb48dea (diff)
Read v:imagedata
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/Mammoth.java')
-rw-r--r--src/main/java/org/zwobble/mammoth/Mammoth.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/main/java/org/zwobble/mammoth/Mammoth.java b/src/main/java/org/zwobble/mammoth/Mammoth.java
index 9564a6f..0651944 100644
--- a/src/main/java/org/zwobble/mammoth/Mammoth.java
+++ b/src/main/java/org/zwobble/mammoth/Mammoth.java
@@ -8,24 +8,25 @@ import org.zwobble.mammoth.xml.XmlElement;
import java.io.File;
import java.io.IOException;
-import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import static com.google.common.collect.Iterables.transform;
public class Mammoth {
public static Result<String> convertToHtml(File file) {
- try (ZipFile zipFile = new ZipFile(file)) {
- ZipEntry entry = zipFile.getEntry("word/document.xml");
- XmlElement documentXml = OfficeXml.parseXml(zipFile.getInputStream(entry));
+ try (DocxFile zipFile = new ZippedDocxFile(new ZipFile(file))) {
+ XmlElement documentXml = OfficeXml.parseXml(zipFile.getInputStream("word/document.xml"));
Styles styles = Styles.EMPTY;
Numbering numbering = Numbering.EMPTY;
Relationships relationships = Relationships.EMPTY;
+ ContentTypes contentTypes = ContentTypes.DEFAULT;
DocumentXmlReader reader = new DocumentXmlReader(new BodyXmlReader(
styles,
numbering,
- relationships));
+ relationships,
+ contentTypes,
+ zipFile));
return reader.readElement(documentXml)
.map(Mammoth::convertToHtml);
} catch (IOException e) {
@@ -104,6 +105,11 @@ public class Mammoth {
public String visit(NoteReference noteReference) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String visit(Image image) {
+ throw new UnsupportedOperationException();
+ }
});
}
}