Hi Mark,
Great thanks for the response and the help you are doing to get resolved
this issue.
Here is my requirement.
1.Want to dump values from db to excel file.
some of the fields have multiple values so want to place these values in
listbox.
Here is very basic code I have written
public class ExcelListDemo{
/**
* @param args
*/
public static void main(String[] args) {
// New Workbook.
File outputFile = new File("C:/Documents and
Settings/nravilla/Desktop/temp.xls");
try {
FileOutputStream fos = new FileOutputStream(outputFile);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("List Sheet");
String[] strFormula = new String[] { "100", "200", "300", "400",
"500"
};
CellRangeAddressList addressList = new CellRangeAddressList();
addressList.addCellRangeAddress(0, 0, 1, 2);
DVConstraint constraing =
DVConstraint.createExplicitListConstraint(strFormula);
HSSFDataValidation dataValidation = new
HSSFDataValidation(addressList,
constraing);
dataValidation.setEmptyCellAllowed(false);
dataValidation.setShowPromptBox(true);
dataValidation.setSuppressDropDownArrow(false);
dataValidation.createErrorBox("Invalid input !", "Something is
wrong.
check condition!");
sheet.addValidationData(dataValidation);
workbook.write(fos);
} catch (Exception e) {
System.out.println(e);
}
}
}
2.so once excel sheet has listbox of values ,user can edit to enter more
values.(FYI with the above lines of code user is not able to enter values in
the listbox.I'm looking into that issue as well.)
so assue the listbox values 100,200...500.Then use can add 600,700,....1000.
3.When I import this sheet ,I shoud be able to store these 600,700...1000
into databse.
Please let me know if you need more informaion on this.
Regards,
Naga.
MSB wrote:
>
> Just a message to let you know that I have not been able to find an answer
> to your question yet and can only hope that this is not holding up a
> project. Tomorrow is an office day for me so I will be able to spend some
> time digging around I hope and will let you know if I do find an answer.
>
> Can you give me a rough idea of what you are trying to achieve with POI
> please? If it does not prove to be possible to get at the contents of the
> list, then we may need to look at possible alternative approaches to
> solving your problem and they do exist - albeit that they have other
> problems that may rule them out; OLE for example only works on Windows
> platforms, cannot be used in a client server architecture and has no way
> to catch and handle errors gracefully.
>
> Yours
>
> Mark B
>
>
> Nagineni wrote:
>>
>> Hi,
>>
>> I'm new to POI.I learned reading excel data from java using POI.
>>
>> I'm not able to find the way to read list box vlues from the excel
>> sheet.Could any one provide me the sample code to read excel sheet list
>> box values so that I can dig into more?
>>
>> I'm helpless from my google search.Please do help me.
>>
>>
>> Regards,
>> Naga.
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/sample-code--to-read-excel-listbox-values-tp23921169p23975037.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]