Please excuse the base level of this question. I am a newbie and seem to be having a problem getting two different fonts inside the same cell.
I am working in Migradoc and Visual Basic Express 2010 on Windows XP
My goal for this portion is to have a table with 2 columns. The first column is just a incremental number and the second has multiple lines with each line different bold, bold italics, size....font can stay the same. I only have a few lines at the moment for testing purposes.
As a side question is it possible to only have a border line on the bottom of the cells?
Here is a simplified sample of what I want
Line 1 Text, small Font, not bold
Line 2 Text, larger Font, Bold Italics
1 Line 3 Text, Large Font, Bold
Line 4 Text, smaller Font, not bold
Line 5 Text, tiny font, not bold
Line drawing at the bottom of the fifth line
Code:
' Create a new MigraDoc document
Dim document As Document = New Document
' Add a section to the document
Dim section As Section = document.AddSection
Dim style As Style = document.Styles("Normal")
' Because all styles are derived from Normal, the next line changes the
' font of the whole document. Or, more exactly, it changes the font of
' all styles and paragraphs that do not redefine the font.
style.Font.Name = "Arial"
Dim agstyle
agstyle = document.Styles.AddStyle("agstyle", "Normal")
agstyle.Font.Size = 8
agstyle.Font.Bold = False
Dim clstyle
clstyle = document.Styles.AddStyle("clstyle", "Normal")
clstyle.Font.Size = 9
clstyle.Font.Bold = True
' Add a paragraph to the section
Dim paragraph As Paragraph = section.AddParagraph
paragraph.Format.Alignment = ParagraphAlignment.Center
paragraph.AddFormattedText("1080", TextFormat.Bold)
paragraph = section.AddParagraph
paragraph.AddFormattedText("Dub Work Order", TextFormat.Bold)
paragraph.Format.Alignment = ParagraphAlignment.Center
' Create the item table
Dim table As MigraDoc.DocumentObjectModel.Tables.Table
table = section.AddTable
table.Style = "Table"
'table.Borders.Color = TableBorder
'table.Borders.Width = 0.25
'table.Borders.Left.Width = 0.5
'table.Borders.Right.Width = 0.5
'table.Rows.LeftIndent = 0
Dim column As MigraDoc.DocumentObjectModel.Tables.Column = table.AddColumn("1cm")
column.Format.Alignment = ParagraphAlignment.Center
column = table.AddColumn("10cm")
column.Format.Alignment = ParagraphAlignment.Left
Dim row As MigraDoc.DocumentObjectModel.Tables.Row = table.AddRow
row.HeadingFormat = True
row.Format.Alignment = ParagraphAlignment.Center
row.Format.Font.Bold = True
'row.Shading.Color = TableBlue
Dim cnt = 0
For x = 0 To ListBox1.Items.Count - 1
cnt = x + 1
row = table.AddRow
row.Cells(0).AddParagraph(cnt)
row.Cells(0).Format.Font.Bold = False
row.Cells(0).Format.Alignment = ParagraphAlignment.Center
row.Cells(0).VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center
' row.Cells(0).MergeDown = 4
row.Cells(1).AddParagraph(DataGridView1.Rows(x).Cells("Agency").FormattedValue)
row.Cells(1).Style = "agstyle"
'row.Cells(1).Format.Font.Bold = True
'row.Cells(1).Format.Font.Size = 8
row.Cells(1).Format.Alignment = ParagraphAlignment.Left
row.Cells(1).AddParagraph(DataGridView1.Rows(x).Cells("Client").FormattedValue)
row.Cells(1).Style = "clstyle"
Next
Return document
I assume I am making beginner mistakes, but no matter what I try the cell ends up with the same formatting for all lines
I appreciate any help you can give me,
Thanks
Joe Ogburn