Declaration
Automation:
ulong  ReplaceAll ( [in]   ref byte  pFrom, [in]   uint  size_from, [in]   ref byte  pTo, [in]   uint  size_to, [in]   bool  ignore_case, [in]   IMultiSelection  pSelection) ;
Native (C++):
HRESULT  ReplaceAll ( [in]   unsigned char *  pFrom, [in]   unsigned long  size_from, [in]   unsigned char *  pTo, [in]   unsigned long  size_to, [in]   BOOL  ignore_case, [in]   IMultiSelection *  pSelection, [out, retval]   unsigned __int64 *  pReplaced) ;
Parameters
pFromPointer to a search patternsize_fromSearch pattern sizepToPointer to a replace patternsize_toReplace pattern sizeignore_caseTrue to ignore case, False to perform exact matchingpSelectionMultiple Selection object, describing the ranges in which to perform search and replacepReplacedPointer to a variable that receives the number of replacements done.
Return Value
Automation:A number of replacements done.Native: S_OK or standard OLE error code.
Remarks
Finds and replaces all occurrences of the given pattern with another pattern. Complexity: varying.
Examples

Searching all pattern occurrences

C#Copy Code
FileDocumentLib.FileDocument fdoc = new FileDocumentLib.FileDocument();
FileDocumentLib.IMultiSelection msel = fdoc.CreateEmptySelection();

fdoc.Open(@"c:\temp\file.txt");
msel.AddRange(0, fdoc.FileSize);  // We'll be searching in a whole file

byte[] pattern1 = new byte[] { 0x0d, 0x0a }; // EOL pattern
byte[] pattern2 = new byte[] { 0x0d, 0x0a, 0x0d, 0x0a }; // Double-EOL pattern
ulong nReplacements = fdoc.ReplaceAll(ref pattern1[0], pattern1.Length, ref pattern2[0], pattern2.Length, false, msel);