This question is locked. New answers and comments are not allowed.
Hi,
We are trying to save a RadDocument into the XAML format.
So, we have add a test button to our UI in order to manage the save.
Unfornutaly, we've got the following exception during the call of the export method :
The save method is implemented as follow :
The implementation of the GetXamlFromDocument method is as follow :
Thanks ins advance for any help.
Best regards
Guillaume Chomat
We are trying to save a RadDocument into the XAML format.
So, we have add a test button to our UI in order to manage the save.
Unfornutaly, we've got the following exception during the call of the export method :
- ex {System.Reflection.TargetInvocationException: Une exception a été levée par la cible d'un appel. ---> System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet. à Telerik.Windows.Documents.Model.RadDocument.get_LineSpacing() --- Fin de la trace de la pile d'exception interne --- à System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) à System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) à System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) à Telerik.Windows.Documents.FormatProviders.Xaml.XamlWriter.WriteProperties(Object obj) à Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.WriteXaml(Boolean isStylesheet, Object objectToWrite, XamlWriter xamlWriter, Boolean isRoot) à Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Export(RadDocument document) à Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Export(RadDocument document, Stream output) à Arcan.Windows.MainPage.GetXamlFormDocument(RadDocument document) à Arcan.Windows.MainPage.RadSave(Object sender, RoutedEventArgs e)} System.Reflection.TargetInvocationExceptionThe save method is implemented as follow :
try{ // Save as XAMLstring xaml = GetXamlFrmDocument(this.radRichTextBox.Document);
...
} catch (System.Reflection.TargetInvocationException ex) {HtmlPage.Window.Alert(ex.Message);
}The implementation of the GetXamlFromDocument method is as follow :
public static string GetXamlFormDocument(RadDocument document){ IDocumentFormatProvider exporter = new XamlFormatProvider(); string result; using (MemoryStream stream = new MemoryStream()) { exporter.Export(document, stream); stream.Seek(0, SeekOrigin.Begin); StreamReader reader = new StreamReader(stream); result = reader.ReadToEnd(); } return result;}Thanks ins advance for any help.
Best regards
Guillaume Chomat