- Code: Select all
Dim tempfont6 As New System.Drawing.Font("Arial", 6.0F, FontStyle.Regular)
f6 = New PdfTrueTypeFont(tempfont6)
Dim tempfont8 As New System.Drawing.Font("Arial", 8.0F, FontStyle.Regular)
f8 = New PdfTrueTypeFont(tempfont8)
HeadFont = f8
BodyFont = f6
Dim table As New PdfTable
table.Style.CellPadding = 3
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
table.Style.HeaderRowCount = 1
table.DataSource = report_dt
table.Style.ShowHeader = True
table.Style.HeaderStyle.BackgroundBrush = PdfBrushes.White
table.Style.HeaderStyle.Font = HeadFont
table.Style.HeaderStyle.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
table.Style.DefaultStyle.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
table.Style.HeaderStyle.TextBrush = PdfBrushes.Red
table.Style.HeaderStyle.BorderPen = New PdfPen(PdfBrushes.Black)
table.Style.DefaultStyle.BorderPen = New PdfPen(PdfBrushes.Blue)
table.Style.BorderPen = New PdfPen(PdfBrushes.Blue)
table.Style.DefaultStyle.BackgroundBrush = PdfBrushes.White
table.Style.DefaultStyle.Font = BodyFont
Dim Last_Col As Integer = this_col - 1
For rowno = 0 To Member_DS.Tables(0).Rows.Count - 1
Dim report_row As DataRow = report_dt.NewRow()
For colno = 0 To Member_DS.Tables(0).Columns.Count - 1
Dim this_width = BodyFont.MeasureString(Member_DS.Tables(0).Rows(rowno).Item(colno).ToString).Width '* 1.5
For col_rowno As Integer = 0 To Last_Col
If col_names(col_rowno) = Member_DS.Tables(0).Columns(colno).ColumnName Then
If colno >= ColumnDateStart Then
Dim thisvalue As String = Member_DS.Tables(0).Rows(rowno).Item(colno).ToString
If thisvalue = "Y" Then
thisvalue = "✓"
Else
If thisvalue = "X" Then
thisvalue = "▀"
Else
End If
End If
report_row.Item(col_rowno) = thisvalue
Else
report_row.Item(col_rowno) = Member_DS.Tables(0).Rows(rowno).Item(colno)
If col_widths(col_rowno) < this_width Then
col_widths(col_rowno) = this_width
End If
End If
End If
Next
Next
report_dt.Rows.Add(report_row)