Recent

Author Topic: a new component (TsWorksheetHeader) for TsWorksheetGrid  (Read 2411 times)

abcthing

  • New Member
  • *
  • Posts: 19
a new component (TsWorksheetHeader) for TsWorksheetGrid
« on: August 28, 2020, 07:55:24 am »
Click the header to pop up the menu, give a name to the column or row, then according to the column name and row name for batch modify cells.

This component is implemented based on the ongetrowheadertext and ongetcolheadertext interfaces.

function:
1.Realize mark of header with popup menu.
2.Save marks of header to file;
3.Load marks of header from file;
4.can prohibit duplicate mark
5.Can hide  marked popup menu item.

demo:
Code: Pascal  [Select][+][-]
  1. var
  2.   fRowIndex, fColIndex: integer;
  3.   fRow, fCol: integer;
  4.   fcell: PCell;
  5.    ...
  6. begin
  7.   for fRowIndex:=0 to LxmHeaders1.RowHeaderItems.Count-1 do
  8.   begin
  9.     fRow := ExcelRow2Fps(StrToInt(LxmHeaders1.RowHeaderItems.Names[fRowIndex]));
  10.     fItem := LxmHeaders1.RowHeaderItems.ValueFromIndex[fRowIndex];
  11.  
  12.     for fColIndex:=0 to LxmHeaders1.ColumnHeaderItems.Count-1 do
  13.     begin
  14.       fCol := ExcelCol2Fps(LxmHeaders1.ColumnHeaderItems.Names[fColIndex]);
  15.       fType := LxmHeaders1.ColumnHeaderItems.ValueFromIndex[fColIndex];
  16.  
  17.       tm1function := GenDataTm1Function(fTm1, fCompany, fMonth, fItem, fType);
  18.       sWorksheetGrid2.Worksheet.WriteFormula(fRow, fCol, tm1function);
  19.  
  20.       fcell := sWorksheetGrid2.worksheet.FindCell(fRow, fCol);
  21.       sWorksheetGrid2.worksheet.WriteCellProtection(fcell, []);
  22.     end;
  23.   end;
  24. end;
« Last Edit: August 29, 2020, 01:59:11 pm by abcthing »

wp

  • Hero Member
  • *****
  • Posts: 13486
Re: Add a new component (TsWorksheetHeader) for TsWorksheetGrid
« Reply #1 on: August 28, 2020, 01:31:57 pm »
Thanks for the idea. It is good that the component is completely separated; therefore it can be used freely. However, I will not include it in flspreadsheet because I think that most users do not need this, and for providing user-specified column and row headers there are already events OnGetColHeaderText and OnGetRowHeaderText
« Last Edit: August 29, 2020, 02:11:07 pm by wp »

 

TinyPortal © 2005-2018