From c4c1eeece906451d005f9bab00e3be107580066e Mon Sep 17 00:00:00 2001 From: alexs75 Date: Mon, 8 Jun 2015 12:08:21 +0000 Subject: [PATCH] RxFPC:fix export to spreadsheet git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4185 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi | 200 +++++++++++------- .../rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpr | 2 + components/rx/trunk/rx.inc | 2 + .../rx/trunk/rxdbgridexportspreadsheet.pas | 25 ++- 4 files changed, 152 insertions(+), 77 deletions(-) diff --git a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi index a4a9ab241..9ccfce327 100644 --- a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi +++ b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpi @@ -55,12 +55,14 @@ - + - + + + @@ -69,7 +71,6 @@ - @@ -95,7 +96,7 @@ - + @@ -103,7 +104,6 @@ - @@ -430,23 +430,21 @@ - + - - + - @@ -563,11 +561,10 @@ - + - @@ -665,9 +662,11 @@ - - + + + + @@ -714,9 +713,12 @@ - - + + + + + @@ -732,127 +734,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + - - + + - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + - - + + - - + + - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpr b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpr index 4d2c139fc..85d1ac422 100644 --- a/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpr +++ b/components/rx/trunk/Demos/RxDBGrid/RxDBGridDemo.lpr @@ -8,12 +8,14 @@ uses {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset Forms, + sysutils, RxDBGridMainUnit; {$R RxDBGridDemo.res} begin LocalizeApp; + DefaultFormatSettings.ThousandSeparator:=' '; // Application.Title:='RxDBGrid demo'; Application.Initialize; diff --git a/components/rx/trunk/rx.inc b/components/rx/trunk/rx.inc index b6341232d..5da245929 100644 --- a/components/rx/trunk/rx.inc +++ b/components/rx/trunk/rx.inc @@ -58,3 +58,5 @@ {$ENDIF} {.$DEFINE RxDBGridDepricatedProps} + +{.$DEFINE OLD_fpSPREADSHEET} diff --git a/components/rx/trunk/rxdbgridexportspreadsheet.pas b/components/rx/trunk/rxdbgridexportspreadsheet.pas index ef9c8a718..743e4a757 100644 --- a/components/rx/trunk/rxdbgridexportspreadsheet.pas +++ b/components/rx/trunk/rxdbgridexportspreadsheet.pas @@ -104,7 +104,9 @@ var C : TRxColumn; CT : TRxColumnTitle; CC : TColor; +{$IFDEF OLD_fpSPREADSHEET} scColor : TsColor; +{$ENDIF} CB:TsCellBorders; FMaxTitleHeight : integer; P: TMLCaptionItem; @@ -125,8 +127,12 @@ begin CC:=C.Title.Color; if (CC and SYS_COLOR_BASE) = 0 then begin +{$IFDEF OLD_fpSPREADSHEET} scColor:=FWorkbook.AddColorToPalette(CC); FWorksheet.WriteBackgroundColor(FCurRow, FCurCol, scColor); +{$ELSE} + FWorksheet.WriteBackgroundColor(FCurRow, FCurCol, CC); +{$ENDIF} end; CB:=[cbNorth, cbWest, cbEast, cbSouth]; @@ -172,8 +178,12 @@ begin CC:=C.Title.Color; if (CC and SYS_COLOR_BASE) = 0 then begin + {$IFDEF OLD_fpSPREADSHEET} scColor:=FWorkbook.AddColorToPalette(CC); FWorksheet.WriteBackgroundColor( FCurRow, FCurCol, scColor); + {$ELSE} + FWorksheet.WriteBackgroundColor( FCurRow, FCurCol, CC); + {$ENDIF} end; FWorksheet.WriteBorders(FCurRow,FCurCol, [cbNorth, cbWest, cbEast, cbSouth]); @@ -262,8 +272,12 @@ begin RxDBGrid.OnGetCellProps(RxDBGrid, C.Field, F, CC); if (CC and SYS_COLOR_BASE) = 0 then begin + {$IFDEF OLD_fpSPREADSHEET} scColor:=FWorkbook.AddColorToPalette(CC); FWorksheet.WriteBackgroundColor(FCurRow,FCurCol, scColor); + {$ELSE} + FWorksheet.WriteBackgroundColor(FCurRow,FCurCol, CC); + {$ENDIF} end; end; @@ -289,7 +303,9 @@ var C : TRxColumn; CT : TRxColumnTitle; CC : TColor; + {$IFDEF OLD_fpSPREADSHEET} scColor : TsColor; + {$ENDIF} begin CC:=FRxDBGrid.FooterOptions.Color; FCurCol:=0; @@ -301,8 +317,12 @@ begin begin if (CC and SYS_COLOR_BASE) = 0 then begin + {$IFDEF OLD_fpSPREADSHEET} scColor:=FWorkbook.AddColorToPalette(CC); - FWorksheet.WriteBackgroundColor(FCurRow,FCurCol, scColor); + FWorksheet.WriteBackgroundColor(FCurRow,FCurCol, scColor);} + {$ELSE} + FWorksheet.WriteBackgroundColor(FCurRow,FCurCol, CC); + {$ENDIF} end; if (C.Footer.ValueType <> fvtNon) then @@ -367,7 +387,8 @@ begin FWorkbook := TsWorkbook.Create; FWorksheet := FWorkbook.AddWorksheet(FPageName); try - scColorBlack:=FWorkbook.AddColorToPalette(FRxDBGrid.GridLineColor); +// scColorBlack:=FWorkbook.AddColorToPalette(FRxDBGrid.GridLineColor); + scColorBlack:=FRxDBGrid.GridLineColor; FCurRow:=0; if ressExportTitle in FOptions then