using NPOI.XWPF.UserModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NPOI
{
class Program
{
static void Main(string[] args)
{
//Create document
XWPFDocument doc = new XWPFDocument();
XWPFParagraph para = doc.CreateParagraph();
XWPFRun run = para.CreateRun();
//Insert image and set its size
using (FileStream picFile = new FileStream("../../../Data/image.jpg", FileMode.Open,FileAccess.Read))
{
run.AddPicture(picFile, (int)PictureType.PNG, "image", 300 * 12857, 168 * 12857);
}
//Save the file
using (FileStream file = File.Create("Image.docx"))
{
doc.Write(file);
}
//Launch
System.Diagnostics.Process.Start("Image.docx");
}
}
}