This article demonstrates how to extract text from textbox within a worksheet using Spire.XLS for Java.
Sample Document
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 workbook.loadFromFile("C:\\Users\\Administrator\\Desktop\\sample.xlsx"); //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(); System.out.print(text); } }
Output