Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JSpreadsheet
>
Tutorial
> Set Cell Border
The following example shows you how to set cell border.
import com.independentsoft.office.spreadsheet.Cell; import com.independentsoft.office.spreadsheet.Workbook; import com.independentsoft.office.spreadsheet.Worksheet; import com.independentsoft.office.spreadsheet.styles.Border; import com.independentsoft.office.spreadsheet.styles.BorderStyle; import com.independentsoft.office.spreadsheet.styles.CellBorder; import com.independentsoft.office.spreadsheet.styles.CellFormat; public class Example { public static void main(String[] args) { try { Border border = new Border(); border.setStyle(BorderStyle.THIN); CellFormat format1 = new CellFormat(); format1.setBorder(new CellBorder()); format1.getBorder().setTop(border); format1.getBorder().setBottom(border); format1.getBorder().setLeft(border); format1.getBorder().setRight(border); Cell a1 = new Cell(999.99); a1.setFormat(format1); Worksheet sheet1 = new Worksheet(); sheet1.set("A1", a1); Workbook book = new Workbook(); book.getSheets().add(sheet1); book.save("c:\\test\\output.xlsx", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*