automate export a report in pdf . is it possible?
Posted: Fri Apr 22, 2011 7:12 am
Hi Vladimir,
Unfortunately, lack of attachment in the topic ...
In the version I have just loaded does the issue as MDC, but the file is empty.
The second problem:
This is the command to be run:
I always use full paths. I run this command in a command prompt to work just fine. The output file is created and includes all that should be in it.
If I but the following command in the PHP language:
If ExportsFX started. In Task Manager the process is displayed. He hangs though. Also, the PHP - script hangs. Only when I finish the task in the Task Manager runs on the PHP script.
Now I have tried everything to solve a batch file. So the command written in a batch file and then this started. Same problem.
Apparently, the PHP exec command is not clear with the AIR application.
So I tried the same with the. NET programming libraries.
I developed a console application that does exactly what does ExportsFX.
This is the MYSQL included described how to access your website
This Solution works:
This is the VB - Code (BetaVersion):
Unfortunately, lack of attachment in the topic ...
In the version I have just loaded does the issue as MDC, but the file is empty.
The second problem:
This is the command to be run:
Code: Select all
C:/development/scriptcase/prod/reportengine/ExportsFX.exe report_file=C:/development/scriptcase/prod/templates/ugs_a4/ugs_a4.mrt export_file=C:/development/documents/UGS_A4.PDF export_format=PDF
If I but the following command in the PHP language:
Code: Select all
$execcommand = $docenginefolder."ExportsFX.exe report_file=$full_report_template export_file=$docfolder$document_key export_format=$format_key";
session_write_close();
$output = array();
$oExec = exec("$execcommand",$output, $exec_return);
PRINT_R( $output ); ECHO ("");FLUSH();
session_start();
Now I have tried everything to solve a batch file. So the command written in a batch file and then this started. Same problem.
Apparently, the PHP exec command is not clear with the AIR application.
So I tried the same with the. NET programming libraries.
I developed a console application that does exactly what does ExportsFX.
This is the MYSQL included described how to access your website
This Solution works:
This is the VB - Code (BetaVersion):
Code: Select all
Imports System
Imports Stimulsoft.Database
Imports Stimulsoft.Database.BaseMetadataProvider
Imports Stimulsoft.Database.StiMySqlMetadataProvider
Imports Stimulsoft.Report
Imports Stimulsoft.Report.Design
Imports Stimulsoft.Report.Export
Imports Stimulsoft.Report.Components
Module Module1
Public par_report_template As String
Public par_report_file As String
Public par_report_fmt As String
Public par_outfile As String
Public par_watermark As String
Public command As String
Public command_value As String
Public Connectionname As String
Public report As StiReport
Private Property generate_outfilename As String
' Aufruf
' ReportExport.exe -t= -OUT=]
' Parameter:
' -template= oder -t= Name der Reportvorlage *.mrt
' -OUT= oder -o= Name der Ausgabedate *.*
' -fmt= oder -f= Format der Ausgabedatei: MDC - Stimulsoft Dokumentdatei
' PDF - PDF Datei
' XLS - Excel Workbook
'
' Commands
' -watermark: oder -wm:
' setzt ein Wasserzeichen mit inhalt drehwinkel
'
Sub Main(ByVal args() As String)
StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlAdapterService())
StiConfig.Services.Add(New Stimulsoft.Report.Dictionary.StiMySqlDatabase())
If args.Count "" Then
set_watermark(par_watermark)
End If
export_report()
'report.Show()
End Sub
Sub set_watermark(ByVal watermarkstring As String)
Dim i As Integer
Dim watermark As StiWatermark = New StiWatermark()
watermark.Angle = 45
watermark.Text = watermarkstring
For i = 0 To report.Pages.Count - 1
report.Pages.Items(i).Watermark = watermark
Next i
End Sub
Sub create_report(ByVal filename As String)
load_report()
End Sub
Sub load_report()
report = New StiReport()
If My.Computer.FileSystem.FileExists(par_report_template) Then
report.Load(par_report_template)
End If
End Sub
Sub save_report()
report.Save(par_report_template)
End Sub
Function generate_outfile_name(ByVal outfilename As String, ByVal out_extension As String) As String
Dim filename As String
Dim s_drive As String
Dim s_pathname As String
Dim s_filename As String
Dim s_title As String
Dim s_suffix As String
SplitPath(outfilename, s_drive, s_pathname, s_filename, s_title, s_suffix)
filename = s_drive & s_pathname & s_title & "." & out_extension
generate_outfile_name = filename
End Function
Sub export_report()
Dim Filename As String
Console.WriteLine("Execute...")
Dim File As String
report.Render(False)
Filename = generate_outfile_name(par_report_file, par_report_fmt)
Console.WriteLine(Filename)
If par_report_fmt = "PDF" Then
report.ExportDocument(StiExportFormat.Pdf, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "HTML" Then
report.ExportDocument(StiExportFormat.HtmlTable, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "XLS" Then
report.ExportDocument(StiExportFormat.Excel, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "TXT" Then
report.ExportDocument(StiExportFormat.Text, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "RTF" Then
report.ExportDocument(StiExportFormat.RtfFrame, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "DOC" Then
report.ExportDocument(StiExportFormat.Word2007, Filename)
'System.Diagnostics.Process.Start(File)
ElseIf par_report_fmt = "MDC" Then
report.SaveDocument(Filename)
End If
End Sub
Sub SplitPath(ByVal Fullpath As String, ByRef Drive As String, ByRef Path As String, ByRef File As String, _
ByRef Title As String, ByRef Suffix As String)
Dim iPos As Long
'Laufwerk/Server bestimmen:
If Mid$(Fullpath, 2, 1) = ":" Then 'Laufwerk:
Drive = Left$(Fullpath, 2)
Fullpath = Mid$(Fullpath, 3)
ElseIf Left$(Fullpath, 2) = "\\" Then 'Server:
iPos = InStr(3, Fullpath, "\")
Drive = Left$(Fullpath, iPos - 1)
Fullpath = Mid$(Fullpath, iPos)
End If
'Pfad und Datei trennen:
For iPos = Len(Fullpath) To 1 Step -1
If Mid$(Fullpath, iPos, 1) = "\" Then Exit For
Next iPos
Path = Left$(Fullpath, iPos)
File = Mid$(Fullpath, iPos + 1)
'Dateiname und Suffix trennen:
For iPos = Len(File) To 1 Step -1
If Mid$(File, iPos, 1) = "." Then Exit For
Next iPos
If iPos Then
Title = Left$(File, iPos - 1)
Suffix = Mid$(File, iPos + 1)
Else
Title = File
Suffix = ""
End If
End Sub
Sub display_help()
Console.WriteLine(" Aufruf")
Console.WriteLine(" ReportExport.exe -t= -OUT=]")
Console.WriteLine(" Parameter:")
Console.WriteLine(" -template= oder -t= Name der Reportvorlage *.mrt")
Console.WriteLine(" -OUT= oder -o= Name der Ausgabedate *.*")
Console.WriteLine(" -fmt= oder -f= Format der Ausgabedatei: MDC - Stimulsoft Dokumentdatei")
Console.WriteLine(" PDF - PDF Datei")
Console.WriteLine(" XLS - Excel Workbook ")
Console.WriteLine(" ")
Console.WriteLine(" Commands ")
Console.WriteLine(" -watermark: oder -wm:")
Console.WriteLine(" setzt ein Wasserzeichen mit inhalt drehwinkel ")
End Sub
End Module