automate export a report in pdf . is it possible?

Stimulsoft Reports.PHP discussion
chopper64
Posts: 26
Joined: Mon Dec 20, 2010 2:33 am
Location: Berlin

automate export a report in pdf . is it possible?

Post by chopper64 »

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:

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
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:


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();
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):

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

Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

automate export a report in pdf . is it possible?

Post by Vladimir »

Hello,
Unfortunately, lack of attachment in the topic ...
In the version I have just loaded does the issue as MDC, but the file is empty.
Sorry. Please see the attached archive in this post.

The second problem:
We will make tests on our PHP server and try to solve the problem.


Thank you.

Attachments
938.ExportsFx.zip
(2.63 MiB) Downloaded 885 times
chopper64
Posts: 26
Joined: Mon Dec 20, 2010 2:33 am
Location: Berlin

automate export a report in pdf . is it possible?

Post by chopper64 »

Hi Vladimir,

Fine, I'll wait and see. But basically, you have me already won. In the first week of May I will show my boss my development and he recommended your system purchase.
I will use your ExportFX not there, but my VB development. I realize that we have to buy. NET components ... But compared to Crystal Reports, these are acceptable losses ...
Why did you develop your ExportFX actually for AIR? Are there any reasons that can get it wrong, my NET development?
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

automate export a report in pdf . is it possible?

Post by Vladimir »

Hello,

For .NET developers we have a Stimulsoft Reports product line. If you use this product, you can export reports using the code in your application, there is no need to run a separate utility for this.

Thank you.
chopper64
Posts: 26
Joined: Mon Dec 20, 2010 2:33 am
Location: Berlin

automate export a report in pdf . is it possible?

Post by chopper64 »

I create my MRT files ReportFX. This works quite fine.
Since I need a server-side export I have a NET console application to do this.
Until the last update of the PHP component everything went well.
But now I get the following error when calling font versions (false) by report.render:

Code: Select all

C:\Users\Kiehnscherf>c:/development/scriptcase/prod/reportengine/ReportExport.ex
e -t=C:/development/scriptcase/prod/templates/UGS_ASM/UGS_ASM.mrt -o=C:/data/sds
/dokumente/WGJ_UGS_ASM_1(0) -f=MDC -wm=Vorabausdruck

ReportTemplate: C:/DEVELOPMENT/SCRIPTCASE/PROD/TEMPLATES/UGS_ASM/UGS_ASM.MRT
ReportFile    : C:/DATA/SDS/DOKUMENTE/WGJ_UGS_ASM_1(0)
ReportFormat  : MDC
Watermark     : VORABAUSDRUCK
Execute...

Unbehandelte Ausnahme: System.FormatException: GUID muss 32 Ziffern mit 4 Bindestrichen enthalten (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
   bei System.Guid.TryParseGuidWithNoStyle(String guidString, GuidResult& result)
   bei System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
   bei System.Guid..ctor(String g)
   bei MySql.Data.Types.MySqlGuid.MySql.Data.Types.IMySqlValue.ReadValue(MySqlPacket packet, Int64 length, Boolean nullVal)
   bei MySql.Data.MySqlClient.NativeDriver.ReadColumnValue(Int32 index, MySqlField field, IMySqlValue valObject)
   bei MySql.Data.MySqlClient.ResultSet.get_Item(Int32 index)
   bei MySql.Data.MySqlClient.MySqlDataReader.GetFieldValue(Int32 index, Boolean checkNull)
   bei MySql.Data.MySqlClient.MySqlDataReader.GetValue(Int32 i)
   bei MySql.Data.MySqlClient.MySqlDataReader.GetValues(Object[] values)
   bei System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReader.GetValues(Object[] values)
   bei System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   bei System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
   bei System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTabledatatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
   bei System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   bei System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 start
Record, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   bei System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   bei Stimulsoft.Report.Dictionary.StiMySqlAdapterService.ConnectDataSourceToData(StiDictionary dictionary, StiDataSource dataSource, Boolean loadData)
   bei Stimulsoft.Report.Dictionary.StiDataSource.Connect(StiDataCollection datas, Boolean loadData)
   bei Stimulsoft.Report.Dictionary.StiDataSourcesCollection.Connect(StiDataCollection datas, Boolean loadData)
   bei Stimulsoft.Report.Dictionary.StiDictionary.Connect(Boolean loadData)
   bei Stimulsoft.Report.Engine.StiRenderProviderV2.ConnectToData(StiReport report)
   bei Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
   bei Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReportmasterReport, StiRenderState renderState)
   bei Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
   bei Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
   bei Stimulsoft.Report.StiReport.Render(Boolean showProgress)
   bei ReportExport.Module1.export_report()
   bei ReportExport.Module1.export_execute()
   bei ReportExport.Module1.Main(String[] args)
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

