<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'C++ Builder and Word fields' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'C++ Builder and Word fields' posted on the 'C++ Builder' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 11:29:21 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 11:29:21 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>C++ Builder and Word fields</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/391964/391964/c++-builder-and-word-fields/</link>
      <description>Hello everyone!!!&lt;br /&gt;
&lt;br /&gt;
anyone tried to pass some data to fields of a word's document after connecting to it?...&lt;br /&gt;
If yes, how I would do?...&lt;br /&gt;
&lt;br /&gt;
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}).&lt;br /&gt;
I connected to the document with:&lt;br /&gt;
&lt;br /&gt;
WordDocument-&amp;gt;ConnectTo(WordApplication-&amp;gt;Documents-&amp;gt;Open(filename));&lt;br /&gt;
&lt;br /&gt;
at this point how I could pass the contents of two dataset fields I have to those word's document fields?&lt;br /&gt;
&lt;br /&gt;
In the specific I tried a code like this:&lt;br /&gt;
&lt;br /&gt;
    WordApplication-&amp;gt;Connect();&lt;br /&gt;
    OleVariant filename = _PathDataBase + "\\document.doc";&lt;br /&gt;
    WordDocument-&amp;gt;ConnectTo(WordApplication-&amp;gt;Documents-&amp;gt;Open(filename));&lt;br /&gt;
    WordDocument-&amp;gt;OnClose = OnWordClose;&lt;br /&gt;
    WordApplication-&amp;gt;set_Visible(false);&lt;br /&gt;
    OleVariant vBookmark;&lt;br /&gt;
    if ( WordDocument-&amp;gt;Bookmarks-&amp;gt;Exists((wchar_t *)"FIRST_BOOKMARK") )&lt;br /&gt;
    {&lt;br /&gt;
      vBookmark = StringToOleStr("FIRST_BOOKMARK");&lt;br /&gt;
      WordDocument-&amp;gt;Bookmarks-&amp;gt;Item(vBookmark)-&amp;gt;Select();&lt;br /&gt;
      AnsiString StringToReplace = _DataSetMemo-&amp;gt;Fields-&amp;gt;Fields[1]-&amp;gt;AsString;&lt;br /&gt;
      WordApplication-&amp;gt;Selection-&amp;gt;TypeText(StringToOleStr(StringToReplace));&lt;br /&gt;
    }&lt;br /&gt;
    WordApplication-&amp;gt;set_Visible(true);&lt;br /&gt;
    WordApplication-&amp;gt;Activate();&lt;br /&gt;
&lt;br /&gt;
but when I am checking if the bookmark exists it returns an error like:&lt;br /&gt;
&lt;br /&gt;
(this-&amp;gt;Exists(Name, (VARIANT_BOOL*)&amp;amp;prop)) Error: C0000005 (-1073741819) @ ....\include\vcl\Word_2k.h/9396&lt;br /&gt;
Press [Y]es to terminate, [N]o to continue and [C]ancel to Debug.&lt;br /&gt;
&lt;br /&gt;
Did I have missed something?... or even did something wrong?...&lt;br /&gt;
&lt;br /&gt;
Thanks in advance to all!!&lt;br /&gt;
Ciao,&lt;br /&gt;
Luigi</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/391964/391964/c++-builder-and-word-fields/</guid>
      <pubDate>Fri, 05 Jun 2009 09:18:54 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
    <item>
      <title>Re: C++ Builder and Word fields</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/391964/392031/re-c++-builder-and-word-fields/#392031</link>
      <description>Or even anyone knows a way to find soem text I could set up and replace with the right text?...  Like if I put in word document this &amp;lt;fieldname=FIRST_BOOKMARK&amp;gt; and finding it from C++ code and replace the entire &amp;lt;&amp;gt; with something else I want to write for example a name?....&lt;br /&gt;
&lt;br /&gt;
Thanks again&lt;br /&gt;
Ciao,&lt;br /&gt;
Luigi&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/391964/392031/re-c++-builder-and-word-fields/#392031</guid>
      <pubDate>Mon, 08 Jun 2009 01:53:48 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
    <item>
      <title>Re: C++ Builder and Word fields</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/391964/409143/re-c++-builder-and-word-fields/#409143</link>
      <description>Yes u can. But I don't really understand what u mean... U want to change a text into the file or what? If u want to work with the text of the file use Standart-&amp;gt;Memo.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/391964/409143/re-c++-builder-and-word-fields/#409143</guid>
      <pubDate>Thu, 12 Nov 2009 03:05:02 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
    <item>
      <title>Re: C++ Builder and Word fields</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/391964/409145/re-c++-builder-and-word-fields/#409145</link>
      <description>Yes u can. But I don't really understand what u mean... U want to change a text into the file or what? If u want to work with the text of the file use Standart-&amp;gt;Memo.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/391964/409145/re-c++-builder-and-word-fields/#409145</guid>
      <pubDate>Thu, 12 Nov 2009 03:12:35 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
    <item>
      <title>Re: C++ Builder and Word fields</title>
      <link>http://www.programmersheaven.com/mb/bcbuilder/391964/409148/re-c++-builder-and-word-fields/#409148</link>
      <description>Yes u can. But I don't really understand what u mean... U want to change a text into the file or what? If u want to work with the text of the file use Standart-&amp;gt;Memo.&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/bcbuilder/391964/409148/re-c++-builder-and-word-fields/#409148</guid>
      <pubDate>Thu, 12 Nov 2009 03:19:40 -0700</pubDate>
      <category>C++ Builder</category>
    </item>
  </channel>
</rss>