Uploaded image for project: 'Keikai'
  1. Keikai
  2. KEIKAI-658

autofit height and cell wrapped text cause row shrink

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 6.0.0
    • 5.12.0
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      run attached xlsx

      Current Result

      Rows that contains a cell with wrapped text, and have auto-height are shrunk

      Expected Result

      Rows should have at least their natural height (same as Excel)

      Debug Information

      Workaround

      <script><![CDATA[
      	zk.afterLoad("zssex", function () {
      	    var _xRow = {};
      	    zk.override(zss.Row.prototype, _xRow, {
      	    	updateRowAutoHeight: function () {
      	    		
      	    		var naturalHeight = this.getHeight();
      	    		
      				if (this.sheet.custRowHeight.isCustomSize(this.r)) {
      					return;
      				}
      
      				var autoHeight = -1,
      					autoHeightCells = this.autoHeightCells;
      				
      				if (autoHeightCells.length > 0) {
      					var largestAutoHeight = this._largestAutoHeight || -1;
      					
      					if(largestAutoHeight == -1) {
      						//enlarge height upon largest text height among wrapped cells
      						var i = autoHeightCells.length;
      						while (i--) {
      							if (autoHeightCells[i]) {
      								autoHeight = Math.max(autoHeight,  autoHeightCells[i].getTextHeight());
      							}
      						}
      						
      						this._largestAutoHeight = autoHeight;
      					} else {
      						// use cache
      						autoHeight = Math.max(autoHeight, largestAutoHeight);
      					}
      				}
      				if (autoHeight == -1) //use default
      					autoHeight = this.sheet.custRowHeight.getDefaultSize();
      
      				const custRowHeight = this.sheet.custRowHeight;
      				const meta = custRowHeight.getMeta(this.r);
      				const rowHeight = meta ? meta[1] : custRowHeight.size;
      				
      				autoHeight = Math.max(naturalHeight, naturalHeight);
      
      				if (rowHeight == autoHeight)
      					return;//equals to current row height, no need to change
      				var CUSTOM = false;
      				this.sheet._setRowHeight(this.r, autoHeight, true, false, false, this.zsh, CUSTOM);
      			}
      	     });
      	});
      ]]></script>
      

            DevChu DevChu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: