Describe the bug
I'm using OpenXML SDK to disable font embedding and remove all FontParts in a presentation. Saving the document isn't resulting in [Content_Types].xml getting updated even though no more fntdata parts exist in the file.
To Reproduce
Steps to reproduce the behavior:
- Download ClearEmbedFontsFlag.zip
- Run the below code using the included pptx as input
internal static void RemoveEmbeddedFontsMin(string file)
{
using PresentationDocument doc = PresentationDocument.Open(file, isEditable: true);
PresentationPart? presentationPart = doc.PresentationPart;
if (presentationPart is null)
return;
BooleanValue? embedFonts = presentationPart.Presentation.EmbedTrueTypeFonts;
if (embedFonts is null || !embedFonts.HasValue || !embedFonts.Value)
return;
presentationPart.Presentation.EmbedTrueTypeFonts = false;
EmbeddedFontList? fontList = presentationPart.Presentation.EmbeddedFontList;
if (fontList is not null)
{
presentationPart.Presentation.EmbeddedFontList = null;
presentationPart.DeleteParts(presentationPart.FontParts);
}
doc.Save();
}
Observed behavior
See EmbeddedFont - Copy.pptx for result.
When you inspect [Content_Types].xml, it still contains this entry:
<Default Extension="fntdata" ContentType="application/x-fontdata" />
Expected behavior
All fntdata parts have been removed. This entry is not nececssary.
If I switch to a SaveAs to a new file instead of a Save, the fntdata entry is removed from the resulting file.
If I open the file inside PowerPoint and let the app save, it also removes the unnecessary entry.
Desktop (please complete the following information):
- OS: Windows
- Office version: N/A
- .NET Target: .Net 6.0
-
- DocumentFormat.OpenXml Version: 2.20.0
Additional context
Add any other context about the problem here.
Describe the bug
I'm using OpenXML SDK to disable font embedding and remove all FontParts in a presentation. Saving the document isn't resulting in
[Content_Types].xmlgetting updated even though no morefntdataparts exist in the file.To Reproduce
Steps to reproduce the behavior:
Observed behavior
See EmbeddedFont - Copy.pptx for result.
When you inspect [Content_Types].xml, it still contains this entry:
<Default Extension="fntdata" ContentType="application/x-fontdata" />Expected behavior
All
fntdataparts have been removed. This entry is not nececssary.If I switch to a SaveAs to a new file instead of a Save, the
fntdataentry is removed from the resulting file.If I open the file inside PowerPoint and let the app save, it also removes the unnecessary entry.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.