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

Import / export issues

4 Answers 244 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Trude
Top achievements
Rank 2
Trude asked on 30 Jun 2010, 12:10 AM

First I read/import a .docx in your richtextbox. I then save/export this file as .xaml format. When I try to read/import this file back I get this exception:

System.Windows.Markup.XamlParseException occurred  
  LineNumber=3 
  LinePosition=31 
  Message=Failed to create a 'System.Double' from the text '13,3333330154419'. [Line: 3 Position: 31]  
  StackTrace:  
       ved MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers, Boolean expandTemplatesDuringParse)  
       ved MS.Internal.XcpImports.CreateFromXaml(String xamlString, Boolean createNamescope, Boolean requireDefaultNamespace, Boolean allowEventHandlers)  
       ved System.Windows.Markup.XamlReader.Load(String xaml)  
       ved Telerik.Windows.Documents.FormatProviders.Xaml.XamlFormatProvider.Import(Stream input)  
       ved I2.document_editor.ButtonOpen_Click(Object sender, RoutedEventArgs e)  
  InnerException: System.Collections.Generic.KeyNotFoundException  
       Message=The given key was not present in the dictionary.  
       StackTrace:  
            ved System.ThrowHelper.ThrowKeyNotFoundException()  
            ved System.Collections.Generic.Dictionary`2.get_Item(TKey key)  
            ved System.Windows.ResourceManagerWrapper.GetResourceForUri(Uri xamlUri, Type componentType)  
       InnerException: 

This is line 3:

<t:Paragraph SpacingAfter="13,3333330154419" FontSize="16">

Another issue that I found is when I try follow your online documentation:

Public Function ExportToXAML(document As RadDocument) As String 
 Dim provider As IDocumentFormatProvider = New XamlFormatProvider()  
 Dim exportValue As String = [String].Empty  
 Using output As New MemoryStream()  
  provider.Export(document, output)  
  output.Seek(0, SeekOrigin.Begin)  
  Using reader As New StreamReader(output)  
   exportValue = reader.ReadToEnd()  
  End Using  
 End Using  
 Return exportValue  
End Function 

If I want to export to .docx instead of .xaml the only thing I need to do is to swap the xamlformaprovider with the docxformatprovider, but that throws an exception:

System.ObjectDisposedException was unhandled by user code  
  Message=Cannot access a closed Stream.  
  ObjectName="" 
  StackTrace:  
       ved System.IO.__Error.StreamIsClosed()  
       ved System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)  
       ved I2.document_editor.ExportDocToDOCX()  
       ved I2.document_editor.SaveFile(String _parameter)  
       ved I2.document_editor.SetFileName(String _text)  
       ved I2.text_input_window.ButtonOK_Click(Object sender, RoutedEventArgs e)  
       ved System.Windows.Controls.Primitives.ButtonBase.OnClick()  
       ved System.Windows.Controls.Button.OnClick()  
       ved Telerik.Windows.Controls.RadButton.OnClick()  
       ved System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)  
       ved System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)  
       ved MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)  
  InnerException:   
 

4 Answers, 1 is accepted

Sort by
0
Accepted
Mike
Telerik team
answered on 02 Jul 2010, 07:55 AM
Hello Jorn,

We confirm that we can reproduce the issues you reported. The points in your account have been updated.
The first issue could be temporally worked around by changing you "region and language options" -> decimal symbol to ".".

The second issue is related to limitations in DocxFormatProvider, which generally exports zip stream and was not intended to be written in a string. But I guess we can change that and not close the provided stream. We will resolve this issues in Q2 release. Until then you can use the XamlFormatProvider.

Let us know if anything else pops up.

Sincerely yours,
Mike
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
0
Trude
Top achievements
Rank 2
answered on 02 Jul 2010, 07:18 PM
Thanks for the feedback. I would really like to be able to save the DocxFormatProvider stream and have the region issue fixed - looking forward to the Q2 release!
0
ss
Top achievements
Rank 1
answered on 20 Oct 2011, 03:34 PM
Hello,

I have same problem. I use HtmlFormatProvider. Export method exports InlineUIElement to:
<!--{InlineUIContainer}<telerik:InlineUIContainer xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FieldStart="{x:Null}" Height="25" Style="{x:Null}" Width="60" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
  <telerik:InlineUIContainer.DefaultStyleSettings>
    <Telerik_Windows_Documents_Model_Styles_Telerik_Windows_Documents:StyleDefinition BasedOn="{x:Null}" xmlns:Telerik_Windows_Documents_Model_Styles_Telerik_Windows_Documents="clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents" />
  </telerik:InlineUIContainer.DefaultStyleSettings>
  <Button Content="myButton" Height="25" Width="60" Canvas.Left="174,824813842773" Canvas.Top="72" />
</telerik:InlineUIContainer>-->
  <!--{/InlineUIContainer}-->

When I try to create instance of InlineUIElement by using XamlReader.Load method I am not able to do this because of Canvas.Left="174,824813842773". XamlReader use InvariantCulture but HtmlFormatProvider use different culture. how can I configure HtmlFormatProvider to provide corrent format of number?

Thank you.

0
Boby
Telerik team
answered on 25 Oct 2011, 11:45 AM
Hi Ss,
Thank you for reporting this issue. We will add it to our to-do list and will try to fix it for some of the future releases. Until now, your can set the current culture to InvariantCulture for the time of export.
Please, excuse us for the inconvenience. We have added points to your account for the suggestions. Don't hesitate to contact us if you have other questions.

Greetings,
Boby
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Trude
Top achievements
Rank 2
Answers by
Mike
Telerik team
Trude
Top achievements
Rank 2
ss
Top achievements
Rank 1
Boby
Telerik team
Share this question
or