Altova StyleVision Server 2024

Este ejemplo muestra cómo usar código Visual Basic para generar un archivo RTF de salida con un archivo PXF y un archivo XML de entrada.

 

Antes de empezar a probar el ejemplo, compruebe que cumple con estos requisitos:

 

StyleVision Server está instalado y tiene asignada una licencia válida.

Su proyecto de Visual Studio incluye una referencia al DLL de StyleVision Server.

 

Option Explicit On

 

Module Program

 

  Sub Main()

 

      Try

          'Create a StyleVision Server object

          Dim objSVS As Altova.StyleVisionServer.Server = New Altova.StyleVisionServer.Server

 

          'Set a working directory - used for output and for intermediate files

           'objSVS.WorkingDirectory = "C:\Program Files (x86)\Altova\MapForceServer2020\etc\Examples"

           objSVS.WorkingDirectory = "..\..\.."

 

          'Default path to the StyleVision Server executable is the installation path (same dir with the StyleVisionServer.dll)

           'In case you moved the binaries on the disk, you need to explicitly set the path to the .exe file

           'objSVS.ServerPath = "C:\Program Files (x86)\Altova\StyleVisionServer2020\bin\StyleVisionServer.exe"

           'objSVS.ServerPath = "C:\Program Files\Altova\StyleVisionServer2020\bin\StyleVisionServer.exe"

 

          'Prepare the name of the working XML

           '    This can be an absolute/relative path if the file is stored externally (not inside PXF)

           ' objSVS.InputXML = "ExpReport.xml"

           '    Or it can contain the path INSIDE the PXF

           objSVS.InputXML = "ExpReport.pxf|zip\ExpReport.xml"

          '    Easiest way is to refer to the file as being embedded in the transformation file

           ' objSVS.InputXML = "altova://packagedfile/ExpReport.xml"

 

           'Add output paths (absolute or relative to WorkingDirectory) for all formats that should be generated

           objSVS.OutputRTF = "C:\tmp\ExpReport.rtf"

           objSVS.OutputPDF = "C:\tmp\ExpReport.pdf"

           objSVS.OutputHTML = "C:\tmp\ExpReport.html"

 

          'Prepare the parameters, if your design uses parameters

           'objSVS.AddParameter( "testparam1", "value 1" )

 

           ' Run the transformation; the output will be stored at C:\temp

          If (objSVS.Generate("ExpReport.pxf")) Then

               System.Console.WriteLine(objSVS.LastExecutionMessage)

               System.Console.WriteLine("Success - finished execution")

          Else

               System.Console.WriteLine(objSVS.LastExecutionMessage)

          End If

 

      Catch ex As Exception

           System.Console.WriteLine("Internal Error - " & ex.Message())

      End Try

 

  End Sub

 

End Module

 

© 2018-2024 Altova GmbH