I want to create a world document using C#. So this is my code for replace word document variables.
private void FindAndReplace(Microsoft.Office.Interop.Word.Application WordApp, object findText, object replaceWithText)
{
try {
object matchCase = true;
object matchWholeWord = true;
object matchWildCards = false;
object matchSoundsLike = false;
object nmatchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida = false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
WordApp.Selection.Find.Execute(ref findText,
ref matchCase, ref matchWholeWord,
ref matchWildCards, ref matchSoundsLike,
ref nmatchAllWordForms, ref forward,
ref wrap, ref format, ref replaceWithText,
ref replace, ref matchKashida,
ref matchDiacritics, ref matchAlefHamza,
ref matchControl);
} catch (Exception error) {
lblerror.Visible = true;
lblerror.Text = error.ToString();
}
}
but in here if the "replaceWithText" too lone there is error and it says
String parameter too long.
So how can I replace long string?