automate export a report in pdf . is it possible?

Post by Vladimir »

Hello,

Judging by the error stack, problem occurs when converting a Guid value. Please check your data. If you use a Guid data type, it must be recorded in the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format, where x - character in hexadecimal number.

Thank you.
chopper64
Posts: 26
Joined: Mon Dec 20, 2010 2:33 am
Location: Berlin

automate export a report in pdf . is it possible?

Post by chopper64 »

I've already made​​.
DesignerFX also writes the following XML tags:
without matching
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I have now deleted using a text editor the TAGs and the ReportGUID changed according to the format statement.
The result is the same.
When I use the MRI file with the designer of editing NET demo that is output by the way ReportGUID formatted properly ...

On Monday or Tuesday I have the presentation on schedule with my boss. Until then, I really have to have a working solution for the server-side export. This is for him a KO. Criterion. Please help me solve the problem.

The programs in the last ExportsFX.zip export nothing left. It creates the error code 4.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

automate export a report in pdf . is it possible?

Post by Vladimir »

Hello,

We checked the save ReportGuid and Guid parameters, they consist from the 32 hexadecimal characters. Please send us your report in which this error of rendering occurs, we test it.

As well, we attached an updated version of ExportsFx.

Thank you.
Attachments
947.ExportsFx.zip
(2.63 MiB) Downloaded 716 times
wvincent
Posts: 2
Joined: Wed Jul 27, 2011 10:27 am
Location: US

automate export a report in pdf . is it possible?

Post by wvincent »

I am having problems getting the exportsfx to work with reports configured with MSSQL data source. I tested using the same command line for my report (r1.mrt) and report provided with package (simplelistwithvariable.mrt)

MSSQL report generates no output .pdf file, simplelistwithvariable does provide a .pdf file however it is not populated with data.

Below are the command lines I used, The return code 2 seems to indicate a problem with the filename, but I do not believe there is anything different between the 2 (my report, and package report). The report runs fine in the viewer and I tried removing the criteria in the query changed to (select top 10 * from table) which works fine in the viewer but still fails to generate the .pdf file and returns error 2.

Is there a special procedure to use the exportsfx in this manner?

********************************************************************
CMD LINE: ExportsFx.exe report_file="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\r1.mrt" export_file="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\Broken.pdf" Variable1="4" export_format=pdf
report_file: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\r1.mrt"
export_file: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\Broken.pdf"
Variable1: "4"
Return Code: 2
********************************************************************
********************************************************************
CMD LINE: ExportsFx.exe report_file="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\simplelistwithvariable.mrt" export_file="C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\Works.pdf" Variable1="TESTING" export_format=pdf
report_file: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\simplelistwithvariable.mrt"
export_file: "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Reports\reports\Works.pdf"
Variable1: "TESTING"
Return Code: 0
********************************************************************
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

automate export a report in pdf . is it possible?

Post by Vladimir »

Hello,

Currently ExportsFx utility only supports XML and MySQL data sources.

Thank you.
Post Reply