Virtual Science Headline Animator

Virtual Science

Search

Sunday, February 13, 2011

Read, Write Excel files in C#, VB.NET

Excel Jetcell .NET component, new release 2.0 has been introduced by Devtrio GROUP. Now .NET developers (C# VB.NET) can read, write Excel files ( XLSX , XLS , CSV ) in ASP.NET applications.
excel writing reading xls xlsx
Excel Jetcell.NET is a professional component that enables .NET developers to read, write Excel Spreadsheet files ( XLSX , XLS , CSV ) from their .NET applications (C#, VB.NET). The Excel spreadsheet is represented as a tree structure. Root of the tree is a Workbook object that has different Worksheets and so on. The set of well-considered and clear API functions allows developers to read, write Excel data dynamically in ASP.NET.
Excel Jetcell .NET component requires only .NET Framework and is many times faster than Excel automation objects. The code of Excel Jetcell .NET component is fully managed and works under .NET Framework started from 1.1 version. Developers can create C# / VB.NET applications or deploy website on servers with medium-trust level without needing to rely on Microsoft Excel.
Excel Jetcell .NET key features:
- Various cell data types (numbers, strings, dates, floating point etc.)
- Multiple worksheets.
- Number formatting (number, currency, date, time, fraction etc.)
- Font formatting (size, color, font type, italic and strikeout properties, boldness, underlining, subscript and superscript).
- Cell alignment (vertical, horizontal).
- Cell Background and Fill Pattern.
- Cell borders (color, style).
- Merged cells.
- Hyperlinks.
- Images in Excel sheet.
- Export to DataTable, DataSet.
- Reads XLSX XLS CSV files (delimited with comma, tab, semicolon or any other separator).
This example shows read/write functions using Excel Jetcell .NET component.
// C# Code Example
ExcelWorkbook Wbook = ExcelWorkbook.ReadXLS("Excel.xls");
ExcelCellCollection Cells = Wbook.Worksheets[0].Cells;

if (Cells["A1"].Value.ToString() == "Cost")
{
Cells["A2"].Value = 10755.45;
Cells["A3"].Value = 11550.75;
}
Wbook.WriteXLS("Excel.xls");
VB.NET Code Example
Dim Wbook As ExcelWorkbook = ExcelWorkbook.ReadXLS("Excel.xls")
Dim Cells As ExcelCellCollection = Wbook.Worksheets(0).Cells

If Cells("A1").Value.ToString() = "Cost" Then
Cells("A2").Value = 10755.45
Cells("A3").Value = 11550.75
End If
Wbook.WriteXLS("Excel.xls")

By:DevitrioGroup

No comments:

Post a Comment