与其他组件比较 IronXL 和 GrapeCity Excel 查看器的比较 Curtis Chau 已更新:七月 28, 2025 Download IronXL NuGet 下载 DLL 下载 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article Using Excel data in a programming situation with a .NET environment can cause a slew of problems, especially when it comes to interoperability. Excel is the most widely used spreadsheet program in the world. Users include both developers and the general public, but developers are more likely to be interested in this content. Initially, developers didn't have many alternatives for integrating Excel into their various apps. However, the Office Suite included VBA (Visual Basic for Applications), which allowed you to edit any Office product to suit your needs. Developers customized their interactions with XLSX spreadsheets and their data, as well as its visual features, using VBA in Excel. What is GrapeCity Documents for Excel? GrapeCity Documents for Excel .NET Edition is a new high-performance, small-footprint spreadsheet component that can be utilized in server or desktop applications. It provides a rich API for creating, manipulating, converting, and sharing Microsoft Excel-compatible spreadsheets. You can also use it from almost any application or platform such as Angular, React or Vue to create custom styles. It has a seamlessly embedded BI platform wyn, with interactive dashboards, scheduling, and distribution tools within any internal or commercial app. GrapeCity's embedded BI platform offers limitless high-speed visual data exploration, allowing the everyday user to become data-driven to easily report solutions with extensive data using the BI ad hoc reporting and interactive dashboards. GcExcel .NET is compatible with a variety of platforms, including the .NET Framework, .NET Core, and Mono, making it the ideal choice for all of your spreadsheet needs. The best thing about GcExcel .NET is that its interface-based API is modeled around Excel's document object paradigm. As a result, users can import, calculate, query, produce, and export any spreadsheet scenario at any time. Furthermore, comprehensive reports, sort, and filter tables, sort and filter pivot tables add charts, sparklines, conditional formats, and dashboard reports, among other things, can be referenced in the imported or generated spreadsheets. What does GrapeCity Documents for Excel offer you? Allows for the creation, manipulation, and serialization of spreadsheets on the server. Low memory footprint. Performs complex calculations using the powerful calculation engine. High-speed intuitive document; embedded business intelligence. Provides full reporting solutions. Gives you full control of your documents at high speed. Generates output in a variety of formats, including .xlsx, and ssjson. Support for .NET Framework, .NET Core, and Mono across several platforms. Compatible with WinForms, WPF, ASP.NET, and other environments. GrapeCity Excel — standout features The latest release version 14.1 has many new and exciting features. Lightweight Spreadsheet API Architecture for Improved Efficiency GcExcel .NET enables users to save a considerable amount of time, storage memory, and effort by improving the overall efficiency with its lightweight API architecture that can be used to generate, load, edit, save and convert spreadsheets. No Dependency on MS Excel In order to work with GcExcel .NET, users don't need to install MS Office Suite or access MS Excel on their systems. Create an Interactive Experience with SpreadJS DSheets GcExcel .NET can be used with spreadsheets for a completely interactive and user-friendly spreadsheet experience. Deploy Apps with Excel Spreadsheets to the Cloud With GcExcel .NET, you can apply cloud-based deployments and deploy your applications on Azure and AWS Lambda. Shapes and Pictures With the spreadsheet API, you can insert and customize shapes and pictures on cells of a worksheet, apply formatting, gradient fill, configure text, insert hyperlinks, set adjustment points of the shapes, group/ungroup them in a worksheet, and determine the position and size of an image. What is IronXL? IronXL is a C# library that makes it easier to read and edit Microsoft Excel documents. IronXL Excel is a .NET software library that can read a variety of spreadsheet formats. It does not necessitate the installation of Microsoft Excel, nor does it rely on Interop. IronXL is a user-friendly C# API that lets you read, edit, and generate Excel files in .NET at breakneck speed. .NET Core, .NET Framework, Xamarin, Mobile, Linux, macOS, and Azure are all supported by IronXL. IronXL is a C# Excel spreadsheet library for .NET Core and .NET Framework. IronXL Feature Set Load, Read, and Edit Data — from XLS/XLSX/CSV/TSV Saving and Exporting — to XLS/XLSX/CSV/TSV/JSON System.Data Objects — Work with Excel Spreadsheets as System.Data.DataSet and System.Data.DataTable objects. Formulas — works with Excel formulas. Formulas are recalculated every time a sheet is edited. Ranges — Easy-to-use WorkSheet ["A1:B10"] syntax. Combine and create ranges intuitively. Sorting — Sort Ranges, Columns, and Rows. Styling — Cell visual styles, font, size, background pattern, border, alignment, and number formats. Installing GrapeCity Documents for Excel In order to use GcExcel .NET in a .NET Core, ASP.NET Core, or .NET Framework application (any target that supports .NET Standard 2.0), install the NuGet packages in your application using the following steps: To find and install the GrapeCity.Documents.Excel NuGet Package: Select Manage NuGet Packages from the context menu of either dependencies or a project in Solution Explorer. Select nuget.org from the Package source dropdown in the Browse tab. In the Browse tab, search for the package "GrapeCity.Documents.Excel" by typing "grapecity.documents" or "GrapeCity.Documents" in the search text box at the top. Click Install to install the GrapeCity.Documents.Excel package and its dependencies in the project. When the installation is complete, make sure you check the NuGet folder in your solution explorer and confirm whether or not the GrapeCity.Documents.Excel package is added to your project dependencies. IronXL C# Library Installation You can download and install the IronXL library using the following methods: Using Visual Studio with NuGet packages. Download the NuGet Package directly. Manually install with the DLL. Let’s take a closer look at each one. Using Visual Studio with NuGet Packages Visual Studio provides the NuGet Package Manager to install NuGet packages in your projects. You can access it through the Project Menu, or by right-clicking your project in the Solution Explorer. Next, from the Browse tab -> search for IronXL.Excel -> Install And we are done. Using the NuGet Package Manager Console Another way to download and install Microsoft.Office.Interop.Excel C# library is to make use of the following steps to install the NuGet package through the Developer Command Prompt. Open the Developer Command Prompt — usually found in the Visual Studio folder. Type the following command: Install-Package Microsoft.Office.Interop.Excel Press Enter. This will download and install the package. Reload your Visual Studio project and begin using it. Add necessary using directives In Solution Explorer, right-click the Program.cs file and then click View Code. Add the following using directives to the top of the code file: using Excel = Microsoft.Office.Interop.Excel; using Excel = Microsoft.Office.Interop.Excel; Imports Excel = Microsoft.Office.Interop.Excel $vbLabelText $csharpLabel Creating Excel Workbooks and Sheets A workbook is an Excel file that contains many rows and columns of worksheets. The ability to create a new Excel workbook and sheets is available in both libraries. Let's take a step-by-step look at the code. Creating Excel files using IronXL It could not be any easier to create a new Excel Workbook using IronXL. Just one line of code! Yes, really. Add the following code to your static void main function in the Program.cs file: WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX); WorkBook workbook = WorkBook.Create(ExcelFileFormat.XLSX); Dim workbook As WorkBook = WorkBook.Create(ExcelFileFormat.XLSX) $vbLabelText $csharpLabel Both XLS (older Excel file version) and XLSX (current and newer file version) file formats can be created with IronXL. And, it’s even easier to create a default Worksheet: var worksheet = workbook.CreateWorkSheet("IronXL Features"); var worksheet = workbook.CreateWorkSheet("IronXL Features"); Dim worksheet = workbook.CreateWorkSheet("IronXL Features") $vbLabelText $csharpLabel You may now utilize the worksheet variable to set cell values and do practically anything an Excel file can do. Creating Excel files using a Server-Side Excel API GrapeCity Excel GrapeCity Documents for Excel (or GcExcel) is a server-side Excel API that allows you to create, load, save, convert, compute, format, parse, and export spreadsheets in any .NET Standard application. GcExcel can deploy to Azure without any Excel dependencies thanks to the full .NET5 support for Windows, Linux, and Mac. GcExcel allows you to create and generate server-side Excel spreadsheets without having to use MS Excel. Create a workbook with GcExcel in a function. Return to the client-side after converting the workbook to JSON. In this example, we're merely going to make a BidTracker.xlsx spreadsheet. This sample displays extra server-side functionality that may be programmed with GcExcel. [HttpGet("{caseName}")] public IActionResult GetSSJsonFromUseCase(string caseName) { Workbook workbook = CreateWorkbookByCaseName(caseName); var ssjson = workbook.ToJson(); return Ok(ssjson); } private Workbook CreateWorkbookByCaseName(string caseName) { switch (caseName) { case "BidTracker": return GetBidTracker(); default: break; } return new Workbook(); } [HttpGet("{caseName}")] public IActionResult GetSSJsonFromUseCase(string caseName) { Workbook workbook = CreateWorkbookByCaseName(caseName); var ssjson = workbook.ToJson(); return Ok(ssjson); } private Workbook CreateWorkbookByCaseName(string caseName) { switch (caseName) { case "BidTracker": return GetBidTracker(); default: break; } return new Workbook(); } <HttpGet("{caseName}")> Public Function GetSSJsonFromUseCase(ByVal caseName As String) As IActionResult Dim workbook As Workbook = CreateWorkbookByCaseName(caseName) Dim ssjson = workbook.ToJson() Return Ok(ssjson) End Function Private Function CreateWorkbookByCaseName(ByVal caseName As String) As Workbook Select Case caseName Case "BidTracker" Return GetBidTracker() Case Else End Select Return New Workbook() End Function $vbLabelText $csharpLabel Edit Excel Files Developers have to be careful when they start out modifying and editing Excel files in C# because it might be easy for one blunder to change the whole document. Being able to rely on simple and efficient lines of code helps lessen the danger of error, and makes it easier for us to update or delete Excel files programmatically. Today we'll walk over the procedures necessary to edit Excel files in C# accurately and rapidly, utilizing tested functions. Edit Excel files with GrapeCity Excel Let's get started using GcExcel to address these issues. You're handed a spreadsheet that looks like this: First, we'll want to format the sheet: Change the font properties of the title of the sheet and the Total Income cell. Change table, table column, and cell styles. Let's take a look at how to accomplish this using GcExcel. Step 1: Load an existing Excel spreadsheet Write the following code to load an existing spreadsheet into your GcExcel Workbook: Workbook workbook = new Workbook(); workbook.Open("EventBudget.xlsx"); Workbook workbook = new Workbook(); workbook.Open("EventBudget.xlsx"); Dim workbook As New Workbook() workbook.Open("EventBudget.xlsx") $vbLabelText $csharpLabel Step 2: Get the worksheet that you want to modify IWorksheet worksheet = workbook.ActiveWorksheet; IWorksheet worksheet = workbook.ActiveWorksheet; Dim worksheet As IWorksheet = workbook.ActiveWorksheet $vbLabelText $csharpLabel Step 3: Modify the font properties of the titles Change the font properties of B2 (font size) and E4 (set to bold) cells: // Change range B2's font size. worksheet.GetRange("B2").Font.Size = 22; // Change range E4's font style to bold. worksheet.GetRange("E4").Font.Bold = true; // Change range B2's font size. worksheet.GetRange("B2").Font.Size = 22; // Change range E4's font style to bold. worksheet.GetRange("E4").Font.Bold = true; ' Change range B2's font size. worksheet.GetRange("B2").Font.Size = 22 ' Change range E4's font style to bold. worksheet.GetRange("E4").Font.Bold = True $vbLabelText $csharpLabel Step 4: Modify table style Set styles of the four tables to an in-built style. worksheet.Tables["tblAdmissions"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblAds"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblVendors"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblItems"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblAdmissions"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblAds"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblVendors"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables["tblItems"].TableStyle = workbook.TableStyles["TableStyleLight10"]; worksheet.Tables("tblAdmissions").TableStyle = workbook.TableStyles("TableStyleLight10") worksheet.Tables("tblAds").TableStyle = workbook.TableStyles("TableStyleLight10") worksheet.Tables("tblVendors").TableStyle = workbook.TableStyles("TableStyleLight10") worksheet.Tables("tblItems").TableStyle = workbook.TableStyles("TableStyleLight10") $vbLabelText $csharpLabel Step 5: Modify cell range style Modify the cell style of Total Income cells. The Interior property of a range can help you set the ThemeColor and TintAndShade properties. You can also change the font of the entire range using the Font property. In addition, this code can set the borders of a range of cells. Since the spreadsheet shows the budget data, set the number format of a range of cells to currency. // Modify range F4:G5's cell style. worksheet.GetRange("F4:G5").Interior.ThemeColor = ThemeColor.Light1; worksheet.GetRange("F4:G5").Interior.TintAndShade = -0.15; worksheet.GetRange("F4:G5").Font.ThemeFont = ThemeFont.Major; worksheet.GetRange("F4:G5").Font.Size = 12; worksheet.GetRange("F4:G5").Borders[BordersIndex.InsideHorizontal].LineStyle = BorderLineStyle.None; worksheet.GetRange("F5:G5").NumberFormat = "$#,##0.00"; // Modify range F4:G5's cell style. worksheet.GetRange("F4:G5").Interior.ThemeColor = ThemeColor.Light1; worksheet.GetRange("F4:G5").Interior.TintAndShade = -0.15; worksheet.GetRange("F4:G5").Font.ThemeFont = ThemeFont.Major; worksheet.GetRange("F4:G5").Font.Size = 12; worksheet.GetRange("F4:G5").Borders[BordersIndex.InsideHorizontal].LineStyle = BorderLineStyle.None; worksheet.GetRange("F5:G5").NumberFormat = "$#,##0.00"; ' Modify range F4:G5's cell style. worksheet.GetRange("F4:G5").Interior.ThemeColor = ThemeColor.Light1 worksheet.GetRange("F4:G5").Interior.TintAndShade = -0.15 worksheet.GetRange("F4:G5").Font.ThemeFont = ThemeFont.Major worksheet.GetRange("F4:G5").Font.Size = 12 worksheet.GetRange("F4:G5").Borders(BordersIndex.InsideHorizontal).LineStyle = BorderLineStyle.None worksheet.GetRange("F5:G5").NumberFormat = "$#,##0.00" $vbLabelText $csharpLabel Step 6: Modify table column styles Since table column ranges are different, set the ThemeColor, TintAndShade properties, and NumberFormat on a different column range of the table. worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.ThemeColor = ThemeColor.Light1; worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.TintAndShade = -0.15; worksheet.GetRange("E8:G11, E15:G18, E22:G25, E29:G33").NumberFormat = "$#,##0.00"; worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.ThemeColor = ThemeColor.Light1; worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.TintAndShade = -0.15; worksheet.GetRange("E8:G11, E15:G18, E22:G25, E29:G33").NumberFormat = "$#,##0.00"; worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.ThemeColor = ThemeColor.Light1 worksheet.GetRange("F8:G11, F15:G18, F22:G25, F29:G33").Interior.TintAndShade = -0.15 worksheet.GetRange("E8:G11, E15:G18, E22:G25, E29:G33").NumberFormat = "$#,##0.00" $vbLabelText $csharpLabel Step 7: Save the Excel file // Save to an Excel file workbook.Save("EventBudget.xlsx"); // Save to an Excel file workbook.Save("EventBudget.xlsx"); ' Save to an Excel file workbook.Save("EventBudget.xlsx") $vbLabelText $csharpLabel Congratulations! You have entirely changed the formatting of the document. Run the application, and your Excel spreadsheet looks like this: Edit Excel files with IronXL Once you have installed IronXL, let's address the process of editing Excel files with it. Edit the Values of Specific Cells First, we'll look at how to change the values of certain cells in an Excel spreadsheet. We do this by importing the Excel spreadsheet that has to be changed and accessing its WorkSheet. Then, we can make the changes as indicated below. using IronXL; static void Main(string[] args) { // Import Excel Spreadsheet WorkBook wb = WorkBook.Load("sample.xlsx"); // Access specific worksheet WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Access specific cell and modify its value ws.Rows[3].Columns[1].Value = "New Value"; // Save changes wb.SaveAs("sample.xlsx"); } using IronXL; static void Main(string[] args) { // Import Excel Spreadsheet WorkBook wb = WorkBook.Load("sample.xlsx"); // Access specific worksheet WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Access specific cell and modify its value ws.Rows[3].Columns[1].Value = "New Value"; // Save changes wb.SaveAs("sample.xlsx"); } Imports IronXL Shared Sub Main(ByVal args() As String) ' Import Excel Spreadsheet Dim wb As WorkBook = WorkBook.Load("sample.xlsx") ' Access specific worksheet Dim ws As WorkSheet = wb.GetWorkSheet("Sheet1") ' Access specific cell and modify its value ws.Rows(3).Columns(1).Value = "New Value" ' Save changes wb.SaveAs("sample.xlsx") End Sub $vbLabelText $csharpLabel Here are before and after screenshots of the Excel spreadsheet sample.xlsx: We can see how simple it is to modify the Excel spreadsheet value. If needed, there is also an alternative way to edit the specific cell value by cell address: // Alternative way to access specific cell and apply changes ws["B4"].Value = "New Value"; // Alternative way to access specific cell and apply changes ws["B4"].Value = "New Value"; ' Alternative way to access specific cell and apply changes ws("B4").Value = "New Value" $vbLabelText $csharpLabel Edit Full Row Values It is pretty simple to edit full row values of an Excel spreadsheet with a static value. using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Set full row value ws.Rows[3].Value = "New Value"; wb.SaveAs("sample.xlsx"); } using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Set full row value ws.Rows[3].Value = "New Value"; wb.SaveAs("sample.xlsx"); } Imports IronXL Shared Sub Main(ByVal args() As String) Dim wb As WorkBook = WorkBook.Load("sample.xlsx") Dim ws As WorkSheet = wb.GetWorkSheet("Sheet1") ' Set full row value ws.Rows(3).Value = "New Value" wb.SaveAs("sample.xlsx") End Sub $vbLabelText $csharpLabel See the screenshots of the sample.xlsx below: For this, we also can edit the value of a specific range of the row by using the range function: // Modify specific range within a row ws["A3:E3"].Value = "New Value"; // Modify specific range within a row ws["A3:E3"].Value = "New Value"; ' Modify specific range within a row ws("A3:E3").Value = "New Value" $vbLabelText $csharpLabel Edit Full Column Values In the same way as above, we can easily edit full columns of the Excel spreadsheet with a single value. using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Set full column value ws.Columns[1].Value = "New Value"; wb.SaveAs("sample.xlsx"); } using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); // Set full column value ws.Columns[1].Value = "New Value"; wb.SaveAs("sample.xlsx"); } Imports IronXL Shared Sub Main(ByVal args() As String) Dim wb As WorkBook = WorkBook.Load("sample.xlsx") Dim ws As WorkSheet = wb.GetWorkSheet("Sheet1") ' Set full column value ws.Columns(1).Value = "New Value" wb.SaveAs("sample.xlsx") End Sub $vbLabelText $csharpLabel This will produce our sample.xlsx spreadsheet as such: Edit Full Rows with Dynamic Values Using IronXL, it is also possible to edit specific rows with dynamic values. This means we can edit a full row by assigning dynamic values for each cell. Let's take a look at the example: using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); for (int i = 0; i < ws.Columns.Count(); i++) { // Set cell value dynamically based on column index ws.Rows[3].Columns[i].Value = "New Value " + i.ToString(); } wb.SaveAs("sample.xlsx"); } using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); for (int i = 0; i < ws.Columns.Count(); i++) { // Set cell value dynamically based on column index ws.Rows[3].Columns[i].Value = "New Value " + i.ToString(); } wb.SaveAs("sample.xlsx"); } Imports IronXL Shared Sub Main(ByVal args() As String) Dim wb As WorkBook = WorkBook.Load("sample.xlsx") Dim ws As WorkSheet = wb.GetWorkSheet("Sheet1") For i As Integer = 0 To ws.Columns.Count() - 1 ' Set cell value dynamically based on column index ws.Rows(3).Columns(i).Value = "New Value " & i.ToString() Next i wb.SaveAs("sample.xlsx") End Sub $vbLabelText $csharpLabel In the table below, we can see the screenshots of the Excel spreadsheet sample.xlsx from this output: Edit Full Columns with Dynamic Values It is also easy to edit specific columns with dynamic values. using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); for (int i = 0; i < ws.Rows.Count(); i++) { // Skip header row if (i == 0) continue; // Set cell value dynamically based on row index ws.Rows[i].Columns[1].Value = "New Value " + i.ToString(); } wb.SaveAs("sample.xlsx"); } using IronXL; static void Main(string[] args) { WorkBook wb = WorkBook.Load("sample.xlsx"); WorkSheet ws = wb.GetWorkSheet("Sheet1"); for (int i = 0; i < ws.Rows.Count(); i++) { // Skip header row if (i == 0) continue; // Set cell value dynamically based on row index ws.Rows[i].Columns[1].Value = "New Value " + i.ToString(); } wb.SaveAs("sample.xlsx"); } Imports IronXL Shared Sub Main(ByVal args() As String) Dim wb As WorkBook = WorkBook.Load("sample.xlsx") Dim ws As WorkSheet = wb.GetWorkSheet("Sheet1") For i As Integer = 0 To ws.Rows.Count() - 1 ' Skip header row If i = 0 Then Continue For End If ' Set cell value dynamically based on row index ws.Rows(i).Columns(1).Value = "New Value " & i.ToString() Next i wb.SaveAs("sample.xlsx") End Sub $vbLabelText $csharpLabel With the table results of sample.xlsx below: Convert spreadsheets to PDF, XML, and JSON Are you using an Excel API to generate spreadsheets in Java applications? When you are working with data, there will be times when you do not want to store your data in an Excel spreadsheet. Instead, you need a PDF. There are several reasons why you wouldn't want to store data in an Excel spreadsheet: You need long-term preservation. You do not have Microsoft Office installed on your system, but still want to print or distribute your Excel spreadsheets. You need to share your spreadsheet and keep your formatting. You need your Excel spreadsheets to look exactly the same when opened on different systems. Using GrapeCity to convert spreadsheets to PDF GrapeCity Documents for Excel, Java Edition (GcExcel Java) is a high-speed, small-footprint spreadsheet API that requires zero dependencies in Excel. With full support on Windows, Linux, and Mac, you can generate, load, modify, and save spreadsheets, then convert them to a PDF. Here are the three steps for converting spreadsheets to PDFs in Java applications: Load an existing Excel spreadsheet in a GcExcel workbook Add PDFBox as a library Convert the spreadsheet to PDF Step 1: Load an existing Excel spreadsheet in a GcExcel workbook Create a GcExcel workbook object and load an existing spreadsheet. Workbook workbook = new Workbook(); workbook.Open("FinancialKPI.xlsx"); Workbook workbook = new Workbook(); workbook.Open("FinancialKPI.xlsx"); Dim workbook As New Workbook() workbook.Open("FinancialKPI.xlsx") $vbLabelText $csharpLabel Step 2: Add PDFBox as a library GcExcel Java references PDFBox to convert spreadsheets to PDF. PDFBox also depends on FontBox and Commons Logging packages. Following these steps will help you add these JAR files as a library to your project: Download the package — PDFBox, FontBox, Commons Loggings JAR files. Under the 'src' folder in the project, add a folder 'libs'. Copy the three JAR files to the 'libs' folder. Right-click the 'libs' folder and choose the 'Add as library' option. Press OK. Note: The above steps would be required only if the project is an original Java console project. If the project is a Maven or Gradle project, just adding the GcExcel Java dependency would be sufficient. Maven or Gradle will download and install all dependent JARs automatically. In some versions of Maven, you may get a dependency error on adding the above JAR files. To resolve that, please add the following node before the dependencies in pom.xml: <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> </plugin> </plugins> </build> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <extensions>true</extensions> </plugin> </plugins> </build> XML Step 3: Convert the spreadsheet to PDF Save the spreadsheet to PDF using the following code: workbook.Save("FinancialKPI.pdf", SaveFileFormat.Pdf); workbook.Save("FinancialKPI.pdf", SaveFileFormat.Pdf); workbook.Save("FinancialKPI.pdf", SaveFileFormat.Pdf) $vbLabelText $csharpLabel Your PDF will look like this: Using IronXL to convert spreadsheets to XML and JSON The following code demonstrates how to export an Excel file to an XML or a JSON file with IronXL. Add the following code: Include the namespace: using IronXL; using IronXL; Imports IronXL $vbLabelText $csharpLabel Add the next few lines: private void ExportToXmlJson() { WorkBook workbook = WorkBook.Load("IronXL_Output.xlsx"); // Export to JSON workbook.SaveAsJson("IronXL_Output.json"); // Export to XML workbook.SaveAsXml("IronXL_Output.xml"); } private void ExportToXmlJson() { WorkBook workbook = WorkBook.Load("IronXL_Output.xlsx"); // Export to JSON workbook.SaveAsJson("IronXL_Output.json"); // Export to XML workbook.SaveAsXml("IronXL_Output.xml"); } Private Sub ExportToXmlJson() Dim workbook As WorkBook = WorkBook.Load("IronXL_Output.xlsx") ' Export to JSON workbook.SaveAsJson("IronXL_Output.json") ' Export to XML workbook.SaveAsXml("IronXL_Output.xml") End Sub $vbLabelText $csharpLabel Here, an existing Excel Workbook object is loaded and then exported to JSON and XML formats. Licensing and Pricing IronXL Licensing and Pricing IronXL is an openly commercial C# Excel library. It is free for development and can always be licensed for commercial deployment. Licenses are offered for single-project use, single developers, agencies, and multinational organizations, as well as SaaS and OEM redistribution. All licenses contain a 30-day money-back guarantee, one year of software support and upgrades, validity for dev/staging/production, and also a permanent license (one-time purchase). The Lite bundle starts from $799. GrapeCity Licensing and Pricing On the other hand, GrapeCity Excel is also a commercial Excel library; it does not offer any free services. GrapeCity Documents pricing starts at the flat rate of $999 per year. They also offer a free trial. Their licenses are broken down into four packages: Developer License (1 Developer, 1 Location) One (1) developer can use GrapeCity Documents in one (1) location with a Developer License (defined as a physical address or office building). Multiple sites are considered to constitute a cloud deployment; see Unlimited Licenses for more information. Developer Unlimited License (1 Developer, Unlimited Locations or Cloud) One (1) developer can use GrapeCity Documents in an unlimited number of locations (specified as a physical address or office building) or in the cloud with a Developer Unlimited License. Team Unlimited License (2–5 Developers, Unlimited Locations or Cloud) GrapeCity Documents can be used by up to five (5) developers in infinite locations (specified as a physical address or office building) or in the cloud with a Team Unlimited License. OEM and SaaS License (6+ Developers) This can be set up by contacting sales support. Conclusion In .NET apps and websites, IronXL for .NET allows developers to read, produce, and modify Excel (and other Spreadsheet files). XLS/XLSX/CSV/TSV can be read and edited, and exports can be saved to XLS/XLSX/CSV/TSV/JSON. It is compatible with the .NET Framework, .NET Core, and Azure. All of this is accomplished without the need for additional dependencies or the installation of Microsoft Office. If you've ever felt that Excel is getting in the way of your .NET office management skills, IronXL is here to help. This is why we built the C# Excel library, which allows you to read, generate, and modify Excel files in .NET apps and websites as a successful developer. GcExcel (GrapeCity Documents for Excel) is a fast, small-footprint spreadsheet API that does not require Excel. You may generate, load, change and convert spreadsheets in .NET Framework, .NET Core, Mono, and Xamarin with full .NET Standard 2.0 support. This spreadsheet API can be used to build apps for the cloud, Windows, Mac, and Linux. You'll never have to sacrifice design or requirements because of its sophisticated computation engine and wide range of features. The GrapeCity Excel license starts at $995 per developer, compared to $799 for IronXL, which comes with the upper hand of a royalty-free and unlimited multi-user plan which becomes cheaper when you are buying for a large number of developers rather than the GcExcel which has a maximum of 6 users on its ultra multiuser plans. IronXL is preferred above other C# alternatives due to its efficiency in dealing with Excel documents. IronXL also stands out due to its operational methods which encourage shorter lines of code. Iron Software is currently offering all its customers and users the option to grab the whole Iron Software suite in two clicks — for the price of just two packages from the Iron Software suite, you can instead get all five packages along with uninterrupted support. 请注意GrapeCity Documents for Excel is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by GrapeCity Documents for Excel. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing. 常见问题解答 C# 开发者的 GrapeCity Excel Viewer 的替代方案有哪些? IronXL 是 C# 开发者的 GrapeCity Excel Viewer 的热门替代方案。它简化了读取和编辑 Excel 文档,无需 Microsoft Excel,支持各种格式和平台,并提供高效的数据处理功能。 如何在 C# 中读取和编辑 Excel 文档而无需安装 Microsoft Excel? 您可以使用 IronXL 在 C# 中读取和编辑 Excel 文档,无需 Microsoft Excel。IronXL 支持多种电子表格格式,并能在不同平台上高效处理操作。 IronXL 支持 Excel 操作的平台有哪些? IronXL 支持 .NET Core、.NET Framework、Xamarin、Mobile、Linux、macOS 和 Azure,使其适用于各种开发环境。 IronXL 如何处理 Excel 公式? IronXL 通过确保每次编辑工作表时重新计算公式来支持 Excel 公式,允许动态数据操作和准确的数据结果。 我可以使用 IronXL 将 Excel 数据导出为 JSON 或 XML 吗? 可以,IronXL 提供将 Excel 数据导出为 JSON 和 XML 格式的功能,便于数据集成和转换任务。 IronXL 的许可选项有哪些? IronXL 提供免版税许可选项,专注于多用户计划,为团队和各种应用提供具有成本效益的解决方案。 GrapeCity Documents for Excel 的突出功能有哪些? GrapeCity Documents for Excel 提供轻量级 API、高速数据处理和与 .xlsx 及 ssjson 等多种格式的兼容性,以及与商业智能工具的无缝集成。 IronXL 和 GrapeCity Documents for Excel 在定价上有何不同? GrapeCity Documents for Excel 每年起价 $999,而 IronXL 提供更灵活且具成本效益的免版税许可选项,特别适合多用户环境。 为什么开发者可能选择 IronXL 而不是 GrapeCity 进行 Excel 操作? 开发者可能会选择 IronXL,因为它在处理 Excel 文档时的简单性、高效性和操作方便性,特别是对于需要快速和简单文档处理的应用。 Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 相关文章 已更新六月 22, 2025 C# 开发人员使用 IronXL 的 Zip 存档教程 在本教程中,我们将探讨如何在C#中创建ZIP文件、从压缩文件中提取数据以及操作ZIP档案,使用相对路径。 阅读更多 已更新七月 28, 2025 比较三个开源 C# Excel 库 本文将探讨三个 C# 开源 Excel 库,旨在简化 .NET 环境中的 Excel 文件操作 阅读更多 已更新八月 4, 2025 EPPlus 读取 Excel 到 DataTable C#(IronXL 教程) EPPlus 是一个强大的开源库,用于在 C# 中创建和操作 Excel 文件。它提供了一个简单直观的 API,使开发人员能够以编程方式生成、读取和修改 Excel 电子表格。 阅读更多 IronXL 和 ClosedXML 的比较IronXL 和 Syncfusion Excel 的比较
已更新八月 4, 2025 EPPlus 读取 Excel 到 DataTable C#(IronXL 教程) EPPlus 是一个强大的开源库,用于在 C# 中创建和操作 Excel 文件。它提供了一个简单直观的 API,使开发人员能够以编程方式生成、读取和修改 Excel 电子表格。 阅读更多