I'm developing a word application with cached data. The application can
modify the data with the cached attribute. When I save the document the data
seems to be updated, but if i close and reopen the document I got an old
version of the cached data.
For example I create a VSTO Word Project with a string with the cached
attribute. In the Startup event I save the document and in the BeforeSave
event I increment the data and show it. Like the code shown below:
Public Class ThisDocument
<Cached()> Public TestString As String
Private Sub ThisDocument_BeforeSave(ByVal sender As Object, ByVal e As
Microsoft.Office.Tools.Word.SaveEventArgs) Handles Me.BeforeSave
If TestString Is Nothing Then
TestString = "1"
Else
TestString = (CInt(TestString) + 1).ToString
End If
MsgBox(TestString)
End Sub
Private Sub ThisDocument_Startup(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Startup
Me.Save()
End Sub
Private Sub ThisDocument_Shutdown(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Shutdown
End Sub
End Class
If I open, close, reopen, reclose,... the word document the data shown is
correct.
But if I Save the document from word, the data seems to be correct, when i
close the document and reopen it the data is obsolete.
Can anyone help me?
Thanks in advanced,
Marchionni Daniele
Marchionni Daniele - 22 May 2006 14:33 GMT
I try to explain better.
The data with cahced attribute in a SmartDoc aren't saved after a call to
Document.Save().
They are saved the first time I call Save but not anymore after, even
using Ctrl-S or File/Save.
The content of the document is saved in all cases.
Regards.