I have made an excel sheet which is generated by Java. The cells can only accept certain values, depending on data validation done against lists on a separate sheet.
我制作了一个由Java生成的excel表。单元格只能接受某些值,具体取决于对单独工作表上的列表进行的数据验证。
This all works great, but if a user copies some values from another cell and pastes it into the cell it avoids validation... is there any way to prevent this?
这一切都很好,但是如果用户从另一个单元格中复制一些值并将其粘贴到单元格中,则可以避免验证...有什么办法可以防止这种情况发生吗?
1 个解决方案
#1
0
You can do this by setting data format for that cell.
您可以通过设置该单元格的数据格式来完成此操作。
style = wb.createCellStyle();
style.setDataFormat(wb.createDataFormat().getFormat("0.000%"));
which will percentage value. For documentation goto: Apache HSSF Doc
这将是百分比值。有关文档goto:Apache HSSF Doc
#1
0
You can do this by setting data format for that cell.
您可以通过设置该单元格的数据格式来完成此操作。
style = wb.createCellStyle();
style.setDataFormat(wb.createDataFormat().getFormat("0.000%"));
which will percentage value. For documentation goto: Apache HSSF Doc
这将是百分比值。有关文档goto:Apache HSSF Doc