- This topic has 0 replies, 1 voice, and was last updated 17 years, 2 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › Get Formatted Text From WORD!
Hi everyone,
I working with WORD by C++. I am stuck in a trouble that I can not know
how to get the formatted text from word to handle. My code like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /*<br /> I declare a range, I got plain text from WORD correctly,<br /> But I want formatted text.<br /> */<br /> _Document *testDoc;<br /> LPDISPATCH pdisp;<br /> pdisp = testDoc->Range(COleVariant( (long)DISP_E_PARAMNOTFOUND,<br /> VT_ERROR ), COleVariant( (long)DISP_E_PARAMNOTFOUND, VT_ERROR ) );<br /> Range r;<br /> r.AttachDispatch(pdisp);<br /> TextEffectFormat pFormat;<br /> <br /> //I confuse if this code is correct(It compiled, but not run correctly)<br /> pFormat = r.GetFormattedText();//return LPDISPATCH<br /> CString tt = pFormat.GetText(); // program exit when excute this line |
Is this sniplet correct? How to get formatted text and out put?
Please help me, I need to finish this project as quickly as possible. Thank you so much.