缩小字体填充问题,也不是不灵,有些地方灵,有些地方不灵。我还是截图。
具体代码:
Dim Book As New XLS.Book(ProjectPath & "Attachments\学籍卡.xls") '打开模板
Dim dr1 As DataRow = Tables("条件").Current.DataRow '定义条件表的值
Dim fl As String = ProjectPath & "Reports\" & dr1("班级名称") & ".xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(1,9).Value = "<[班级名称] = '" & dr1("班级名称")&"'>" '这里是报表的范围值
Book.Build() '生成报表
Book.Save(fl)
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.EntireColumn.AutoFit '自动调整列宽
'Rg.EntireRow.AutoFit '自动调整行高
'Rg.WrapText = True
rg.ShrinkToFit = True
App.Visible = False
app.quit
代码可以正常运行。
运行以后,关键问题是有些地方缩小字体。有些地方居然没有。
此主题相关图片如下:100.png