Open mc2002tii opened 5 years ago
same issue here is there any solutions?
@mc2002tii Can you include something I can repro?
@mc2002tii Can you include something I can repro?
I'll have to test this when I'm back in the office next week. I couldn't reproduce it today, but at home I have a completely different environment (O365 vs Word 2016, Mac vs. Windows). I know I could still reproduce it with .NET Core 3.1 and DocumentFormat.OpenXML 2.10, but I don't think I tried again when 2.11 came out.
I am facing this issue with .Net 6 DocumentFormat.OpenXML 2.16
related to issue 1551
Description
I'm using the sample code at https://docs.microsoft.com/en-us/office/open-xml/how-to-convert-a-word-processing-document-from-the-docm-to-the-docx-file-format to remove macros from a docm file and convert it to docx because we have some filtering software in place that prevents transferring files with macros.
Using that sample code I delete the VbaProjectPart, change the document type, and change the file extension. However, our filtering software identifies the resulting file as corrupt (Word 2016 opens the file just fine though, so it is probably within spec).
When I examine the contents of the .docx file, I notice that the [Content_Types].xml file at the root still contains the following line: <Default ContentType="application/vnd.ms-office.vbaProject" Extension="bin"/>
The VbaProjectPart PartName reference is gone and no other content in the .docx file structure contains any macro components. I think that one line in [Content_Types].xml is enough to trip up our scanner.
Is there some other way to get rid of this line that I'm missing, is this a bug, or is this structure just something that our scanning software should accept?
Information
Repro
Observed
file.docx [Content_Types].xml still contains a macro reference.
Expected file.docx should not contain any references to macros.