Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}A [SearchMatch|SearchMatch] object represents a match in the document found by using the method [Element.Search|Element.Search(String)].{excerpt}
{signature:C#}
 public sealed class SearchMatch
{signature}{signature:vb.net}
Public NotInheritable Class SearchMatch
{signature}
{example}{code:csharp|title=C#}

          //--- Required for IEnumerator
          using System.Collections;
          ...
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"c:\myDoc.doc");

          //--- Search a document for social security numbers, or any series of
          //--- nine digits, and remove them. The question mark after each dash
          //--- makes the presence of the dash optional.
          IEnumerator searcherator = doc.Search(@"\d\d\d-?\d\d-?\d\d\d\d").GetEnumerator();
          while (searcherator.MoveNext())
          {
               SearchMatch match = (SearchMatch)searcherator.Current;
               match.Element.DeleteElement();
          }
        {code}
{code:vb.net|title=vb.net}

          '--- Required for IEnumerator
          Imports System.Collections
          ...
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("c:\myDoc.doc")

          '--- Search a document for social security numbers, or any series of
          '--- nine digits, and remove them. The question mark after each dash
          '--- makes the presence of the dash optional.
          Dim searcherator As IEnumerator = doc.Search(@"\d\d\d-?\d\d-?\d\d\d\d").GetEnumerator()
          While searcherator.MoveNext()
               Dim match As SearchMatch = searcherator.Current
               match.Element.DeleteElement()
          End While
        {code}

{example}
{properties}
||Name||Description||
|[Element|SearchMatch.Element]|{excerpt-include:SearchMatch.Element|nopanel=true}|
|[GroupCount|SearchMatch.GroupCount]|{excerpt-include:SearchMatch.GroupCount|nopanel=true}|
{methods}
||Name||Description||
|[Group(Int32)|SearchMatch.Group(Int32)]|{excerpt-include:SearchMatch.Group(Int32)|nopanel=true}|
|[Replace(String)|SearchMatch.Replace(String)]|{excerpt-include:SearchMatch.Replace(String)|nopanel=true}|