Wed Oct 09, 2019 10:00 am
Document document = new Document(@"filepath of file docx input");
Section section = document.Sections[0];
Paragraph paragraph = section.Paragraphs.Count > 0 ? section.Paragraphs[0] : section.AddParagraph();
paragraph.AppendText("The sample demonstrates how to insert an image into a document.");
paragraph.ApplyStyle(BuiltinStyle.Heading2);
paragraph = section.AddParagraph();
Bitmap p = new Bitmap(Image.FromFile(@"filepath of file image"));
//rotate image and insert image to word document
// p.RotateFlip(RotateFlipType.Rotate90FlipX);
DocPicture picture = document.Sections[0].Paragraphs[0].AppendPicture(p);
//set image's position
picture.HorizontalPosition = 400.0F;
picture.VerticalPosition = -5.0F;
//set image's size
picture.Width = 214;
picture.Height = 56;
//set textWrappingStyle with image;
// picture.TextWrappingStyle = TextWrappingStyle.Through;
//Save doc file.
document.SaveToFile(@"filepath of file docx", FileFormat.Doc);
-- the input file null , i created the barcode from text , i convert barcode from byte[] to image, after, i insert image into file docx.