Free Support Forum - aspose.com

Random values in XLS sheet?

Hi all,

I am writing a method to find the first cell with a value in all columns with content. The only problem is that when i loop through the columns, i often get a strange value from a field (at random) that is empty in the sheet? I have created multiple sheets to make sure that the sheet wasn't the problem.

I am using the latest hotfix Aspose.Excel dll (downloaded today), and developing in C#. The error is generated by the code below.

/*******CODE*******/

Aspose.Excel.Excel e = new Aspose.Excel.Excel();

e.Open("Test1.xls");

Aspose.Excel.Worksheet ws = e.Worksheets[0];

int maxRowLookup = 10; //Defines max number of rows to check in each column

for (int i = 0; i < ws.Cells.MaxColumn; i++)

{

bool ColumnHeaderFound = false;

for (int j = 0; j < maxRowLookup; j++)
{

if (ws.Cells.MaxRow < j || ws.Cells.MaxColumn < i)
break;

if (ColumnHeaderFound)
break;

if (ws.Cells[j, i].StringValue.Equals(string.Empty))
continue;

Console.WriteLine("Value: " + ws.Cells[j, i].StringValue.ToString());

ColumnHeaderFound = true;

}

}

/*******CODE END*******/

The XLS doc Test1:

A1

A2

A3

A4

A5

1

Campaign

2

Adwords

Target

3

KeyWords

4

Pallehat

Three test-outputs (building the app three times without changing anything):
-----OUTPUT 1-----
Value: Campaign
Value: UdoN1ben2G1D0YRg9
Value: KeyWords
Value: Pallehat
Value: Target

-----OUTPUT 2-----
Value: Campaign
Value: Adwords
Value: KeyWords
Value: AVu42vruS
Value: Target

-----OUTPUT 3-----
Value: Campaign
Value: Adwords
Value: m95d4aowftfUsZ
Value: Pallehat
Value: Target

Once in a while the output is as expected.

Am i doing something wrong?

Hope you can help.

Kind Regards,
Daniel Christensen
Traceworks.com

It would seem that this is actually a registration-issue. Sorry for the "bogus" post. Smile [:)]

/Daniel Christensen