以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- excel报表,如何设置可以自适应行高 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=186931) |
-- 作者:moseser -- 发布时间:2023/6/9 10:11:00 -- excel报表,如何设置可以自适应行高 如题? |
-- 作者:有点蓝 -- 发布时间:2023/6/9 10:24:00 -- 只能生成报表后使用vba代码处理 dim fl as string = "生成的报表路径" Dim App As New MSExcel.Application Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fl) Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) Dim Rg As MSExcel.Range = Ws.Cells rg.WrapText = True Rg.EntireRow.AutoFit \'自动调整行高 Ws.Activate App.ActiveWindow.DisplayGridlines = False \'隐藏网格线 Wb.save App.Visible = True 如果有合并单元格参考:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=70571 |