Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#44: How can I convert a color value into in HTML format?

If you want to create a HTML-file, you must define a tag for font color or backgroubd color. But you can't insert a Delphi's TColor value - you must convert the color into RGB-format. In own SMExport suite I use the next
function:

function GetHTMLColor(cl: TColor; IsBackColor: Boolean): string;
var rgbColor: TColorRef;
begin
  if IsBackColor then
    Result := 'bg'
  else
    Result := '';
  rgbColor := ColorToRGB(cl);
  Result := Result + 'color="#' + Format('%.2x%.2x%.2x',
                                            [GetRValue(rgbColor),
                                             GetGValue(rgbColor),
                                             GetBValue(rgbColor)]) + '"';
end;


Published: November 22, 1999

See also
 
Paradox to MS Access converter
SMExport suite
SMImport suite
ABA Picture Convert
SMDBGrid
ABA Document Convert
Viewer for TNEF-files (winmail.dat)
ABA Database Convert
DBExport tools
SMReport
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2024, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising