Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
Does infragistics support Export to word in a Ultrawebgrid.
posted

Does infragistics support Export to word in a Ultrawebgrid. I have seen Export to PDF,XPS and Excel but i have a requirement of exporting the data of a ultraweb grid to Word. Please help me out.

Thanks in advance.

Parents
No Data
Reply
  • 2677
    posted

    Hello,

    Infragistics does not have a control or API to export the grid to Microsoft word.  However, you can still do it, but you will need to do a little work.  One simple way would be to just write it out to ms word using an htmltextwriter.  This will throw all the contents of the grid into a word doc.  However, this will not look pretty because there will be no formatting.  Here is a simple code snippet.

    protected void Button1_Click(object sender, EventArgs e)
            {
                Response.Clear();
                Response.ContentType = "application/ms-word";
                Response.AddHeader("Content-Disposition", "inline;filename=test.doc");
                Response.Charset = "";
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                StringWriter stringWriter = new StringWriter();
                HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
                this.UltraWebGrid1.RenderControl(htmlTextWriter);
                Response.Write(stringWriter.ToString());
                Response.End();
            }

    Another way would be to use a little COM Interop classes to create word objects and build the word table yourself.  Here is a good article that explains how to work with the Word objects in C#.  Hope this helps.  http://support.microsoft.com/kb/316384

    Aside from all these workarounds, you can submit a Feature Request for this new functionality.

Children
No Data