-- 作者:ajie5211
-- 发布时间:2018/10/12 14:30:00
-- [求助]专业报表字宽系数能否控制
如题,专业报表中,字体的字宽系数能否控制?
Dim ls As WinForm.NumericComboBox = e.Form.Controls("列数") Dim hs As WinForm.NumericComboBox = e.Form.Controls("行数") Dim zbj As WinForm.NumericComboBox = e.Form.Controls("字边距") Dim zt As WinForm.FontPicker = e.Form.Controls("字体") Dim zg As WinForm.NumericComboBox = e.Form.Controls("字高") Dim nr As String For Each r As Row In Tables("表A").Rows If r.IsNull("第一列") = False Then nr = iif(nr Is Nothing,r("第一列") & r("第二列"),nr & vbcrlf & r("第一列") & r("第二列")) End If Next
Dim doc As New PrintDoc \'定义一个报表 Dim rt As New prt.RenderTable() \'定义一个表格对象 Dim rx As prt.RenderText \'定义一个文本对象 Dim fnt As New Font(Cstr(zt.Value),CInt(zg.Value),FontStyle.Regular)
Doc.PageSetting.PaperKind = 9 Doc.PageSetting.LeftMargin = 2 \'设置左边距 Doc.PageSetting.RightMargin = 2 \'设置右边距 Doc.PageSetting.TopMargin = 2 \'设置上边距 Doc.PageSetting.BottomMargin = 2 \'设置下边距
doc.Body.Children.Add(rt) \'将表格对象加入到报表中 rt.Style.GridLines.All = New prt.LineDef \'将网格线类型设为默认类型 rt.Width = 205 \'表宽为150毫米 rt.Height = 290 \'表高为150毫米 rt.Rows.Count = hs.Value \'设置行数 rt.Cols.Count = ls.Value \'设置列数 For r As Integer = 0 To hs.Value For c As Integer = 0 To ls.Value rx = New prt.RenderText \'创建一个新的文本对象 rx.text = nr \'设置文本对象的内容 rx.Style.Spacing.All = CInt(zbj.Value) \'内容和网格线的距离为1 rx.Style.Font = fnt \'设置字体 rt.Cells(r, c).RenderObject = rx \'放置在单元格中 Next Next Doc.Preview() \'预览报表
|