Java – how to use Apache POI to select and bold the entire worksheet

I am a beginner of Apache POI library

In VBA, I know I can use the following code to select and bold the entire worksheet

Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets(1)
ws.Cells.Font.Bold = True

Can I know how to select and bold the entire table by coding using the Apache POI library?

thank you

Solution

There is a good example of this link

Sheet sheet = wb.createSheet("test");
CellStyle cs = wb.createCellStyle();
Font f = wb.createFont();
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
cs.setFont(f);
sheet.setDefaultColumnStyle(1,cs); //set bold for column 1
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>