Hi,
in einem Projekt habe ich das so gemacht:
Ein Word-Vorlage erstellt, mit einem Frame, jedes Element im Word hat ein Index (keine Ahnung mehr ob man den selbst vergeben muss, oder ob das automatisch passiert!?, ist zu lange her.)
Das Image temp zwischengespeichert.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37:
| public void ShowWordReport(string id, string image, string wordPatternFile) { if (!File.Exists(wordPatternFile)) { MessageBox.Show("Die Vorlage wurde nicht gefunden!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
ApplicationClass myWordApp = new ApplicationClass();
myWordApp.Visible = true;
object wordPattern = wordPatternFile; object newDoc = false; object documentType = 0; object visible = true;
Document aDoc = myWordApp.Documents.Add(ref wordPattern, ref newDoc, ref documentType, ref visible);
object n = Type.Missing; object index = 3; object what = WdGoToItem.wdGoToBookmark; object name = aDoc.Bookmarks.get_Item(ref index).Name; myWordApp.Selection.GoTo(ref what, ref n, ref n, ref name); myWordApp.Selection.Text = id; object indexTextBox1 = 1; Shape molMassTextBox = aDoc.Shapes.get_Item(ref indexTextBox1); molMassTextBox.Fill.UserPicture(image); } |
Ich denke das solte dir weiterhelfen

Google kennt sicher noch mehr......