New Error while adding a table section for printing Grid

8 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 29 Dec 2011 Link to this post

    I've updated to silverlight 5 and a new version of telerik and my printing of a grid doesn't work now.          
    I did have to change the defaultStyleSettings, but now when I try to print, after the last line in the code below, I get an error:
    "Value cannot be null.  Parameter name: key"
      Table table = new Table();
      Telerik.Windows.Documents.Model.Styles.StyleDefinition myst = new Telerik.Windows.Documents.Model.Styles.StyleDefinition();
      myst.SetPropertyValue(Span.FontSizeProperty, Unit.PointToDip(8));
      myst.Type = Telerik.Windows.Documents.Model.Styles.StyleType.Table;
      table.Style = myst;
    //  table.DefaultStyleSettings = myst;
      RadDocument document = new RadDocument();
     
      Section section = new Section();
      section.Blocks.Add(table);
      document.Sections.Add(section);


  2. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 29 Dec 2011 Link to this post

    This is only happening when I set the table style.  What is the correct way to do this. The default doesn't work anymore.
  3. DevCraft banner
  4. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 30 Dec 2011 Link to this post

    It won't error now when I set the name
     myst.Name = "test123";

    but it's not setting the font size correctly like it used to.
  5. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 04 Jan 2012 Link to this post

    Hello Dan,
    We currently do not support table styles. This feature is scheduled for the next major release (Q1 2012) which will be released in February/March.
    If you want to change the font size you will have to do it for each element (Paragraphs or Spans) inside the table cells.

    Sorry for the inconvenience. If you have further question do not hesitate to contact us.

    All the best,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 04 Jan 2012 Link to this post

    How to I set the span or paragraph of the cell?    It doesn't let me assign styles to cells either?  I can only add a string to cell value.
    I can't print out gridviews or send to PDF anymore.  The default font size is very big and doesn't look good.
    There is no replacement for table.DefaultStyleSettings?

    EDIT: I'm just trying to print and export my gridviews to PDF

                
    TableCell cell = new TableCell();
    cell.Background = headerBackColor;
    AddCellValue(cell, columns[i].UniqueName);
  7. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 09 Jan 2012 Link to this post

    Hello Dan,
    In the "AddCellValue" method you need to set style to paragraph or span (character) accordingly. If you don't want to set style or if you don't have predefined style you can set the font size directly to the span. 

    Here is the "AddCellValue" method edited to change the font size to 8:

    private void AddCellValue(Telerik.Windows.Documents.Model.TableCell cell, string value)
    {
        Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();
        cell.Blocks.Add(paragraph);
     
        Telerik.Windows.Documents.Model.Span span = new Telerik.Windows.Documents.Model.Span();
        span.Text = value;
        span.FontSize = Unit.PointToDip(8);
     
        paragraph.Inlines.Add(span);
    }

    If you have further questions do not hesitate to contact us.

    Kind regards,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Doguhan
    Doguhan avatar
    2 posts
    Member since:
    Oct 2011

    Posted 23 Jul 2012 Link to this post

    Setting the Table style doesn't working in Q2 2012 contrary to what the first reply says.
  9. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 24 Jul 2012 Link to this post

    Hi Doguhan,

    Can you give us some more details about what exactly is the problem as we were not able to infer that from your post?

    Looking forward to your reply.
     

    Greetings,
    Mihail
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner