0

I have a prob lem with excel and c#. When I set in the cell A1 a number like 123456789.

In all column A when the format is Number, next code is working without problems:

Workbook workbook = new Workbook(stream);
Worksheet worksheet = workbook.Worksheets[0];
var count = worksheet.Cells.Count; // count is 1

If I have column A design in format Text, converts that cell as '123456789 and then the code is wrong and returns me count=126 and when I query the cells all cells from 2 to 126 are empty or null and A1 as '1234567890

Why is happening that behavior?

Dave
  • 7,028
  • 11
  • 35
  • 58

1 Answers1

1

Try out something like

Excel.Range range;
range = worksheet.UsedRange;
var count = range.Count;

It's a problem othersalready got.

Source : Interop Excel UsedRange Rows Count incorrect

JBO
  • 270
  • 1
  • 6