Link to home
Start Free TrialLog in
Avatar of Jerre
JerreFlag for United Kingdom of Great Britain and Northern Ireland

asked on

RAS 9 Printing issue

I have a few issues when printing ras 9 web repors.

1) Is there a way to get around all the different internet explorer prompts.
    ( printing a report is just going to export it to adobe acrobat reader, and then you have to maually print via adobes file print menu)

2) Is there a way to change the appearance of the toolbar buttons (print,export,refresh,...)
   created by the ras server when showing a report.

3) Is there a way to change the default page range option to ALL PAGES instead of FROM PAGE 1 TO 1 in the first dialog box ?

Any suggestions are welcome !

Thanks in advance


Avatar of Mike McCracken
Mike McCracken

Q1.  Why are you exporting to PDF rather than printing the report directly?

Q2.  I know of no wayto change the appearance of the toolbar.  This question or one like it has been asked and as I recall no satisfactory answer was found.

Q3.  How are you calling the report?

mlmcc
Avatar of Jerre

ASKER

1)When using the report application server 9 , and you click the print button , the report is always exported to a PDF file , and then you have to print it from there.
It is the builtin way crystal decicions provided.

I don't mind this so much... the one thing I do mind is the amount of internet explorer prompts before the report opens up in adobe acrobat reader.

2) the toolbar is only a bit of html code as well as the rest , so I was hoping someone could maybe tell me where this was kept (html file , resource dll , ...?)

3)I am using the report application server ( web reports ).
1) You can make your own export/print button that will stream pdf directly to a new window. Yes, you will still have to select print button in that window, but you will skip all that annoying questions about open/save unknown file etc.
2) Toolbar images are under:
 c:\Program Files\Common Files\Crystal Decisions\2.0\crystalreportviewers\images\toolber
3) That's what I would like to know very much...
 
  Do you use asp or .NET?

Lady Linet
Avatar of Jerre

ASKER

Lady Linet,

I am using ASP.

Is it possible to give me some more help on the annoying questions open/save problem ?

Thanks
Make your own print or export button (regular submit in asp), and use this code for export:
 If you encounter problems with missing constants, they are in Programm Files\Crystal Decisions\Report Application Server 9\rasconst.vbs.

'------------------------------------------------------------------------------
' Name: ExportReport
' In: /
' Out: /
' Effect:
'---------------------------------------------------------
Function ExportReport(strExportFormat)
  Dim i,j
  Dim oPrintOutputController
  Dim strExt, strMime, strFormat, iFormat, strEFileName
  Dim oByteArray
  Select CASE (UCASE(strExportFormat))
   Case "PDF" : iFormat = crReportExportFormatPDF
        strMime = "application/pdf"  
        strExt = ".pdf"
   Case "MSWORD" : iFormat = crReportExportFormatMSWord
           strExt = ".doc"
           strMime = "application/msword"  
   Case "MSEXCEL" : iformat =  crReportExportFormatMSExcel
              strExt = ".xsl"
              strMime="application/vnd.ms-excel"                                                                                          
   Case "MSEXCELDATA" :
      iformat =  crReportExportFormatRecordToMSExcel
        strExt = ".xsl"
        strMime="application/vnd.ms-excel"                                                                                   
 Case "TEXT":            
                iformat =  crExportFormatText
      strExt = ".txt"
      strMime="text/plain"
   Case "CSV"            : iformat =  crReportExportFormatCharacterSeparatedValues
                     strExt = ".csv"
                     strMime="text/plain"                                                         
   Case Else            
            iFormat = crReportExportFormatPDF
            strExt = ".pdf"
            strMime = "application/pdf"                                                                                                          
  END Select
  '---- Add a custom header for an inline file type with a default file name  
        Response.Clear  
   Response.AddHeader "content-disposition", "filename=export" & strExt
   Response.ContentType = strMime  
 
  Set oPrintOutputController = rcDoc.PrintOutputController
  Set oByteArray = oPrintOutputController.Export(iFormat)
 
  '----- Send the bytearray to the browser through the Response object, used
  '----- detachArray method for quicker tranfer of data
  Response.BinaryWrite oByteArray.detachArray
  ExportReport = True
End Function
Avatar of Jerre

ASKER

Can I not put that code to behind the current ras reportviewer , and have it triggered when the existing print button is clicked instead of the current doexport() ?

If not ... how can I add a new print button to the existing ras viewer page ? where can I find the code behind the current ras viewer , and can I ammend it ?

Thanks so much for all this help !
ASKER CERTIFIED SOLUTION
Avatar of ladylinet
ladylinet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jerre

ASKER

No Luck!

I am sorry to have to bother you again.
But after trying everything I know , I can still not export a report showing with ras 9 to a PDF file on the screen the way you have tried to explain me.
Is it possible to send me a copy of the include files you used to create the toolbar , what action does the submit button have ?
How does it know what report to print , where does the exportreport code go ? where is the exportreport code called ?

