none
Using WordEditor RRS feed

  • Question

  • Hi,

    I'm taking the WordEditor from current inspector (Outlook 2007/2010):

    activeInspector->get_WordEditor(&pDisp);

    and then I tried to set it to IHTMLDocument:

    CComQIPtr<IHTMLDocument2> spHTMLDoc(pDisp);

    but I received spHTMLDoc equal zero, nothing was assign. I need to get or set input position inside the mail...

    Monday, June 18, 2012 5:15 PM

Answers

  • Why do you expect the Word's Document obejct to support the IHTMLDocument2 interface?

    To get the cursor position, use the Document.Application.Selection object.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, June 18, 2012 5:45 PM

All replies

  • Why do you expect the Word's Document obejct to support the IHTMLDocument2 interface?

    To get the cursor position, use the Document.Application.Selection object.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Monday, June 18, 2012 5:45 PM
  • OK, so for getting selection I'm using:

    CComPtr<IDispatch> pDisp;
    CComQIPtr<Outlook::_Inspector> activeInspector;
    CComQIPtr<Word::_Document> pWordDoc;
    CComQIPtr<Word::_Application> pAppl;
    CComQIPtr<Word::Selection> sel;

    activeInspector->get_WordEditor(&pDisp);
    pWordDoc = pDisp;
    pWordDoc->get_Application(&pAppl);
    pAppl->get_Selection(&sel);

    How I'm setting new selection range back to document?

    Monday, June 18, 2012 10:27 PM
  • OK, I saw that I can work with selection, in order of getting and setting, my question is, if I can do it with html and not plain text?
    Tuesday, June 19, 2012 6:57 AM
  • yes, no matter what body type is used underneath wordeditor object will be exposed.
    Tuesday, June 19, 2012 10:45 AM