What's "-256" in Reader.Excel5._readBIFF8CellRangeAddressB?

Topics: Developer Forum
Dec 7, 2012 at 3:29 PM

I have a .XLS file which has some functions:
  "=SUM(D2:FN2)" in a cell C2,
  "=SUM(D3:FN3)" in a cell C3,
  "=SUM(D4:FN4)" in a cell C4, ...

I wrote a code to load this, modify some other cells, and write to .XLS.
But, an error "Formula Error: An unexpected error occured" is occured.

I tried to find what's wrong, I got something strange.
Cell C2 was "=SUM(D2:FN2)",
but cell C3 was "=SUM(D3:?3)". corrupted.
This caused the error.

Finally, I got the point.
the function "_readBIFF8CellRangeAddressB" In Reader/Excel5.php.

  $lcIndex = 0x00FF & self::_GetInt2d($subData, 6);
  $lcIndex = ($lcIndex <= 127) ? $lcIndex : $lcIndex - 256;
  $lc = PHPExcel_Cell::stringFromColumnIndex($baseCol + $lcIndex);

After the first line, $lcIndex becomes abount 160 from "FN".
Then, After the second line, $lcIndex becomes some negative value,
After the following third line, $lc becomes a corrupted character.

I tried to comment-out the second line,
Then it seems like the error was fixed...

But, is this all right?
Are there any possible side effects?

Sorry about my poor English.