我需要将一个变量传递给excel表格单元格。所以如何检查它是否返回空值。如果它具有空值,我需要在单元格而不是实际单元格中给出警告消息值。
// Element fetching
Element= driver.findElement(By.xpath(".//*[@id='Form1']/table[3]/tbody/tr[5]/td[3]/a")) ;
Email_ID = Element.getText();
FileInputStream fis = new FileInputStream("E:\\ExcelRead.xls");
Workbook wb = WorkbookFactory.create(fis);
Sheet sh = wb.getSheet("Input");
// File Handling
Row row = sh.createRow(ExcelRow);
Cell cell_3 = row.createCell(2);
cell_3.setCellValue(Email_ID);
//文件处理
FileOutputStream fos = new FileOutputStream("E:\\ExcelRead.xls");
wb.write(fos);
fos.close();
System.out.println("Excel File Written.");
答案 0 :(得分:1)
检查它是否为import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import com.esri.android.map.MapOptions;
import com.esri.android.map.MapView;
public class MainActivity extends Activity {
MapView mMapView = null;
Button b1;
MapOptions options = new MapOptions(MapOptions.MapType.TOPO, 49.591241, 17.255503, 16);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mMapView = (MapView) findViewById(R.id.map);
//mMapView.centerAndZoom(49.591241, 17.255503, 8);
btnClick();
mMapView.setMapOptions(options);
mMapView.setAllowRotationByPinch(true);
mMapView.setRotationAngle(25);
mMapView.enableWrapAround(true);
}
public void btnClick() {
b1 = (Button) findViewById(R.id.button);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
//mMapView.centerAndZoom(49.591241, 17.255503, 10);
mMapView.setMapOptions(options);
}
});
}
@Override
protected void onPause() {
super.onPause();
// Call MapView.pause to suspend map rendering while the activity is paused, which can save battery usage.
mMapView.pause();
}
@Override
protected void onResume() {
super.onResume();
// Call MapView.unpause to resume map rendering when the activity returns to the foreground.
mMapView.unpause();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
。这可以应用于任何对象。
null