Function ReplaceDesign(TemplDB As NotesDatabase, TargetDB As NotesDatabase) As Integer
'''''''''''''''''''''''''''''''''''''
Const NOTE_CLASS_ICON_DEFAULT = &H8010 '*** icon default note
Const NOTE_CLASS_DESIGN_DEFAULT = &H8020 '*** icon default note _DEFAULT = &H8010 '*** icon default note
Const NOTE_CLASS= &H0003
Dim hNote As Long
Dim PathName As String * 256
Dim TargetPathName As String * 256
Dim retflag As Integer
''''''''''''''''''''''''''''''''''''''
Dim htemplate As Long
Dim htarget As Long
''''''''''''''''''''''''''''''''''''''
Dim DBDocPropTempl As NotesDocument
Dim DBDocPropTarget As NotesDocument
''''''''''''''''''''''''''''''''''''''
Call W32_OSPathNetConstruct("", TemplDB.Server, TemplDB.FilePath, PathName)
Call W32_OSPathNetConstruct("",TargetDB.Server, TargetDB.FilePath,TargetPathName)
Call W32_NSFDbOpen(PathName, htemplate)
If htemplate=0 Then Exit Function
Call W32_NSFDbOpen(TargetPathName, htarget)
If htarget=0 Then Exit Function
If TargetDB.GetDocumentByID("FFFF0020") Is Nothing Then
RetFlag = W32_NSFNoteCreate(htarget,hNote)
Call W32_NSFNoteSetInfo( hNote, NOTE_CLASS, NOTE_CLASS_DESIGN_DEFAULT)
RetFlag = W32_NSFNoteUpdate( hNote,0)
Call W32_NSFNoteClose( hNote)
End If
If TargetDB.GetDocumentByID("FFFF0010") Is Nothing Then
RetFlag = W32_NSFNoteCreate(htarget,hNote)
Call W32_NSFNoteSetInfo( hNote, NOTE_CLASS, NOTE_CLASS_ICON_DEFAULT)
RetFlag = W32_NSFNoteUpdate( hNote,0)
Call W32_NSFNoteClose( hNote)
End If
Call W32_DesignReplace(htemplate, htarget, 1, 1, 0, 0)
Call W32_NSFDbClose(htemplate)
Call W32_NSFDbClose(htarget)
' Заменили дизайн, переписываем документ со свойствами базы
Set DBDocPropTempl = TemplDB.GetDocumentByID("FFFF0010")
Set DBDocPropTarget = TargetDB.GetDocumentByID("FFFF0010")
Call DBDocPropTempl.CopyAllItems(DBDocPropTarget,True)
Call DBDocPropTarget.Save(True, False)
End Function