Bonjour
Je suis en train de faire un tableau dans un dichier word à travers vb.net.
J'ai reussi à le faire mais le problème c'est que les traits entres les lignes et entre les colonnes n'existent pas. comment je peux les afficher pour rendre le tableau plus clair.
avez-vous une idée?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Imports System.Drawing.Printing
Imports Microsoft.Office.Interop
Imports Word = Microsoft.Office.Interop.Word
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim tbl As Word.Table
Dim oPara1 As Word.Paragraph, oPara2 As Word.Paragraph
Dim oPara3 As Word.Paragraph
oWord = CreateObject("Word.Application")
oWord.Visible = True
oDoc = oWord.Documents.Add
'Insert a paragraph at the beginning of the document.
oPara1 = oDoc.Content.Paragraphs.Add
oPara1.Range.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphLeft
oPara1.Range.Font.Name = "Andalus"
oPara1.Range.Font.Size = 6
oPara1.Range.Text = "............."
oPara1.Format.SpaceAfter = 4
oPara1.Range.InsertParagraphAfter()
'reste du code
tbl = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, r, 10)
tbl.Range.Font.Size = 8
tbl.Range.Font.Name = "Verdana"
tbl.ApplyStyleFirstColumn = True
tbl.ApplyStyleLastColumn = True
tbl.ApplyStyleLastRow = True |
j'ai essayé ces lignes de code mais une erreur s'affiche à chaque fois.
1 2
|
tbl.Range.Style = BorderStyle.FixedSingle |
tbl.Style = "Table Grid 7"
tbl.Cell(1, 1).Range.Style = BorderStyle.FixedSingle
J'ai besoin de votre aide, c'est urgent.
Merci d'avance.
Partager