D
David Ei
I used the video "Office 2003 Video: Building Managed Solutions Behind Word
2003 Documents" and the "Understanding the Word Object Model from a .Net
Developer's Perspective" from the Office SDK 3.0 to write a VB and C# program
that creates a Word document containing a table.
It worked fine until I installed Office Service Pack 2 and Update KB9074517
as recommended on the Office Update site. After this, the CodeBehind program
fails when launched from Visual Studio. No errors are shown, and breakpoints
at the beginning of the program are not hit. There are no errors in the event
logs, either.
I tried setting MS Word's security settings as low as possible, but it
didn't help (no store random number, Macro security = low, Trust all add-ins,
and trust access to VBA Projects).
The code I used is similar to that shown in the video, and worked fine until
I installed the SP. Any ideas?
Private Sub CreateTable()
ThisDocument.Range.Delete()
With ThisDocument.Range
.Font.Name = "Verdana"
.Font.Size = 16
.InsertBefore("Sales by Category")
.InsertParagraphAfter()
.InsertParagraphAfter()
End With
'Dim tableRange As Word.Range =
ThisDocument.Range(ThisDocument.Characters.Count, 0);
Dim tableRange As Word.Range = ThisDocument.Range(0, 0)
ThisDocument.Tables.Add(Range:=tableRange, NumRows:=1, NumColumns:=2)
With ThisDocument.Tables.Item(1)
.Range.Font.Size = 10
.Style = "Table Grid 8"
.ApplyStyleFirstColumn = False
.ApplyStyleLastColumn = False
.ApplyStyleLastRow = False
With .Cell(1, 1).Range
.Text = "Category"
.Font.Bold = True
End With
With .Cell(1, 2).Range
.Text = "Total Quantity"
.Font.Bold = True
End With
End With
End Sub
Private Sub FillTable()
Dim tbl As Word.Table = ThisDocument.Tables(1)
Dim i As Integer = 2
While i < 4
tbl.Rows.Add()
tbl.Cell(i, 1).Range.Text = i.ToString()
tbl.Cell(i, 2).Range.Text = (i + 1).ToString()
i += 1
End While
End Sub
2003 Documents" and the "Understanding the Word Object Model from a .Net
Developer's Perspective" from the Office SDK 3.0 to write a VB and C# program
that creates a Word document containing a table.
It worked fine until I installed Office Service Pack 2 and Update KB9074517
as recommended on the Office Update site. After this, the CodeBehind program
fails when launched from Visual Studio. No errors are shown, and breakpoints
at the beginning of the program are not hit. There are no errors in the event
logs, either.
I tried setting MS Word's security settings as low as possible, but it
didn't help (no store random number, Macro security = low, Trust all add-ins,
and trust access to VBA Projects).
The code I used is similar to that shown in the video, and worked fine until
I installed the SP. Any ideas?
Private Sub CreateTable()
ThisDocument.Range.Delete()
With ThisDocument.Range
.Font.Name = "Verdana"
.Font.Size = 16
.InsertBefore("Sales by Category")
.InsertParagraphAfter()
.InsertParagraphAfter()
End With
'Dim tableRange As Word.Range =
ThisDocument.Range(ThisDocument.Characters.Count, 0);
Dim tableRange As Word.Range = ThisDocument.Range(0, 0)
ThisDocument.Tables.Add(Range:=tableRange, NumRows:=1, NumColumns:=2)
With ThisDocument.Tables.Item(1)
.Range.Font.Size = 10
.Style = "Table Grid 8"
.ApplyStyleFirstColumn = False
.ApplyStyleLastColumn = False
.ApplyStyleLastRow = False
With .Cell(1, 1).Range
.Text = "Category"
.Font.Bold = True
End With
With .Cell(1, 2).Range
.Text = "Total Quantity"
.Font.Bold = True
End With
End With
End Sub
Private Sub FillTable()
Dim tbl As Word.Table = ThisDocument.Tables(1)
Dim i As Integer = 2
While i < 4
tbl.Rows.Add()
tbl.Cell(i, 1).Range.Text = i.ToString()
tbl.Cell(i, 2).Range.Text = (i + 1).ToString()
i += 1
End While
End Sub