Home

Bytescout.XLS for .NET
Screenshots

Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample
Click to view sample Click to view sample

Bytescout.XLS library for .NET

Download Free Trial Buy Now More Information

How to write a formula into a cell in the Excel spreadsheet generated by Bytescout.XLS library

This source code sample demonstrates how to write formula into a cell in a new excel spreadsheet made with Bytescout.XLS library for .NET

Download example source code: bytescoutxls_write_formula_into_cell.zip (2 KB)

formula in a cell was automatically calculated and displayed in Excel

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.XLS;
using System.Diagnostics;

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create new XLSDocument
XLSDocument document = new XLSDocument();

// add new worksheet
Worksheet Sheet = document.WorkBook.Worksheets.Add("FormulaDemo");

// headers to indicate purpose of the column
Sheet.Cell("A1").Value = "Formula (as text)";
// set A column width
Sheet.Columns[0].Width = 250;

Sheet.Cell("B1").Value = "Formula (calculated)";
// set B column width
Sheet.Columns[1].Width = 250;


// write formula as text
Sheet.Cell("A2").Value = "7*3+2";
// write formula as formula
Sheet.Cell("B2").Value = "=7*3+2";

// save generated XLS document into new file
document.SaveAs("WritingFormulaDemo.xls");

// open generated document in Excel (if installed)
Process.Start("WritingFormulaDemo.xls");
}

}
}

Download example source code: bytescoutxls_write_formula_into_cell.zip (2 KB)

Download Free Trial Buy Now More Information

Documentation online: view (separate window)

First steps tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement