summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2017-04-01 16:30:06 +0100
committerMichael Williamson <mike@zwobble.org>2017-04-01 16:30:06 +0100
commit7f074c9d20d47b67f71642c536e39ef3006195ba (patch)
treec5d5fa43271c189e1036b9ee2a5e0798ca6a7837
parent164625ecf3d011503984e9eeb7edda3f827a9c17 (diff)
Allow embedded style maps to be disabled
-rw-r--r--Mammoth.Tests/DocumentConverterTests.cs8
-rw-r--r--Mammoth/DocumentConverter.cs4
2 files changed, 12 insertions, 0 deletions
diff --git a/Mammoth.Tests/DocumentConverterTests.cs b/Mammoth.Tests/DocumentConverterTests.cs
index 3b8ca6a..416893f 100644
--- a/Mammoth.Tests/DocumentConverterTests.cs
+++ b/Mammoth.Tests/DocumentConverterTests.cs
@@ -207,6 +207,14 @@ namespace Mammoth.Tests {
}
[Fact]
+ public void embeddedStyleMapsCanBeDisabled() {
+ AssertSuccessfulConversion(
+ ConvertToHtml("embedded-style-map.docx", mammoth => mammoth.DisableEmbeddedStyleMap()),
+ "<p>Walking on imported air</p>"
+ );
+ }
+
+ [Fact]
public void CanExtractRawTextFromFile() {
AssertSuccessfulConversion(
new DocumentConverter().ExtractRawText(TestFilePath("simple-list.docx")),
diff --git a/Mammoth/DocumentConverter.cs b/Mammoth/DocumentConverter.cs
index eb8c939..59b09e1 100644
--- a/Mammoth/DocumentConverter.cs
+++ b/Mammoth/DocumentConverter.cs
@@ -29,6 +29,10 @@ namespace Mammoth {
public DocumentConverter DisableDefaultStyleMap() {
return new DocumentConverter(options.disableDefaultStyleMap());
}
+
+ public DocumentConverter DisableEmbeddedStyleMap() {
+ return new DocumentConverter(options.disableEmbeddedStyleMap());
+ }
public IResult<string> ConvertToHtml(Stream stream) {
return new InternalDocumentConverter(options)