-
Notifications
You must be signed in to change notification settings - Fork 3
Create a word processing document
ZeeshanShafqat edited this page Jan 28, 2014
·
2 revisions
###OpenXML SDK ###
class Program
{
static void Main(string[] args)
{
CreateWordprocessingDocument("Create a word processing document.doc");
}
public static void CreateWordprocessingDocument(string filepath)
{
// Create a document by supplying the filepath.
using (WordprocessingDocument wordDocument =
WordprocessingDocument.Create(filepath, WordprocessingDocumentType.Document))
{
// Add a main document part.
MainDocumentPart mainPart = wordDocument.AddMainDocumentPart();
// Create the document structure and add some text.
mainPart.Document = new Document();
Body body = mainPart.Document.AppendChild(new Body());
Paragraph para = body.AppendChild(new Paragraph());
Run run = para.AppendChild(new Run());
run.AppendChild(new Text("Create text in body - CreateWordprocessingDocument"));
}
}
}
###Aspose.Words ###
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Writeln("Hello World!");
doc.Save("Create word processing document.docx");
}
}
Download