hi
i have added a button and text box to InlineUIContainer , we have a functionality where when we click on convert to html button ,
we have to convert the text to html
i am able to serialise the button and text box to xaml , but i am unable to replace the existing control with the xaml
so that i can give the document to html converter
pls let me know how can i do that
thanks
satish
private void btnHtml_Click(object sender, RoutedEventArgs e)
{
String _html;
ReplaceCustomInlines(
this.MsWordExampleInstance.editor.Document);
new customHtmlFormatter().Export(this.MsWordExampleInstance.editor.Document);
_html = ToHtml(
this.MsWordExampleInstance.editor.Document);
//_html = ToXaml(this.MsWordExampleInstance.editor.Document);
MsWordExampleInstance.editor.Document =
new TxtFormatProvider().Import(_html);
}
private void ReplaceCustomInlines(RadDocument document)
{
foreach (Telerik.Windows.Documents.Model.Section section in document.Sections)
{
foreach (Telerik.Windows.Documents.Model.Paragraph paragraph in section.Paragraphs)
{
List<Telerik.Windows.Documents.Model.InlineUIContainer> removeinlines = new List<Telerik.Windows.Documents.Model.InlineUIContainer>();
Telerik.Windows.Documents.Model.
InlineCollection inttt = paragraph.Inlines;
Telerik.Windows.Documents.Model.
Span x1 = new Telerik.Windows.Documents.Model.Span();
foreach (Telerik.Windows.Documents.Model.Inline inline in paragraph.Inlines)
{
if (inline is Telerik.Windows.Documents.Model.InlineUIContainer)
{
Grid grid = (inline as Telerik.Windows.Documents.Model.InlineUIContainer).UiElement as Grid;
UiXamlSerializer uxs = new UiXamlSerializer();
string text = uxs.Serialize(grid);
paragraph.Inlines.Remove(inline);
Telerik.Windows.Documents.Model.
Span span = new Telerik.Windows.Documents.Model.Span(text);
paragraph.Inlines.Add(span);
// MsWordExampleInstance.editor.Document = document;
document.UpdateLayout();
}
}
}
}
}