diff --git a/components/fpspreadsheet/source/common/xlsbiff5.pas b/components/fpspreadsheet/source/common/xlsbiff5.pas index 553fbbe80..ae438212b 100644 --- a/components/fpspreadsheet/source/common/xlsbiff5.pas +++ b/components/fpspreadsheet/source/common/xlsbiff5.pas @@ -980,9 +980,10 @@ begin { Color index } // The problem is that the palette is loaded after the font list; therefore // we do not know the rgb color of the font here. We store the palette index - // ("SetAsPaletteIndex") and replace it by the rgb color at the end of the - // workbook globals records. As an indicator that the font does not yet - // contain an rgb color a control bit is set in the high-byte of the TsColor. + // ("SetAsPaletteIndex") and replace it by the rgb color after reading of the + // palette and after reading the workbook globals records. As an indicator + // that the font does not yet contain an rgb color a control bit is set in + // the high-byte of the TsColor. lColor := WordLEToN(AStream.ReadWord); if lColor < 8 then // Use built-in colors directly otherwise the Workbook's FindFont would not find the font in ReadXF diff --git a/components/fpspreadsheet/source/common/xlsbiff8.pas b/components/fpspreadsheet/source/common/xlsbiff8.pas index 4b16e7e69..34e6ffe38 100644 --- a/components/fpspreadsheet/source/common/xlsbiff8.pas +++ b/components/fpspreadsheet/source/common/xlsbiff8.pas @@ -1812,9 +1812,10 @@ begin { Color index } // The problem is that the palette is loaded after the font list; therefore // we do not know the rgb color of the font here. We store the palette index - // ("SetAsPaletteIndex") and replace it by the rgb color at the end of the - // workbook globals records. As an indicator that the font does not yet - // contain an rgb color a control bit is set in the high-byte of the TsColor. + // ("SetAsPaletteIndex") and replace it by the rgb color after reading of the + // palette and after reading the workbook globals records. As an indicator + // that the font does not yet contain an rgb color a control bit is set in + // the high-byte of the TsColor. lColor := WordLEToN(AStream.ReadWord); if lColor < 8 then // Use built-in colors directly otherwise the Workbook's FindFont would not find the font in ReadXF diff --git a/components/fpspreadsheet/source/common/xlscommon.pas b/components/fpspreadsheet/source/common/xlscommon.pas index 82b05a8e5..a2c06af4a 100644 --- a/components/fpspreadsheet/source/common/xlscommon.pas +++ b/components/fpspreadsheet/source/common/xlscommon.pas @@ -1944,6 +1944,11 @@ begin // Read palette colors and add them to the palette while FPalette.Count < n do FPalette.AddColor(DWordLEToN(AStream.ReadDWord)); + + // The problem is that the palette is loaded after the font list. During + // loading of the fonts the font color had stored the palette index. Here + // we replace the palette index by the rgb color. + FixColors; end; {@@ ---------------------------------------------------------------------------- diff --git a/components/fpspreadsheet/tests/spreadtestgui.lpi b/components/fpspreadsheet/tests/spreadtestgui.lpi index 9649cf21e..03ae8d1ed 100644 --- a/components/fpspreadsheet/tests/spreadtestgui.lpi +++ b/components/fpspreadsheet/tests/spreadtestgui.lpi @@ -7,7 +7,11 @@ + <Scaled Value="True"/> <ResourceType Value="res"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> </General> <i18n> <EnableI18N LFM="False"/> diff --git a/components/fpspreadsheet/tests/spreadtestgui.lpr b/components/fpspreadsheet/tests/spreadtestgui.lpr index edb225bfe..cff3d0e01 100644 --- a/components/fpspreadsheet/tests/spreadtestgui.lpr +++ b/components/fpspreadsheet/tests/spreadtestgui.lpr @@ -16,6 +16,7 @@ uses hyperlinktests, pagelayouttests, protectiontests; begin + Application.Scaled := True; {$IFDEF HEAPTRC} // Assuming your build mode sets -dDEBUG in Project Options/Other when defining -gh // This avoids interference when running a production/default build without -gh diff --git a/components/fpspreadsheet/tests/spreadtestgui.res b/components/fpspreadsheet/tests/spreadtestgui.res index 7c6cf3e4b..d5ab174bd 100644 Binary files a/components/fpspreadsheet/tests/spreadtestgui.res and b/components/fpspreadsheet/tests/spreadtestgui.res differ