RISOLTO Upgrade crystal report e componenti activex

Pubblicità
Stato
Discussione chiusa ad ulteriori risposte.

Scripta14

Nuovo Utente
Messaggi
95
Reazioni
8
Punteggio
25
Buongiorno a tutti,

vi scrivo per chiedere aiuto su un nuovo progetto. Quindi mi scuso anticipatamente se non sarò da subito preciso nell'esporre il quesito.
Che voi sappiate, è possibile eseguire metodi presenti nelle dll ActiveX con le nuove versioni di crystal report? Ma sopratutto le nuove versioni di crystal report utilizzano ancora i componenti ActiveX? Ho cercato sul sito ufficiale e altrove, ma non riesco a trovare le informazioni che mi servono. L'applicazione che utilizza queste dll è scritta non utilizzando .Net oppure Java, ma un linguaggio per applicazioni client. La versione di crystal report attualmente utilizzata è la 10.
Aggiungo che di .Net e ActiveX ne so veramente poco, perchè utilizzo prevalentemente Java come linguaggio di programmazione.

Grazie anticipatamente a tutti per l'aiuto.
 
ciao cosa devi fare con crystal report?
 
Ciao, con l'editor di CR sono stati preparati i modelli di stampa, e attraverso gli activeX l'applicazione richiama il crystal report engine che completa il modello con i valori e lo visualizza a video.
 
ok ma non ho capito la tua domanda, cosa vorresti fare?
 
Vorrei eseguire delle richieste dal programma legacy e tramite le runtime activex di crystal report visualizzare i vari report o stampe che ho precedentemente creato con l'editor di Crystal report. Quantomeno così funziona adesso. Siccome sto incontrando qualche difficoltà, anche dovuta alla mia scarsa capacità nel maneggiare dll e ocx. Ho visto sul sito della SAP che è possibile scaricare il SDK Crystal Reports for Developers per Eclipse versione free. Così potrei creare un'applicazione che fa da tramite tra l'applicazione legacy e la richiesta di un determinato report, eseguendo il crystal report engine tramite l'applicazione java con le varie librerie che gestiscono le diverse funzionalità richieste.
Questa è la mia idea, anche se sto trovando difficoltà nel scaricare sdk dal sito di SAP Crystal Report. Il sito non mi permette di registrarmi per fare l'accesso e scaricare l'sdk.
Se avete qualsiasi altra idea più funzionale è ben gradita.

Grazie a tutti in anticipo per l'aiuto.
 
guarda io crystal report lo uso a lavoro su ambiente .NET.
Praticamente generiamo i report con associati una tabella per prendere i campi che ci servono.
Poi da .NET tramite le dll prendiamo il report che ci serve gli associamo una sorgente dati e generiamo la stampa passandogli il dataset dei dati che serve.
Su che browser entri sul sito SAP?
 
:inchino::inchino::inchino:.....Grazie. Utilizzo solitamente Chrome, ma non mi visualizzava la form per la registrazione e quindi non potevo accedere all'area del download e documentazione. Ho provato con Firefox e magicamente è apparsa. Adesso spero di trovare materiale per capire come gestire quello che mi serve. Qualcosa ho trovato nell'area dedicata ad eclipse, ma ho visto che SAP predilige .Net dove c'è più materiale.
Grazie per l'aiuto.
 
si con .net è molto molto facile far interagire le due cose
 
Grazie per l'aiuto. Sono riuscito a scaricare e installare sdk per eclipse e ho cominciato a dare un'occhiata, e qualche problema l'ho già riscontrato. Adesso ci lavoro su... :varie13: :boh:
Grazie ancora.
 
di nulla fammi sapere se riesci nel tuo intento
 
ciao, ho cercato online svariate fonti e sono arrivato ad un punto che non so più dove sbattere la testa. Ho trovato un esempio che mi consente di importare il .rpt e generare un .pdf. Se utilizzo un .rpt che non contiene connessione al db access funziona correttamente(credo con qualsiasi db), altrimenti mi genera l'errore:
Codice:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Errore nella ricerca del nome JNDI (nomeDBAccess)---- Error code:-2147467259 Error code name:failed
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:238)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:148)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:129)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:112)
    at EsmpiodiProva.JRCExportReport.main(JRCExportReport.java:51)
Caused by: com.crystaldecisions.reports.common.JndiNotFoundException: Errore nella ricerca del nome JNDI (nomeDBAccess )
    at com.crystaldecisions.reports.queryengine.Connection.a(SourceFile:1871)
    at com.crystaldecisions.reports.queryengine.Connection.bs(SourceFile:1815)
    at com.crystaldecisions.reports.queryengine.Connection.bv(SourceFile:505)
    at com.crystaldecisions.reports.queryengine.Connection.uj(SourceFile:3020)
    at com.crystaldecisions.reports.dataengine.dfadapter.DFAdapter.a(SourceFile:697)
    at com.crystaldecisions.reports.dataengine.dfadapter.DFAdapter.for(SourceFile:707)
    at com.crystaldecisions.reports.reportdefinition.ReportHelper.a(SourceFile:198)
    at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.long(SourceFile:962)
    at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:640)
    at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:677)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1943)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:525)
    at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423)
    at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351)
    at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
    at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
    at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
    at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
    at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
    at com.crystaldecisions.sdk.occa.report.application.dt.a(SourceFile:186)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)
    at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337)
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:224)
    ... 4 more
Caused by: com.businessobjects.reports.jdbinterface.common.DBException: Errore nella ricerca del nome JNDI (nomeDBAccess )
    at com.crystaldecisions.reports.queryengine.driverImpl.jdbc.JDBCConnection.Open(Unknown Source)
    at com.crystaldecisions.reports.queryengine.JDBConnectionWrapper.Open(SourceFile:123)
    at com.crystaldecisions.reports.queryengine.Connection.bs(SourceFile:1786)
    ... 30 more

riporto il codice:
Codice:
import com.crystaldecisions.sdk.occa.report.lib.*;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.data.IConnectionInfo;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;

//Java imports.
import java.io.*;

import org.apache.log4j.BasicConfigurator;

public class JRCExportReport {

    
    static final String REPORT_NAME = "C:\\ProveCR2013\\st_rpt.rpt";
    //static final String REPORT_NAME = "C:\\ProveCR2013\\JRCExportReport.rpt";
    static final String EXPORT_FILE = "C:\\ProveCR2013\\myExportedReport.pdf";
    
    
    public static void main(String[] args) {
    
        try {
            BasicConfigurator.configure();
            //Open report.            
            ReportClientDocument reportClientDoc = new ReportClientDocument();
                     
             reportClientDoc.open(REPORT_NAME, 0);
            
            //NOTE: If parameters or database login credentials are required, they need to be set before.
            //calling the export() method of the PrintOutputController.
            
            //Export report and obtain an input stream that can be written to disk.
            //See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
            //possible with the JRC.
            ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
            
            //Release report.
            reportClientDoc.close();
                        
            //Use the Java I/O libraries to write the exported content to the file system.
            byte byteArray[] = new byte[byteArrayInputStream.available()];

            //Create a new file that will contain the exported result.
            File file = new File(EXPORT_FILE);
            FileOutputStream fileOutputStream = new FileOutputStream(file);

            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
            int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());

            byteArrayOutputStream.write(byteArray, 0, x);
            byteArrayOutputStream.writeTo(fileOutputStream);

            //Close streams.
            byteArrayInputStream.close();
            byteArrayOutputStream.close();
            fileOutputStream.close();
            
            System.out.println("Successfully exported report to " + EXPORT_FILE);
                                
        }
        catch(ReportSDKException ex) {
        
            ex.printStackTrace();
            
        }
        catch(Exception ex) {
            
            ex.printStackTrace();
                        
        }

    }

}

Se non aggiungo l'istruzione BasicConfigurator.configure() mi segnala un warning su log4j.jar. Deve essere qualcosa nella configurazione della classe ReportClientDocument, meglio penso sia quella, perchè lanciando il metodo reportClientDocument.open(...) va in errore.
Grazie per l'aiuto.
 
hai impostato la connessione al database, senza dubbio il report ha necessità di un dataset da passare al report per generarlo
 
Si avevo provato provato, ma con scarsi risultati.
Codice:
import com.crystaldecisions.sdk.occa.report.lib.*;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.data.IConnectionInfo;
import com.crystaldecisions.sdk.occa.report.data.ITable;
import com.crystaldecisions.sdk.occa.report.data.Tables;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;

//Java imports.
import java.io.*;

import org.apache.log4j.BasicConfigurator;

