WriteBorderLineStyle(s) is missing [ANSWERED] lazarus / 49-FPSpreadsheet ---------------------------------------------------------------------- totya · 2020-07-15 08:06 Hi master! I working my app hardly. These procedures: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function WriteBorderLineStyle(ARow, ACol: Cardinal; ABorder: TsCellBorder; ALineStyle: TsLineStyle): PCell; overload;procedure WriteBorderLineStyle(ACell: PCell; ABorder: TsCellBorder; ALineStyle: TsLineStyle): PCell; overload; are okay... But slightly complicated to draw to the corner, because two codeline needed, for example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i       if row_i = ARowStart then begin        WriteBorders(ARowStart, AColStart, [cbNorth, cbWest]);        WriteBorderLineStyle(ARowStart, AColStart, cbNorth, BorderLineStyle);        WriteBorderLineStyle(ARowStart, AColStart, cbWest, BorderLineStyle);      end  ...so I suggest these procedures too (similar to WriteBorders, WriteBorderStyles): function WriteBorderLineStyles(ARow, ACol: Cardinal; ABorders: TsCellBorders; ALineStyle: TsLineStyle): PCell; overload; procedure WriteBorderLineStyles(ACell: PCell; ABorders: TsCellBorders; ALineStyle: TsLineStyle): PCell; overload; Thank you! ---------------------------------------------------------------------- wp · 2020-07-15 21:02 Since there are already so many methods of TsWorksheet I prefer to skip these. But did you notice that recently I added methods to the TsCellFormat record (in order to facilitate working with conditional formats)? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TsCellFormat = record ...    procedure SetBackground(AFillStyle: TsFillStyle; AFgColor, ABgColor: TsColor);    procedure SetBackgroundColor(AColor: TsColor);    procedure SetBorders(ABorders: TsCellBorders;      AColor: TsColor = scBlack; ALineStyle: TsLineStyle = lsThin);    procedure SetFont(AFontIndex: Integer);    procedure SetHorAlignment(AHorAlign: TsHorAlignment);    procedure SetTextRotation(ARotation: TsTextRotation);    procedure SetVertAlignment(AVertAlign: TsVertAlignment);  end; Among them the SetBorders with the parameters of your request. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  cell: PCell;  fmt: TsCellFormat;...  cell := sheet.WriteNumber(2, 2, 3.141592);  fmt := book.GetCellFormat(cell^.FormatIndex);  fmt.SetBorders([cbNorth, cbWest], lsDouble, scRed);  cell^.FormatIndex := book.AddCellFormat(fmt); Or, using the TCell helpers in fpsCell and the new CellFormat() function in fpsUtils, even faster: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     cell := sheet.WriteText(5, 2, 'abc');    cell^.Borders[[cbNorth, cbSouth]] := CellBorderStyle(lsThick, scGreen); ---------------------------------------------------------------------- totya · 2020-07-16 07:43 Hi wp master! Thank you for your detailed answer! QuoteSetBorders I read this information: https://wiki.freepascal.org/FPSpreadsheet#Cell_borders but I didn't found SetBorders. I searched in the fpspreadsheet-api.chm (shipped via component), but didn't found too. So this information is new for me. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Cell^.Borders latest svn (7545): unit_tsworksheet_helper.pas(99,11) Error: identifier idents no member "Borders" But the first solution is okay (modified, color and style parameter order is reverse): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i begin // Top border...    for col_i := AColStart to AColEnd do    begin      Cell := GetCell(ARowStart, col_i);       fmt := Workbook.GetCellFormat(Cell^.FormatIndex);      fmt.SetBorders([cbNorth], ABorderColor, ABorderLineStyle);      Cell^.FormatIndex := Workbook.AddCellFormat(fmt);    end; ---------------------------------------------------------------------- wp · 2020-07-16 10:37 With every addition to fpspreadsheet, the documentation is getting more and more complex, and people are already complaining that the wiki article is too long and loads too slowly over the slow internet. An unsolvable situation... I absolutely urge you (and everybody) to learn how to navigate the source code. It is always up to date, and I often add lots of comments to describe the functions (the comments are used by the chm help file generator). Please search the forum for "navigate" and my user name - I described the procedure already several times. There is not yet any "official" documentation for the TCell record helpers. Here is the declaration of the methods: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TCellHelper = record helper for TCell  ...  public    property BackgroundColor: TsColor      read GetBackgroundColor write SetBackgroundColor;    property BiDiMode: TsBiDiMode      read GetBiDiMode write SetBiDiMode;    property Border: TsCellBorders      read GetBorder write SetBorder;    property Borders[ABorders: TsCellBorders]: TsCellBorderStyle      write SetBorders;  // write- only!    property BorderStyle[ABorder: TsCellBorder]: TsCellBorderStyle      read GetBorderStyle write SetBorderStyle;    property BorderStyles: TsCellBorderStyles      read GetBorderStyles write SetBorderStyles;    property CellFormat: TsCellFormat      read GetCellFormat write SetCellFormat;    property Comment: String      read GetComment write SetComment;    property Font: TsFont read GetFont;    property FontIndex: Integer      read GetFontIndex write SetFontIndex;    property HorAlignment: TsHorAlignment      read GetHorAlignment write SetHorAlignment;    property Hyperlink: TsHyperlink      read GetHyperlink write SetHyperlink;    property NumberFormat: TsNumberFormat      read GetNumberFormat write SetNumberFormat;    property NumberFormatStr: String      read GetNumberFormatStr write SetNumberFormatStr;    property TextRotation: TsTextRotation      read GetTextRotation write SetTextRotation;    property UsedFormattingFields: TsUsedFormattingFields      read GetUsedFormattingFields write SetUsedFormattingFields;    property VertAlignment: TsVertAlignment      read GetVertAlignment write SetVertAlignment;    property Wordwrap: Boolean      read GetWordwrap write SetWordwrap;    property Workbook: TsBasicWorkbook read GetWorkbook;  end; Having unit fpscell in "uses" you can simply set these properties: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  cell: PCell;...  cell := worksheet.WriteNumber(1, 2, 3.141592);  cell^.NumberFormatStr := '0.00';  cell^.BackgroundColor := scRed;  cell^.Borders[[cbNorth, cbSourh]] := CellBorderStyle(scRed, scDouble); A special note should be make for the property Borders (plural) which is write-only. In the above example, the top and bottem borders of the cell are set as red double lines. (Using the color scUndefined or scTransparent as color parameter hides the border line). It does not make sense to read back the cell border styles because the border elements specified in the parameter may be different. ---------------------------------------------------------------------- totya · 2020-07-18 13:54 Hi wp master! Thank you for this information. The wiki page is very detailed, and I didn't tought before, this is incomplete. I suggest to you write to the top of the wiki page this informations with big letters (about): These informations outdated, please see source code... ---------------------------------------------------------------------- wp · 2020-07-18 14:21 Quote from: totya on July 18, 2020, 03:54:54 pmThese informations outdated, please see source code... No it's not outdated, it just does not explain each of the many ways of formatting. I'll probably write a new, more complete article about formatting; when it is not included in the main article I think there is more space to explain more details. ---------------------------------------------------------------------- totya · 2020-07-20 11:28 Hi master! For example this line in the wiki is outdated: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i fnt := MyWorksheet.ReadCellFont(0, 0); ...because the required paramters: PCell and not row/col. ---------------------------------------------------------------------- wp · 2020-07-20 21:58 Thanks for reporting. Fixed.