Sasha95 / excellibrary

Automatically exported from code.google.com/p/excellibrary
0 stars 0 forks source link

Object Reference not Set (Cell.cs) #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
  Hi!

 In my code i used: 
  planilha.Cells[i + 4, 0] = new Cell(intervalos[i].dtTime);
  planilha.Cells[i + 4, 0].DateTimeValue = intervalos[i].dtTime;
  planilha.Cells[i + 4, 0].FormatString = "h:mm:ss";

I expected to set a DateTime to the property DateTimeValue, to in next line
format to a time. 

Error: SharedResource was NULL !
Where: Cell.cs 
Line: 96   
Checkout SVN: 12/02/2009 - At: 10:00 AM
 part of code:
      set
            {
                double days = SharedResource.EncodeDateTime(value);
                this._value = days;
            }

Original issue reported on code.google.com by gui.lo...@gmail.com on 12 Feb 2009 at 12:48

GoogleCodeExporter commented 9 years ago
New test case is created at r21.

I think we don't need the set accessor for Cell.DateTimeValue. The DateTime 
value can
be set directly when calling the Cell constructor with current codebase. When 
saving
the workbook, all cells are encoded again using WorkSheetEncoder.EncodeCell() 
anyway.

However, calling other properties such Cell.Format and Cell.BackColor also cause
NullReferenceException be thrown for newly created worksheeet.

Original comment by jetcat on 13 Feb 2009 at 12:26

GoogleCodeExporter commented 9 years ago
Fixed by r24.

Original comment by China.LiuJunFeng on 13 Feb 2009 at 6:57