Skip to main content

Posts

Showing posts from December, 2019

Find, Replace and Highlight Data in Excel in Java

Finding and replacing data is one of the most useful features in Microsoft Excel, it allows us to quickly locate the position of a particular data and replace it with another data. This blog demonstrates how to find a specified text, replace it with another text and then highlight the result in Excel file in Java using Free Spire.XLS for Java library. Before using the below code, please download Free Spire.XLS for Java package then and import Spire.Xls.jar under the lib folder into your project. import com.spire.xls.CellRange; import com.spire.xls.ExcelVersion; import com.spire.xls.Workbook; import com.spire.xls.Worksheet; import java.awt.*; public class ReplaceAndHightlightText {     public static void main(String[] args){         //Create a Workbook instance         Workbook workbook = new Workbook();         //Load the Excel file         workbook.loadFromFile( "test.xlsx" );         //Get the first worksheet         Worksheet worksheet = workbook.getWork

Encrypt and Decrypt Excel Files in Java

This blog demonstrates how to encrypt and decrypt Excel Files in Java using Free Spire.XLS for Java library. Installation First of all, you need to download spire.xls.jar and add it to your project as dependency. If you use maven, you need to add the following dependencies to your pom.xml file. <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.xls.free</artifactId>         <version>2.2.0</version>     </dependency> </dependencies> Encrypt Excel file Free Spire.XLS for Java supports the following encrypt options: Encrypt the whole excel file with password E

Convert PDF to Image in Java

This blog demonstrates how to convert PDF to Image using Free Spire.PDF for Java library. Free Spire.PDF is a Java library which supports converting PDF to multiple commonly used image formats such as .png, .jpg, .tiff and .svg. Free Spire.PDF for Java provide a saveAsImage method in PdfDocument class which enables us to save PDF to image. In the following example, we will see how to convert a PDF file to .png images using Free Spire.PDFfor Java. Before start with coding, you need to Download  Free Spire.PDF for Java package , unzip it and import Spire.Doc.jar file from the  lib  folder in your project as a denpendency. import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import com.spire.pdf.PdfDocument; import javax.imageio.ImageIO; public class PDFtoImage {         public static void main(String[] args) throws IOException {         //load a PDF file         PdfDocument pdf = new PdfDocument();         pdf.loadFromF

Create Excel File in Java

In this blog, I will show you how to create an Excel file in Java with Free Spire.XLS for Java API. Free Spire.XLS for Java is a free and independent Java Excel API that empowers developers to create, read, edit, convert and print Excel files without installing Microsoft Office. 1. Installation Download the Free Spire.XLS for Java API from this link , unzip the package and then add the Spire.Xls.jar to your project as a dependency. For maven project, you can add the following code to pom.xml file to import Spire.Xls.jar into your project. <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.xl