quinta-feira, 10 de julho de 2014

Remover hide-when de documentos com campo richtext utilizando xsl

Option Public
Option Declare

Const CONST_XSL = {

   

   
   
       
           
       

   

   
   
   

 
}
Sub Initialize
    On Error GoTo ErrorHandler
   
    Dim S As New NotesSession
    Dim t_dbThis As NotesDatabase
    Set t_dbThis = S.Currentdatabase
   
    Dim t_nstXSLT As NotesStream
    Set t_nstXSLT = S.CreateStream()
    'Call t_nstXSLT.Open("c:\dados\removehiderichtext.xsl", "UTF-8")
   
    Call t_nstXSLT.Writetext(CONST_XSL)
    t_nstXSLT.Position = 0
   
    Dim t_ndeSource As NotesDXLExporter
    Set t_ndeSource = S.Createdxlexporter()
    Dim t_nclSource As NotesNoteCollection
    Set t_nclSource = t_dbThis.Createnotecollection(false)
    t_nclSource.Selectdocuments = True
    '// REALIZEI UM FILTRO PARA OS DOCUMENTOS COM O FORMULÁRIO QUE DESEJO ALTERAR
    t_nclSource.Selectionformula = |@Contains(@LowerCase(Form);"fo_docrichtext")|
    Call t_nclSource.BuildCollection()
    Call t_ndeSource.setInput(t_nclSource)
   
    Dim t_ndiDest As NotesDXLImporter
    Set t_ndiDest = S.Createdxlimporter()
    Call t_ndiDest.setOutput(t_dbThis)

    t_ndiDest.Documentimportoption= DXLIMPORTOPTION_REPLACE_ELSE_IGNORE
   
    Dim t_xslTransformer As NotesXSLTransformer
    Set t_xslTransformer = S.Createxsltransformer()
    Call t_xslTransformer.SetStyleSheet(t_nstXSLT)
   
    Call t_ndeSource.Setoutput(t_xslTransformer)
    Call t_ndiDest.Setinput(t_xslTransformer)
   
    Call t_ndeSource.Process()   

    Exit Sub
ErrorHandler:
    Dim t_strError As String
    t_strError = Error & ": " & Err()
    MsgBox t_strError
   
    If Not t_ndeSource Is Nothing Then
        Dim t_nosError As NotesStream
        Set t_nosError = S.Createstream()
        Call t_nosError.open("C:\dados\Error.xml", "UTF-8")
        Call t_nosError.Writetext(t_ndeSource.Log)
        Call t_nosError.Close()
    End If
    Exit sub
End Sub

Nenhum comentário:

Postar um comentário