Tutorial by Examples

//fill column A with solid red color from hex worksheet.Column(1).Style.Fill.PatternType = ExcelFillStyle.Solid; worksheet.Column(1).Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#FF0000")); //fill row 4 with striped orange background worksheet.Row(4).Style.Fill.Patte...
//make the borders of cell F6 thick worksheet.Cells[6, 6].Style.Border.Top.Style = ExcelBorderStyle.Thick; worksheet.Cells[6, 6].Style.Border.Right.Style = ExcelBorderStyle.Thick; worksheet.Cells[6, 6].Style.Border.Bottom.Style = ExcelBorderStyle.Thick; worksheet.Cells[6, 6].Style.Border.Left.St...
//set the font type for cells C1 - C30 worksheet.Cells["C1:C30"].Style.Font.Size = 13; worksheet.Cells["C1:C30"].Style.Font.Name = "Calibri"; worksheet.Cells["C1:C30"].Style.Font.Bold = true; worksheet.Cells["C1:C30"].Style.Font.Color.SetColor(Co...
//make column H wider and set the text align to the top and right worksheet.Column(8).Width = 25; worksheet.Column(8).Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; worksheet.Column(8).Style.VerticalAlignment = ExcelVerticalAlignment.Top; //wrap text in the cells worksheet.Column...
//create a new ExcelPackage using (ExcelPackage excelPackage = new ExcelPackage()) { //create the WorkSheet ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1"); //add some dummy data, note that row and column indexes start at 1 for (int i = 1;...
//get the image from disk using (System.Drawing.Image image = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath("logo.jpg"))) { var excelImage = worksheet.Drawings.AddPicture("My Logo", image); //add the image to row 20, column E excelImage.SetPo...

Page 1 of 1