Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
powerplay

Avatar / Picture

Senior Member
Registered:
Posts: 77
Reply with quote  #1 
Hi All,

Sorry, coming up with some weird requirement here, but I need help from you.

In a metastorm report, I have a button "OK" in filter area to generate report.
Once the report is generated, user can click the other button "Export" and the report shall be exported in excel.
We do have a default export functionality, but we are not able to use it in sharepoint.
I tried implementing C# code on button click using the following code:

{
HttpResponse response = HttpContext.Current.Response;
        
        // first let's clean up the response.object   
        response.Clear();
        response.Charset = "";

        // set the response mime type for excel   
        response.ContentType = "application/vnd.ms-excel";
        response.AddHeader("Content-Disposition", "attachment;filename=\"" + "test.xlsx");

        // create a string writer   
        using (StringWriter sw = new StringWriter())
        {
            using (HtmlTextWriter htw = new HtmlTextWriter(sw))
            {
                // instantiate a datagrid   
                DataGrid dg = new DataGrid();
                //dg.DataBinding += new EventHandler();
                Request.
                dg.DataSource = ds.Tables[0];
                string test = "Parameter: Test" + "\n";
                dg.DataBind();
                dg.RenderControl(htw);
                response.Write(test + sw.ToString());
                response.End();
            }
        }  

but the Response object in the first line itself is giving error. I believe its null as it is giving Object reference not set to instance error.

Can you you please share how to achieve this.

Also any workaround will be helpful...


__________________
Thanks
HB
0
powerplay

Avatar / Picture

Senior Member
Registered:
Posts: 77
Reply with quote  #2 
Please ignore the syntactical mistakes..code is any way compiles properly...
also i found this link..
which scans the grid client side. But here as well I believe the report grid behaves differently than the form grid..
Please help...


__________________
Thanks
HB
0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #3 
The 'grid' in a report id a very different beast. Have a look at our 'Business Object Reporting' library. We use the Business Object instead:
http://www.processmapping.com.au/freestuff/freemetastormbpm9solutions/BusinessObjectReporting.html

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!