Set cell font color in Office

0

I export data from a report to a spreadsheet, depending on what the user has installed on the machine, for Excel or for BrOffice . My question is coloring a cell's source in BrOffice , I know I have to use the .CharColor := clBlue code for example.
But for the result I got, it is necessary to do some conversion so the resulting color is what I want. As in the example, instead of the text in the worksheet being in Blue , it remained in Red . This was just an example, but it happened in all cells and with other colors.

The question is: Is there a conversion table? Or how to outline this situation?

    
asked by anonymous 05.12.2016 / 20:26

1 answer

1

You really need to convert the color, try with this function:

function SwapColor(nColor: TColor): TColor;
var
  c1, c2, c3: byte;
begin
  c1 := (nColor and $000000FF);        // $..0000FF
  c2 := (nColor and $0000FF00) shr 8;  // $..00FF00
  c3 := (nColor and $00FF0000) shr 16; // $..FF0000

  result := (c1 shl 16) + (c2 shl 8) + c3;
end;

Take a look at these links:

link link

    
06.12.2016 / 11:50