如何从vb.net代码增加excel行的行高? [英] How can I increase the row height of excel row from vb.net code?
本文介绍了如何从vb.net代码增加excel行的行高?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从vb.net代码增加excel行的行高?
我有此代码无法正常工作.没有错误来了.
宽度部分工作正常..
How can I increase the row height of excel row from vb.net code?
I have this code which is not working. No error is coming.
Width section is working fine..
Dim _xl As New Excel.Application
Dim _xlBook As Excel.Workbook
Dim _xlSheet1 As Excel.Worksheet
_xlSheet1.Rows("1:1").rowheight = 100
_xlSheet1.Columns(1).ColumnWidth = 15
_xlSheet1.Columns(2).ColumnWidth = 34
推荐答案
您是否尝试过使用以下方法:
Have you tried this with:
Dim _xl As New Excel.Application
Dim _xlBook As Excel.Workbook
Dim _xlSheet1 As Excel.Worksheet
_xlSheet1.Rows(1).RowHeight = 100 ' This will set the height for row number 1
_xlSheet1.Columns(1).ColumnWidth = 15
_xlSheet1.Columns(2).ColumnWidth = 34
希望对您有所帮助!
问候,
Manfred
Hope that helps!
Regards,
Manfred
Dim _xl As New Excel.Application
Dim _xlBook As Excel.Workbook
Dim _xlSheet1 As Excel.Worksheet
_xlBook = _xl.Workbooks.Open("fullpathtothefile.xls") 'or: New Workbook
_xlSheet1 = _xlBook.WorkSheets(1) 'or _xlBook.WorkSheets("NameOfSheet")
_xlSheet1.Rows("1:1").RowHeight = 100
_xlSheet1.Columns(1).ColumnWidth = 15
_xlSheet1.Columns(2).ColumnWidth = 34
看到区别了吗?
Do you see the difference?
''设置第一行的RowHeight = 25
''set the RowHeight=25 of the first row
_xlSheet1.SetRowHeight(1, 25)
这篇关于如何从vb.net代码增加excel行的行高?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文