Home     Products      Support      Corporate     Sign In 

Support Knowledge Base, Article 1222

Product
ExcelWriter
Version
6.x
Title
How to check if a cell is empty
Problem
Using the ExcelApplication class/object, how can I check if a cell is empty?
Solution

A cell can contain a value and/or a formula. To check if a cell is empty use the Cell.Value and Cell.Formula properties to look for the following conditions:

Language Cell.Value Cell.Formula
C# null (empty string)
VB.NET Nothing Nothing
Java null (empty string)
ASP/COM * (empty string) (empty string)

* Includes SAExcelApplicationDotNet wrapper class used in ASP.NET

Examples

The following examples demonstrate how to check if a cell is empty:

[C#] [VB.NET] [Java] [COM/ASP]  
//--- myCell is a Cell object

if (myCell.Value == null && myCell.Formula == "")
{
    //--- Cell is empty
}

Related Links
OfficeWriter Home Page
OfficeWriter Enterprise Edition
Latest OfficeWriter News
OfficeWriter: Programmatic Runtime Control

Created : 8/28/2006 11:58:32 AM (last modified : 11/6/2006 11:54:25 AM)

Rate this article!

 
Comments



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.

Site Map     |     Privacy Policy     |     Contact Us