RadLinearSparkline inside of Cell for Pdf Document

2 posts, 0 answers
  1. Andrey
    Andrey avatar
    5 posts
    Member since:
    Sep 2012

    Posted 17 Sep 2012 Link to this post

    Hi all.

    I'd like to render the RadLinearSparkline control inside of the Table Cell, and then export document to PDF.
    here is the code:
    private static void AddTrendCell(IBlockContainer cell, IEnumerable<double> value)
    {
        var trendLine = new RadLinearSparkline();
        trendLine.ItemsSource = value;
        trendLine.LineStroke = new SolidColorBrush(Colors.Red);
        trendLine.Background = new SolidColorBrush(Colors.Green);
     
        var paragraph = new Paragraph();
        paragraph.Inlines.Add(new InlineUIContainer(trendLine, new Size(180, 30)));
        cell.Blocks.Add(paragraph);
    }

    but there is no any content inside of Cell in the PDF document.
    please help.
  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    104 posts

    Posted 18 Sep 2012 Link to this post

    Hello Andrey,

    Your code seems to be fine. However, you should explicitly set width and height of the control contained by the container:

    trendLine.Width = 180;
    trendLine.Height = 30;

    If your problem persists, have in mind that if the item is not displayed properly in a RichTextBox when the document is previewed in one, it will also not be exported to PDF since the export consists of making a "screenshot" of the visible content.

    Don't hesitate to contact us if you have other questions.

    Kind regards,
    Martin
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  3. DevCraft banner
Back to Top