J
JSS
i am creating a wrapper class for word by adding a
referrence to the Word library 9.0 in C#.Net and used the
following code.
Word.ApplicationClass ac = new Word.ApplicationClass ();
ac.Visible = true;
object oFile =
txtFileLocation.Text;
object oMissing = Type .Missing ;
object oTrue = true;
object oFalse = false;
Word.Document doc =
ac.Documents.Open (ref oFile,ref oFalse,ref oFalse,ref
oFalse,ref oMissing,ref oMissing,ref oFalse ,
ref oMissing,ref
oMissing,ref oMissing,ref oMissing,ref oTrue);
Word.Range rng = doc.Range(ref
oMissing ,ref oMissing);
Word.Find fnd = rng.Find;
fnd.Forward = true;
fnd.ClearFormatting();
object oFindText =
txtSearchWord.Text;
object oReplacetext =
txtReplaceWord.Text;
fnd.Execute(ref oFindText,ref
oMissing,ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref oMissing,
ref oMissing,ref
oReplacetext,ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing);
when i call fnd.ClearFormatting() it throws an exception
saying that the "Parameter is incorrect".the function does
not require a parameter.
Can anyone help please.I have to use Word 2000 and so
probably Word library 9.0.
Thanks in Advance
referrence to the Word library 9.0 in C#.Net and used the
following code.
Word.ApplicationClass ac = new Word.ApplicationClass ();
ac.Visible = true;
object oFile =
txtFileLocation.Text;
object oMissing = Type .Missing ;
object oTrue = true;
object oFalse = false;
Word.Document doc =
ac.Documents.Open (ref oFile,ref oFalse,ref oFalse,ref
oFalse,ref oMissing,ref oMissing,ref oFalse ,
ref oMissing,ref
oMissing,ref oMissing,ref oMissing,ref oTrue);
Word.Range rng = doc.Range(ref
oMissing ,ref oMissing);
Word.Find fnd = rng.Find;
fnd.Forward = true;
fnd.ClearFormatting();
object oFindText =
txtSearchWord.Text;
object oReplacetext =
txtReplaceWord.Text;
fnd.Execute(ref oFindText,ref
oMissing,ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing,ref oMissing,
ref oMissing,ref
oReplacetext,ref oMissing,ref oMissing,ref oMissing,ref
oMissing,ref oMissing);
when i call fnd.ClearFormatting() it throws an exception
saying that the "Parameter is incorrect".the function does
not require a parameter.
Can anyone help please.I have to use Word 2000 and so
probably Word library 9.0.
Thanks in Advance