Posted 28 January 2022, 2:29 am EST
Hi,
We are sorry but this is by design. Spread.net does not change the height dynamically. Fort this you need to calculate the Text height by yourself and set it inside the EditStopped event. please refer to the following code snippet and let me know if you face any issues.
var spread1 = document.getElementById("<%=FpSpread1.ClientID %>");
if (document.all) {
// IE
if (spread1.addEventListener) {
// IE9
spread1.addEventListener("EditStopped", cellChanged, false);
} else {
// Other versions of IE and IE9 quirks mode (no doctype set)
spread1.onEditStopped = cellChanged;
}
}
else {
spread1.addEventListener("EditStopped", AutoFitRow, false);
}
function AutoFitRow(event) {
let spread = event.spread
spread1.setRowHeight2(spread.ActiveRow, getHeight(spread.ActiveRow, spread));
}
function getHeight(row,spread) {
let height = -1
for (let i = 0; i < parseInt(spread1.ColCount); i++) {
let colHeader = spread.getColHeader(0);
let columnWidth = colHeader.querySelectorAll("td")[i].getBoundingClientRect().width
let divEle = document.createElement("div")
divEle.textContent = spread.Cells(row,i).textContent;
divEle.style.width = columnWidth + "px";
divEle.style.height = "fit-content";
document.body.appendChild(divEle)
height = Math.max(height, divEle.getBoundingClientRect().height);
divEle.remove()
}
return height;
}
Regards,
Avinash