Created
August 23, 2016 06:46
-
-
Save sontx/24a35f21582ba7e787830c86e273772d to your computer and use it in GitHub Desktop.
Demo using ClosedXML
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 ClosedXML.Excel; | |
using System.Windows.Forms; | |
namespace ExcelCSharp | |
{ | |
public partial class Form1 : Form | |
{ | |
public Form1() | |
{ | |
InitializeComponent(); | |
// create new excel workbook | |
var workbook = new XLWorkbook(); | |
// set author for this workbook | |
workbook.Author = "www.sontx.in"; | |
// create a sheet | |
var worksheet = workbook.Worksheets.Add("new worksheet"); | |
// set value for A1 cell in this worksheet | |
worksheet.Cell("A1").Value = "This is value in A1 cell"; | |
// export excel file to disk | |
workbook.SaveAs("my_report.xlsx"); | |
// clean up | |
workbook.Dispose(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment