Hi
I am looking for a alternative to using the Word object model, and you guys seem the best solution. I am updating documents from a ASP.Net
page, updating document properties and then inserting data from datagrids into tables in the document. I was just wondering how I would do this in Aspose.
Here is my code that I use with the Word object model:
Dim blnProj As Boolean
blnProj = False
For k As Integer = (K2grdSol1TangibleBenefits.Items.Count - 1) To 0 Step -1
Dim item As DataGridItem
item = K2grdSol1TangibleBenefits.Items(k)
If blnProj = True Then
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenRow”)
lobjWordApp.Selection.Paste()
End If
’Copy Table 1st
If blnProj = False Then
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenRow”)
lobjWordApp.Selection.Copy()
End If
blnProj = True
objectives = objectives & item.Cells(0).Text & ","
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenDescr”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(0).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenInitVal”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(1).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenProjVal”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(2).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenPercChange”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(3).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenDescM”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(4).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenVar1”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(5).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenVar2”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(6).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenVar3”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(7).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenRespP1”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(8).Text)
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenRealiseD”)
lobjWordApp.Selection.TypeText(Text:=item.Cells(9).Text)
Next
lobjWordApp.Selection.GoTo(What:=wdGoToBookmark, Name:=“TBenRow”)
lobjWordApp.Selection.PasteAppendTable()
This is fairly critical to the system, and I don’t really want to be do this through XML,
which would be nearly impossible in a complex document like the ones I am updating.