Skip to Content
0
Former Member
May 25, 2010 at 05:52 PM

Problem in Date filed in Upload Excel Sheet Program

40 Views

Hi Friends,

I have one doubt on File upload. After downloading data into excel Sheet I have to modify some columns in the excel sheet then I am trying to upload same excel sheet to table.

I am getting problem in date column. I have written this code for upload excel file

boolean flag = false;

try

{

Path: here I am getting file from the server path

wb = Workbook.getWorkbook(new File(path)); // For Dev

Sheet sh = wb.getSheet(0);

int cloumns = sh.getColumns();

int row = sh.getRows();

int i = 0;

for(int j=1; j<row ; j++)

{

IPrivatePO_Details_ResultView.IPoDetails_OutTabElement ele = wdContext.nodePoDetails_OutTab().createPoDetails_OutTabElement();

ele.setChcekBoxEnable(true);

Cell c1 = sh.getCell(i,j);

ele.setPo_Number(c1.getContents());

BigDecimal bdStr = null;

Cell c7 = sh.getCell(i+6,j);

bdStr = new BigDecimal(c7.getContents());

ele.setQuantity(bdStr);

Cell c8 = sh.getCell(i+7,j);

bdStr = new BigDecimal(c8.getContents());

ele.setOa_Quantity(bdStr);

SimpleDateFormat smDate = smDate = new SimpleDateFormat("dd-MM-yyyy");

Date dt = null;

Cell c10 = sh.getCell(i+9,j);

*dt = (Date)smDate.parse(c10.getContents()); *

ele.setDeliv_Date(dt);

Cell c11 = sh.getCell(i+10,j);

dt = (Date)smDate.parse(c11.getContents());

ele.setStat_Date(dt);

Cell c14 = sh.getCell(i+13,j);

ele.setPo_Status(c14.getContents());

wdContext.nodePoDetails_OutTab().addElement(ele);

}

}

catch(Exception Ex)

{

Ex.printStackTrace();

}

Here PoDetails_OutTab this is value node under this value node Deliv_Date is available the date data type is date.

Please help me.

Regards

Vijay Kalluri