EDN Admin
Well-known member
<span id="x_result_box" lang="en <span>Imports Word = Microsoft.Office.Interop.Word<br/>
Public Class Form1<br/>
<br/>
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load<br/>
Dim a As String = My.Resources.<span id="x_result_box" lang="en <span>Animals<br/>
<span id="x_result_box" lang="en <span> Dim b As String() = a.Split(vbNewLine)<br/>
ListBox1.Items.AddRange(b)<br/>
End Sub<br/>
<br/>
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click<br/>
Dim WordApp As Word.Application = CreateObject("Word.Application")<br/>
<br/>
Novi word dokument<br/>
Dim WordDoc As Word.Document = WordApp.Documents.Add()<br/>
WordApp.Visible = True<br/>
Dim Tabela1 As Word.Table = WordDoc.Tables.Add(WordDoc.Bookmarks.Item("endofdoc").Range, 3, 4)<br/>
Tabela1.Range.ParagraphFormat.SpaceAfter = 0<br/>
Font u tabeli<br/>
Tabela1.Range.Font.Size = 15<br/>
Tabela1.Range.Font.Name = "Arial"<br/>
<br/>
Dim array2D(ListBox1.Items.Count - 1, 3) As String<br/>
For x As Integer = 0 To ListBox1.Items.Count - 1<br/>
Dim fields() As String = ListBox1.Items(x).ToString.Split(" "c)<br/>
array2D(x, 0) = fields(0)<br/>
array2D(x, 1) = fields(1)<br/>
array2D(x, 2) = fields(2)<br/>
array2D(x, 3) = fields(3)<br/>
<br/>
Tabela1.Cell(fields(0), 1).Range.Text = fields(0)<br/>
Tabela1.Cell(fields(0), 2).Range.Text = fields(1)<br/>
Tabela1.Cell(fields(0), 3).Range.Text = fields(2)<br/>
Tabela1.Cell(fields(0), 4).Range.Text = fields(3)<br/>
<br/>
Next<br/>
With Tabela1<br/>
.Style = "Table Grid"<br/>
End With<br/>
<br/>
End Sub<br/>
End Class<br/>
<img src="http://social.microsoft.com/Forums/getfile/46364/" alt=" <br/>
<span>
View the full article
Public Class Form1<br/>
<br/>
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load<br/>
Dim a As String = My.Resources.<span id="x_result_box" lang="en <span>Animals<br/>
<span id="x_result_box" lang="en <span> Dim b As String() = a.Split(vbNewLine)<br/>
ListBox1.Items.AddRange(b)<br/>
End Sub<br/>
<br/>
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click<br/>
Dim WordApp As Word.Application = CreateObject("Word.Application")<br/>
<br/>
Novi word dokument<br/>
Dim WordDoc As Word.Document = WordApp.Documents.Add()<br/>
WordApp.Visible = True<br/>
Dim Tabela1 As Word.Table = WordDoc.Tables.Add(WordDoc.Bookmarks.Item("endofdoc").Range, 3, 4)<br/>
Tabela1.Range.ParagraphFormat.SpaceAfter = 0<br/>
Font u tabeli<br/>
Tabela1.Range.Font.Size = 15<br/>
Tabela1.Range.Font.Name = "Arial"<br/>
<br/>
Dim array2D(ListBox1.Items.Count - 1, 3) As String<br/>
For x As Integer = 0 To ListBox1.Items.Count - 1<br/>
Dim fields() As String = ListBox1.Items(x).ToString.Split(" "c)<br/>
array2D(x, 0) = fields(0)<br/>
array2D(x, 1) = fields(1)<br/>
array2D(x, 2) = fields(2)<br/>
array2D(x, 3) = fields(3)<br/>
<br/>
Tabela1.Cell(fields(0), 1).Range.Text = fields(0)<br/>
Tabela1.Cell(fields(0), 2).Range.Text = fields(1)<br/>
Tabela1.Cell(fields(0), 3).Range.Text = fields(2)<br/>
Tabela1.Cell(fields(0), 4).Range.Text = fields(3)<br/>
<br/>
Next<br/>
With Tabela1<br/>
.Style = "Table Grid"<br/>
End With<br/>
<br/>
End Sub<br/>
End Class<br/>
<img src="http://social.microsoft.com/Forums/getfile/46364/" alt=" <br/>
<span>
View the full article