Extract Text from Textbox in Excel Using Java

Installation (2 Method)

<url>http://repo.e iceblue.com/nexus/content/groups/public/</url>

Steps and Sample Code

  1. Create a Workbook instance.
  2. Load a sample Excel file using Workbook.loadFromFile() method.
  3. Get a specified worksheet using Workbook.getWorksheets().get() method.
  4. Get a specified textbox using Worksheet.getTextBoxes().get() method.
  5. Get the text in the specified textbox using XlsTextBoxShape.getText() method.
import com.spire.xls.Workbook;
import com.spire.xls.Worksheet;
import com.spire.xls.core.spreadsheet.shapes.XlsTextBoxShape;

public class ExtractTextFromTextbox {

public static void main(String[] args) {

//Create a Workbook instance
Workbook workbook = new Workbook();

//Load a sample Excel file

//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);

//Get the first textbox
XlsTextBoxShape shape = (XlsTextBoxShape)sheet.getTextBoxes().get(0);

//Get the text inside the textbox
String text = shape.getText();




Sharing Java Code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to set up separate testing and production environments by integrating Github-Jenkins-Docker.

PointPay Wednesday Update

Make your own APNS pusher 🔔

How To Setup Docker for Symfony 4 Applications

Scheduling Backups on an Oracle Cloud VPS


Tutorial Fuzzy Logic Mamdani for Arduino

Tutorial Fuzzy Logic Mamdani for Arduino

OpsGenie’s secret for delivering a great product

Mocaserver usage and options for RedPrairie/JDA WMS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Wilson

Andrew Wilson

Sharing Java Code

More from Medium

Apply or Remove Data Validation in Excel Using Java

Beginners Guide to Java Programming


Multiple classes in a single Java source file