ClearFormat.cs
  1. //
  2. // This code is part of Document Solutions for Word demos.
  3. // Copyright (c) MESCIUS inc. All rights reserved.
  4. //
  5. using System;
  6. using System.IO;
  7. using System.Drawing;
  8. using System.Linq;
  9. using GrapeCity.Documents.Word;
  10.  
  11. namespace DsWordWeb.Demos
  12. {
  13. // This sample shows how to clear all formatting in a DOCX.
  14. // To see see the sample document with original formatting,
  15. // run the SampleParagraphs sample.
  16. public class ClearFormat
  17. {
  18. public GcWordDocument CreateDocx()
  19. {
  20. var doc = new GcWordDocument();
  21. doc.Load(Path.Combine("Resources", "WordDocs", "SampleParagraphs.docx"));
  22.  
  23. // ClearFormatting() is defined on the RangeBase class.
  24. // It can be applied to any range as well as to the whole
  25. // document body (which is derived from RangeBase too):
  26. doc.Body.ClearFormatting();
  27. return doc;
  28. }
  29. }
  30. }
  31.