TextEnd.Text = 'Text add using paragraph end.' įile.WriteAllBytes( 'AddImageInline.docx', wordFile.Export(document)) Using (Stream stream = File.OpenRead( 'sample.png')) Insert image in the middle of text content TextStart.Text = 'Text add using paragraph start.' Paragraph paragraph = builder.InsertParagraph()
Add in-line image using Paragraph object Using (Stream stream = File.OpenRead( 'sample.jpg'))īuilder.InsertImageInline(stream, 'jpg') īuilder.InsertText( 'Simple sentence 2 in line') WordDocumentBuilder builder = new WordDocumentBuilder(document) īuilder.InsertText( 'Simple sentence 1 in line.
WordDocument document = new WordDocument() This C# tutorial shows how to add in-line image to MS Word document.Īdding image in-line means the image (such as jpg, png, tiff format) will be inserted in paragraph, and the image and text content will be display in the same line. How to Insert In-Line Image to Docx Document in C# language
How to Insert Image to Word Document in C#.NET Code