Issues while integrating outlook 2007 component

R

ranga

Hi All,

I work for a adobe product called Contribute, we have Microsoft Office
plugin integrated to our product. To be specific, When we have opened
an existing mail item in outlook, we can select some portion of the
mail data or full mail content and can open it in our contribute
application for futher contribute specific operations.

And we had integrated office 2003 also with our product, now i am
checking whether the same code works for office 2007 or it needs
changes.

I came across several issues and started debuging it.

First of all, in office 2007, the mail content gets opened in
wordeditor (enum value is Outlook::eek:lEditorWORD) while office 2003
used to open the mail content in html editor (enum value in msoutl.tlh
is Outlook::eek:lEditorHTML).

In our code while looking for the selection in the opened mail item, we
used to use API which are for html editor as shown below


//See if there is a selection in the document
IDispatch* pHtmlEditor = NULL;
m_Inspector->get_HTMLEditor(&pHtmlEditor);

if(pHtmlEditor)
{
CComQIPtr <IHTMLDocument2> html(pHtmlEditor);
ATLASSERT(html);
CComPtr <IHTMLSelectionObject > selection;
html->get_selection(&selection);
if(!selection)
{
ATLASSERT(selection);
return;
}
IDispatch* pRange = NULL;
selection->createRange(&pRange);
if(pRange)
{
CComQIPtr<IHTMLTxtRange> textRange(pRange);
BSTR pText = NULL;
textRange->get_text(&pText);
BSTR pHtmlText = NULL;
textRange->get_htmlText(&pHtmlText);


But now with office 2007, since outlook always opens in wordeditor ,
our APIs for html editor doesnot work.
And the interfaces IHTMLDocument2 ,IHTMLSelectionObject ,IHTMLTxtRange
etc.. works only for html editor not for wordeditor.

Now i want to figureout how to implement the same thing for word
editor.

Has any come across this issues, or anyone has any pointers about how
to go ahead to get the selection worked for outlook2007.

Thanks in advance
--ranga
 
K

Ken Slovak - [MVP - Outlook]

First of all, even in previous versions of Outlook it never was true that
the editor was always the HTML editor or that the format was HTML. Any of
the 3 available formats could and can be used (HTML, Plain Text, Rich Text)
and previously either WordMail or the Outlook editor could be used. Now it's
just WordMail.

In Outlook 2003 for example, the default is HTML format with WordMail. In
that case the HTML editor would be Word. For earlier versions you always
should check IsWordMail before assuming anything. In Outlook 2007 IsWordMail
is always true.

If WordMail is being used you access WordEditor, which is the active
Document object in the Word object model. Then you can use Word code to
access the body of the email. If HTML was being used with the Outlook editor
then using HTMLEditor will yield you an HTML Document object that you can
work with. In Plain Text and the Outlook editor you don't have any options
for working with parts of the Body unless you get Body as a string and play
with that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top