Blank Table column

Is there any way to detect whether a table column is blank or contain only spaces nothing else.


If I am doing cell.getText() and testing with string.isEmpty() method it always fails even the cell doesn’t contain any text.

Is there any other way?

Hi Abhradeep,


Thanks for your inquiry. I think, you can get the text representation of a particular cell by using Cells.ToString(SaveFormat.Text).Trim() to determine it. I hope, this helps.

Best regards,

Yes trim works but not sure why the getText() is putting additional /r /n characters…

Hi Abhradeep,


Thanks for your inquiry.

The CompositeNode.GetText method gets the text of this node and of all its children. The returned string includes all control and special characters as described in ControlChar class. The following code shows the difference between calling the GetText and ToString methods on a node.
Document doc = new Document();

// Enter a dummy field into the document.
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertField(“MERGEFIELD Field”);

// GetText will retrieve all field codes and special characters
System.out.println("GetText() Result: " + doc.getText());

// ToString will export the node to the specified format. When converted to text it will not retrieve fields code
// or special characters, but will still contain some natural formatting characters such as paragraph markers etc.
// This is the same as “viewing” the document as if it was opened in a text editor.
System.out.println("ToString() Result: " + doc.toString(SaveFormat.TEXT));

I hope, this helps.

Best regards,