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

[Solved] Use of RadRichTextBox for displaying and exporting data

1 Answer 160 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.
Manfred
Top achievements
Rank 2
Manfred asked on 16 Feb 2011, 09:59 AM
Hi there,

I need a little hint.
My problem:
I have a service report which has to be filled with data.
I tried to create the file via code behind, but I can't get access to the properties of the tables.
How can I modify the lines of the table and how can I cet access to the vertical alignment of the cells?
I tried to create my template in Word and open it with the Telerik editor in the examples, but the effect was that my template looks completely different to my Word-export.

Can you guys give me a little hint how to create a template the best way?
And how I can access the properties for alignment and line-style for tables and cells.

Best Regards
Manfred

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 21 Feb 2011, 09:39 AM
Hi Manfred,

You can access the rows of a table through the Rows property. You can create an array from the rows and then access the cells of every row through its Cells property. Something like:

TableRow[] rows = table.Rows.ToArray();
TableCell[] cellsInFirstRow = rows[0].Cells.ToArray();

To set the vertical alignment of a cell, you can use its property VerticalAlignment:
cell.VerticalAlignment = Telerik.Windows.Documents.Layout.RadVerticalAlignment.Center;

The following code is equivalent to setting the borders' width to 0. You can also check the other constructors of the Border class.
table.Borders.All = new Telerik.Windows.Documents.Model.Border(BorderStyle.None);

There is a simple demo of programmatically setting the content of a RadDocument in one of the posts in this forum thread (CodeBehindDemo).
As for the import of the DOCX file, if you like, you can send it in the support ticket you opened, so that we can look into the matter.

All the best,
Iva
the Telerik team
Tags
RichTextBox
Asked by
Manfred
Top achievements
Rank 2
Answers by
Iva Toteva
Telerik team
Share this question
or