C#: Online Guide
How To: excel SDK
Load, Save Document
  |  
Home ›› XDoc.Excel ›› C# Excel: Load, Save Document

How to C#: Load, Save Excel Document


Overview for How to Use XDoc.Excel to load and save Excel document in C# .NET Programming Project




RasterEdge XDoc.Excel has provided three ways to create Excel document object that are load from file, load from stream and load from byte array.Conversely, the Excel SDK can also save Excel document object to file, stream or byte array. convert excel to pdf c# code, export datagridview to pdf in vb.net 2008, pdfreader not opened with owner password itext c#, itextsharp pdf to text c#, azure function word to pdf, c# code 128 reader.


Related .net document control helps:
asp.net view tiff images: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net mvc word viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
c# asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net view powerpoint: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net mvc pdf editor using c#: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net pdf viewer using c#: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
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...




C# DLLs: Load and Save Excel Document



Add necessary 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.Excel.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll asp.net pdf preview, asp net mvc show pdf in div, load pdf file asp.net c#, asp.net core open excel file, asp net replace text from pdf javascript, asp.net pdf editor control, asp.net remove image from pdf file.


Using namespaces:


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Excel;




Load Excel Document From Existing File Using C#



You may also load or create a Excel document object from existing Excel file in C#.net. convert text to pdf c#, reduce pdf file size vb net, how to make pdf password protected in c#, c# add watermark to existing pdf file using itextsharp, vb.net itextsharp split pdf, c# code to convert pdf file to tiff, vb.net rotate pdf.




//  Load from a file
String inputFilePath  = Program.RootPath + "\\" + "1.xlsx";
XLSXDocument doc = new XLSXDocument(inputFilePath);
if (doc == null) throw new Exception("fail to load the file");
//  ...





Load Excel From Stream Object in C# Project



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




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





Load Excel From Byte Array Object in C# Project



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




//  Load from a stream
String inputFilePath = Program.RootPath + "\\" + "2.xlsx";
using (FileStream fileStream = File.Open(inputFilePath, FileMode.Open, FileAccess.Read))
{
    byte[] array = new byte[fileStream.Length];
    fileStream.Read(array, 0, array.Length);
    XLSXDocument doc = new XLSXDocument(fileStream);
    if (doc == null) throw new Exception("fail to load Excel document from the stream");
    //  ...
}





Save Excel Document To File in C# Project



Excel document can be saved to a Excel file in C# programming.




String inputFilePath = Program.RootPath + "\\" + "2.xlsx";
String outputFilePath = Program.RootPath + "\\" + "output.xlsx";
XLSXDocument doc = new XLSXDocument(fileStream);
if (doc == null) throw new Exception("fail to load Excel document from the stream");
//  Save document to a Excel file
doc.Save(outputFilePath);





Save Excel Document To Stream Object in C# Project



Excel document can be saved to a stream object in C# programming.




String inputFilePath = Program.RootPath + "\\" + "2.xlsx";
Stream stream = new MemoryStream();
XLSXDocument doc = new XLSXDocument(fileStream);
if (doc == null) throw new Exception("fail to load Excel document from the stream");
//  Save document  to  a stream object
doc.SaveToStream(stream);





Save Excel Document To Byte Array in C# Project



Excel document can be saved to a byte array object in C# programming.




String inputFilePath = Program.RootPath + "\\" + "2.xlsx";
XLSXDocument doc = new XLSXDocument(inputFilePath);
if (doc == null) throw new Exception("fail to load Excel document from the stream");
//  Save document to a byte array object
byte[] array = doc.SaveToByte();