Ciao a tutti, mediante questo codice genero una tabella word...
Il problema consiste nel fatto che tale tabella non ha nessuno stile, e va impostato manualmente...codice:Imports Word = Microsoft.Office.Interop.Word Public Class Form1 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 oTable As Word.Table Dim oPara1 As Word.Paragraph, oPara2 As Word.Paragraph Dim oPara3 As Word.Paragraph, oPara4 As Word.Paragraph Dim oRng As Word.Range Dim oShape As Word.InlineShape Dim oChart As Object Dim Pos As Double 'Start Word and open the document template. oWord = CreateObject("Word.Application") oWord.Visible = True oDoc = oWord.Documents.Add 'Insert a 5 x 2 table, fill it with data, and change the column widths. oTable = oDoc.Tables.Add(oDoc.Bookmarks.Item("\endofdoc").Range, 5, 2) oTable.Range.ParagraphFormat.SpaceAfter = 6 For r = 1 To 5 For c = 1 To 2 oTable.Cell(r, c).Range.Text = "r" & r & "c" & c Next Next oTable.Columns.Item(1).Width = oWord.InchesToPoints(2) 'Change width of columns 1 & 2 oTable.Columns.Item(2).Width = oWord.InchesToPoints(3) Me.Close() End Sub End Class
Vorrei sapere: come faccio da codice ad impostare lo stile alla tabella?
Un'altra cosa: sempre da codice, come posso passare alla pagina successiva del file di word?
Grazie mille a tutti...![]()

Rispondi quotando