<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум компьютерной помощи &mdash; Выгрузка из lotus в Word]]></title>
	<link rel="self" href="http://itpmr.ru/extern.php?action=feed&amp;tid=896&amp;type=atom" />
	<updated>2015-03-13T14:55:04Z</updated>
	<generator>PunBB</generator>
	<id>http://itpmr.ru/viewtopic.php?id=896</id>
		<entry>
			<title type="html"><![CDATA[Re: Выгрузка из lotus в Word]]></title>
			<link rel="alternate" href="http://itpmr.ru/viewtopic.php?pid=124281#p124281" />
			<content type="html"><![CDATA[<p>Ссылка на базу:&nbsp; yadi.sk/d/JKYNi0JLfES6k</p>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>http://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-03-13T14:55:04Z</updated>
			<id>http://itpmr.ru/viewtopic.php?pid=124281#p124281</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выгрузка из lotus в Word]]></title>
			<link rel="alternate" href="http://itpmr.ru/viewtopic.php?pid=124280#p124280" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Function dispatch_object(obj As NotesEmbeddedObject, Byval s_dir$, s_file$) As Boolean
    &#039; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    &#039; выгрузка прикреплений и ole в указанный каталог с указанным именем файла
    On Error Goto ErrLab
    Dim FR As Boolean
    Dim handleV As Variant
    Dim s_ext$, s_tmp$
    
    If obj.Type = EMBED_ATTACHMENT Then
        obj.ExtractFile(s_dir + &quot;\&quot; + s_file)
    Elseif obj.Type = EMBED_OBJECT Then
        s_tmp = Lcase(obj.Class)
        If Instr(s_tmp, &quot;word&quot;) Then
            s_ext = &quot;.doc&quot;
        Elseif Instr(s_tmp, &quot;excel&quot;) Then
            s_ext = &quot;.xls&quot;
        Elseif Instr(s_tmp, &quot;powerpoint&quot;) Then
            s_ext = &quot;.ppt&quot;
        Elseif Instr(s_tmp, &quot;visio&quot;) Then
            s_ext = &quot;.vsd&quot;
        Else
            s_ext = &quot;&quot;
        End If
        Set handleV = obj.Activate( False )
        s_file = s_file + s_ext        &#039; Так может измениться расширение при записи
        Call handleV.SaveAs(s_dir + &quot;\&quot; + s_file)        
        Call handleV.Close
    End If
    FR = True
    
EndLab:
    dispatch_object = FR
    Exit Function
ErrLab:
    FR = False
    Goto EndLab
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>http://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-03-13T14:51:19Z</updated>
			<id>http://itpmr.ru/viewtopic.php?pid=124280#p124280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выгрузка из lotus в Word]]></title>
			<link rel="alternate" href="http://itpmr.ru/viewtopic.php?pid=124279#p124279" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Function copy_richtext(ws As NotesUIWorkspace, rtitm As NotesRichTextItem, Byval s_comment$, _
objApp As Variant, objDoc As Variant, Byval s_target_dir$) As Boolean
    &#039; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    
    &#039; копирование через буфер содержимого поля rtitm в заданный документ заданного приложения word (текст предваряется комментарием s_comment)
    &#039; выгрузка в указанный каталог всех прикреплений и ole из данного rtf-поля
    On Error Goto ErrLab
    Dim uid As NotesUIDocument
    Dim itm As NotesItem, doc As NotesDocument, obj As NotesEmbeddedObject
    Dim s_text$, s_file$
    Dim n_ole%
    Dim arEO As Variant
    Dim FR As Boolean
    Set doc = rtitm.Parent
    Call doc.ReplaceItemValue(&quot;Form&quot;, &quot;BODYFORM&quot;)
    Set uid = ws.EditDocument(False, doc, False, &quot;&quot;, True)
    On Error Resume Next
    Call uid.ExpandAllSections()
    On Error Goto ErrLab
    Call uid.SelectAll()
    Call uid.Copy        &#039; копируем в буфер
    Call uid.Close(True)
    &#039; добавляем разделитель документов
    With objApp.Application.Selection
        .TypeText(&quot;= = = = = = = = = = = = = = = = = = = = = = = = = = &quot;)
        .TypeParagraph
        If s_comment &lt;&gt; &quot;&quot; Then
            .Font.Bold = True
            .Font.Size = 20
            .TypeText(s_comment)
            .Font.Bold = False
            .Font.Size = 12
            .TypeParagraph
        End If
        .TypeText(&quot;= = = = = = = = = = = = = = = = = = = = = = = = = = &quot;)
        .TypeParagraph
    End With
    Call objApp.Application.Selection.PasteAndFormat(0)
    s_text = &quot;&quot;
    n_ole = 0
    On Error Resume Next
    arEO = rtitm.EmbeddedObjects
    On Error Goto ErrLab
    If Isarray(arEO) Then
        Forall o In rtitm.EmbeddedObjects
            Set obj = o
            If obj.Name = obj.Source Then
                s_file = obj.Source
            Else
                s_file = obj.Name + &quot;-&quot; + obj.Source
            End If
            If dispatch_object(obj, s_target_dir, s_file) Then
                Call objApp.Application.Selection.TypeParagraph
                Call objDoc.Hyperlinks.Add( objApp.Application.Selection.Range, s_file,&quot;&quot;,&quot;&quot;, &quot;Приложение: &quot; + s_file, &quot;&quot;)
            Else
                n_ole = n_ole + 1
            End If
        End Forall
        If n_ole &gt; 0 Then
            s_text = &quot;Имеется &quot; + Cstr(n_ole) + &quot; не выгруженных OLE-объектов&quot;
            With objApp.Application.Selection
                .TypeParagraph
                .TypeParagraph
                .Font.Color = 255
                .Font.Bold = True
                .Font.Size = 18
                .TypeText(s_text)
                .Font.Color = 0
                .Font.Bold = False
                .Font.Size = 12
            End With
        End If
        Erase arEO
    End If
    With objApp.Application.Selection
        .TypeParagraph
        .TypeParagraph
        .TypeParagraph
    End With
    FR = True
EndLab:
    copy_richtext = FR
    Exit Function
ErrLab:
    FR = False
    Goto EndLab
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>http://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-03-13T14:43:44Z</updated>
			<id>http://itpmr.ru/viewtopic.php?pid=124279#p124279</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Выгрузка из lotus в Word]]></title>
			<link rel="alternate" href="http://itpmr.ru/viewtopic.php?pid=124278#p124278" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>Function copy_richtext_collection(col As NotesDocumentCollection, Byval s_richtext_name$, Byval s_caption_formula$, Byval s_dir_name$, Byval s_file_name$)
    &#039; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    &#039; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    &#039; выгрузка rt-полей из заданной коллекции документов в заданный каталог с указанным именем
    
    On Error Goto ErrLab
    Dim ws As New NotesUIWorkspace
    Dim session As NotesSession
    Dim db As NotesDatabase
    Dim doc As NotesDocument, tmpdoc As NotesDocument
    Dim k%, n%
    Dim s_comm$
    Dim v_result As Variant
    Dim itm As NotesItem, rti As NotesRichTextItem
    Set db = col.Parent
    Set session = db.Parent
    Dim wdApp As Variant, wdDoc As Variant
    Set wdApp = CreateObject(&quot;Word.Application&quot;)        &#039; открыли Word
    If wdApp.Application.Visible Then
        Call wdApp.Application.Documents.Close
        wdApp.Application.Visible = False
    End If
    Call wdApp.Application.Documents.Add
    Set wdDoc = wdApp.Application.Documents(1)
    n = col.Count
    For k = 1 To n
        Set doc = col.GetNthDocument(k)
        If doc.HasItem(s_richtext_name) Then
            Set itm = doc.GetFirstItem(s_richtext_name)
            If const_rti_name &lt;&gt; s_richtext_name Then
                Set tmpdoc = New NotesDocument(db)
                Set itm = itm.CopyItemToDocument(tmpdoc, const_rti_name)
            End If
            If itm.Type = 1 Then
                Set rti = itm
                v_result = Evaluate(s_caption_formula, doc)
                If Isarray(v_result) Then
                    s_comm = v_result(0)
                    Erase v_result
                Else
                    s_comm = Cstr(v_result)
                End If
                Call copy_richtext(ws, rti, s_comm, wdApp, wdDoc, s_dir_name)
            End If
        End If
    Next k
    Call wdDoc.SaveAs(s_dir_name + &quot;\&quot; + s_file_name)        &#039; МОЖНО НАЗВАТЬ КАК ХОТИМ
    &#039;wdApp.Application.Visible = True
    Call wdApp.Application.Quit
    &#039;КОНЕЦ ПОДПРОГРАММЫ
EndLab:
    Exit Function
ErrLab:
    Msgbox &quot;Agent Sub copy_richtext_collection&quot; + Chr(13) _
    + &quot;Line &quot; + Cstr(Erl) + Chr(13) _
    + &quot;Error &quot; + Cstr(Err) + Chr(13) _
    + Error
    Goto EndLab
End Function</code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>http://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-03-13T14:39:23Z</updated>
			<id>http://itpmr.ru/viewtopic.php?pid=124278#p124278</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Выгрузка из lotus в Word]]></title>
			<link rel="alternate" href="http://itpmr.ru/viewtopic.php?pid=124277#p124277" />
			<content type="html"><![CDATA[<p>Код агента, который получает документ с вьюхи и сохраняет его на диск в папочку.<br />В документе могут быть вложения.<br />На форме TEST есть поле Body&nbsp; типа RichText.</p><br /><div class="codebox"><pre><code>Sub Initialize
    On Error Goto ErrLab
    Dim sess As New NotesSession
    Dim db As NotesDatabase
    Dim col As NotesDocumentCollection
    Dim doc As NotesDocument, tmpdoc As NotesDocument
    Dim k%, n%
    Dim s_rti_name$, s_target_dir$
    Set db = sess.CurrentDatabase
    Set col = db.UnprocessedDocuments
    s_target_dir = Inputbox$(&quot;Введите существующий каталог для выгрузки&quot;, &quot;Ввод данных&quot;, &quot;C:\temp&quot;)
    If s_target_dir = &quot;&quot; Then Exit Sub
    s_rti_name = &quot;Body&quot;
    
    Call copy_richtext_collection(col, s_rti_name, {&quot;Выгрузка &quot;+DocID1+TechTask+Subject}, s_target_dir, &quot;Documentation.doc&quot;)
    
EndLab:
    Exit Sub
ErrLab:
    Msgbox &quot;Line &quot; + Cstr(Erl) + &quot;, Error &quot; + Cstr(Err) + Chr(13) + Error
    Goto EndLab
End Sub</code></pre></div>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>http://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2015-03-13T14:34:57Z</updated>
			<id>http://itpmr.ru/viewtopic.php?pid=124277#p124277</id>
		</entry>
</feed>
