Forum > FPSpreadsheet

[SOLVED] FrozenRow/Col in TsWorksheet



As I see sWorksheetGrid support the FrozenRow/Col. Mean these lines/cols do not move when user scrolls.

I'd like if the TsWorksheet support it too (mainly Excel).

Thank you!


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program demo_frozen_rows_cols;uses  SysUtils,  FPSpreadsheet, fpsTypes, xlsxOOXML;var  wb: TsWorkbook;  ws: TsWorksheet;  r, c: Integer;begin  wb := TsWorkbook.Create;  try    ws := wb.AddWorksheet('Sheet1');     // Fill worksheet with some data    for r := 0 to 100 do      for c := 0 to 10 do        ws.WriteText(r, c, Format('R%d C%d', [r, c]));     // Prepare frozen columns and frozen rows    ws.LeftPaneWidth := 1;  // There should be 1 frozen column    ws.TopPaneHeight := 2;  // There should be 2 frozen rows    ws.Options := ws.Options + [soHasFrozenPanes];  // Activate this feature.     // Save to file    wb.WriteToFile('test.xlsx', true);  finally    wb.Free;  end;end.

@wp Thank you for the answer, and for this sample demo! I tried it, it's working. :)


[0] Message Index

Go to full version