我使用Apache POI生成Excel表格,但是生成的表格在Excel自身“格式化为表格”时缺少每个标题上的下拉菜单。如何使用Apache Poi添加表格标题下拉菜单
我想生成此:
而是我得到这个:
我下面this blog post,我的代码如下所示:
XSSFTable table = sheet.createTable();
table.setDisplayName("Data");
CTTable ctTable = table.getCTTable();
ctTable.setDisplayName("Data");
ctTable.setId(1L);
ctTable.setName("DATA");
CTTableStyleInfo table_style = ctTable.addNewTableStyleInfo();
table_style.setName("TableStyleMedium9");
table_style.setShowColumnStripes(false);
table_style.setShowRowStripes(true);
然后每列都是这样创建的:
CTTableColumn column = ctColumns.addNewTableColumn();
column.setName(headers.get(i));
column.setId(i + 1);
我在想什么?
你检查http://stackoverflow.com/问题/ 27630507 /这是一个最大数量的项目,而生成下拉列表中的Excel使用apach – emin 2015-02-09 22:18:54
我看到在搜索,但我不知道的排序菜单在与DataValidation相关的表上 - 它们是否被链接? – 2015-02-09 22:47:10
选中此:http://tiku.io/questions/421420/excel-drop-down-list-using-apache-poi – emin 2015-02-09 23:09:17