docx Open Source URL: http://docx.codeplex.com/
1. Introduce the DocX.dll call ReplaceText () method to replace the characters in the template. Word documents that only support docx format
using (docx docx = docx.load (filedemo)) { docx. ReplaceText ("@ xxx ", tester.name); Docx. ReplaceText ("@110101198101010001", Tester. Idcode); Docx. SaveAs (FileSave); }
2. Insert the shape of the picture.
Introducing Aspose.words Components
Document doc =NewDocument (FileSave); Documentbuilder Builder=NewDocumentbuilder (DOC); Shape Shape=NewShape (Doc, Shapetype.rectangle); //shape. Imagedata.setimage (fileimage);Shape. Width =width; Shape. Height=height; Shape. FillColor=color.red; //shape. HorizontalAlignment = HorizontalAlignment.Left; //Align to rightBuilder. MoveToBookmark (bookmark); Builder. Insertnode (Shape); //Bookmark myname = doc. range.bookmarks["MyName"]; //MyName. Text = ""; //Doc. range.bookmarks["MyName"]. Remove ();Doc. Save (FileSave, saveformat.docx);
"C # Moving Bricks" Export a docx file in Word format with docx