Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert PDF to Excel in C #

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces C# how to achieve PDF into Excel related knowledge, the content is detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that after reading this C# how to achieve PDF into Excel article will have a harvest, let's take a look at it.

In general, PDF format documents can support more editing functions than office documents, for PDF documents with tabular data, if you want to edit the data in the table, you can convert the PDF document to Excel format, and then edit.

Dll reference method method 1

Introduce Spire.Pdf.dll file into the program; download Spire.PDF for .NET locally, extract it, and install it. After the installation is complete, locate the Spire.Pdf.dll in the BIN folder under the installation path. Then open solution Explorer in Visual Studio, right-click "reference" and "add reference" to add a reference to the dll file under the local path BIN folder.

Method 2

Install via NuGet. It can be installed in the following two ways:

1. You can open solution Explorer in Visual Studio, right-click "references", "manage NuGet packages", then search for "Spire.PDF" and click "install". Wait for the program to be installed.

two。 Copy the following to the PM console installation: Install-Package Spire.PDF-Version 8.3.9

PDF to Excel

When converting, you can do this by following these steps, requiring only three lines of code:

Create an object of the PdfDocument class.

Call the PdfDocument.LoadFromFile (string filename) method to load the PDF document.

Save the file to the specified path in Excel format through the PdfDocument.SaveToFile (string filename, FileFormat fileFormat) method.

C#using Spire.Pdf;namespace PDFtoExcel {class Program {static void Main (string [] args) {/ / load PDF document PdfDocument pdf = new PdfDocument (); pdf.LoadFromFile ("test.pdf"); / / Save as Excel document pdf.SaveToFile ("ToExcel.xlsx", FileFormat.XLSX) } VB.NETImports Spire.PdfNamespace PDFtoExcel Class Program Private Shared Sub Main (args As String ()) 'load PDF document Dim pdf As New PdfDocument () pdf.LoadFromFile ("test.pdf")' Save as Excel document pdf.SaveToFile ("ToExcel.xlsx", FileFormat.XLSX) End Sub End ClassEnd Namespace

The PDF document for conversion, which contains 9 pages:

During the conversion, each page of the original PDF is converted into a single sheet page, as shown in the figure. The converted Excel document contains 9 sheet pages:

This is the end of the article on "how to convert PDF to Excel in C#". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to convert PDF into Excel". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report