Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Spreadsheet .NET
>
Tutorial
> Sum Cells
The following example shows you how to add formula to a cell.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Spreadsheet; namespace Sample { class Program { static void Main(string[] args) { Cell a1 = new Cell(100); Cell b1 = new Cell(200); Cell c1 = new Cell(); c1.Formula = new Formula("SUM(A1,B1)"); Worksheet sheet1 = new Worksheet(); sheet1["A1"] = a1; sheet1["B1"] = b1; sheet1["C1"] = c1; Workbook book = new Workbook(); book.Sheets.Add(sheet1); book.Save("c:\\test\\output.xlsx", true); } } }
VB example
Imports System Imports Independentsoft.Office Imports Independentsoft.Office.Spreadsheet Module Module1 Sub Main(ByVal args As String()) Dim a1 As New Cell(100) Dim b1 As New Cell(200) Dim c1 As New Cell() c1.Formula = New Formula("SUM(A1,B1)") Dim sheet1 As New Worksheet() sheet1("A1") = a1 sheet1("B1") = b1 sheet1("C1") = c1 Dim book As New Workbook() book.Sheets.Add(sheet1) book.Save("c:\test\output.xlsx", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*