Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.429 Beiträge
 
Delphi 10.4 Sydney
 
#8

AW: Excel-Export, RefToCell, Spalten>26

  Alt 31. Jan 2012, 13:06
Oder getrennt:
Delphi-Quellcode:
function RefToColumn(ACol: Integer): string;
const
  Basis = Ord('A');
  Range = Ord('Z') - Basis + 1;
begin
  Result := '';
  repeat
    Dec(ACol, 1);
    Result := Char(Basis + ACol mod Range) + Result;
    ACol := ACol div Range;
  until (ACol = 0);
end;

function RefToCell(ACol, ARow: Integer): string;
begin
  Result := RefToColumn(ACol) + IntToStr(ARow);
end;
  Mit Zitat antworten Zitat