diff --git a/components/fpspreadsheet/fpscell.pas b/components/fpspreadsheet/fpscell.pas index 384bfa0c7..bc498e651 100644 --- a/components/fpspreadsheet/fpscell.pas +++ b/components/fpspreadsheet/fpscell.pas @@ -14,6 +14,7 @@ type function GetBackgroundColor: TsColor; function GetBorder: TsCellBorders; function GetBorderStyle(const ABorder: TsCellBorder): TsCellBorderStyle; + function GetBorderStyles: TsCellBorderStyles; function GetCellFormat: TsCellFormat; function GetFont: TsFont; function GetFontIndex: integer; @@ -27,6 +28,7 @@ type procedure SetBackgroundColor(const AValue: TsColor); procedure SetBorder(const AValue: TsCellBorders); procedure SetBorderStyle(const ABorder: TsCellBorder; const AValue: TsCellBorderStyle); + procedure SetBorderStyles(const AValue: TsCellBorderStyles); procedure SetCellFormat(const AValue: TsCellFormat); procedure SetFontIndex(const AValue: Integer); procedure SetHorAlignment(const AValue: TsHorAlignment); @@ -44,6 +46,10 @@ type read GetBackgroundColor write SetBackgroundColor; property Border: TsCellBorders read GetBorder write SetBorder; + property BorderStyle[ABorder: TsCellBorder]: TsCellBorderStyle + read GetBorderStyle write SetBorderStyle; + property BorderStyles: TsCellBorderStyles + read GetBorderStyles write SetBorderStyles; property CellFormat: TsCellFormat read GetCellFormat write SetCellFormat; property Font: TsFont read GetFont; @@ -83,6 +89,11 @@ begin Result := Worksheet.ReadCellBorderStyle(@self, ABorder); end; +function TCellHelper.GetBorderStyles: TsCellBorderStyles; +begin + Result := Worksheet.ReadCellBorderStyles(@self); +end; + function TCellHelper.GetCellFormat: TsCellFormat; begin Result := Workbook.GetCellFormat(FormatIndex); @@ -163,6 +174,11 @@ begin Worksheet.WriteBorderStyle(@self, ABorder, AValue); end; +procedure TCellHelper.SetBorderStyles(const AValue: TsCellBorderStyles); +begin + Worksheet.WriteBorderStyles(@self, AValue); +end; + procedure TCellHelper.SetCellFormat(const AValue: TsCellFormat); begin Worksheet.WriteCellFormat(@self, AValue); diff --git a/components/fpspreadsheet/fpspreadsheet.pas b/components/fpspreadsheet/fpspreadsheet.pas index 8d54997fb..9af2d29bd 100755 --- a/components/fpspreadsheet/fpspreadsheet.pas +++ b/components/fpspreadsheet/fpspreadsheet.pas @@ -215,6 +215,7 @@ type function ReadBackgroundColor(ACell: PCell): TsColor; function ReadCellBorders(ACell: PCell): TsCellBorders; function ReadCellBorderStyle(ACell: PCell; ABorder: TsCellBorder): TsCellBorderStyle; + function ReadCellBorderStyles(ACell: PCell): TsCellBorderStyles; function ReadCellFont(ACell: PCell): TsFont; function ReadCellFormat(ACell: PCell): TsCellFormat; function ReadHorAlignment(ACell: PCell): TsHorAlignment; @@ -2842,6 +2843,23 @@ begin end; end; +{@@ ---------------------------------------------------------------------------- + Determines which all border styles of a given cell +-------------------------------------------------------------------------------} +function TsWorksheet.ReadCellBorderStyles(ACell: PCell): TsCellBorderStyles; +var + fmt: PsCellFormat; + b: TsCellBorder; +begin + Result := DEFAULT_BORDERSTYLES; + if ACell <> nil then + begin + fmt := Workbook.GetPointerToCellFormat(ACell^.FormatIndex); + for b in fmt.Border do + Result[b] := fmt^.BorderStyles[b]; + end; +end; + {@@ ---------------------------------------------------------------------------- Determines the font used by a specified cell. Returns the workbook's default font if the cell does not exist. Considers the uffBold and uffFont formatting