Create Empty Document in NPOI

Aspose.Words - Create Empty Document

Call the Document constructor without parameters to create a new blank document.

If you want to generate a document programmatically, the most reasonable step after creation is to use DocumentBuilder to add document contents.

C#

using Aspose.Words;
Document doc = new Document();
doc.Save("blank.docx");

NPOI HWPF XWPF - Create Empty Document

Below example shows how to create a new document using NPOI XWPF

C#

using NPOI.XWPF.UserModel;
XWPFDocument doc = new XWPFDocument();
doc.CreateParagraph();
using (FileStream sw = File.Create("blank.docx"))
{
    doc.Write(sw);
}

Download Running Code

Download Create Empty Document from any of the below mentioned social coding sites: