Posts

Showing posts from September, 2015

How to Upload and Export Data From Excel File.

To Export a set of data on List we can use the DLL call NPOI.  To Download the NPOI Dll Follow the Link Below  https://npoi.codeplex.com/releases . At First to Export List to Excel the Coding as below : public FileResult ExportByLocationWise(int LocationId)         {                       //Create new Excel workbook             var workbook = new NPOI.HSSF.UserModel.HSSFWorkbook();             //Create new Excel sheet             var sheet = workbook.CreateSheet();             //font style1: underlined, italic, red color, fontsize=20             NPOI.SS.UserModel.IFont font1 = workbook.CreateFont();             font1.Color = HSSFColor.Red.Index;             font1.IsItalic = true;             font1.Underline = FontUnderlineType.Double;             font1.FontHeightInPoints = 20;             //bind font with style 1             NPOI.SS.UserModel.ICellStyle style1 = workbook.CreateCellStyle();             style1.SetFont(font1);             //(Optional) set the widt