Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

E-iceblue Product Family
E-iceblue Product Family

Posted on

     

Convert PDF to Excel or Word in Java

Occasionally, you might be in a sitution where you need to extract table from a PDF document and save the table date either in a Word file or in an Excel worksheet, so that you can edit the date freely. In this article, I am going to show you how to convert a whole PDF document to Excel or Word by usingSpire.PDF for Java.

Below is a screenshot of the input file.
Alt Text

Install Spire.Pdf.jar

If you’re creating a Maven project, you can easily add the jar in your applciation using the following configurations. For non-Maven projects, download the jar file fromthis link and add it as a dependency in your applicaiton.

<repositories><repository><id>com.e-iceblue</id><name>e-iceblue</name><url>http://repo.e-iceblue.com/nexus/content/groups/public/</url></repository></repositories><dependencies><dependency><groupId>e-iceblue</groupId><artifactId>spire.pdf</artifactId><version>3.8.5</version></dependency></dependencies>

Convert PDF to Excel (XLS/XLSX)

publicclassConvertPdfToExcel{publicstaticvoidmain(String[]args){//Create a PdfDocument instancePdfDocumentpdf=newPdfDocument();//Load a PDF filepdf.loadFromFile("C:\\Users\\Administrator\\Desktop\\table.pdf");//Save as Excel filepdf.saveToFile("ToExcel.xlsx",FileForma.XLSX);}}

Output
Alt Text

Convert PDF to Word (DOC/DOCX)

publicclassConvertPdfToWord{publicstaticvoidmain(String[]args){//Create a PdfDocument instancePdfDocumentpdf=newPdfDocument();//Load a PDF filepdf.loadFromFile("C:\\Users\\Administrator\\Desktop\\table.pdf");//Save as Word filepdf.saveToFile("ToWord.docx",FileFormat.DOCX);}}

Output
Alt Text

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Your Office Development Master
  • Location
    Chengdu, SiChuan, China
  • Work
    Dev at E-iceblue
  • Joined

More fromE-iceblue Product Family

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp