1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Private Function GetVersion() As String
Dim strVersion As String = ""
Dim oCustProp As DSOFile.CustomProperty
Dim m_oDocument As DSOFile.OleDocumentPropertiesClass = New DSOFile.OleDocumentPropertiesClass
Try
m_oDocument.Open(CheminCompletBdd, True, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess)
For Each oCustProp In m_oDocument.CustomProperties
If oCustProp.Type <> DSOFile.dsoFilePropertyType.dsoPropertyTypeUnknown Then
If Not oCustProp.Name Is Nothing Then
If oCustProp.Name.ToUpper = PROPRIETE_DSO_VERSION Then
strVersion = oCustProp.Value
End If
End If
End If
Next oCustProp
m_oDocument.Close(False)
Catch ex As Exception
My.Application.Log.WriteEntry(Now & "-" & ex.Message & vbCrLf & ex.StackTrace)
End Try
Return strVersion
End Function
Private Sub SetVersion(pStrVersion As String)
Dim m_oDocument As DSOFile.OleDocumentPropertiesClass = New DSOFile.OleDocumentPropertiesClass
m_oDocument.Open(CheminCompletBdd, False, DSOFile.dsoFileOpenOptions.dsoOptionDefault)
Try
m_oDocument.CustomProperties(PROPRIETE_DSO_VERSION).Value = pStrVersion
Catch e As Exception
m_oDocument.CustomProperties.Add(PROPRIETE_DSO_VERSION, pStrVersion)
End Try
m_oDocument.Save()
m_oDocument.Close(False)
End Sub |