3

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.

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?

Sankumarsingh
  • 9,889
  • 11
  • 50
  • 74
Ben Taliadoros
  • 7,003
  • 15
  • 60
  • 97

1 Answers1

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

Kishor Sharma
  • 599
  • 8
  • 15