Trouble changing background color of row in codename one table - background-color

I have an app with a route datatable. The data is csv file. I like
highlight a row in a table in codenameone by changing the backgroundcolor of the row. How can I do this?
My Code is
String File_Name ="/route.csv";
//"/root/sdcard/Pictures/route.csv";
File f= new File (File_Name);
if (f.exists())
InputStream is = Display.getInstance().getResourceAsStream(getClass(), File_Name );
CSVParser parser = new CSVParser();
String[][] data = parser.parse(is);
String[] columnNames = new String[data[0].length];
l = data.length;
for(int iter= 0 ; iter < columnNames.length ; iter++) {
if (iter== 0) {
columnNames[iter] = "Naam";
}
else if (iter== 1) {
columnNames[iter] = "Latitude";
}
else if (iter== 2) {
columnNames[iter] = "Longitude";
}
}
tm = new DefaultTableModel(columnNames, data);
}
}
catch (IOException err){
err.printStackTrace();
}
further in the code
Table tm2 = new Table(tm)
EDIT solved myself
I edited the table definiton tm2 and added the variable A. A is the row which is highlighted
Table tm2 = new Table(tm) {
#Override
public Component createCell(Object value, int row, int column, boolean editable) { // (1)
Component cell;
cell = super.createCell(value, row, column, editable);
if(row > a-1 && row < a+1) { // (5)
// pinstripe effect
cell.getAllStyles().setBgColor(0xe2f30d);
cell.getAllStyles().setBgTransparency(255);
}
return cell;
}

Changing the cell color is discussed in the developer guide as you probably discovered the pinstripe sample from there.
The full sample from the developer guide is this:
Table table = new Table(model) {
#Override
protected Component createCell(Object value, int row, int column, boolean editable) {
Component cell;
if(row == 1 && column == 1) {
Picker p = new Picker();
p.setType(Display.PICKER_TYPE_STRINGS);
p.setStrings("Row B can now stretch", "This is a good value", "So Is This", "Better than text field");
p.setSelectedString((String)value);
p.setUIID("TableCell");
p.addActionListener((e) -> getModel().setValueAt(row, column, p.getSelectedString()));
cell = p;
} else {
cell = super.createCell(value, row, column, editable);
}
if(row > -1 && row % 2 == 0) {
// pinstripe effect
cell.getAllStyles().setBgColor(0xeeeeee);
cell.getAllStyles().setBgTransparency(255);
}
return cell;
}
#Override
protected TableLayout.Constraint createCellConstraint(Object value, int row, int column) {
TableLayout.Constraint con = super.createCellConstraint(value, row, column);
if(row == 1 && column == 1) {
con.setHorizontalSpan(2);
}
con.setWidthPercentage(33);
return con;
}
};

Related

Apache POI : Copy data to Particular sheet at particular cell with Merged Columns in Source Sheet

Problem
How to add some part of data from source excel sheet to the destination excel sheet using Apache POI(XSSF Format)?Excel sheet contains merged columns.
Requirement:
Requirement is not only to copy the row but also to put the data into desired Excel cell(desired column) of the destination sheet.
Note
-Copying row to desired row location in destination excel sheet is achievable. Problem is to first merge the cell as per source sheet in destination sheet and then put data into desired merged excel cell.
- Merged Columns could vary in a row.
Here is the source code, half referred and half written.
public static void copyNodeFrmtSrcToDest(XSSFSheet srcSheet, XSSFSheet destSheet, XSSFRow srcRowStart,XSSFRow srcRowEnd
,XSSFRow destRowStart, int destCellStart, Map<Integer, XSSFCellStyle> styleMap){
/*Check if there is only one row to be pasted*/
int noOfRows = srcRowEnd.getRowNum() - srcRowStart.getRowNum();
/*Check if there is only one row to be pasted*/
if(noOfRows == 0)
{
/*Copy a single row*/
copyRow(srcSheet,destSheet,srcRowStart,destRowStart,destCellStart,styleMap);
return;
}
for (int i = 0;i <= noOfRows ;i++)//For every row
{
/*Get rows from source sheet and increment it*/
XSSFRow srcIntermediateRow = srcSheet.getRow(srcRowStart.getRowNum() + i);
if(destRowStart == null)
{
try {
throw new RowNotFoundError("Row has not been found in the sheet.Kindly create a row.");
} catch (RowNotFoundError e) {
e.printStackTrace();
System.out.println(e.toString());
}
}
if(i!=0)//Assuming destRowStart has been created by user of the API
{
/*Create a new row*/
destRowStart = destSheet.createRow(destRowStart.getRowNum()+1);
}
copyRow(srcSheet,destSheet,srcIntermediateRow,destRowStart,destCellStart,styleMap);
}
}
public static void copyRow(XSSFSheet srcSheet, XSSFSheet destSheet, XSSFRow srcRow, XSSFRow destRow, int destCellStart,
Map<Integer, XSSFCellStyle> styleMap) {
int count = 1;
Set<CellRangeAddress> mergedRegions = new HashSet<CellRangeAddress>();
CellRangeAddress previousMergedRegion =null;
destRow.setHeight(srcRow.getHeight());
for (int j = srcRow.getFirstCellNum(); j <= srcRow.getLastCellNum(); j++) {
int mergedDiff;
XSSFCell oldCell = srcRow.getCell(j);
XSSFCell newCell;
if(j == srcRow.getFirstCellNum()){
newCell = destRow.getCell(destCellStart);}
else
{
newCell = destRow.getCell(destCellStart + count);
}
if (oldCell != null) {
if (newCell == null) {
if(j == srcRow.getFirstCellNum()){
newCell = destRow.createCell(destCellStart);//Keeping the new cell as the first one.
copyCell(oldCell, newCell, styleMap);
}
else{
newCell = destRow.createCell(destCellStart + count);
count = count + 1;
copyCell(oldCell, newCell, styleMap);}
}
CellRangeAddress mergedRegion = getMergedRegion(srcSheet, srcRow.getRowNum(),oldCell.getColumnIndex());
if(previousMergedRegion != null && mergedRegion != null)
{
mergedDiff = mergedRegion.getLastColumn() - mergedRegion.getFirstColumn();
if(!previousMergedRegion.equals(mergedRegion))
{
destCellStart = destCellStart + mergedDiff + 1;
count = 1;
}
}
if (mergedRegion != null) {
previousMergedRegion = mergedRegion.copy();
mergedDiff = mergedRegion.getLastColumn() - mergedRegion.getFirstColumn();
CellRangeAddress newMergedRegion = new CellRangeAddress(destRow.getRowNum(),destRow.getRowNum()
,destCellStart,destCellStart + mergedDiff);
if (isNewMergedRegion(newMergedRegion, mergedRegions))
{
mergedRegions.add(newMergedRegion);
destSheet.addMergedRegion(newMergedRegion);
}
}
}
}
}
public static void copyCell(XSSFCell oldCell, XSSFCell newCell, Map<Integer, XSSFCellStyle> styleMap) {
if(styleMap != null) {
if(oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()){
newCell.setCellStyle(oldCell.getCellStyle());
} else{
int stHashCode = oldCell.getCellStyle().hashCode();
XSSFCellStyle newCellStyle = styleMap.get(stHashCode);
if(newCellStyle == null){
newCellStyle = newCell.getSheet().getWorkbook().createCellStyle();
newCellStyle.cloneStyleFrom(oldCell.getCellStyle());
styleMap.put(stHashCode, newCellStyle);
}
newCell.setCellStyle(newCellStyle);
}
}
switch(oldCell.getCellTypeEnum()) {
case STRING:
newCell.setCellValue(oldCell.getStringCellValue());
break;
case NUMERIC:
newCell.setCellValue(oldCell.getNumericCellValue());
break;
case BLANK:
newCell.setCellValue(oldCell.getStringCellValue());
break;
case BOOLEAN:
newCell.setCellValue(oldCell.getBooleanCellValue());
break;
case ERROR:
newCell.setCellErrorValue(oldCell.getErrorCellValue());
break;
case FORMULA:
newCell.setCellFormula(oldCell.getCellFormula());
break;
default:
break;
}
}
public static CellRangeAddress getMergedRegion(XSSFSheet sheet, int rowNum, int cellNum) {
for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
CellRangeAddress merged = sheet.getMergedRegion(i);
if (merged.isInRange(rowNum, cellNum)) {
return merged;
}
}
return null;
}
private static boolean isNewMergedRegion(CellRangeAddress newMergedRegion, Set<CellRangeAddress> mergedRegions)
{
if(mergedRegions.isEmpty())
{
return true;
}
return !mergedRegions.contains(newMergedRegion);
}
}
It is working fine for some testcases but not for all.

Work at Primefaces Extensions Custom Exporter

I have some dataTables on the web page and I'd like to export all to an excel file, like the web page images:
I'd like to export the footer like showed in page. I try to use rendered and exportable,both with boolean attribute, but no way.
What might be the reason of such behaviour?
I use the customExport, doing the steps on the link Steps to Custom Exporter
When I debug the code, I see the mode to create the footers on the document exporter, which it's not consist the tag exportable (isExportable()). Into the method "tableColumnGroup(Sheet sheet, DataTable table, String facetType){", of the class ExcelCustomExporter, I need to add an if: "if(column.isExportable()){" to create a cell and add value to this, and another if, the same way, to increment the variable using in the method for(i++); only the if is true I create the cell, add value and increment the variable i.
See below the code modified:
protected void tableColumnGroup(Sheet sheet, DataTable table, String facetType) {
ColumnGroup cg = table.getColumnGroup(facetType);
List<UIComponent> headerComponentList = null;
if (cg != null) {
headerComponentList = cg.getChildren();
}
if (headerComponentList != null) {
for (UIComponent component : headerComponentList) {
if (component instanceof org.primefaces.component.row.Row) {
org.primefaces.component.row.Row row = (org.primefaces.component.row.Row) component;
int sheetRowIndex = sheet.getLastRowNum() + 1;
Row xlRow = sheet.createRow(sheetRowIndex);
int i = 0;
for (UIComponent rowComponent : row.getChildren()) {
UIColumn column = (UIColumn) rowComponent;
String value = null;
if (facetType.equalsIgnoreCase("header")) {
value = column.getHeaderText();
} else {
value = column.getFooterText();
}
int rowSpan = column.getRowspan();
int colSpan = column.getColspan();
Cell cell = xlRow.getCell(i);
if (rowSpan > 1 || colSpan > 1) {
if (rowSpan > 1) {
cell = xlRow.createCell((short) i);
Boolean rowSpanFlag = false;
for (int j = 0; j < sheet.getNumMergedRegions(); j++) {
CellRangeAddress merged = sheet.getMergedRegion(j);
if (merged.isInRange(sheetRowIndex, i)) {
rowSpanFlag = true;
}
}
if (!rowSpanFlag) {
cell.setCellValue(value);
cell.setCellStyle(facetStyle);
sheet.addMergedRegion(new CellRangeAddress(
sheetRowIndex, //first row (0-based)
sheetRowIndex + (rowSpan - 1), //last row (0-based)
i, //first column (0-based)
i //last column (0-based)
));
}
}
if (colSpan > 1) {
cell = xlRow.createCell((short) i);
for (int j = 0; j < sheet.getNumMergedRegions(); j++) {
CellRangeAddress merged = sheet.getMergedRegion(j);
if (merged.isInRange(sheetRowIndex, i)) {
cell = xlRow.createCell((short) ++i);
}
}
cell.setCellValue(value);
cell.setCellStyle(facetStyle);
sheet.addMergedRegion(new CellRangeAddress(
sheetRowIndex, //first row (0-based)
sheetRowIndex, //last row (0-based)
i, //first column (0-based)
i + (colSpan - 1) //last column (0-based)
));
i = i + colSpan - 1;
}
} else {
//TODO TRATAR E VERIRIFICAR SE O VALUE PODE SER EXIBIDO
if (column.isExportable()) {
cell = xlRow.createCell((short) i);
for (int j = 0; j < sheet.getNumMergedRegions(); j++) {
CellRangeAddress merged = sheet.getMergedRegion(j);
if (merged.isInRange(sheetRowIndex, i)) {
cell = xlRow.createCell((short) ++i);
}
}
cell.setCellValue(value);
cell.setCellStyle(facetStyle);
}
}
if (column.isExportable()) {
i++;
}
}
}
}
}
Screnshoot, but the JAN to MAY:

Selenium Webdriver How to select records from table by fetching Excel Input

im struggeling for below scenario.
Application displayed records of 100 suppliers in one table have three columns namely as ID,Company name and Subscription name.
i want to take input from my excel sheet say company name"xyz" and using that input i have to click on subscription name details link so application will navigates me next page.
Sample code i have created as below:
`public static void main(String[] args) throws BiffException, IOException, Exception {
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
//Workbook location
Workbook wBook = Workbook.getWorkbook(new File("C:\Users\amit.bhagwat\Documents\TestData\SampleData.xls"));
//get sheet
jxl.Sheet Sheet = wBook.getSheet(0);
//loop
for(int i=1; i<Sheet.getRows(); i++)
{
driver.get("http://206.132.42.243/Web");
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.xpath("//input[#id='UserName']")).sendKeys(Sheet.getCell(0, i).getContents());
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.xpath("//input[#id='Password']")).sendKeys(Sheet.getCell(1, i).getContents());
driver.findElement(By.xpath("//input[#id='Password']")).sendKeys(Sheet.getCell(1, i).getContents());
Thread.sleep(40);
driver.findElement(By.xpath("//input[#name='Login']")).click();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.xpath("//a[contains(text(),'Task')]")).click();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.xpath("//a[contains(text(),'Data Checking')]")).click();
jxl.Sheet Sheet2 = wBook.getSheet(0);
WebElement kancheck = driver.findElement(By.name("Grant & Brown"));
kancheck.click();
System.out.println(kancheck.isSelected());
driver.findElement(By.xpath("//a[contains(text(),'Data Checking')]")).sendKeys(Sheet2.getCell(1, i).getContents());
Thread.sleep(40);` enter code here
As far as I could understand, you are trying to read the file from a remote location and then read the information from it. It would be a good practice if you can use Apache POI library to read contents at run-time.
In my project, I read all the contents from an excel sheet usingApache POI library to set the values of my variables. Here is a code snippet on how i achieved it. Hopefully this will guide you to a proper solution. :)
public void readExcelDoc() throws FileNotFoundException, IOException
{
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("excelDoc//scripts.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = null;
HSSFCell cell = null;
int rows = 0; // No of rows
// rows = sheet.getPhysicalNumberOfRows();
rows = sheet.getLastRowNum();
int cols = 2; // No of columns
int tmp = 0;
// This trick ensures that we get the data properly even if it doesn't start from first few rows
for(int i = 0; i < 10 || i < rows; i++) {
row = sheet.getRow(i);
if(row != null) {
tmp = sheet.getRow(i).getPhysicalNumberOfCells();
if(tmp > cols) cols = tmp;
}
}
int testRowNo = 0;
String rowName = "Test Name";
String columnValue = " ";
//Iterate through Row and columns here. Excluding 1st row for title names
for(int r = 1; r <= rows; r++) {
row = sheet.getRow(r);
if(row != null) {
//Browse through columns using c
for(int c = 0; c < cols; c++) {
if(c==0) //Only taking data from Cell 0; Ignoring any other inputs
{
cell = row.getCell((short)c);
try
{
if(cell.getStringCellValue().contains(rowName))
{
testRowNo =row.getRowNum();
}
if(testRowNo > 0 )
{
if(cell.getColumnIndex() == 0 && row.getRowNum() > testRowNo && cell.getStringCellValue().length() !=0)
{
try{
String cellValue = cell.getStringCellValue().toLowerCase();
//System.out.println(cellValue);
scriptType.add(cellValue);
}
catch(IllegalStateException e)
{
e.printStackTrace();
scriptType.add(cell.getStringCellValue());
}
}
}
}
catch(NullPointerException e)
{
}
}
if(c==1)
{
cell = row.getCell((short)c); //this sets the column number
if(testRowNo == 0)
{
try{
String cellValue = cell.getStringCellValue();
//System.out.println(cellValue);
columnValue = cellValue;
}
catch(IllegalStateException e)
{
String cellValue = cell.toString();
columnValue = cellValue;
}
catch(NullPointerException e)
{
String cellValue = nodata;
columnValue = cellValue;
}
}
}
if(c==2)
{
cell = row.getCell((short)c); //this sets the column number
if(testRowNo == 0)
{
try{
String cellValue = cell.getStringCellValue();
//System.out.println(cellValue);
inputParameters.put(cellValue, columnValue);
}
catch(IllegalStateException e)
{
String cellValue = cell.toString();
inputParameters.put(cellValue, columnValue);
}
catch(NullPointerException e)
{
String cellValue = nodata;
inputParameters.put(cellValue, columnValue);
}
}
}
}
}
}
System.out.println("---------The parameters set from excel are : ---------");
#SuppressWarnings("rawtypes")
Iterator iterator = inputParameters.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next().toString();
String value = inputParameters.get(key).toString();
System.out.println(key + " : " + value);
}
}

