Board index » delphi » Delphi5 --> Delphi2006
Brian Ellul
![]() Delphi Developer |
Delphi5 --> Delphi20062007-06-15 10:30:48 PM delphi79 I'm migrating an application from Delphi5 to Delphi2006 and I've encountered, a section of code where I am exporting a result set to Excel. I've pasted a piece of my code. Var WorkBk: _WorkBook; WorkSheet: _WorkSheet; I, J, K, R, C, x : Integer; TabGrid: Variant; TotalList: OleVariant; UpperBound: Integer; lNumberFormat: String; xIcid : Variant; Begin Try StatusBar.Panels[0].Text:= 'Exporting to Excel...'; ProgressBar.Max:= StringGrid.RowCount; UpperBound:= StringGrid.ColCount - 2; TotalList:= VarArrayCreate([0,UpperBound - 1], varVariant); For x:= 1 To UpperBound Do TotalList[x - 1]:= 2 + x; {Sending data to Excel...} R:= StringGrid.RowCount; C:= StringGrid.ColCount; TabGrid := VarArrayCreate([0,(R - 1),0,(C - 1)],varVariant); I:= 0; Repeat For J := 0 to (C - 1) do TabGrid[I,J]:= StringGrid.Cells[J,I]; Inc(I,1); ProgressBar.Position:= I; Until I>(R - 1); Try XLApp.Connect; XLApp.WorkBooks.Add(xlWBatWorkSheet,0); WorkBk := XLApp.WorkBooks.Item[1]; WorkSheet := WorkBk.WorkSheets.Get_Item(1) as _WorkSheet; Worksheet.Range['A1',Worksheet.Cells.Item[R,C]].Value := TabGrid; Worksheet.Range['A1',Worksheet.Cells.Item[R,C]].Value := TabGrid This line used to work fine in Delphi 5, but now it is not compiling; E2029 '[' expected but ':=' found. Regards Brian |