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

how to replace the custom control added to InlineUIContainer with xaml before converting it to html ( able to serialize the control to xaml )

1 Answer 111 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
satish
Top achievements
Rank 1
satish asked on 03 Sep 2010, 02:39 PM

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();

 

}

}

}

}

}

 

 


1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 08 Sep 2010, 03:25 PM
Hello Satish,

For now, exporting InlineUIContainers to XAML or HTML is not supported. We are planning to extend format providers' API to support such functionality for Q3, so you can wait for it if this is an option for you. 

Best wishes,
Boby
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
satish
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or