IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Pb Génération PDF


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Avril 2006
    Messages
    38
    Détails du profil
    Informations forums :
    Inscription : Avril 2006
    Messages : 38
    Par défaut Pb Génération PDF
    Salut,

    Je veux imprimer un rapport sous format PDF, pour cela j'utilise localReport. Voici la partie de code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    public byte[] Generate(string reportPath, ReportDataSourceCollection sources, OutputFormat format)
            {
                LocalReport localReport = new LocalReport();
                localReport.ReportPath = reportPath;
     
                foreach (ReportDataSource source in sources.Values)
                    localReport.DataSources.Add(source);
     
                Warning[] warnings;
                string[] streamids;
                string mimeType;
                string deviceInfo = "<DeviceInfo><StartPage>0</StartPage></DeviceInfo>";
                string encoding;
                string extension;
                string outFormat;
                switch (format)
                {
                    case OutputFormat.Pdf:
                        outFormat = "PDF";
                        break;
                    case OutputFormat.Excel:
                        outFormat = "Excel";
                        break;
                    default:
                        outFormat = "PDF";
                        break;
                }
                return localReport.Render(
                    outFormat, deviceInfo, out mimeType, out encoding, 
                    out extension, out streamids, out warnings);
            }
    Mon problème c'est qu'il me dit qu'il y a une exception interne dans le return et malheureusement je ne trouve pas comment corriger ça.

    Hoping to get help. Merci.

  2. #2
    Membre averti
    Inscrit en
    Avril 2006
    Messages
    38
    Détails du profil
    Informations forums :
    Inscription : Avril 2006
    Messages : 38
    Par défaut
    Plus précisement voilà le message de l'exception :

    L'exception Microsoft.Reporting.WebForms.LocalProcessingException n'a pas été gérée
    Message="Une erreur s'est produite lors du traitement du rapport local."
    Source="Microsoft.ReportViewer.WebForms"
    StackTrace:
    à Microsoft.Reporting.WebForms.LocalReport.CompileReport()
    à Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
    à Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
    à Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
    à Framework.ReportManager.Generate(String reportPath, ReportDataSourceCollection sources, OutputFormat format) dans D:\Sources\Reporting\ReportManager.cs:ligne 57
    à Business.Report.ReportBuilder.Generate(ContractReportContainer reportData) dans D:\Sources\Report\ReportBuilder.cs:ligne 21
    à Business.test2.test2_Load(Object sender, EventArgs e) dans D:\Sources\test2.cs:ligne 34
    à System.Windows.Forms.Form.OnLoad(EventArgs e)
    à System.Windows.Forms.Form.OnCreateControl()
    à System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    à System.Windows.Forms.Control.CreateControl()
    à System.Windows.Forms.Control.WmShowWindow(Message& m)
    à System.Windows.Forms.Control.WndProc(Message& m)
    à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    à System.Windows.Forms.ContainerControl.WndProc(Message& m)
    à System.Windows.Forms.Form.WmShowWindow(Message& m)
    à System.Windows.Forms.Form.WndProc(Message& m)
    à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    à System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
    à System.Windows.Forms.Control.SetVisibleCore(Boolean value)
    à System.Windows.Forms.Form.SetVisibleCore(Boolean value)
    à System.Windows.Forms.Control.set_Visible(Boolean value)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Application.Run(Form mainForm)
    à Business.program.Main() dans D:\Sources\program.cs:ligne 18
    à System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
    à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    à System.Threading.ThreadHelper.ThreadStart()

  3. #3
    Membre averti
    Inscrit en
    Avril 2006
    Messages
    38
    Détails du profil
    Informations forums :
    Inscription : Avril 2006
    Messages : 38
    Par défaut
    Problème consistait dans le chemin du fichier à enregistrer. -> Problème résolu.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [c#] Génération PDF : Détection d'une marque non reconnue
    Par PtiBubu dans le forum Windows Forms
    Réponses: 1
    Dernier message: 27/06/2006, 15h19
  2. [Mail] Envoi automatique de mail & génération pdf
    Par moabomotal dans le forum Langage
    Réponses: 1
    Dernier message: 01/06/2006, 08h46
  3. PB de génération PDF !!!
    Par elitost dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 27/07/2005, 08h44
  4. [XSLFO & génération pdf] retrait à droite d'un texte
    Par flzox dans le forum XSL/XSLT/XPATH
    Réponses: 3
    Dernier message: 23/06/2005, 16h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo