阅读背景:

C# 解决EXCEL单元格合并,行高无法自适应问题

来源:互联网 

解决方法:根据单元格内容长度,设置单元格所在行的行高

      public static float getExcelCellAutoHeight(string strtest, float fontCountInline)
        {
            float defaultRowHeight = 18.00f;//每一行的高度指定
            float defaultCount = 0.00f;
            for (int i = 0; i <strtest.Length; i++)
            {
                float ff = getRegex(strtest.Substring(i, 1));
                defaultCount = defaultCount + ff;
            }
            return ((int)(defaultCount / fontCountInline) + 1) * defaultRowHeight;//计算
        }
      public s



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: