Page 1 of 1

Problem with BackgroundColor and FillPattern

Posted: Mon Nov 20, 2017 2:49 pm
by bturcs
I'm using an indexed color and a fill pattern, but I am unable to set the pattern background color. Only the pattern foreground color is set, wich is different from XLSSUIT4.

Image

Left is the result of XLSSUIT6, right the result of XLSSUIT4. What can I do to fix this issue?

XLSSUIT Version 6:

Code: Select all

  try
    LDoc := TXLSReadWriteII5.Create(nil);
    LDoc.Sheets[0].AsString[3,3] := '';
    LFormat := LDoc.CmdFormat;
    LFormat.BeginEdit(LDoc[0]);
    LFormat.Fill.BackgroundColor.IndexColor := xcBlueGreen;
    LFormat.Fill.PatternStyle := efpLightGrid;
    LFormat.Apply(3, 3);
    LDoc.Filename := 'C:\TEMP\GRID.XLSX';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;
XLSSUIT Version 4:

Code: Select all

  try
    LDoc := TXLSReadWriteII4.Create(nil);
    LDoc.Sheets[0].AsString[3,3] := '';
    LCell := LDoc.Sheets[0].Cell[3,3];
    LCell.FillPatternBackColor := xcBlueGreen;
    LCell.FillPatternPattern := efpLightGrid;
    LDoc.Filename := 'C:\TEMP\GRID.XLS';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;



Re: Problem with BackgroundColor and FillPattern

Posted: Mon Jan 29, 2018 11:33 am
by bturcs
Just solved this problem: there is a different property to set the pattern color:

Code: Select all

  try
    LDoc := TXLSReadWriteII5.Create(nil);
    LDoc.Sheets[0].AsString[3,3] := '';
    LFormat := LDoc.CmdFormat;
    LFormat.BeginEdit(LDoc[0]);
    LFormat.Fill.PatternStyle := efpLightGrid;
    LFormat.Fill.PatternColor.IndexColor := xcBlueGreen;
    LFormat.Apply(3, 3);
    LDoc.Filename := 'C:\TEMP\GRID.XLSX';
    LDoc.Write;
  finally
    freeAndNil(LDoc);
  end;