M
MaksK
В lotus Notes есть кнопка которая импортирует файлы doc и автоматически заполняет поля карточки информацией с этого файла. Сейчас в организации сделали новый сайт с новой формой(в которой отличаются название полей),с которого и приходил эти файлы doc. После этого авто заполнение полей работать перестало. Где то в коде я так понял нужно поменять название полей.
В прикрепленных файлах есть старый и новый образец doc файла
Может кто нибудь сможет помочь.
Вот код который отвечает за авто заполнение я так понял:
<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">"код"</div></div><div class="sp-body"><div class="sp-content">
В прикрепленных файлах есть старый и новый образец doc файла
Может кто нибудь сможет помочь.
Вот код который отвечает за авто заполнение я так понял:
<div class="sp-wrap"><div class="sp-head-wrap"><div class="sp-head folded clickable">"код"</div></div><div class="sp-body"><div class="sp-content">
Код:
Function ProcessFile As String
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Dim WordObj As Variant, WordDoc As Variant, myRange As Variant
Dim ContentofFile As String, ContentofFile1 As String, Macros As String, Result As Variant, Pos As Integer
Dim fileNum1 As Integer
Dim OutFiles As String
On Error 101 Goto FileNotFound
Set WordObj = CreateObject("Word.Application.8")
WordObj.Documents.Open pathName & fileName
Set WordDoc = WordObj.Documents(1)
WordObj.Visible = True
Set myRange = WordDoc.Content
ContentofFile = myRange.Text
WordObj.Quit
OutFiles = ""
Set doc = db.CreateDocument
Set rtitem = New NotesRichTextItem( doc, "TextRez" )
Set object = rtitem.EmbedObject (EMBED_ATTACHMENT, "", pathName & fileName)
tmp = Trim(Strleft(ContentofFile, "--=="))
tmp = Trim(Strright(tmp, "Файлы:"))
Result = Split(tmp, ",")
fileNum1% = Freefile()
Forall x In Result
If Trim(x) = "<none>" Or x = "" Then Exit Forall
tmp = Strleftback(fileName, ".") + "_"
x = Trim(x)
If Mid(x, Len(x), 1) = Chr(10) Or Mid(x, Len(x), 1) = Chr(13) Then x = Left(x, Len(x)-1)
Macros = pathName + tmp + x
Open Macros For Input As fileNum1%
If Macros <> "" Then
Set object = rtitem.EmbedObject (EMBED_ATTACHMENT, "", Macros)
Close fileNum1%
If OutFile = "" Then
OutFile = OutFile + tmp + x
Else
OutFile = OutFile + "," + tmp + x
End If
fileNum1% = Freefile()
End If
End Forall
doc.Form = "Карточка электр."
doc.ExecuterSub = "ExecuteLogic"
doc.TypeDoc = "Входящий"
doc.VidDoc = "ЭЛЕКТРОННОЕ ОБРАЩЕНИЕ"
doc.WorkflowObject = "Новые электронные обращения, требующие внимания"
Call doc.ReplaceItemValue ("StatusE", "Новый")
Call doc.ReplaceItemValue ("StatusNew", 1)
Call doc.ReplaceItemValue ("InputNum", 0)
tmp = Fulltrim(Strleft(ContentofFile, "Кому:"))
tmp = Fulltrim(Strright(tmp, "От:"))
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
doc.Adress_2 = tmp
tmp = Fulltrim(Strleft(ContentofFile, "Тема:"))
tmp = Fulltrim(Strright(tmp, "Написано:"))
Macros = {@ReplaceSubstring("} + tmp + {"; "," : " г." : " января " : " февраля " : " марта " : " апреля " : " мая " : " июня " : " июля " : " августа " : " сентября " : " октября " : " ноября " : " декабря "; "" : "" : ".01." : ".02." : ".03." : ".04." : ".05." : ".06." : ".07." : ".08." : ".09." : ".10." : ".11." : ".12.")}
result = Evaluate(Macros, doc)
tmp = Trim(result(0))
doc.InputDate = Cdat(Today)
If tmp <> "" Then
doc.OutDate1 = Cdat(tmp)
tmp = Fulltrim(Strleft(ContentofFile, "Файлы:"))
If tmp = "" Then tmp = Fulltrim(Strleft(ContentofFile, "--="))
tmp = Fulltrim(Strright(tmp, "Тема:"))
Macros = {@ReplaceSubstring("} + tmp + {"; "[Обратная связь] "; "")}
result = Evaluate(Macros, doc)
tmp = Trim(result(0))
doc.Body1 = tmp
End If
ContentofFile1 = Trim(Strleft(ContentofFile, "Текст обращения:"))
If ContentofFile1 <> "" Then
tmp = Fulltrim(Strright(ContentofFile, "Текст обращения:"))
If Len(tmp) > 13000 Then tmp = Left(tmp, 12997) + "..."
doc.Body = tmp
Pos = Instr(1, ContentofFile1, "Наименование юр. лица:")
If Pos = 0 Then
Pos = Instr(1, ContentofFile1, "ФИО:")
If Pos <> 0 Then
tmp = Fulltrim(Strleft(ContentofFile1, "Почтовый адрес:"))
tmp = Fulltrim(Strright(tmp, "ФИО:"))
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
doc.NewFrom1_ = tmp
doc.NameChief = tmp
tmp = Fulltrim(Strleft(ContentofFile1, "Адресат:"))
tmp = Fulltrim(Strright(tmp, "Почтовый адрес:"))
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
doc.Adress = tmp
' tmp = Trim(Strright(ContentofFile1, "Адресат:"))
' Macros = {@ReplaceSubstring("} + tmp + {"; """; @Char(34) )}
' result = Evaluate(Macros, doc)
' tmp = Trim(result(0))
' doc.CommOtm = tmp
End If
Else
tmp = Fulltrim(Strleft(ContentofFile1, "ФИО руководителя/ уполн. лица:"))
tmp = Fulltrim(Strright(tmp, "Наименование юр. лица:"))
Macros = {@ReplaceSubstring("} + tmp + {"; """; @Char(34) )}
result = Evaluate(Macros, doc)
tmp = Trim(result(0))
doc.NewFrom1_ = tmp
tmp = Fulltrim(Strleft(ContentofFile1, "Почтовый адрес юр. лица:"))
tmp = Fulltrim(Strright(tmp, "ФИО руководителя/ уполн. лица:"))
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
doc.NameChief = tmp
tmp = Fulltrim(Strleft(ContentofFile1, "Адресат:"))
tmp = Fulltrim(Strright(tmp, "Почтовый адрес юр. лица:"))
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
If Mid(tmp, Len(tmp), 1) = Chr(10) Or Mid(tmp, Len(tmp), 1) = Chr(13) Then tmp = Left(tmp, Len(tmp)-1)
tmp = Fulltrim(tmp)
doc.Adress = tmp
' tmp = Trim(Strright(ContentofFile1, "Адресат:"))
' Macros = {@ReplaceSubstring("} + tmp + {"; """; @Char(34) )}
' result = Evaluate(Macros, doc)
' tmp = Trim(result(0))
' doc.CommOtm = tmp
End If
Else
tmp = Fulltrim(Strright(ContentofFile, "--=="))
If Len(tmp) > 13000 Then tmp = Left(tmp, 12997) + "..."
doc.Body = tmp
End If
Call doc.Save(True, False)
ProcessFile = OutFile
Exit Function
FileNotFound :
Macros = ""
Resume Next
End Function