Created
January 25, 2016 03:30
-
-
Save jimmcslim/58d82277eaf82a3b8ec4 to your computer and use it in GitHub Desktop.
Quick demo of creating a spreadsheet
This file contains hidden or 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 System.IO; | |
using System.Linq; | |
using OfficeOpenXml; // comes from EPPlus | |
namespace SpreadsheetGenerationSample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var template = new ExcelPackage(new FileInfo(@"c:\Users\james\Documents\sample.xlsx")); | |
var package = new ExcelPackage(); | |
package.Workbook.Worksheets.Add("mySample1", template.Workbook.Worksheets.First()); | |
package.Workbook.Worksheets.Add("mySample2", template.Workbook.Worksheets.First()); | |
var info = new FileInfo(@"c:\Users\james\Documents\test.xlsx"); | |
package.SaveAs(info); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment