C#: Online Guide
How To: Word SDK
File: Create, Load a Word File
File: Create, Load a Word File
  |  
Home ›› XDoc.Word ›› C# Word: Create, Load a Word File

C# Word - Word Creating in C#.NET


Tell Users How to Create New Word File and Load Word from Other Files




Overview



C#.NET Word document file creating library control, RasterEdge XDoc.Word SDK for .NET, is a robust & thread-safe .NET solution which provides a reliable and quick approach for C# developers to create a highly-secure and industry-standard Word document file. c# excel to pdf free library, vb.net add text to pdf, pdfsharp table example c#, create pdf thumbnail image c#, c# free tiff library, c# data matrix reader. The Word document file created by RasterEdge C# Word document creator library is searchable and can be fully populated with editable text and graphics programmatically.


Related .net document control helps:
asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net excel web viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
asp.net image viewer zoom: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net mvc text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net document viewer control: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...


This Visual C# .NET Word document creation control toolkit can not only allow developers to generate standard Word document file but also offer them the ability to count the page numbers of generated Word document by simple C# programming code. c# draw rectangle in pdf, c# convert pdf to image without ghostscript, c# get thumbnail of pdf, convert pdf to html string c#, c# create editable pdf, vb.net search pdf for text, c# draw pdf. As this Word document creator library is built in .NET Framework 2.0 and designed specifically for .NET applications, C# developers can easily use this professional Word document generating SDK in all .NET developing applications, including ASP.NET web services and Windows Forms application.


After creating a Word document in C#.NET using this Word document creating toolkit, if you need to add some text and draw some graphics on created Word document file, you can also use this C#.NET Word document drawing library control. open word document in asp.net mvc, asp.net add text to pdf file, edit pdf in asp.net mvc, asp.net core mvc view pdf, pdf preview in asp net c# example, imagedraw asp.net multipage tiff viewer, asp.net c# pdf viewer.




C# DLLs: Word Creating



Add references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Word;




Create New Word Document With One Blank Page in C# Project



In C# class programming, you can use specific APIs to create Word file. And the Word document can contain one empty page or multiple empty pages. The following example will tell you how to create a Word document with one empty page.




String outputFile = Program.RootPath + "\\" + "output.docx";

//  Create a new Word Document object with one blank page
DOCXDocument doc = DOCXDocument.Create(outputFile);

//  Save the new created Word document into file
doc.Save(outputFile);





Extract Word Document From Existing Word File Using C#



You may also load or create a Word document object from existing Word file in C#.net.




//  Load from a file
String inputFilePath1 = Program.RootPath + "\\" + "1.docx";
DOCXDocument doc1 = new DOCXDocument(inputFilePath1);
if (doc1 == null) throw new Exception("fail to load the file");
//  ...





Load Word From Stream Object in C# Project



Word document can be loaded from a stream object in C# programming.




//  Load from a stream
String inputFilePath = Program.RootPath + "\\" + "2.docx";
using (FileStream fileStream = File.Open(inputFilePath, FileMode.Open, FileAccess.Read))
{
    DOCXDocument doc = new DOCXDocument(fileStream);
    if (doc == null) throw new Exception("fail to load word document from the stream");
    //  ...
}