Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 17:08

All times are UTC




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: 13 Mar 2023, 10:31 
Offline

Joined: 31 Jan 2013, 13:05
Posts: 17
blumache wrote:
About Excel XLSX export. It is possible to export the color of the ehlib grid cells? :roll:


Thanks for reply. I need a solution to export a grid with cells colored different, using different condition.

I try your ehlib demos examples to change the color of the font from different cells in red if the condition is true.

grid->Canvas->Font->Color = clRed;
grid->DefaultDrawColumnCell(Rect, DataCol, Column, State);

On the screen looks ok, no problem. But in XLSX export, i don't see red font form desktop, only blue font in all xlsx.

Some advice, please!


Top
 Profile  
 
PostPosted: 14 Mar 2023, 10:02 
Offline

Joined: 08 May 2014, 18:06
Posts: 660
Hello

Use TDBGridEh.OnGetColumnCellParams or TColumnEh.OnGetCellParams to set background or font color like this:

Code:
procedure TForm1.DBGridEh1GetCellParams(Sender: TObject; Column: TColumnEh;
  AFont: TFont; var Background: TColor; State: TGridDrawState);
begin
  if MemTableEh1.FieldByName('Continent').AsString = 'North America' then
  begin
    //Background := clMoneyGreen;
    AFont.Color := clRed;
  end;
end;


Grid uses OnGetCellParams event when draw cells and when export itself.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2, 3

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group