Insert Textbox to Excel Worksheet Using Java

import com.spire.xls.*;
import com.spire.xls.core.ITextBox;
import com.spire.xls.core.ITextBoxShape;

public class ExcelTextbox {
public static void main(String[] args) throws Exception {

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

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

//Insert the textbox with text
ITextBox textBox = sheet.getTextBoxes().addTextBox(5, 3, 70, 196);
textBox.setText("Insert TextBox in Excel");

//Insert the textbox with picture
ITextBoxShape shape = sheet.getTextBoxes().addTextBox(5, 8, 128, 196);

//Save the Excel file
workbook.saveToFile("output/TextBox.xlsx", ExcelVersion.Version2010);



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