Document conversion formats through to meet the needs of different occasions office document operations. This article describes a method to convert Excel documents other common document formats. By the text of the method, may support the conversion of Excel including PDF , images, html, XPS, XML, CSV , PCL, ODS, PostScript, and different versions of Office Excel, such as, version97-2003, version2007, version2010, version2013 , version2016 etc. including different document formats. In this paper, converting a few of example to introduce the specific document format conversion method.
Use tools: as Free Spire.XLS for the Java (free version)
Jar file download and import:
Method 1 : through the official website to download jar package. After the download, unzip the file, the lib folder under the Spire.Xls.jar import Java programs. As shown below:
Method 2 : by maven introduced warehouse.
Java code sample (for reference)
import com.spire.xls.*; public class ExcelToImg { public static void main (String [] args) { // load Excel worksheet the Workbook WB = new new the Workbook (); wb.loadFromFile("test.xlsx"); // get the worksheet Worksheet Sheet = wb.getWorksheets () GET (0. ); // call the method to save Excel worksheet as a picture sheet.saveToImage ( "ToImg.png" ); // call the method specified Excel range cell data saved as a picture // sheet.saveToImage ( "ToImg2.png", 8 , 1,30,7); // call the method will save Excel to HTML sheet.saveToHtml ( "ToHtml.html" ); // call the method will save Excel to XPS sheet.saveToFile ( "ToXPS.xps" , String.valueOf (FileFormat.XPS)); // call the method will save Excel to CSV sheet.saveToFile ( "ToCSV.csv" , String.valueOf (FileFormat.CSV)); // call the method will save Excel to XML sheet.saveToFile ( "ToXML.xml" , String.valueOf (FileFormat.XML)); // call the method will save Excel as a PostScript sheet.saveToFile ( "ToPostScript.postscript" , String.valueOf (FileFormat.PostScript)); // call the method will save Excel as PCL sheet.saveToFile ( "ToPCL.pcl" , String.valueOf (FileFormat.PCL)); } }
Document conversion results:
(This article End)