Changing colors in xamDataGrid cells

I have xamDataGrid bound to DataTable where first column contains reference values. Coloring of all other columns depends on whether the value in cells is or isn't equal to the value of reference column. The logic uses converter.
What I want to achieve is when I move another column to the 1st position, it will become the reference column and the colors in all other columns should change.
I'm listening to FieldPositionChanged event and invalidating the grid layout, but it does not work:
grid.UpdateLayout();
grid.InvalidateVisual();
The breakpoint in converter is hit but not for all records (only 2 or 3).
If you set the CellValuePresenterStyle when the fields move they should update correctly. The following logic will do this:
void XamDataGrid1_FieldPositionChanged(object sender, Infragistics.Windows.DataPresenter.Events.FieldPositionChangedEventArgs e)
{
FieldLayout layout = e.Field.Owner;
Field first = null;
foreach (Field f in layout.Fields)
{
if (f.ActualPosition.Column == 0)
first = f;
}
if (first != null)
{
SetCellValuePresenterStyle(e.Field.Owner, first);
}
}
void XamDataGrid1_FieldLayoutInitialized(object sender, Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializedEventArgs e)
{
SetCellValuePresenterStyle(e.FieldLayout, e.FieldLayout.Fields[0]);
}
void SetCellValuePresenterStyle(FieldLayout layout, Field sourceField)
{
Binding sourceValueBinding = new Binding("DataItem[" + sourceField.Name + "]");
foreach (Field f in layout.Fields)
{
if (f != sourceField)
{
Style cellValuePresenterStyle = new Style(typeof(CellValuePresenter));
Binding compareValueBinding = new Binding("DataItem[" + f.Name + "]");
MultiBinding styleBinding = new MultiBinding();
styleBinding.Bindings.Add(sourceValueBinding);
styleBinding.Bindings.Add(compareValueBinding);
styleBinding.Converter = new EqualMultiValueConverter();
DataTrigger trigger = new DataTrigger();
trigger.Value = true;
trigger.Binding = styleBinding;
cellValuePresenterStyle.Triggers.Add(trigger);
Setter backgroundSetter = new Setter(Control.BackgroundProperty, Brushes.Green);
trigger.Setters.Add(backgroundSetter);
f.Settings.CellValuePresenterStyle = cellValuePresenterStyle;
}
else
{
f.Settings.CellValuePresenterStyle = null;
}
}
}

How to transpose sheet with POI SS/XSSF?

I am using POI XSSF API and I would like to transpose a sheet.
how can I do that?
Thanks.
Transpose, as in swap A2 with B1 and A3 with C1 (so columns become rows)?
If so, there's nothing built in, so you'd need to do a little bit of coding yourself. You'd likely want to grab a pair of cells, save the contents of one (value and style), copy the second to the first, then overwrite the second.
See the quick guide if you're not sure on all the reading/writing parts.
I was looking for the same answer and had to code it myself. I've attached my solution which is quite simple:
Determine the number of rows
Determine the maximal number of columns used
Iterator over every row, and every column
Save the Cell from that row/column into a simple list as a 'CellModel' type
Once done, iterate over all CellModels
Switch column and row index and save the CellModel into the sheet
The code I've used is:
public static void transpose(Workbook wb, int sheetNum, boolean replaceOriginalSheet) {
Sheet sheet = wb.getSheetAt(sheetNum);
Pair<Integer, Integer> lastRowColumn = getLastRowAndLastColumn(sheet);
int lastRow = lastRowColumn.getFirst();
int lastColumn = lastRowColumn.getSecond();
LOG.debug("Sheet {} has {} rows and {} columns, transposing ...", new Object[] {sheet.getSheetName(), 1+lastRow, lastColumn});
List<CellModel> allCells = new ArrayList<CellModel>();
for (int rowNum = 0; rowNum <= lastRow; rowNum++) {
Row row = sheet.getRow(rowNum);
if (row == null) {
continue;
}
for (int columnNum = 0; columnNum < lastColumn; columnNum++) {
Cell cell = row.getCell(columnNum);
allCells.add(new CellModel(cell));
}
}
LOG.debug("Read {} cells ... transposing them", allCells.size());
Sheet tSheet = wb.createSheet(sheet.getSheetName() + "_transposed");
for (CellModel cm : allCells) {
if (cm.isBlank()) {
continue;
}
int tRow = cm.getColNum();
int tColumn = cm.getRowNum();
Row row = tSheet.getRow(tRow);
if (row == null) {
row = tSheet.createRow(tRow);
}
Cell cell = row.createCell(tColumn);
cm.insertInto(cell);
}
lastRowColumn = getLastRowAndLastColumn(sheet);
lastRow = lastRowColumn.getFirst();
lastColumn = lastRowColumn.getSecond();
LOG.debug("Transposing done. {} now has {} rows and {} columns.", new Object[] {tSheet.getSheetName(), 1+lastRow, lastColumn});
if (replaceOriginalSheet) {
int pos = wb.getSheetIndex(sheet);
wb.removeSheetAt(pos);
wb.setSheetOrder(tSheet.getSheetName(), pos);
}
}
private static Pair<Integer, Integer> getLastRowAndLastColumn(Sheet sheet) {
int lastRow = sheet.getLastRowNum();
int lastColumn = 0;
for (Row row : sheet) {
if (lastColumn < row.getLastCellNum()) {
lastColumn = row.getLastCellNum();
}
}
return new Pair<Integer, Integer>(lastRow, lastColumn);
}
Whereby the CellModel is a wrapper which holds the data a Cell contained (you can add more attributes if you like e.g., comments, ...):
static class CellModel {
private int rowNum = -1;
private int colNum = -1;
private CellStyle cellStyle;
private int cellType = -1;
private Object cellValue;
public CellModel(Cell cell) {
if (cell != null) {
this.rowNum = cell.getRowIndex();
this.colNum = cell.getColumnIndex();
this.cellStyle = cell.getCellStyle();
this.cellType = cell.getCellType();
switch (this.cellType) {
case Cell.CELL_TYPE_BLANK:
break;
case Cell.CELL_TYPE_BOOLEAN:
cellValue = cell.getBooleanCellValue();
break;
case Cell.CELL_TYPE_ERROR:
cellValue = cell.getErrorCellValue();
break;
case Cell.CELL_TYPE_FORMULA:
cellValue = cell.getCellFormula();
break;
case Cell.CELL_TYPE_NUMERIC:
cellValue = cell.getNumericCellValue();
break;
case Cell.CELL_TYPE_STRING:
cellValue = cell.getRichStringCellValue();
break;
}
}
}
public boolean isBlank() {
return this.cellType == -1 && this.rowNum == -1 && this.colNum == -1;
}
public void insertInto(Cell cell) {
if (isBlank()) {
return;
}
cell.setCellStyle(this.cellStyle);
cell.setCellType(this.cellType);
switch (this.cellType) {
case Cell.CELL_TYPE_BLANK:
break;
case Cell.CELL_TYPE_BOOLEAN:
cell.setCellValue((boolean) this.cellValue);
break;
case Cell.CELL_TYPE_ERROR:
cell.setCellErrorValue((byte) this.cellValue);
break;
case Cell.CELL_TYPE_FORMULA:
cell.setCellFormula((String) this.cellValue);
break;
case Cell.CELL_TYPE_NUMERIC:
cell.setCellValue((double) this.cellValue);
break;
case Cell.CELL_TYPE_STRING:
cell.setCellValue((RichTextString) this.cellValue);
break;
}
}
public CellStyle getCellStyle() {
return cellStyle;
}
public int getCellType() {
return cellType;
}
public Object getCellValue() {
return cellValue;
}
public int getRowNum() {
return rowNum;
}
public int getColNum() {
return colNum;
}
}

Resources