Custom tags are not getting removed from presentation (C# .NET)

Hi Aspose,

I noticed one thing - Presentation.Save method generates own presentation tags when I save document in Open XML format.

For example:

  <p:tagLst xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
  <p:tag name="AS_NET" val="4.0.30319.42000" /> 
  <p:tag name="AS_OS" val="Microsoft Windows NT 6.2.9200.0" /> 
  <p:tag name="AS_RELEASE_DATE" val="2019.09.14" /> 
  <p:tag name="AS_TITLE" val="Aspose.Slides for .NET 4.0 Client Profile" /> 
  <p:tag name="AS_VERSION" val="19.9" /> 
  </p:tagLst>

I my application I remove all tags, so I do not expect to see these new tags. Please advise how can I save document without adding additional tags?

Many thanks,
Alex Shloma

@licenses,

I have observed your requirements. You can achieve this by using IPresentationFactory class. Please try using following sample code on your end.

    var presinfo = PresentationFactory.Instance.GetPresentationInfo( "ppt_M.ppt");
    presinfo.ReadDocumentProperties().ClearCustomProperties();
    presinfo.WriteBindedPresentation("ppt_M2.ppt");

Thank you, @mudassir.fayyaz, for quick reply.

Unfortunately suggested approach does not help. Moreover, when I process tags, I should not affect the custom properties. All I need is for the Aspose.Slides not to generate its own tags and not affect tags that already were present in the document.

For example first five tags (with prefix AS_) were generated by Aspose and shouldn’t be present in the document after saving. But two last were in the original document and should be kept.

<p:tagLst xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
<p:tag name=“AS_NET” val=“4.0.30319.42000” />
<p:tag name=“AS_OS” val=“Microsoft Windows NT 6.2.9200.0” />
<p:tag name=“AS_RELEASE_DATE” val=“2019.09.14” />
<p:tag name=“AS_TITLE” val=“Aspose.Slides for .NET 4.0 Client Profile” />
<p:tag name=“AS_VERSION” val=“19.9” />
<p:tag name=“PRES_TAG1” val=“Pres_Tag1_Value” />
<p:tag name=“PRES_TAG2” val=“Pres_Tag2_Value” />
</p:tagLst>

@licenses,

I have observed the issue shared by you and request you to please provide the source presentation and generated presentation file us. We will be able to investigate the issue further on our end on provision of requested information.

Hi @mudassir.fayyaz,

Please see sample files: Sample files.zip (108.7 KB)

Also please note, that Tags are added even during conversion Open XML file to another Open XML file.

@licenses,

Thank you for the elaboration. An issue with ID SLIDESNET-41436 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESNET-41436) have been fixed in this update.

@licenses,

Please use Presentation.CustomData.Tags to work with custom tags in your presentations.

You can remove tags by name before presentation saving:

Presentation present = new Presentation(path + "Original_2.pptm");

// remove tags by name before saving
foreach (string tagName in present.CustomData.Tags.GetNamesOfTags())
{
    if (tagName.StartsWith("AS_"))
        present.CustomData.Tags.Remove(tagName);
}

present.Save(path + "Converted.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

or clear all custom tags:

Presentation present = new Presentation(path + "Original_2.pptm");
present.CustomData.Tags.Clear();// remove custom tags
present.Save(path + "Converted.pptx", SaveFormat.Pptx);