Eksport do excela z ListView i dziwne ograniczenie

0

Witam! Wiem ze temat excela juz byl wiele razy na forum ale nie potrafie sobie poradzic z nastepujacym problemem.
Mam taka procedure eksportu:

procedure TCodeListForm.ExportToExcel(List: TListView; FileName: String; Start, Stop: Integer);
var  Sheet, Ash: OleVariant;
           i, j: Byte;
       exptitle: string;

begin
exptitle := FormatDateTime('yyyy.mm.dd, hh-mm', Now);
Sheet    := CreateOleObject('Excel.Sheet');
Ash      := Sheet.ActiveSheet;
Ash.Cells[1, 1] := 'Nazwa';
Ash.Cells[1, 2] := 'Producent';
Ash.Cells[1, 3] := 'Kod';
Ash.Cells[1, 4] := 'Termin';
Ash.Cells[1, 1].Interior.ColorIndex:=15;       Ash.Cells[1, 1].Interior.PatternColorIndex:=15;
Ash.Cells[1, 2].Interior.ColorIndex:=15;       Ash.Cells[1, 2].Interior.PatternColorIndex:=15;
Ash.Cells[1, 3].Interior.ColorIndex:=15;       Ash.Cells[1, 3].Interior.PatternColorIndex:=15;
Ash.Cells[1, 4].Interior.ColorIndex:=15;       Ash.Cells[1, 4].Interior.PatternColorIndex:=15;
j        := 1;
For i:=Start to Stop-1 do begin
Inc(j);
Ash.Cells[j, 1] := List.Items[i].Caption;
Ash.Cells[j, 2] := List.Items[i].Subitems[0];
Ash.Cells[j, 3] := List.Items[i].Subitems[4];
Ash.Cells[j, 4] := List.Items[i].Subitems[2];
end;
Ash.Columns[1].ColumnWidth := 30;
Ash.Columns[2].ColumnWidth := 20;
Ash.Columns[3].ColumnWidth := 30;
Ash.Columns[4].ColumnWidth := 20;
Sheet.WorkSheets[1].Name   := exptitle;
Sheet.Application.Visible  := False;
Sheet.SaveAs(FileName);
Sheet.Application.Quit;
end;

wszystko jest pięknie ale jeśli chcę eksportować ponad 250 rekordów to dupa bo plik jest twozony ale jest pusty. Do 250 wszystko jest ok. Czy ktos wie jak mozna to obejsc bo ja prawie zawsze potrzebuje eksportować wiecej niz 250 rekordów. Proszę o jakieś wskazówki

0

witam,

czy czasami nie zachodzi przekroczenie zakresu zmiennej i ? :)

0

dzieki za pomoc faktycznie zamiast byte trzeba dac integer i jest wszystko ok

1 użytkowników online, w tym zalogowanych: 0, gości: 1