import java.util.ArrayList;
import remedy.api.WritertoAR;
import com.remedy.arsys.api.EntryItem;
import com.remedy.arsys.api.FieldID;
import com.remedy.arsys.api.Value;
public class Common extends WritertoAR {
public Common() {
id.add(new Long(536870913));
}
private static final String FORMNAME = "BOCOM_IF_CENTERFORM ";// BOCOM_IF_CENTERFORM
private ArrayList id = new ArrayList();
private ArrayList value = new ArrayList();
public EntryItem[] creatEntryItems() {
// TODO Auto-generated method stub
EntryItem[] entryItems = new EntryItem[value.size()];
for (int i = 0; i < entryItems.length; i++) {
entryItems[i] = new EntryItem(new FieldID(Long.parseLong((this.id
.get(i)).toString())), new Value(new String(this.value.get(
i).toString())));
}
return entryItems;
}
public String getFormName() {
// TODO Auto-generated method stub
return FORMNAME;
}
public ArrayList getId() {
return id;
}
public void setId(ArrayList id) {
this.id = id;
}
public ArrayList getValue() {
return value;
}
public void setValue(ArrayList value) {
this.value = value;
}
}
****************************************************
public void ReadXLS() {
try {
String path2 = " ";
Workbook book = Workbook.getWorkbook(new File(path2));
// 获得第一个工作表对象
Sheet sheet = book.getSheet(0);
Cell cell1 = null;
for (int i = 1; i < sheet.getRows(); i++) {
ids = new ArrayList <Long> ();
values = new ArrayList <String> ();
for (int j = 0; j < sheet.getColumns(); j++) {
if (j == 0) {
ids.add(new Long(536870915));
} else {
ids.add(new Long(ids.get(ids.size() - 1) + 1));
}
cell1 = sheet.getCell(j, i);
String result = cell1.getContents();
values.add(result);
// System.out.println(ids.get(j));
// System.out.println(values.get(j));
}
out.setId(ids);
out.setValue(values);
ARSWriter.getArswriter().createEntry(out);
}
book.close();
} catch (Exception ex) {
ex.printStackTrace();
}