This is a migrated thread and some comments may be shown as answers.

New Error while adding a table section for printing Grid

7 Answers 88 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
danparker276
Top achievements
Rank 2
danparker276 asked on 30 Dec 2011, 12:48 AM
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);


7 Answers, 1 is accepted

Sort by
0
danparker276
Top achievements
Rank 2
answered on 30 Dec 2011, 01:26 AM
This is only happening when I set the table style.  What is the correct way to do this. The default doesn't work anymore.
0
danparker276
Top achievements
Rank 2
answered on 30 Dec 2011, 07:06 PM
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.
0
Mihail
Telerik team
answered on 04 Jan 2012, 08:40 AM
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 >>

0
danparker276
Top achievements
Rank 2
answered on 04 Jan 2012, 08:02 PM
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);
0
Mihail
Telerik team
answered on 09 Jan 2012, 03:08 PM
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 >>

0
Doguhan
Top achievements
Rank 1
answered on 23 Jul 2012, 03:15 PM
Setting the Table style doesn't working in Q2 2012 contrary to what the first reply says.
0
Mihail
Telerik team
answered on 24 Jul 2012, 12:32 PM
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.

Tags
RichTextBox
Asked by
danparker276
Top achievements
Rank 2
Answers by
danparker276
Top achievements
Rank 2
Mihail
Telerik team
Doguhan
Top achievements
Rank 1
Share this question
or