![]() ![]()
Since I need a nice looking font I am giving the Verdana font.įollowing this PdfPTable and PdfPCell are used for generating the normal table layout. Font: Using the FONT class the developer can control the font features. #Jqgrid export to excel demo javascript free pdf#This class enables the document class to generate the PDF content and save them in a file. ![]() PdfWriter: PdfWriter takes the filename and the document as the reference.This document instance will be further used in next methods for reference. There is also an option to define the rectangle size. Document: This is the document class which takes care of creating the document sheet with particular size.There are three main things in this library. This command will pulldown latest available library. It’s an opensource library readily available as NUget library. ITextSharp is one of the pioneer in PDF export. PdfPCell cell5 = new PdfPCell( new Phrase( value, rowfont)) String value = item.GetType().GetProperty(column).GetValue(item).ToString() PdfPCell cell = new PdfPCell( new Phrase(column, headerFont)) PdfPTable table = new PdfPTable(columns.Length) New FileStream(filePath, FileMode.OpenOrCreate)) PdfWriter writer = PdfWriter.GetInstance(document, Private static void ExportPDF(IList customerList,string columns, string filePath)įont headerFont = FontFactory.GetFont( " Verdana", 10, Color.WHITE) įont rowfont = FontFactory.GetFont( " Verdana", 10, Color.BLUE) ĭocument document = new Document(PageSize.A4) since column names are passed as argument there is no need to worry about the property names. This is a generic method which can handle any data source. For PDF operation a filename is generated and then sent to the ExportPDF method which will take care of generating the PDF from the datasource. When the application starts this method is first hit for initial page request. The index actionmethod has a Boolean argument named pdf. Return File(filePath, " application/pdf", " list.pdf") Bundleconfig can be found in the App_Start folder in the project structure.ĬolNames: ["CustomerID ", "CustomerName " , #Jqgrid export to excel demo javascript free update#Once the script is downloaded and referenced in the project update the bundleconfig file to add the script reference in the pages. This command will pull down the latest JQGrid package and adds them in the script folder. From the tools menu select “Library Package Manager” and then select “Package Manager Console”. #Jqgrid export to excel demo javascript free download#I have given below the command to download the jQGrid through the package manager console. You can download the jQgrid from the jQGrid homepage or as NUget package. ITextSharp tutorials can be found at the following link JQgrid related wiki can be found at below links: The article assumes the developer to have a fair amount of knowledge on ASP.NET MVC and C#.ĭevelopers can learn about the jQuery and jQueryUI at I have enabled nugget restore, hence references will be downloaded and updated during the build. #Jqgrid export to excel demo javascript free code#Please do a nuget update before running the demo code if you face DLL reference issue. There are also other features available as extension plugins and developers can write their own if needed. It helps in building a beautiful grid with paging, sorting and exiting options. jQGrid is one of the client grid framework built on top of the jQuery framework. The solution is done using the iTextSharp in ASP.NET MVC 4 and Visual Studio 2012. The aim of this article is to address the PDF export from client side grid frameworks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |