Formula is a core of excel automation and allows to organize a complex applications. The easiest and fastest way to work with formula from C#/VB.NET/ASP.NET project is to use third-party components, like Excel .NET introduced by Elerium Software. Elerium Excel .NET component can create, read and calculate formulas.
First off all a developer must install Excel .NET to the project:
1. Download the latest version of the component from this link: http://eleriumsoft.com/
2. Extract the downloaded archive and put the Excel.dll component into /bin folder of the project.
3. Add the component to the “using” section:
using Docs.Excel;
When the component is connected to the project, a developer can create/open excel files and work with its content, including formulas:
using System;
using System.Collections.Generic;
using System.Text;
using Docs.Excel;
namespace Formula
{
class Program
{
static void Main(string[]
{
//Create a new workbook.
ExcelWorkbook Wbook = new ExcelWorkbook();
//Add new worksheet to workbook.
Wbook.Worksheets.Add("
//Set width of columns.
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
//Column headings.
Wbook.Worksheets[
Wbook.Worksheets[
//Writes formulas.
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
Wbook.Worksheets[
// XSL
Wbook.WriteXLS(@"
// XSLX
Wbook.WriteXLSX(@"
//Open specified file in MS Excel.
System.Diagnostics.Process.Start(@"
}
}
}
Supported Excel formulas:
1. Function of Date & Time: DATE / DATEVALUE / DAY / HOUR / MINUTE / MONTH / NOW / SECOND / TIME / TIMEVALUE / TODAY / WEEKDAY /YEAR
2. Financial function: SLN / SYD
3. Logical function: AND / FALSE / IF / NOT / OR / TRUE
4. Text function: CHAR / CODE / CONCATENATE / DOLLAR / EXACT / FIXED / LEFT / LEN / LOWER / MID / PROPER / REPLACE / REPT / RIGHT / SUBSTITUTE / TEXT / TRIM / UPPER / VALUE
5. Math & Trig function: ABS / ACOS / ASIN / ATAN / ATAN2 / CEILING / COMBIN / COS / COSH / DEGREES / EVEN / EXP / FACT / FLOOR / INT / LN / LOG / LOG10 /MOD / ODD / PI / POWER / PRODUCT / RADIANS / RAND / ROUND / ROUNDDOWN / ROUNDUP / SIGN / SIN / SINH / SQRT / SUM / SUMSQ / TAN / TANH / TRUNC /
6. Statistical function: AVERAGE / COUNT / MAX / MIN
About Elerium Software
Elerium Software develops professional solutions for use in .NET projects (C#, VB.NET, ASP.NET) that aimed to read/write/convert different office/web documents and formats. Elerium Software components are based on the unique design and fast algorithms that allow to be independent from the third-party applications and libraries.
For more information about the component please visit the product page:
http://www.eleriumsoft.com/



