Please check my code :-----

Sub ExportReport()

'Check to see if the application directory has a subdirectory called "Exported".

'If not, create the directory since exported files will be placed here.

'This uses the Directory classof the System.IO namespace.

Dim ExportPath As String

Dim sFilename As String

Dim getFileFromServer As String

Dim fso, fileObject



sFilename = Format(Now, "MMddyyyyHHmmss") & ".pdf"

ExportPath = "Exported/" & sFilename

getFileFromServer = "http://dcc/CurrentAwareness/exported/"; & sFilename

'ExportPath = "C:\Inetpub\wwwroot\TabStrip\Exported\" & sFilename

ExportPath = Request.PhysicalApplicationPath & ExportPath

If Directory.Exists(ExportPath) = False Then

Directory.CreateDirectory(Request.PhysicalApplicationPath + "Exported\")

End If

' ********************************



' First we must create a new instance of the diskfiledestinationoptions class 
and

' set variable called crExportOptions to the exportoptions class of the 
reportdocument.

crDiskFileDestinationOptions = New DiskFileDestinationOptions

crExportOptions = crReportDocument.ExportOptions



crDiskFileDestinationOptions.DiskFileName = ExportPath

'set the required report ExportOptions properties

With crExportOptions

.DestinationOptions = crDiskFileDestinationOptions

.ExportDestinationType = ExportDestinationType.DiskFile

.ExportFormatType = ExportFormatType.PortableDocFormat

End With

'--------------------------------------------------------------------

'Once the export options have been set for the report, the report can be 
exported. The Export command

'does not take any arguments

Try

' Export the report

crReportDocument.Export()

Response.Write("<script language='JavaScript'>")

Response.Write("window.open('" & getFileFromServer & 
"','','menubar=no,resizable=yes, scrollbars=yes');void('');")

Response.Write("<"& Chr(47) & "script>")



Catch err As Exception

Response.Write("<BR>")

Response.Write(err.Message.ToString)

End Try

'File.Delete(getFileFromServer.ToString())

End Sub

When i uncomment the line File.Delete(getFileFromServer.ToString()) some error 
occurs "URI formats are not supported." please help me how can i delete that 
file from the server.

Thanks in Advance 

Parvez 



  ----- Original Message ----- 
  From: vvskm 
  To: [email protected] 
  Sent: Wednesday, July 13, 2005 7:40 AM
  Subject: [AspNetAnyQuestionIsOk] Re: How to Display a report in PDF format 
without SAVING it on server or client machine..??


  I may not be correct with my answer, however I can tell you 
  something like this.

  If you are sending the PDF file to the client browser, then you 
  should use Response.WriteFile(string FileName). The best way to 
  address to your question would be to create a PDF file, SEND the 
  file and immediately delete the file.

  Let me know if this has helped you.

  Here is the code:

      CrystalDecisions.Shared.ExportOptions myExportOptions = 
  rpt.ExportOptions;
      CrystalDecisions.Shared.DiskFileDestinationOptions 
  myDiskFileDestinationOptions = new    
  CrystalDecisions.Shared.DiskFileDestinationOptions();

      string fName = Server.MapPath("\\")+Session.SessionID.ToString()
  +".pdf";
      myDiskFileDestinationOptions.DiskFileName = fName.ToString();
       
      myExportOptions.DestinationOptions = 
  myDiskFileDestinationOptions;
      myExportOptions.ExportDestinationType = 
  ExportDestinationType.DiskFile;
      myExportOptions.ExportFormatType = 
  ExportFormatType.PortableDocFormat;

      rpt.Export();

      Response.ClearContent();
      Response.ClearHeaders();
      Response.ContentType = "application/pdf";
       
      Response.WriteFile(fName);
      Response.Flush();
      Response.Close();
      

      System.IO.File.Delete(fName.ToString());




  - Krishna Vemuri.







  --- In [email protected], "Parvez Khan" 
  <[EMAIL PROTECTED]> wrote:
  > Hi friends,
  > 
  > I want to show crystal report in PDF format without saving it 
  either on SERVER or on CLIENT machine.
  > 
  > Can anyone help me also send me the code for that
  > 
  > Thanks in Advance
  > Parvez
  > 
  > [Non-text portions of this message have been removed]




------------------------------------------------------------------------------
  YAHOO! GROUPS LINKS 

    a..  Visit your group "AspNetAnyQuestionIsOk" on the web.
      
    b..  To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]
      
    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


------------------------------------------------------------------------------



[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to