小编Div*_*rai的帖子

如何在Apache POI中设置固定列宽

如何在Apache POI中设置固定列宽.我想让我的第一列固定宽度.

我试过了sheet.setColumnWidth(0,1000); cellStyle.setWrapText(真); //设置wordwrap它没有反映

    public XSSFWorkbook generateReport(List<Dto> result, boolean isRes, boolean isRes1) {
    XSSFWorkbook workbook = null;
    XSSFSheet sheet = null;
    XSSFRow row = null;
    XSSFCell cell = null;
    String[] headers = null;
    int rowNum = 0;
    int colNum = 0;
    CellStyle cellStyle = null;
    CellStyle headerStyle = null;
    XSSFFont font = null;
    CellStyle datecellStyle = null;
    /* set the weight of the font */



    try {
        workbook = new XSSFWorkbook();

        headers = new String[] { ...values goes here...}; …
Run Code Online (Sandbox Code Playgroud)

java apache-poi

5
推荐指数
2
解决办法
3万
查看次数

如何在正则表达式中只允许一个点?

我已经有正则表达式,只允许数字和点.

但它允许多个点.就我而言,我只想要一个点.

/[0-9.]/
Run Code Online (Sandbox Code Playgroud)

regex

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

apache-poi ×1

java ×1

regex ×1