Insert PivotTable in XLS Documents via C#
Native and high performance Microsoft Excel XLS spreadsheet with PivotTable creation programmatically using server side .NET APIs.
Generating MS Excel XLS file with PivotTable dynamically within running application is easy. In order to create XLS documents with PivotTable from scratch without requiring MS Office, we’ll use
API that offers different features for spreadsheets creation, manipulation and conversion using .NET platform. Developers can easily enhance code for writing data, generating charts or graphs as well as creating table in spreadsheets.
How to insert PivotTable in XLS via C#
It is easy for the developers to insert PivotTable in XLS format spreadsheet within running different reporting applications for data processing in just a few lines of code.
- Include the namespace in your class file
- Create Workbook class instance.
- Access the first worksheet of the workbook.
- Get the desired cell(s) of the worksheet and put the value in the cell(s).
- Insert PivotTable and set the style
- Use Save method to save the workbook as XLS file.
Just make sure that system have Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms as well as development environment like Microsoft Visual Studio.
- Install from command line as
nuget install Aspose.Cellsor via Package Manager Console of Visual Studio with
- Alternatively, get the offline MSI installer or all DLLs in a ZIP file from downloads
Insert PivotTable in XLS - C#
XLS What is XLS File Format
Files with XLS extension represent Excel Binary File Format. Such files can be created by Microsoft Excel as well as other similar spreadsheet programs such as OpenOffice Calc or Apple Numbers. File saved by Excel is known as Workbook where each workbook can have one or more worksheets. Data is stored and displayed to users in table format in worksheet and can span numeric values, text data, formulas, external data connections, images, and charts. Applications like Microsoft Excel lets you export workbook data to several different formats including PDF, CSV, XLSX, TXT, HTML, XPS, and several others. The XLS file format was replaced with a more open and structured format, XLSX, with the release of Microsoft Excel 2007. The latest versions still provide support for creating and reading XLS files, though XLSX is the first choice of use now.Read More