Data Export Cell in C#, VB.NET

  • Demo
  • C# source
  • VB.Net source

Not needing to have Microsoft Excel installed on the machine, The Spire.DataExport can create Excel spreadsheet.

 

 

private void btnRun_Click(object sender, System.EventArgs e)
{
	oleDbConnection1.Open();
	try
	{
		cellExport1.SaveToFile();
	}
	finally
	{
		this.oleDbConnection1.Close();
	}
}

private void Form1_Load(object sender, System.EventArgs e)
{
	LoadData();
}

private void button2_Click(object sender, System.EventArgs e)
{
	LoadData();
}

private void btnAbout_Click(object sender, System.EventArgs e)
{
	Close();
}

private void button1_Click(object sender, System.EventArgs e)
{
	oleDbConnection1.Open();
	try
	{
		cellExport2.SaveToFile();
	}
	finally
	{
		this.oleDbConnection1.Close();
	}
}

private void button3_Click(object sender, System.EventArgs e)
{
	oleDbConnection1.Open();
	try
	{
		cellExport3.SaveToFile();
	}
	finally
	{
		this.oleDbConnection1.Close();
	}
	
}

private void button4_Click(object sender, System.EventArgs e)
{
	oleDbConnection1.Open();
	try
	{
		cellExport4.SaveToFile();
	}
	finally
	{
		this.oleDbConnection1.Close();
	}

}

private void button5_Click(object sender, System.EventArgs e)
{
	ushort currentRow = 1;
	string currentFormula = string.Empty;

	Cell cell = null;

	cellExport5.Cells.Clear();
	cellExport5.SetColumnWidth(1, 32);
	cellExport5.SetColumnWidth(2, 16);
	cellExport5.SetColumnWidth(3, 16);

	cell = cellExport5.AddString(1,currentRow++,"Examples of formulas :");
	cell.Format.Font.Bold = true;
	cell.Format.FillStyle.Background = CellColor.LightGreen;
	cell.Format.FillStyle.Pattern = Pattern.Solid;
	cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium;

	cell = cellExport5.AddString(1,++currentRow,"Test data:");
	cell.Format.Font.Bold = true;
	cell.Format.FillStyle.Background = CellColor.LightGreen;
	cell.Format.FillStyle.Pattern = Pattern.Solid;
	cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium;
	
    //test data
	cellExport5.AddNumeric(2,currentRow, 7.3);
	cellExport5.AddNumeric(3,currentRow,5);
	cellExport5.AddNumeric(4,currentRow,8.2);
	cellExport5.AddNumeric(5,currentRow,  4);
	cellExport5.AddNumeric(6,currentRow, 3);
	cellExport5.AddNumeric(7,currentRow++, 11.3);

		
	cell = cellExport5.AddString(1,++currentRow, "Formulas");
	cell.Format.Font.Bold = true;
	cell.Format.FillStyle.Background = CellColor.LightGreen;
	cell.Format.FillStyle.Pattern = Pattern.Solid;
	cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium;

	cell = cellExport5.AddString(2,currentRow, "Results");
	cell.Format.Font.Bold = true;
	cell.Format.FillStyle.Background = CellColor.LightGreen;
	cell.Format.FillStyle.Pattern = Pattern.Solid;
	cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium;

	//str.
	currentFormula = "=\"hello\"";
	cellExport5.AddString(1, ++currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow, "=\"hello\"");			
	cellExport5.AddFormula(3, currentRow, "=\"" + new string(new char[]{'\u4f60', '\u597d'})+ "\"");			



	//int.
	currentFormula = "=300";
	cellExport5.AddString(1, ++currentRow,currentFormula);
	cellExport5.AddFormula(2,currentRow, currentFormula);			

	// float
	currentFormula = "=3389.639421";
	cellExport5.AddString(1, ++currentRow, currentFormula);			
	cellExport5.AddFormula(2,currentRow,currentFormula);

	//bool.
	currentFormula = "=false";
	cellExport5.AddString(1, ++currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow, currentFormula);

	currentFormula = "=1+2+3+4+5-6-7+8-9";
	cellExport5.AddString( 1, ++currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow, currentFormula);

	currentFormula = "=33*3/4-2+10";
	cellExport5.AddString( 1,++currentRow,currentFormula);			
	cellExport5.AddFormula(2, currentRow, currentFormula);			
	

	// sheet reference
	currentFormula = "=Sheet1!$B$3";
	cellExport5.AddString(1,++currentRow, currentFormula);			
	cellExport5.AddFormula(2,currentRow, currentFormula);

	// sheet area reference
	currentFormula = "=AVERAGE(Sheet1!$D$3:G$3)";
	cellExport5.AddString(1, ++currentRow, currentFormula);			
	cellExport5.AddFormula(2,currentRow, currentFormula);

	// Functions
	currentFormula = "=Count(3,5,8,10,2,34)";
	cellExport5.AddString(1,++currentRow,  currentFormula);			
	cellExport5.AddFormula(2,currentRow++, currentFormula);


	currentFormula = "=NOW()";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++,  currentFormula);

	currentFormula = "=SECOND(11)";
	cellExport5.AddString(1 ,currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow++, currentFormula);

	currentFormula = "=MINUTE(12)";
	cellExport5.AddString(1, currentRow,currentFormula);
	cellExport5.AddFormula(2, currentRow++, currentFormula);

	currentFormula = "=MONTH(9)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=DAY(10)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=TIME(4,5,7)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=DATE(6,4,2)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=RAND()";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=HOUR(12)";
	cellExport5.AddString(1, currentRow,currentFormula);
	cellExport5.AddFormula(2, currentRow++,  currentFormula);

	currentFormula = "=TEXT(\"world\", \"$d\")";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=MOD(5,3)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=WEEKDAY(3)";
	cellExport5.AddString(1, currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow++, currentFormula);

	currentFormula = "=YEAR(23)";
	cellExport5.AddString(1, currentRow, currentFormula);
	cellExport5.AddFormula(2, currentRow++, currentFormula);

	currentFormula = "=NOT(true)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=OR(true)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=AND(TRUE)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=VALUE(30)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=LEN(\"world\")";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=MID(\"world\",4,2)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=ROUND(7,3)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=SIGN(4)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=INT(200)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=ABS(-1.21)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=LN(15)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=EXP(20)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=SQRT(40)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=PI()";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=COS(9)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=SIN(45)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=MAX(10,30)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=MIN(5,7)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=AVERAGE(12,45)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=SUM(18,29)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=IF(4,2,2)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	currentFormula = "=SUBTOTAL(3,Sheet1!B2:E3)";
	cellExport5.AddString( 1, currentRow, currentFormula);
	cellExport5.AddFormula( 2, currentRow++, currentFormula);

	this.cellExport5.SaveToFile();
}

private void cellExport1_GetDataParams(object sender, Spire.DataExport.EventArgs.DataParamsEventArgs e)
{
	if 	((e.Sheet == 0) && (e.Col == 6))
	{
		e.FormatText = cellExport1.DataFormats.Currency;
	}
}

Private Sub btnRun_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRun.Click
    oleDbConnection1.Open()
    Try
        cellExport1.SaveToFile()
    Finally
        Me.oleDbConnection1.Close()
    End Try
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    LoadData()
End Sub

Private Sub button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
    LoadData()
End Sub

Private Sub btnAbout_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAbout.Click
    Close()
End Sub

Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
    oleDbConnection1.Open()
    Try
        cellExport2.SaveToFile()
    Finally
        Me.oleDbConnection1.Close()
    End Try
End Sub

Private Sub button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button3.Click
    oleDbConnection1.Open()
    Try
        cellExport3.SaveToFile()
    Finally
        Me.oleDbConnection1.Close()
    End Try

End Sub

Private Sub button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button4.Click
    oleDbConnection1.Open()
    Try
        cellExport4.SaveToFile()
    Finally
        Me.oleDbConnection1.Close()
    End Try

End Sub

Private Sub button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button5.Click
    Dim currentRow As Integer = 1
    Dim firstCol As UInt16 = Convert.ToUInt16(1)
    Dim secondCol As UInt16 = Convert.ToUInt16(2)
    Dim currentFormula As String = String.Empty

    Dim cell As cell = Nothing

    cellExport5.Cells.Clear()
    cellExport5.SetColumnWidth(System.Convert.ToUInt16(1), System.Convert.ToUInt16(32))
    cellExport5.SetColumnWidth(System.Convert.ToUInt16(2), System.Convert.ToUInt16(16))
    cellExport5.SetColumnWidth(System.Convert.ToUInt16(3), System.Convert.ToUInt16(16))

    cell = cellExport5.AddString(System.Convert.ToUInt16(1), System.Convert.ToUInt16(currentRow), "Examples of formulas :")
    currentRow += 1
    cell.Format.Font.Bold = True
    cell.Format.FillStyle.Background = CellColor.LightGreen
    cell.Format.FillStyle.Pattern = Pattern.Solid
    cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium

    cell = cellExport5.AddString(System.Convert.ToUInt16(1), System.Convert.ToUInt16(currentRow), "Test data:")
    currentRow += 1
    cell.Format.Font.Bold = True
    cell.Format.FillStyle.Background = CellColor.LightGreen
    cell.Format.FillStyle.Pattern = Pattern.Solid
    cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium

    'test data
    cellExport5.AddNumeric(System.Convert.ToUInt16(2), System.Convert.ToUInt16(currentRow), 7.3)
    cellExport5.AddNumeric(System.Convert.ToUInt16(3), System.Convert.ToUInt16(currentRow), 5)
    cellExport5.AddNumeric(System.Convert.ToUInt16(4), System.Convert.ToUInt16(currentRow), 8.2)
    cellExport5.AddNumeric(System.Convert.ToUInt16(5), System.Convert.ToUInt16(currentRow), 4)
    cellExport5.AddNumeric(System.Convert.ToUInt16(6), System.Convert.ToUInt16(currentRow), 3)
    cellExport5.AddNumeric(System.Convert.ToUInt16(7), System.Convert.ToUInt16(currentRow), 11.3)
    currentRow += 1
    currentRow += 1


    cell = cellExport5.AddString(Convert.ToUInt16(1), Convert.ToUInt16(currentRow), "Formulas")
    cell.Format.Font.Bold = True
    cell.Format.FillStyle.Background = CellColor.LightGreen
    cell.Format.FillStyle.Pattern = Pattern.Solid
    cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium

    cell = cellExport5.AddString(secondCol, Convert.ToUInt16(currentRow), "Results")
    currentRow += 1
    cell.Format.Font.Bold = True
    cell.Format.FillStyle.Background = CellColor.LightGreen
    cell.Format.FillStyle.Pattern = Pattern.Solid
    cell.Format.Borders.Bottom.Style = CellBorderStyle.Medium

    'str.
    currentFormula = "=""hello"""
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), "=""hello""")
    cellExport5.AddFormula(Convert.ToUInt16(3), Convert.ToUInt16(currentRow), "=""" & ChrW(20320) & ChrW(22909) + """")
    currentRow += 1



    'int.
    currentFormula = "=300"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    ' float
    currentFormula = "=3389.639421"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1


    'bool.
    currentFormula = "=false"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=1+2+3+4+5-6-7+8-9"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=33*3/4-2+10"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    ' sheet reference
    currentFormula = "=Sheet1!$B$3"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    ' sheet area reference
    currentFormula = "=AVERAGE(Sheet1!$D$3:G$3)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    ' Functions
    currentFormula = "=Count(3,5,8,10,2,34)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1


    currentFormula = "=NOW()"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SECOND(11)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MINUTE(12)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MONTH(9)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=DAY(10)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=TIME(4,5,7)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=DATE(6,4,2)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=RAND()"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=HOUR(12)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=TEXT(""world"", ""$d"")"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MOD(5,3)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=WEEKDAY(3)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=YEAR(23)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=NOT(true)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=OR(true)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=AND(TRUE)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=VALUE(30)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=LEN(""world"")"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MID(""world"",4,2)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=ROUND(7,3)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SIGN(4)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=INT(200)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=ABS(-1.21)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=LN(15)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=EXP(20)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SQRT(40)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=PI()"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=COS(9)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SIN(45)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MAX(10,30)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=MIN(5,7)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=AVERAGE(12,45)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SUM(18,29)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=IF(4,2,2)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1

    currentFormula = "=SUBTOTAL(3,Sheet1!B2:E3)"
    cellExport5.AddString(firstCol, Convert.ToUInt16(currentRow), currentFormula)
    cellExport5.AddFormula(secondCol, Convert.ToUInt16(currentRow), currentFormula)
    currentRow += 1
    Me.cellExport5.SaveToFile()
End Sub

Private Sub cellExport1_GetDataParams(ByVal sender As Object, ByVal e As Spire.DataExport.EventArgs.DataParamsEventArgs) Handles cellExport1.GetDataParams, cellExport3.GetDataParams
    If (e.Sheet = 0) AndAlso (e.Col = 6) Then
        e.FormatText = cellExport1.DataFormats.Currency
    End If
End Sub