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

C# Excel - Excel Creating in C#.NET


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




Overview



C#.NET Excel document file creating library control, RasterEdge XDoc.Excel 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 Excel document file. The Excel document file created by RasterEdge C# Excel document creator library is searchable and can be fully populated with editable text and graphics programmatically.


Related .net document control helps:
asp.net mvc file viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net create pdf control: ASP.NET Create PDF Document Control: create, convert PDF file from Word, Excel, Tiff file formats in C# ASP.NET
asp.net sharepoint file viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net azure pdf editor control: ASP.NET Azure PDF Editor Control: view, edit, annotate, redact PDF files online
asp.net pdf file viewer: ASP.NET PDF Document Viewer in C#: view, annotate, redact Adobe PDF files online in ASP.NET
asp.net open pdf password control: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#
asp.net redact pdf control: ASP.NET Redact PDF Document Control: redact, remove PDF text, images in web browser using C# ASP.NET


This Visual C# .NET Excel document creation control toolkit can not only allow developers to generate standard Excel document file but also offer them the ability to count the page numbers of generated Excel document by simple C# programming code. As this Excel document creator library is built in .NET Framework 2.0 and designed specifically for .NET applications, C# developers can easily use this professional Excel document generating SDK in all .NET developing applications, including ASP.NET web services and Windows Forms application.


After creating a Excel document in C#.NET using this Excel document creating toolkit, if you need to add some text and draw some graphics on created Excel document file, you can also use this C#.NET Excel document drawing library control.




C# DLLs: Create 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


Using namespaces:


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Excel;




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



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




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

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

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





Extract Excel Document From Existing Excel File Using C#



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




//  Load from a file
String inputFilePath1 = Program.RootPath + "\\" + "1.xlsx";
XLSXDocument doc1 = new XLSXDocument(inputFilePath1);
if (doc1 == 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");
    //  ...
}