VB.NET中的Excel自动适合列 [英] Excel auto fit column in VB.NET

查看:179
本文介绍了VB.NET中的Excel自动适合列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB6中有我的代码,并且运行良好.

I have here my code in VB6 and its working well.

 For CLms = 1 To 10
      ws.Columns(CLms).AutoFit '<---Autofilt data on XL sheet
 Next CLms

我已经在VB.NET中搜索了如何使Excel列宽自动适合的等效方法或替代方法,但是我仍然没有获得确切的AutoFit函数.

I have searched on what is the equivalent or alternative on how to make the excel columns width autofit in VB.NET, but I'm still not getting the exact AutoFit function.

任何帮助将不胜感激.

Any help will be appreciated.

推荐答案

这是我在vb.net中完成的方法.

This is how I've done it in vb.net.

xlSheet.Range("A1:X1").EntireColumn.AutoFit()

这篇关于VB.NET中的Excel自动适合列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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