We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Send parameter to doc

hi,
for example
i have a doc with below sentenses :

"your id is =ID , tanx "
"PIC"

i want sent user id and user Pic to doc and replace with ID, and PIC







Hi Morteza,

Thanks for your query. You can achieve your requirement by using Mail Merge feature. Please use the following code snippet to fill document with ID and image. Please read Mail Merge documentation for further detail. I have attached the sample doc file and FileToByteArray code in attachment.<span style=“font-size: 10pt; font-family: “Courier New”;”>

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:DoNotShowRevisions/>
<w:DoNotPrintRevisions/>
<w:DoNotShowMarkup/>
<w:DoNotShowComments/>
<w:DoNotShowInsertionsAndDeletions/>
<w:DoNotShowPropertyChanges/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-GB</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Cordia New"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Document doc = new Document(MyDir + "DemoMailMerge.doc");

doc.MailMerge.Execute(new string[] { "ID", "Logo" }, new object[] { "1001", FileToByteArray("d:\\Chrysanthemum.jpg") });

doc.Save(MyDir + "DemoMailMerge-Out.doc");

Hi Morteza,


Thanks for your inquiry. In your case, you can use the MailMerge feature of Aspose.Words. I hope you can achieve what you need after reading the articles suggested below:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/about-mail-merge-in-aspose-words.html
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-execute-simple-mail-merge.html
http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/howto-insert-images-from-a-database.html

Please let us know if you need more information, we are always glad to help you.

Best Regards,