Я попробовал код ниже и смог добавить текст. Как вместо этого добавить HTML?
Код: Выделить всё
// Get the active Inspector (email editor)
Outlook.Inspector inspector = outlookApp.ActiveInspector();
if (inspector != null && inspector.CurrentItem is Outlook.MailItem mailItem)
{
// Get the Word editor for the email
Document wordDocument = inspector.WordEditor as Document;
if (wordDocument != null)
{
// Access the current selection (cursor position)
Selection selection = wordDocument.Application.Selection;
if (selection != null)
{
// Insert HTML at the current selection (cursor position)
Range range = selection.Range;
selection.TypeText(signature);
// Set the range's HTML format to preserve HTML tags
range.FormattedText = wordDocument.Application.Selection.FormattedText;
// Set the email's HTML body to include the new HTML content
//mailItem.HTMLBody = mailItem.HTMLBody.Insert(mailItem.HTMLBody.Length, "Ram");
return "NOTREQUIRED";
}
}
}
Код: Выделить всё
//Insert the HTML content at the current cursor position
selection.Range.InsertAfter(htmlContent);
Подробнее здесь: https://stackoverflow.com/questions/793 ... vsto-addin
Мобильная версия