C++ Builder and Word fields - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

C++ Builder and Word fields

LuiginoLuigino Posts: 3Member
Hello everyone!!!

anyone tried to pass some data to fields of a word's document after connecting to it?...
If yes, how I would do?...

I created a word document saved as RTF where I put inside two REF fields related to two bookmarks ( ex. {REF FIRST_BOOKMARK} {REF SECOND_BOOKMARK}).
I connected to the document with:


at this point how I could pass the contents of two dataset fields I have to those word's document fields?

In the specific I tried a code like this:

OleVariant filename = _PathDataBase + "\document.doc";
WordDocument->OnClose = OnWordClose;
OleVariant vBookmark;
if ( WordDocument->Bookmarks->Exists((wchar_t *)"FIRST_BOOKMARK") )
vBookmark = StringToOleStr("FIRST_BOOKMARK");
AnsiString StringToReplace = _DataSetMemo->Fields->Fields[1]->AsString;

but when I am checking if the bookmark exists it returns an error like:

(this->Exists(Name, (VARIANT_BOOL*)&prop)) Error: C0000005 (-1073741819) @ ....includevclWord_2k.h/9396
Press [Y]es to terminate, [N]o to continue and [C]ancel to Debug.

Did I have missed something?... or even did something wrong?...

Thanks in advance to all!!


Sign In or Register to comment.