Even if you are attempting to just write a validator for some input that is then used to update/add to a workbook, you may not get what you want relying on cell formatting. Excel lets you format an entire column as numbers, but enter text in whatever cells you want, for things like column headers.
You may be better served having users define data validation constraints for specific cells or ranges of cells, and using the code added recently to POI to evaluate those constraints dynamically as data changes. On Tue, Jun 27, 2017 at 10:45 AM Murphy, Mark <murphym...@metalexmfg.com> wrote: > I don't think you can restrict what goes in a cell in Excel without using > VBA. If you need to do that you are better off with a database anyway. > Besides, VBA cannot be parsed by POI, so even if you do restrict the > contents of a cell that way, you can't detect it with POI. > > -----Original Message----- > From: Blake Watson [mailto:blake.wat...@pnmac.com] > Sent: Tuesday, June 27, 2017 12:26 PM > To: POI Users List <user@poi.apache.org> > Subject: Re: Intended Cell Type > > >> but doesn't mean that's what will be written there. > > Not in Excel-land. This presents some challenges when you're trying to > actually restrict what might go there. > > >>You could try entering a date and format it as "#,##0.00". > > Yeah. And I could format the values according to whats in there, which > would remove the scientific notation aspect, but which would also put > commas in exported numbers. > > Excel's a hell of a thing. >