Skip to content

Commit 7fe5667

Browse files
authored
Add support for MSOffice macro-enabled docs and templates (#720)
1 parent 356bce8 commit 7fe5667

9 files changed

+46
-1
lines changed

core.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ function getFileTypeFromMimeType(mimeType) {
7979
ext: 'xlsx',
8080
mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
8181
};
82+
case 'application/vnd.ms-excel.sheet.macroEnabled':
83+
return {
84+
ext: 'xlsm',
85+
mime: 'application/vnd.ms-excel.sheet.macroEnabled.12',
86+
};
8287
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
8388
return {
8489
ext: 'xltx',
@@ -94,21 +99,41 @@ function getFileTypeFromMimeType(mimeType) {
9499
ext: 'docx',
95100
mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
96101
};
102+
case 'application/vnd.ms-word.document.macroEnabled':
103+
return {
104+
ext: 'docm',
105+
mime: 'application/vnd.ms-word.document.macroEnabled.12',
106+
};
97107
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
98108
return {
99109
ext: 'dotx',
100110
mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
101111
};
112+
case 'application/vnd.ms-word.template.macroEnabledTemplate':
113+
return {
114+
ext: 'dotm',
115+
mime: 'application/vnd.ms-word.template.macroEnabled.12',
116+
};
102117
case 'application/vnd.openxmlformats-officedocument.presentationml.template':
103118
return {
104119
ext: 'potx',
105120
mime: 'application/vnd.openxmlformats-officedocument.presentationml.template',
106121
};
122+
case 'application/vnd.ms-powerpoint.template.macroEnabled':
123+
return {
124+
ext: 'potm',
125+
mime: 'application/vnd.ms-powerpoint.template.macroEnabled.12',
126+
};
107127
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
108128
return {
109129
ext: 'pptx',
110130
mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
111131
};
132+
case 'application/vnd.ms-powerpoint.presentation.macroEnabled':
133+
return {
134+
ext: 'pptm',
135+
mime: 'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
136+
};
112137
case 'application/vnd.ms-visio.drawing':
113138
return {
114139
ext: 'vsdx',

fixture/fixture.docm

11.9 KB
Binary file not shown.

fixture/fixture.dotm

11.9 KB
Binary file not shown.

fixture/fixture.potm

32.7 KB
Binary file not shown.

fixture/fixture.pptm

32.7 KB
Binary file not shown.

fixture/fixture.xlsm

8.64 KB
Binary file not shown.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,12 @@
228228
"odg",
229229
"otg",
230230
"otp",
231-
"ott"
231+
"ott",
232+
"xlsm",
233+
"docm",
234+
"dotm",
235+
"potm",
236+
"pptm"
232237
],
233238
"dependencies": {
234239
"@tokenizer/inflate": "^0.2.6",

readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,9 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
453453
- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package
454454
- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image
455455
- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file
456+
- [`docm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled document
456457
- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word document
458+
- [`dotm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word macro-enabled template
457459
- [`dotx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Word template
458460
- [`drc`](https://en.wikipedia.org/wiki/Zstandard) - Google's Draco 3D Data Compression
459461
- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF)
@@ -536,7 +538,9 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
536538
- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format
537539
- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy
538540
- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics
541+
- [`potm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled template
539542
- [`potx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint template
543+
- [`pptm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft PowerPoint macro-enabled document
540544
- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft PowerPoint document
541545
- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript
542546
- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document
@@ -569,6 +573,7 @@ abortController.abort(); // Abort file-type reading from the Blob stream.
569573
- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format
570574
- [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack
571575
- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility
576+
- [`xlsm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled document
572577
- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel document
573578
- [`xltm`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel macro-enabled template
574579
- [`xltx`](https://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions) - Microsoft Excel template

supported.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ export const extensions = [
165165
'otp',
166166
'odg',
167167
'otg',
168+
'xlsm',
169+
'docm',
170+
'dotm',
171+
'potm',
172+
'pptm',
168173
];
169174

170175
export const mimeTypes = [
@@ -329,4 +334,9 @@ export const mimeTypes = [
329334
'application/vnd.oasis.opendocument.presentation-template',
330335
'application/vnd.oasis.opendocument.graphics',
331336
'application/vnd.oasis.opendocument.graphics-template',
337+
'application/vnd.ms-excel.sheet.macroEnabled.12',
338+
'application/vnd.ms-word.document.macroEnabled.12',
339+
'application/vnd.ms-word.template.macroEnabled.12',
340+
'application/vnd.ms-powerpoint.template.macroEnabled.12',
341+
'application/vnd.ms-powerpoint.presentation.macroEnabled.12',
332342
];

0 commit comments

Comments
 (0)