Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is my code, for your interest. Firstly, this is the <code>letter.doc</code> files</p> <blockquote> <p>Dear /FirstName/ /MiddleName/ /LastName/:</p> <p>Welcome to our program. We are committed to giving you the highest quality of customer service....</p> </blockquote> <p>I also have a <code>Dictionary&lt;string, string&gt; Data</code> that store the key/value for each placeholder</p> <pre><code> ... "/FirstName/" : "read from database" "/MiddleName/" : "read from database" "/LastName/" : "read from database" ... </code></pre> <p>And I have a method that reads the .doc file and replaces the placeholders :</p> <pre><code> oWordApp = new MSWord.ApplicationClass(); doc = oWordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing); doc.Activate(); doc.Select(); oWordApp.Selection.Find.ClearFormatting(); oWordApp.Selection.Find.MatchWildcards = true; oWordApp.Selection.Find.Wrap = MSWord.WdFindWrap.wdFindContinue; oWordApp.Selection.Find.Text = "/[A-Z]*/"; bool isFound = true; while(isFound == true) { isFound = oWordApp.Selection.Find.Execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); if( isFound == true ) { //use the database to do the replacing //how to get the placeholder itself, such as "/FirstName/", "/LastName/",... } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload