Skip to main content

Posts

Showing posts from May, 2020

Add Hyperlinks to Excel in Java

In Excel, you can create a hyperlink to a web page, a file, an email address or create an image hyperlink. In this article, I’m going to show you how to add these hyperlinks to an Excel file programmatically in Java by using Free Spire.XLS for Java API. Before using the following code, you need to download Free Spire.XLS for Java API, unzip the package and then add Spire.Xls.jar in the lib folder into your project. If you’re creating maven projects, you can install Free Spire.XLS for Java API from maven repository .   Add hyperlinks import com.spire.xls.ExcelPicture ; import com.spire.xls.ExcelVersion ; import com.spire.xls.HyperLink ; import com.spire.xls.Workbook ; import com.spire.xls.Worksheet ; public class AddHyperlinks {     public static void main ( String [] args) throws Exception {         //Create a Workbook instance         Workbook workbook = new Workbook();         //Get the first worksheet         Worksheet sheet = workbook .getWorksheets().get( 0 )

Replace Text in PDF in Java

  This article introduces two ways to replace text in PDF in Java: Replace only the first occurrence of the specified text Replace all occurrences of a specified text Before using the following code, you need to download Free Spire.PDF for Java API, unzip the package and then add Spire.Pdf.jar in the lib folder into your project. If you’re creating maven projects, you can install Free Spire.PDF for Java API from maven repository .   Replace only the first occurrence of the specified text import com.spire.pdf.PdfDocument ; import com.spire.pdf.PdfPageBase ; import com.spire.pdf.general.find.PdfTextFind ; import com.spire.pdf.general.find.PdfTextFindCollection ; import com.spire.pdf.graphics.PdfBrush ; import com.spire.pdf.graphics.PdfBrushes ; import com.spire.pdf.graphics.PdfRGBColor ; import com.spire.pdf.graphics.PdfSolidBrush ; import com.spire.pdf.graphics.PdfTrueTypeFont ; import java.awt. *; import java.awt.geom.Rectangle2D ;   public class ReplaceText {     public st