A
Alexander
Hello.
Where can i find information about API for MS Office 2007 for highlighting
text without changing style/formatting, like spellchecker does it?
I need to highlight text in word, excel, powerpoint.
I found example, it works, but changes formatting.
private void FindLoop(object findText)
{
int intFound = 0;
Document document = Globals.ThisAddIn.Application.ActiveDocument;
Range rng = document.Content;
object missing = Type.Missing ;
object format = true;
rng.Find.ClearFormatting();
rng.Find.Forward = true;
rng.Find.Text = findText.ToString();
rng.Find.MatchCase = false;
rng.Find.Format = true;
rng.Find.Execute(ref findText, ref missing, ref missing, ref missing, ref
missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
while (rng.Find.Found)
{
intFound++;
rng.Font.Bold = 1;
rng.Font.Color = WdColor.wdColorRed;
rng.Find.Execute(
ref findText, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
}
}
Thanks.
Where can i find information about API for MS Office 2007 for highlighting
text without changing style/formatting, like spellchecker does it?
I need to highlight text in word, excel, powerpoint.
I found example, it works, but changes formatting.
private void FindLoop(object findText)
{
int intFound = 0;
Document document = Globals.ThisAddIn.Application.ActiveDocument;
Range rng = document.Content;
object missing = Type.Missing ;
object format = true;
rng.Find.ClearFormatting();
rng.Find.Forward = true;
rng.Find.Text = findText.ToString();
rng.Find.MatchCase = false;
rng.Find.Format = true;
rng.Find.Execute(ref findText, ref missing, ref missing, ref missing, ref
missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
while (rng.Find.Found)
{
intFound++;
rng.Font.Bold = 1;
rng.Font.Color = WdColor.wdColorRed;
rng.Find.Execute(
ref findText, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing);
}
}
Thanks.