Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Saving Webi Report to Disk

Status
Not open for further replies.

john121

Programmer
Oct 18, 2007
9
GB
Hi

I am trying to save a report from infostore to a disk (ex:c\crystalreport.pdf), using the following statement

Code:
eportDocument crReportDocument = new ReportDocument();
crReportDocument.Load(source_path_to_report);

//Export the report to disk.
crReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, destination_path);

How can i find the path to the report. I have tried giving a physical path on my local drive for source and that works fine. But i don't know how can i find that path for the original reports from infostore.

Hope some one can help me to solve this.

I am trying the above one in csharp, so any help will be very much appreciated.

Thanks



 
If you're trying to work with a WebI report, you can't use the Crystal ReportDocument object - that only works with Crystal reports. I haven't done this, but I believe you'll have to use either the Webi class or you may have to go through one of the Viewers without actually showing the report on the screen.

To get to the report, you need to query the InfoStore to find the report InfoObject. You then cast the InfoObject to Webi or load it into the viewer and export. For a good example, go to the Developer Library (the XI R2 library is here: Click on BusinessObjects Enterprise SDK then on .NET developer guide and API reference. Go to Sample Code, Feature Samples, Clien Desktop. There's a sample there of how to view a Webi report. That should provide the info you need to get started.

-Dell


A computer only does what you actually told it to do - not what you thought you told it to do.
 
Hi hilfy

Thanks for your input, I will shed some light on to webi class. But the link you have mentioned, did not have any thing on webi reports for how to save a webi documents to disk.

Here is what i have done so far, which is working fine for the time being. It may not be the best way of doing, but if any one has used the webi class to do the same task, then i really appreciate their input on this.

Code:
 //Create Document Instance to open document in PDF format
        IDocumentInstance oDocument = mReportEngine.OpenDocument(Convert.ToInt32(reportID));
        IBinaryView docBinaryView = (IBinaryView)oDocument.GetView(OutputFormatType.Pdf);

        //Use FileStream Object to Create new PDF file and save that document in the desired location.
        FileStream fs = System.IO.File.Create(exportPath);
        docBinaryView.WriteContent(fs);
        fs.Close();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top