Is the variable 'rcDoc' the Crystal reports Client document ?

Thanks so much for you help !

Regards,
Jeroen.
Uh... first, did you manage to view your report in RAS?

1.  rcDoc is ReportClientDocument from RAS.

  Set objectFactory = CreateObject("CrystalReports.ObjectFactory.2")
  Set rcDoc = ObjectFactory.CreateObject("CrystalClientDoc.ReportClientDocument")

  rcDoc.Open "c:\inetpub\wwwroot\rpt\a.rpt"

 Button is simple submit, that I intercept after I create rcDoc, login to db and pass parameters, but before I call processHTTPRequest, like this...

  blnExport = False
  strExportFormat = Request.QueryString("Export")
  If strExportFormat > "" Then
   blnExport = True  
  End IF

IF blnExport = True Then
      ExportReport(strExportFormat)
Else
%>
 <!-- #include virtual="/Includes/exportbutton.asp" -->
<%
'---------------------------------------------------------
' Call HTML Viewer
'---------------------------------------------------------
 setViewerParameters(viewer)
 viewer.ProcessHttpRequest Request, Response


 All that is export button is doing is to attach to the querystring parameter called export, with value from dropdown, like 'PDF', or 'MSWORD'...

HTH,
Lady Linet
p.s. can you open another question for this...?
Hi

i am also intrested in knowing the way we can show all pages of the cr9 using scroll .. by default we can do it by using the navigation bar by pressing next , next button ....

Please let me know Is it possible to show al pages together .. with definately a scroll bar .?

I am using rdc for cr9 ...  

Regards
Ade
Can you open new question for that?

Lady Linet
ladylinet

please give the answer here i'll give you the points if it works ..

regards
Ade
I feel your pain wtf666.  I am having the same problem.  I would like to give the user the choice of opening the report in PDF format directly or opening in Crystal Report format.
Sorry, I'm not using Rdc, that's why I've told you to open new question - more people can help you if you open new question. I can help you only with RAS (Report application server on web).

Lady Linet
oright ...
Thanks

Ade
wtf666,

I am currently working with Crystal Tech Support for a better method but here's what will work (at least as a short term solution)

instead of assigning the ClientReportDocument to the CrystalReportViewer

do this

Dim strPath as string = "c:\winnt\temp\"
dim strName as string =  rptClientDoc.DisplayName & ".pdf"

rptClientDoc.PrintOutputController.Export(CrReportExportFormatEnum.crReportExportFormatPDF).Save(strPath & strName, True)

Response.Redirect(strPath & strName)


I hate the fact that I am saving the file to the local hard drive before displaying it but this is the only way I can get it to run.

Thanks,
matchbx
In C# using the RAS model the PrintController class method Export is a member of the Controllers in the ReportAppServer namespace.
This function has a second parameter. Does anyone have any idea what this parameter is for and what the correct values for it are?

Thanks very much

Gary
Follow up!!!!! i used the code by matchbx27 to write a little final ditch effort pdf load code and it works!! but i get a few exceptions raised as soon as i call response.redirect to location on the disk.
The errors says "thread was being aborted"
It would be great if someone could throw some light on this please!

Cheers

Gary
I'm using code provided to me by Crystal Decisions (now Business Objects).  The code that they gave me did not work and after some troubleshooting with Business Objects it was discovered that the response.end (the last line of code)  was missing.


This function should be the very last function called, instead of assigning your ReportClientDocument Object to the Viewer.

   crViewer.ReportSource = rptClientDoc
   crViewer.Visible = True


Call this Code


    Private Sub OpenInPDF()

        Dim crRptExportFormat As Integer

        '5 is the emun for pdf
        crRptExportFormat = 5

        Dim oPrintOutputController As PrintOutputController

        'rptClientDoc is the ReportClientDocument Object
        oPrintOutputController = rptClientDoc.PrintOutputController

        Response.ClearContent()
        Response.ClearHeaders()
        Dim oByte(1) As Byte

        oByte = oPrintOutputController.Export(crRptExportFormat).ByteArray

        'Response.ContentType = "application/pdf"
        Response.AddHeader("Content-disposition", "filename=" & "untitled" & ".pdf")
        Response.BinaryWrite(oByte)
        Response.End()
    End Sub
If i export the report using PrintOutputController to pdf, a message "Damage file can't recover it" appears, using RAS 9 with c#.

Why this happens?
Am I to assume you are not using Cyrstal Enterprise but RAS instead?

If so, I have not used RAS.  I attempted to look for some sample code at http://www.businessobjects.com/products/dev_zone/net/downloads.asp?ref=devzone_netzone_nav

But I did see any samples referencing pdf files.

Sorry I could not help,
matchbx
Don't worry thanks anyway, yes, i'm using Report Application Server 9.

I
Download hotfix for ras.

Lady LInet