Forum > FPSpreadsheet

auto-adjust only number of rows with data

(1/1)

Ericktux:
Hello friends, when I load an excel with several rows I use the option to auto-adjust "sWorksheetGrid -> AutoExpand (only aeNavigation marked)" it works for me when I have several rows, but when I have only 5 rows it always gives me 10 or 11 rows by default.

How can I solve this friends, greetings

attached example image

wp:
If you want to see the grid lines only within the range occupied by data you should set the grid's ColCount and GrowCount accordingly. If you have aeNavigation in the AutoExpand property the range expands when you navigate outside the given range - I don't know if this is what you want. aeData is sufficient, in my opinion.


--- 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";}};} ---procedure TForm1.FormCreate(Sender: TObject);var  nc, nr: Cardinal;  sheet: TsWorksheet;begin  sWorksheetGrid1.LoadFromSpreadsheetFile('test.xlsx', sfOOXML);  sWorksheetGrid1.AutoExpand := [aeData];  sheet := sWorksheetGrid1.Worksheet;  nc := sheet.GetLastColIndex;  nr := sheet.GetlastRowIndex;  sWorksheetGrid1.ColCount := nc;  sWorksheetGrid1.RowCount := nr;end;

Navigation

[0] Message Index

Go to full version