Hi,
textboxIndex = worksheet.getTextBoxes().add(15, 4, 85, 120);
Hi,
textboxIndex = worksheet.getTextBoxes().add(15, 4, 85, 120);
Hi,
Workbook wb = new Workbook(“bk_addtextbox1.xlsx”);
Worksheet ws = wb.getWorksheets().get(0);
Cells cells = ws.getCells();
//Get the column width in pixels of second column i.e, B.
int colwidth = cells.getColumnWidthPixel(1);
System.out.println(colwidth);
//Now add the text box in B2 cell.
int index = ws.getTextBoxes().add(1, 1, 85, colwidth);
wb.save(“outbkaddtextbox1.xlsx”);
Amjad,
Hi,
Workbook wb = new Workbook(“bk_addtextbox1.xlsx”);
Worksheet ws = wb.getWorksheets().get(0);
Cells cells = ws.getCells();
//Get the column width in pixels of second column i.e, B.
int colwidth = cells.getColumnWidthPixel(1);
System.out.println(colwidth);
//Now add the text box in B2 cell.
int index = ws.getTextBoxes().add(1, 1, 85, colwidth);
**//Get the text box.**
**TextBox textBox = ws.getTextBoxes().get(index);**
**//Set its placement type so, when you increase the column’s width, the text box’s width also gets increased.**
**textBox.setPlacement(PlacementType.MOVE_AND_SIZE);**
wb.save(“outbkaddtextbox1.xlsx”);
Amjad,
int add = sheet.getTextBoxes().add(startRowIndex, startColumnIndex, height , width);
TextBox addTextBox = sheet.getTextBoxes().get(add);
addTextBox.setText(value);
TextFormat textFormat = label.getTextFormat();
if(null != textFormat) {
Font font = addTextBox.getFont();
font.setBold(textFormat.isBold());
font.setSize(textFormat.getFontSize());
font.setName(textFormat.getFontName());
if(0 != textFormat.gethAlignment()) {
addTextBox.setTextHorizontalAlignment(textFormat.gethAlignment());
}
}
addTextBox.setPlacement(PlacementType.MOVE_AND_SIZE);
Hi,