Sorry to say this but no, I do not think this is possible using 'core' HSSF/XSSF - though of course I could be wrong.
To my mind you have two options; 1. Create a template file that contains an on activation macro - one that will run when the user opens the workbook. The macro will contain code to perform the sort for you and you can use HSSF/XSSF to open the template file, populate the worksheets with data and then save it all away again. Sadly, unless you are able to use the Office 2007 .xlsm file extension (denoting a macro enabled workbook or one containing macros that have been deemed safe) then the user will be faced with a message telling them the file contains macros and asking them whether or not themacros should be enabled or disabled. Of course, if they choose to disable the macros then the data will not be sorted. 2. The second option is to create some code that will sort the data for you prior to populating the worksheet. I think that you will have to create some sort of container that you can write the data to initially, that can be sorted and then interrogated again so that you can recover the data - sorted into order - to populate the worksheet. Though it may sound a little intimidating, I must admit that this is probably the option I would take. V S P wrote: > > Hello > I have done my best to search before posting > but did not find the help in all the docs and the API > > all I need is to sort (strings) by two columns B and C > (I have 5 total columns) > > My preference is that the sort will happen on the 'user' side > when the spreadsheet is opened and not while I am creating it. > > Thank you in advance, > VSP > -- > V S P > [email protected] > > -- > http://www.fastmail.fm - Or how I learned to stop worrying and > love email again > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://www.nabble.com/HSSF-sorting-by-two-columns-tp23400522p23401598.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
