This is the main namespace for EPPlus
Classes
Class | Description | |
---|---|---|
ExcelAddress |
Range address with the address property readonly
|
|
ExcelAddressBase |
A range address
|
|
ExcelBackgroundImage |
An image that fills the background of the worksheet.
|
|
ExcelCellAddress |
A single cell address
|
|
ExcelCellBase |
Base class containing cell address manipulating methods.
|
|
ExcelColumn |
Represents one or more columns within the worksheet
|
|
ExcelComment |
An Excel Cell Comment
|
|
ExcelCommentCollection |
Collection of Excelcomment objects
|
|
ExcelEncryption |
How and if the workbook is encrypted
|
|
ExcelHeaderFooter |
Represents the Header and Footer on an Excel Worksheet
|
|
ExcelHeaderFooterText |
Print header and footer
|
|
ExcelHyperLink |
HyperlinkClass
|
|
ExcelNamedRange |
A named range.
|
|
ExcelNamedRangeCollection |
Collection for named ranges
|
|
ExcelPackage |
Represents an Excel 2007/2010 XLSX file package.
This is the top-level object to access all parts of the document.
CopyC# FileInfo newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx"); if (newFile.Exists) { newFile.Delete(); // ensures we create a new workbook newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx"); } using (ExcelPackage package = new ExcelPackage(newFile)) { // add a new worksheet to the empty workbook ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Inventory"); //Add the headers worksheet.Cells[1, 1].Value = "ID"; worksheet.Cells[1, 2].Value = "Product"; worksheet.Cells[1, 3].Value = "Quantity"; worksheet.Cells[1, 4].Value = "Price"; worksheet.Cells[1, 5].Value = "Value"; //Add some items... worksheet.Cells["A2"].Value = "12001"; worksheet.Cells["B2"].Value = "Nails"; worksheet.Cells["C2"].Value = 37; worksheet.Cells["D2"].Value = 3.99; worksheet.Cells["A3"].Value = "12002"; worksheet.Cells["B3"].Value = "Hammer"; worksheet.Cells["C3"].Value = 5; worksheet.Cells["D3"].Value = 12.10; worksheet.Cells["A4"].Value = "12003"; worksheet.Cells["B4"].Value = "Saw"; worksheet.Cells["C4"].Value = 12; worksheet.Cells["D4"].Value = 15.37; //Add a formula for the value-column worksheet.Cells["E2:E4"].Formula = "C2*D2"; //Ok now format the values; using (var range = worksheet.Cells[1, 1, 1, 5]) { range.Style.Font.Bold = true; range.Style.Fill.PatternType = ExcelFillStyle.Solid; range.Style.Fill.BackgroundColor.SetColor(Color.DarkBlue); range.Style.Font.Color.SetColor(Color.White); } worksheet.Cells["A5:E5"].Style.Border.Top.Style = ExcelBorderStyle.Thin; worksheet.Cells["A5:E5"].Style.Font.Bold = true; worksheet.Cells[5, 3, 5, 5].Formula = string.Format("SUBTOTAL(9,{0})", new ExcelAddress(2,3,4,3).Address); worksheet.Cells["C2:C5"].Style.Numberformat.Format = "#,##0"; worksheet.Cells["D2:E5"].Style.Numberformat.Format = "#,##0.00"; //Create an autofilter for the range worksheet.Cells["A1:E4"].AutoFilter = true; worksheet.Cells["A1:E5"].AutoFitColumns(0); // lets set the header text worksheet.HeaderFooter.oddHeader.CenteredText = "&24&U&\"Arial,Regular Bold\" Inventory"; // add the page number to the footer plus the total number of pages worksheet.HeaderFooter.oddFooter.RightAlignedText = string.Format("Page {0} of {1}", ExcelHeaderFooter.PageNumber, ExcelHeaderFooter.NumberOfPages); // add the sheet name to the footer worksheet.HeaderFooter.oddFooter.CenteredText = ExcelHeaderFooter.SheetName; // add the file path to the footer worksheet.HeaderFooter.oddFooter.LeftAlignedText = ExcelHeaderFooter.FilePath + ExcelHeaderFooter.FileName; worksheet.PrinterSettings.RepeatRows = worksheet.Cells["1:2"]; worksheet.PrinterSettings.RepeatColumns = worksheet.Cells["A:G"]; // Change the sheet view to show it in page layout mode worksheet.View.PageLayoutView = true; // set some document properties package.Workbook.Properties.Title = "Invertory"; package.Workbook.Properties.Author = "Jan Källman"; package.Workbook.Properties.Comments = "This sample demonstrates how to create an Excel 2007 workbook using EPPlus"; // set some extended property values package.Workbook.Properties.Company = "AdventureWorks Inc."; // set some custom property values package.Workbook.Properties.SetCustomPropertyValue("Checked by", "Jan Källman"); package.Workbook.Properties.SetCustomPropertyValue("AssemblyName", "EPPlus"); // save our new workbook and we are done! package.Save(); } return newFile.FullName; |
|
ExcelPrinterSettings |
Printer settings
|
|
ExcelProtection |
Sets protection on the workbook level
|
|
ExcelRange |
A range of cells.
|
|
ExcelRangeBase |
A range of cells
|
|
ExcelRow |
Represents an individual row in the spreadsheet.
|
|
ExcelSheetProtection |
Sheet protection
|
|
ExcelStyleCollection<(Of <(T>)>) |
Base collection class for styles.
|
|
ExcelStyles |
Containts all shared cell styles for a workbook
|
|
ExcelTextFormat |
Describes how to split a CSV text. Used by the ExcelRange.LoadFromText method
|
|
ExcelWorkbook |
Represents the Excel workbook and provides access to all the
document properties and worksheets within the workbook.
|
|
ExcelWorkbookView |
Access to workbook view properties
|
|
ExcelWorksheet |
Represents an Excel worksheet and provides access to its properties and methods
|
|
ExcelWorksheet..::.MergeCellsCollection<(Of <(T>)>) |
Collection containing merged cell addresses
|
|
ExcelWorksheets |
The collection of worksheets for the workbook
|
|
ExcelWorksheetView |
Represents the different view states of the worksheet
|
|
ExcelWorksheetView..::.ExcelWorksheetPanes |
The worksheet panes after a freeze or split.
|
|
OfficeProperties |
Provides access to the properties bag of the package
|
|
XmlHelper |
Help class containing XML functions.
Can be Inherited
|
Enumerations
Enumeration | Description | |
---|---|---|
eDataTypes |
Discribes a column when reading a text using the ExcelRangeBase.LoadFromText method
|
|
EncryptionAlgorithm |
Encryption Algorithm
|
|
eOrientation |
Printer orientation
|
|
ePageOrder |
Specifies printed page order
|
|
ePaperSize |
Papersize
|
|
eWorkSheetHidden |
Worksheet hidden enumeration
|
|
ExcelCalcMode |
How the application should calculate formulas in the workbook
|
|
PictureAlignment |
How a picture will be aligned in the header/footer
|