获取单元格设置了WrapText的行的高度 [英] Get height of row where the cells have WrapText set

查看:108
本文介绍了获取单元格设置了WrapText的行的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试计算要插入到Excel工作表中的行的高度.该行的单元格使用WrapText=true格式化,因此该行的高度不是固定的. 访问row.Height将返回null.

I am trying to compute the height of the row I'm inserting into my excel sheet. The row's cells are formatted with WrapText=true, so the height of the row is not fixed. Accessing row.Height will return null.

我当时正在考虑使用类似于Graphics.MeasureString的方式,其中我还指定了宽度约束以获取高度.

I was thinking of using something similar to Graphics.MeasureString where I also specify the width constraint in order to retrieve the height.

找不到在线任何相关信息.任何帮助将不胜感激.

Didn't find any relevant info online. Any help would be appreciated.

推荐答案

在此处使用Graphics.MeasureString查看我的帖子.效果很好.

See my post here using Graphics.MeasureString. It works very well.

在EPPlus中自动拟合合并单元格的行高

这篇关于获取单元格设置了WrapText的行的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