vbdotnet.it

Tricks & tips, workaround, forum and ideas with .Net

About the author

Enrico Rossini è il gestore di questo blog.
E-mail me Send mail

Recent posts

Recent comments

Contributi

Best 6 ~ 6 users ~ 6 comments

Info legali

Le opinioni espresse in questo blog sono strettamente personali e ogni persona è responsabile dei commenti che inserisce. I marchi citati sono delle rispettive aziende.

© Copyright 2010

Advertising


Microsoft Report: aggiungere il numero di riga ad una tabella

Quando si crea una tabella con dei dati in Microsoft Report è tutto abbastanza facile. Un problema che non sapevo come risolvere era quello di inserire un numero di riga progressivo. Non ho trovato molte indicazioni su come fare ma poi ho sparato un'idea e ha funzionato.Il comando da eseguire nella cella dove visualizzare i numeri progressivi è la seguente:

=RowNumber(Nothing)

Facile, no? Ciao e buon lavoro a tutti!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by enrico on Friday, January 22, 2010 5:48 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Caricare 2 dfferenti report in Microsoft ReportViewer

Non so se ha te è capitato di dover caricare diversi Report fatti con il tool di Microsoft e vedersi restituire degli errori di vario tipo. Ad esempio a me è capitato che due report aventi parametri diversi mi creavano dei problemi quando li andavo a visualizzare.

Per poter risolvere il problema è necessario effettuare un refresh del report poiché sembra che il ReportViewer tenga in memoria le informazioni del report definiti durante la creazione in design-time.

Per poter risolvere il problema si possono utilizzare le seguenti righe di codice:

   1: Dim rds As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
   2: Me.ReportViewer1.Reset()
   3: Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "report.rdlc"
   4: Me.ReportViewer1.LocalReport.DataSources.Clear()
   5: rds.Name = "nome_dataset_del_report"
   6: rds.Value = Me.CommesseAttivitaBindingSource
   7: Me.ReportViewer1.LocalReport.DataSources.Add(rds)

Buon lavoro!

P. S.: abbiamo creato il nostro forum per poter rispondere alle vostre domande. Utilizzatelo numerosi! Grazie

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by enrico on Monday, March 09, 2009 7:11 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Esportare un report di Crystal Report direttamente in PDF con ASP.NET

Già creare un report alle volte non è una cosa velocissima ma quando all’utente gli viene proposta la pagina di selezione di tipologia di report da stampare, va in panico. È meglio quindi far in modo che il report creato con Crystal Report venga subito visualizzato in un file PDF.

La risoluzione è abbastanza semplice. Innanzitutto inserire gli opportuni import che sono i seguenti:

   1:  Imports CrystalDecisions.CrystalReports.Engine
   2:  Imports CrystalDecisions.Shared
   3:  Imports CrystalDecisions.Web.Design

Poi nella funzione di generazione dei report e del suo binding, inserire questo codice (oReport è di tipo ReportDocument):

   1:  Dim objMem As New MemoryStream
   2:  objMem = CType(oReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream)
   3:  oReport.Close()
   4:   
   5:  Response.Clear()
   6:  Response.AddHeader("content-disposition", "attachment;filename=Export.pdf")
   7:  Response.Buffer = True
   8:  Response.ContentType = "application/pdf"
   9:  Response.BinaryWrite(objMem.ToArray())
  10:  Response.End()

Ciao.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by enrico on Thursday, January 22, 2009 4:36 PM
Permalink | Comments (0) | Post RSSRSS comment feed