I would like to find out whether table can be generated automatically by program in Docx and XAML formate in RadRichTextbox ?
For example, user put <summary table> in the template, this <summary table> should be replaced by the actual data table when user preview the report, are there anyway that this table can be generated by the program in Docx and XAML format?
6 Answers, 1 is accepted
The way I understand your use-case, it is practically mail merge - having some template and filling it with different data. This is a feature that we have planned for 2011.Q1, which is expected some time in the second half of March.
What you can do as of now is to traverse the document, search for all occurrences of <summary table> or any other tag you will be using, and replace it with the data you wish to display. You can store the data in DOCX, XAML or HTML, but you would have to get the data entry you wish to show yourself (if you store the DOCX/ XAML/ HTML in a database), import it using the corresponding format provider and then get the table from the imported document.
As for the import/ export from/ to DOCX and XAML, you can test how it works in our demo.
If you need further help, do not hesitate to contact us again.
Iva
the Telerik team
private
void
buttonFind_Click(
object
sender, RoutedEventArgs e)
{
this
.radRichTextBox.Document.Selection.Clear();
DocumentTextSearch search =
new
DocumentTextSearch(
this
.radRichTextBox.Document);
foreach
(var textRange
in
search.FindAll(
this
.textBox.Text))
{
this
.radRichTextBox.Document.Selection.AddSelectionStart(textRange.StartPosition);
this
.radRichTextBox.Document.Selection.AddSelectionEnd(textRange.EndPosition);
}
}
But the above code stops working if I want to search some strings like: [InsertTable] or [keyword], is there any way to make it work?
Thanks.
The FindAll method of the takes a string as an argument, but regards it as a regular expression. For example, searching “[a-z]*control[a-z]*” will find all words that contain the word “control” as a substring. In your case [InsertTable] looks for any of the letters I, n, s, e, r, t, etc, which probably produces a rather large output.
In order to find the string "[InsertTable]", you would have to escape it before proceeding with the search as follows:
string
text = Regex.Escape(
this
.textBox.Text);
foreach
(var textRange
in
search.FindAll(text)) {...}
Let us know if you encounter any other obstacles. Greetings,
Iva
the Telerik team
Do you have this template feature in RichTextBox now? I am looking for a similar feature where I could let the user insert a table...sort of a grid...that shows merge result in tabular format. Please let me know if it is possible in any way.
Thanks,
Ankur
You can benefit from our mail merge functionality - you can have a document containing table filled with merge fields and perform mail merge operation.
If this doesn't answer your question, please share more details about your scenario, so we can adequately help you further.
All the best,
Boby
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>