xvExcel2007: 'Cell is missing/is of wrong type' exception

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
maseline_98
Posts: 10
Joined: Fri Jan 20, 2012 11:49 pm

xvExcel2007: 'Cell is missing/is of wrong type' exception

Post by maseline_98 »

I get a 'Cell is missing/is of wrong type' exception for any formula I try to use while using xvExcel2007. I'm using delphi 2007. Any reason for this? We have been using the xvExcel97 version with no issue, but it appears some of our clients want the most recent file extension(.xlsx). I thought maybe the formulas might be different, but I'm not sure...Any insight would be most appreciated.

Code: Select all

procedure TForm1.RzButton1Click(Sender: TObject);
begin
  xls.filename := 'c:\temp\test.xlsx';
  xls.version := xvExcel2007;
  xls.Sheet[0].AsFloat[0, 0] := 1;
  xls.Sheet[0].AsFloat[0, 1] := 2;
  xls.Sheet[0].AsFormula[0, 2] := 'sum(A1+A2)';
//  xls.Sheet[0].AsFormula[0, 2] := 'sum(,A1,A2)'; --also tried this.
//  xls.Sheet[0].AsFormula[0, 2] := 'A1+A2'; --also tried this.
  xls.Write;
end;
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: xvExcel2007: 'Cell is missing/is of wrong type' exception

Post by larsa »

Hello

I can't reproduce this. The error message "Cell is missing/is of wrong type" make no sense as this only occure when you read a cell value, like AsBoolean and the cell is not a boolean cell.
Lars Arvidsson, Axolot Data
maseline_98
Posts: 10
Joined: Fri Jan 20, 2012 11:49 pm

Re: xvExcel2007: 'Cell is missing/is of wrong type' exception

Post by maseline_98 »

My version is:
4.00.05

The only thing I can think of is maybe my version is somehow corrupted or I have an older version. I also had another programmer(he has the same version as I) try to compile and run it and he is getting the same result.
maseline_98
Posts: 10
Joined: Fri Jan 20, 2012 11:49 pm

Re: xvExcel2007: 'Cell is missing/is of wrong type' exception

Post by maseline_98 »

Here is my call stack:

Code: Select all

FormulaHandler4.TFormulaHandler.GetAsFormulaEx12(???,0,2)
SheetData4.TSheet.GetAsFormulaEx12(???,???)
XLSWriteXML4.WriteFormula
XLSWriteXML4.WriteSheet(0)
XLSWriteXML4.TXLSWrite2007XML.WriteSheets($20A57F0)
XLSWriteXML4.TXLSWrite2007XML.SaveToStream($20A5450,???)
XLSReadWriteII4.TXLSReadWriteII4.WriteToStreamXML($20A5450)
XLSReadWriteII4.TXLSReadWriteII4.Write
Unit1.TForm1.RzButton1Click(???)
Post Reply