Created
July 29, 2016 12:22
-
-
Save harshityadav95/3c91097cd8fab813f278b9ced58372fc to your computer and use it in GitHub Desktop.
Code to Insert data into the Excel File using C# application using Google Code ExcelLibrary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ExcelLibrary.CompoundDocumentFormat; | |
using ExcelLibrary.SpreadSheet; | |
string file = "newdoc.xls"; | |
Workbook workbook = new Workbook(); | |
Worksheet worksheet = new Worksheet("First Sheet"); | |
worksheet.Cells[0, 1] = new Cell((short)1); | |
worksheet.Cells[2, 0] = new Cell(9999999); | |
worksheet.Cells[3, 3] = new Cell((decimal)3.45); | |
worksheet.Cells[2, 2] = new Cell("Text string"); | |
worksheet.Cells[2, 4] = new Cell("Second string"); | |
worksheet.Cells[4, 0] = new Cell(32764.5, "#,##0.00"); | |
worksheet.Cells[5, 1] = new Cell(DateTime.Now, @"YYYY-MM-DD"); | |
worksheet.Cells.ColumnWidth[0, 1] = 3000; | |
workbook.Worksheets.Add(worksheet); workbook.Save(file); | |
// open xlsfile | |
Workbook book = Workbook.Load(file); | |
Worksheet sheet = book.Worksheets[0]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excel Library.dll to be added in the reference of the project