public class JRCExportReport {

    
    static final String REPORT_NAME = "C:\\ProveCR2013\\st_rpt.rpt";
    //static final String REPORT_NAME = "C:\\ProveCR2013\\JRCExportReport.rpt";
    static final String EXPORT_FILE = "C:\\ProveCR2013\\myExportedReport.pdf";
    
    
    public static void main(String[] args) {
        PropertyBag propertyBag = null;
        IConnectionInfo connectionInfo = null;
     // Declare variables to hold ConnectionInfo values.
        // Below is the list of values required to switch to use a JDBC/JNDI
        // connection
        String TRUSTED_CONNECTION = "false";
        String SERVER_TYPE = "JDBC (JNDI)";
        String USE_JDBC = "true";
        String DATABASE_DLL = "crdb_jdbc.dll";
      //  String JNDI_OPTIONAL_NAME = jndiName;
        String CONNECTION_URL = "jdbc:odbc:nomeDBAccess";
        String DATABASE_CLASS_NAME = "sun.jdbc.odbc.JdbcOdbcDriver";
        String DB_USER_NAME = "user";
        String DB_PASSWORD = "password";
        ITable origTable = null;
        ITable newTable = null;
        
        
        try {
            BasicConfigurator.configure();
            //Open report.            
            ReportClientDocument reportClientDoc = new ReportClientDocument();
            
        
        
                     
             reportClientDoc.open(REPORT_NAME, 0);
             reportClientDoc.getDatabaseController().logon("user", "password");


            // Change connection information properties
            connectionInfo = newTable.getConnectionInfo ();

            // Set new table connection property attributes
            propertyBag = new PropertyBag ();

            // Overwrite any existing properties with updated values
            propertyBag.put ("Trusted_Connection", TRUSTED_CONNECTION);
            propertyBag.put ("Server Type", SERVER_TYPE);
            propertyBag.put ("Use JDBC", USE_JDBC);
            propertyBag.put ("Database DLL", DATABASE_DLL);
            //propertyBag.put ("JNDIOptionalName", JNDI_OPTIONAL_NAME);
            propertyBag.put ("Connection URL", CONNECTION_URL);
            propertyBag.put ("Database Class Name", DATABASE_CLASS_NAME);
            // propertyBag.put("Server Name", SERVER_NAME); //Optional property
            // propertyBag.put("Connection String", CONNECTION_STRING); //Optional property
            // propertyBag.put("Database Name", DATABASE_NAME); //Optional property
            // propertyBag.put("URI", URI); //Optional property
            connectionInfo.setAttributes (propertyBag);

            // Set database username and password
            // NOTE: Even if the username and password properties do not change
            // when switching databases, the
            // database password is *not* saved in the report and must be set at
            // runtime if the database is secured.
            connectionInfo.setUserName (DB_USER_NAME);
            connectionInfo.setPassword (DB_PASSWORD);

            // Update the table information
            reportClientDoc.getDatabaseController ().setTableLocation (origTable, newTable);
            
            //NOTE: If parameters or database login credentials are required, they need to be set before.
            //calling the export() method of the PrintOutputController.
            
            //Export report and obtain an input stream that can be written to disk.
            //See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
            //possible with the JRC.
            ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
            
            //Release report.
            reportClientDoc.close();
                        
            //Use the Java I/O libraries to write the exported content to the file system.
            byte byteArray[] = new byte[byteArrayInputStream.available()];

            //Create a new file that will contain the exported result.
            File file = new File(EXPORT_FILE);
            FileOutputStream fileOutputStream = new FileOutputStream(file);

            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
            int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());

            byteArrayOutputStream.write(byteArray, 0, x);
            byteArrayOutputStream.writeTo(fileOutputStream);

            //Close streams.
            byteArrayInputStream.close();
            byteArrayOutputStream.close();
            fileOutputStream.close();
            
            System.out.println("Successfully exported report to " + EXPORT_FILE);
                                
        }
        catch(ReportSDKException ex) {
        
            ex.printStackTrace();
            
        }
        catch(Exception ex) {
            
            ex.printStackTrace();
                        
        }

    }

}

Il codice scritto dopo di reportClientDoc.open(REPORT_NAME, 0) genera un NullPointerException, mentre se richiamo questo codice prima di reportClientDoc.open(REPORT_NAME, 0), mi segnala che non è stato aperto di documento.
 
ma guarda che da quel che so il codice che usiamo noi è diverso.
Si dichiara un oggetto di tipo = new report Document() ad esempio.
a questo oggetto gli passi il report che deve usare(come se fosse un template) e poi gli passi la sorgente dati che deve utilizzare per generare il report.
Alla fine fai report.export(serie di parametri) e ti restituisce il report
 
Ho visto che anche in Java fa la stessa cosa. Solo che non riesco a settare correttamente la connessione ad un db da me scelto(che nel mio caso è Access). Nell'esempio di prova che genera eclipse c'è Xtreme :boh::boh::boh:
Grazie per il supporto.
 
Stato
Discussione chiusa ad ulteriori risposte.
Pubblicità
Pubblicità
Indietro
Top