Rad chart export to xls or pdf or word doc

Thread is closed for posting
4 posts, 0 answers
  1. puneet
    puneet avatar
    1 posts
    Member since:
    Nov 2007

    Posted 15 Jan 2008 Link to this post

    Hi,

    I know rad chart doesn't provide any in-built way of exporting the rad chart to xls/pdf/doc formats. I was just wondering if there is any round about way of doing it?

    thanks,
    PM
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 18 Jan 2008 Link to this post

    Hello Puneet,

    You can use RadChart.Save() method to save the chart to an image or a memory stream. Then you can use it in any custom scenario.


    Greetings,
    Ves
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Abhay Das
    Abhay Das avatar
    1 posts
    Member since:
    Oct 2009

    Posted 22 Oct 2009 Link to this post

    The problem with Rad Chart is you cannot print it into PDF directly.

    Now, solution depends upon the third party tool or dll you use to make a PDF.

    Since Rad chart is basically image being shown after rendering, you have to call the image using e.g. <asp:image runat="server" id="imgTest" ImageURL="Test.aspx" />.

    Now in Test.aspx:

        public void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                    MemoryStream imageStream = drawChart();

                    Byte[] imageContent = new Byte[imageStream.Length];

                    imageStream.Position = 0;
                    imageStream.Read(imageContent, 0, (Int32)imageStream.Length);
                    imageStream.Close();

                    Response.ContentType = "image/jpeg";
                    Response.BinaryWrite(imageContent);
            }
        }

        private MemoryStream drawChart()
        {
            RadChart chart = new RadChart();

            // Do the necessary coding in order to generate the chart.
            //If more than one chart  is being used call the same page with necessary inputs to generate a new image.

            MemoryStream mStream = new MemoryStream();

            chart.Save(mStream, ImageFormat.Jpeg);

            return mStream;
        }

    I think it will solve the problem...if authentication issues doesn't arise.

  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 27 Oct 2009 Link to this post

    Hi Abhay Das,

    Thanks for sharing this. I am sure it will prove handy for our community members. I have updated your Telerik points.

    Best regards,
    Ves
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top