/// <summary> /// Begins a PowerTools Block by (1) removing annotations and, unless the package was /// opened in read-only mode, (2) saving the package. /// </summary> /// <remarks> /// Removes <see cref="XDocument" /> and <see cref="XmlNamespaceManager" /> instances /// added by <see cref="PtOpenXmlExtensions.GetXDocument(OpenXmlPart)" />, /// <see cref="PtOpenXmlExtensions.GetXDocument(OpenXmlPart, out XmlNamespaceManager)" />, /// <see cref="PtOpenXmlExtensions.PutXDocument(OpenXmlPart)" />, /// <see cref="PtOpenXmlExtensions.PutXDocument(OpenXmlPart, XDocument)" />, and /// <see cref="PtOpenXmlExtensions.PutXDocumentWithFormatting(OpenXmlPart)" />. /// methods. /// </remarks> /// <param name="package"> /// A <see cref="WordprocessingDocument" />, <see cref="SpreadsheetDocument" />, /// or <see cref="PresentationDocument" />. /// </param> public static void BeginPowerToolsBlock(this OpenXmlPackage package) { if (package == null) { throw new ArgumentNullException("package"); } package.RemovePowerToolsAnnotations(); package.Save(); }