How to C#: Load, Save Word Document
Overview for How to Use XDoc.Word to load and save Word document in C# .NET Programming Project
RasterEdge XDoc.Word has provided three ways to create word document object that are load from file, load from stream and load from byte array.
convert excel to pdf using c# windows application,
vb.net itextsharp print pdf,
vb.net pdf read text,
compress pdf file size in c#,
c# pdf split merge,
qr code generator c# tutorial.
Conversely, the Word SDK can also save word document object to file, stream or byte array.
Related .net document control helps:
asp.net office viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net pdf editor component: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
c# asp.net mvc document viewer: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net edit pdf page control:
ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net pdf viewer control free: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net sharepoint document viewer control: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net document viewer example:
EdgeDoc:ASP.NET Document Viewer C# Control:
Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
C# DLLs for Word File Loading and Saving
Add references:
RasterEdge.Imaging.Basic.dll
RasterEdge.Imaging.Basic.Codec.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;
Load Word Document From Existing File Using C#
You may also load or create a Word document object from existing Word file in C#.net.
convert pdf to png c#,
convert pdf to html programmatically c#,
convert pdf to word vb.net,
c# draw rectangle on pdf,
vb.net pdf add page thumbnails,
c# pdf page to bitmap,
vb.net pdf preview.
// Load from a file
String inputFilePath = Program.RootPath + "\\" + "1.docx";
DOCXDocument doc = new DOCXDocument(inputFilePath);
if (doc == 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.
pdf viewer asp.net control open source,
asp.net tiff image viewer,
asp.net edit pdf,
how to add header and footer in pdf using itextsharp in asp.net,
asp.net mvc pdf viewer free,
asp net replace text from pdf javascript,
pdf preview in asp net c# example.
// 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");
// ...
}
|
Load Word From Byte Array 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))
{
byte[] array = new byte[fileStream.Length];
fileStream.Read(array, 0, array.Length);
DOCXDocument doc = new DOCXDocument(fileStream);
if (doc == null) throw new Exception("fail to load word document from the stream");
// ...
}
|
Save Word Document To File in C# Project
Word document can be saved to a word file in C# programming.
String inputFilePath = Program.RootPath + "\\" + "2.docx";
String outputFilePath = Program.RootPath + "\\" + "output.docx";
DOCXDocument doc = new DOCXDocument(fileStream);
if (doc == null) throw new Exception("fail to load word document from the stream");
// Save document to a word file
doc.Save(outputFilePath);
|
Save Word Document To Stream Object in C# Project
Word document can be saved to a stream object in C# programming.
String inputFilePath = Program.RootPath + "\\" + "2.docx";
Stream stream = new MemoryStream();
DOCXDocument doc = new DOCXDocument(fileStream);
if (doc == null) throw new Exception("fail to load word document from the stream");
// Save document to a stream object
doc.SaveToStream(stream);
|
Save Word Document To Byte Array in C# Project
Word document can be saved to a byte array object in C# programming.
String inputFilePath = Program.RootPath + "\\" + "2.docx";
DOCXDocument doc = new DOCXDocument(inputFilePath);
if (doc == null) throw new Exception("fail to load word document from the stream");
// Save document to a byte array object
byte[] array = doc.SaveToByte();
|