如何自动调整excel列 [英] How to autofit excel columns

查看:174
本文介绍了如何自动调整excel列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我正在生成包含多张床单的Excel报告。



用户必须双击以扩展列



i使用下面的代码:



Hi all

I am generating excel report with multiple sheets.

the user have to double click for expanding the columns

i used this below code:

obj_Range = objxlWorksheet.get_Range("A1", "1");
obj_Range.AutoFit();





但收到此错误:



but getting this error:

Exception from HRESULT: 0x800A03EC





请让我知道是什么问题。



Please let me know what is the problem.

推荐答案

您好,



这里您要为整行提供自动调整属性,而您需要将其应用于指定的列或单元格。



Hi,

Here you are providing the autofit property to the whole row instead you need to apply this to the specified columns or cells.

obj_Range.Columns.AutoFit();





希望这能解决您的问题。



谢谢,

Sisir Patro



Hope this will resolve your issue.

Thanks,
Sisir Patro


这篇关于如何自动调整excel列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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