Hi,
I am working on a ATL Component that loads a Microsoft Word document and extracts all the text from it. As far as extracting the text is concerned it works fine. But when I extract text from the Comments that one gives in the word document, I can extract the number of comments, Author who made the comments and other relevant stuff. But I cann't extract the text in the Comments.
I am using msword9 component.
Code snippet is as follows:
theDoc = theDocuments.Open(vFileName,vTrue, vTrue, vOptional, vOptional,vOptional,vOptional,vOptional, vOptional,vOptional,vOptional,vOptional);
// Set the Readonly property of the Document to True,
// so as to avoid any change.
theDoc.SetReadOnlyRecommended(TRUE);
// Set the range of the document from Start point to End point
theRange = theDoc.Range(vStart, vEnd);
theComments = theRange.GetComments();
int iCommentCounter = theComments.GetCount();
for(int index = 0 ;index < iCommentCounter;index++)
{
CString str = theComments.GetShowBy();
theComment = theComments.Item(index);
//Fails, this should return me a single comment object of type LPDISPATCH
It gives : "Unhandled Exception (Kernel32.dll):0xE06D7363: Microsoft C++ exception
str = theComment.GetAuthor();
int iValue = theComment.GetIndex(); Range objRange = theComment.GetRange();
str = objRange.GetText();
MessageBox(NULL,(LPCTSTR)str,"Comments Made",MB_OK);
}
Can someone help my case. Thanks in advance.
Hemant
I am working on a ATL Component that loads a Microsoft Word document and extracts all the text from it. As far as extracting the text is concerned it works fine. But when I extract text from the Comments that one gives in the word document, I can extract the number of comments, Author who made the comments and other relevant stuff. But I cann't extract the text in the Comments.
I am using msword9 component.
Code snippet is as follows:
theDoc = theDocuments.Open(vFileName,vTrue, vTrue, vOptional, vOptional,vOptional,vOptional,vOptional, vOptional,vOptional,vOptional,vOptional);
// Set the Readonly property of the Document to True,
// so as to avoid any change.
theDoc.SetReadOnlyRecommended(TRUE);
// Set the range of the document from Start point to End point
theRange = theDoc.Range(vStart, vEnd);
theComments = theRange.GetComments();
int iCommentCounter = theComments.GetCount();
for(int index = 0 ;index < iCommentCounter;index++)
{
CString str = theComments.GetShowBy();
theComment = theComments.Item(index);
//Fails, this should return me a single comment object of type LPDISPATCH
It gives : "Unhandled Exception (Kernel32.dll):0xE06D7363: Microsoft C++ exception
str = theComment.GetAuthor();
int iValue = theComment.GetIndex(); Range objRange = theComment.GetRange();
str = objRange.GetText();
MessageBox(NULL,(LPCTSTR)str,"Comments Made",MB_OK);
}
Can someone help my case. Thanks in advance.
Hemant