Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Excel-Sheet mit Delphi verändern (https://www.delphipraxis.net/145816-excel-sheet-mit-delphi-veraendern.html)

Hermann85 11. Jan 2010 09:56

Re: Excel-Sheet mit Delphi verändern
 
Hallo,
Hab mal eine schöne Function im Netz gefunden, die das Problem behandelt:

Delphi-Quellcode:
// Hilfsfunktion
(*Wandelt Buchstaben-Zahlenkombination in eine ZellenReferenz für Excel um*)
function RefToCell(RowID, ColID : Integer): string;
var ACount, APos : Integer;
begin
  ACount := ColID div 26;
  APos  := ColID mod 26;
  if APos = 0 then
  begin
    ACount := ACount-1;
    APos  := 26;
  end;
  if ACount = 0 then
  begin
    Result := Chr(Ord('A') + ColID -1) + IntToStr(RowID);
  end;
  if ACount = 1 then
  begin
    Result := 'A' + Chr(Ord('A') + APos -1) + IntToStr(RowID);
  end;
  if ACount > 1 then
  begin
    Result := Chr(Ord('A') + ACount -1) + Chr(Ord('A') + APos - 1) + IntToStr(RowID);
  end;
end;

Gruß Hermann

PPaB 11. Jan 2010 10:51

Re: Excel-Sheet mit Delphi verändern
 
danke genau das wollte ich wissen :-D


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:04 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz