You've already forked lazarus-ccr
fpspreadsheet: Allow writing duplicate filler palette entries like in the built-in Excel colors
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5867 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1230,6 +1230,11 @@ begin
|
||||
SetLength(sheetPos, 0);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Populates the palette of the writer with the colors used by the workbook.
|
||||
BIFF8 begins with the 8 default colors which are duplicated. Then the user
|
||||
colors follow up to a max of total 64 entries.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFF5Writer.PopulatePalette(AWorkbook: TsWorkbook);
|
||||
var
|
||||
i: Integer;
|
||||
@ -1240,7 +1245,9 @@ begin
|
||||
// Fill up Excel colors of the standard palette to avoid empty color
|
||||
// place holders in Excel's colordialog.
|
||||
for i := 16 to High(PALETTE_BIFF5) do
|
||||
FPalette.AddUniqueColor(PALETTE_BIFF5[i]);
|
||||
FPalette.AddColor(PALETTE_BIFF5[i]);
|
||||
// The BIFF5 palette contains duplicate colors -> don't use AddUniqueColor
|
||||
// FPalette.AddUniqueColor(PALETTE_BIFF5[i]);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
|
@ -2226,6 +2226,11 @@ begin
|
||||
SetLength(sheetPos, 0);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Populates the palette of the writer with the colors used by the workbook.
|
||||
BIFF8 begins with the 8 default colors which are duplicated. Then the user
|
||||
colors follow up to a max of total 64 entries.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFF8Writer.PopulatePalette(AWorkbook: TsWorkbook);
|
||||
var
|
||||
i: Integer;
|
||||
@ -2236,7 +2241,9 @@ begin
|
||||
// Fill up Excel colors of the standard palette to avoid empty color
|
||||
// place holders in Excel's colordialog.
|
||||
for i := 16 to High(PALETTE_BIFF8) do
|
||||
FPalette.AddUniqueColor(PALETTE_BIFF8[i]);
|
||||
FPalette.AddColor(PALETTE_BIFF8[i]);
|
||||
// The BIFF8 palette contains duplicate colors -> don't use AddUniqueColor
|
||||
// FPalette.AddUniqueColor(PALETTE_BIFF8[i]);
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
|
@ -3853,11 +3853,13 @@ end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
Writes the PALETTE record for the color palette.
|
||||
Valid for BIFF3-BIFF8. BIFF2 has no palette in the file.
|
||||
Valid for BIFF3-BIFF8. BIFF2 has no palette in the file, i.e. WritePalette is
|
||||
not called.
|
||||
-------------------------------------------------------------------------------}
|
||||
procedure TsSpreadBIFFWriter.WritePalette(AStream: TStream);
|
||||
const
|
||||
NUM_COLORS = 56;
|
||||
MAX_PALETTE = NUM_COLORS + 8 - 1;
|
||||
var
|
||||
i, n: Integer;
|
||||
rgb: TsColor;
|
||||
@ -3872,7 +3874,7 @@ begin
|
||||
n := FPalette.Count;
|
||||
|
||||
{ Skip the first 8 entries - they are hard-coded into Excel }
|
||||
for i := 8 to 8 + NUM_COLORS - 1 do
|
||||
for i := 8 to MAX_PALETTE do
|
||||
begin
|
||||
rgb := Math.IfThen(i < n, FPalette[i], $FFFFFF);
|
||||
AStream.WriteDWord(DWordToLE(rgb))
|
||||
|
Reference in New Issue
Block a user