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

Exceptions when importing DocX files

1 Answer 186 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
ANN
Top achievements
Rank 1
ANN asked on 11 Nov 2010, 09:26 PM

We are trying to load help documents from the server into a RichTextBox. We were going to use HTML files but the image links caused cross domain issues. I saw the post : http://www.telerik.com/community/forums/silverlight/richtextbox/initialize-richtextbox-with-docx-file.aspx so we decided to try switching to docx files. We upgraded to the Nov 2010 release (2010.3.1110.1040)  and picked two sample docx files that were created in Word 2007. One has just one small image in it (20kb) and the other is 11 pages (299Kb). The small document loads but larger docs all throw exceptions.  Is there only limited support for the docx format?

When we load the larger docx file we get this exception:
System.FormatException occurred
  Message=Input string was not in a correct format.
  StackTrace:
       at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
       at System.Convert.ToSingle(String value, IFormatProvider provider)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlHelper.GetPtProperty(String style, String propertyName)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlHelper.GetSizeFFromString(String style)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.ReadImageInlineShape(ImageInline imageInline)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.BuildImageInlineFromShape()
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.BuildInline(Style style)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.ParagraphImporter.Import(Style parentStyle)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildDocument()
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.Import()
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentFromPackage(DocxPartImporterBase importer)
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.Import()
       at Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider.Import(Stream input)
       at DataLink.Controls.Help.WebClient_OpenAsyncCompleted(Object sender, OpenReadCompletedEventArgs e)
  InnerException:

Imports Telerik.Windows.Documents.Model
Imports Telerik.Windows.Documents.FormatProviders.Html
Imports Telerik.Windows.Documents.FormatProviders.OpenXml
  
  
..........
  
  Dim uri As New Uri(baseUri, "_help/test.docx")
  Me.WebClient.OpenReadAsync(uri)
End Sub
  
...............
  
  
Private Sub WebClient_OpenAsyncCompleted(ByVal sender As Object, ByVal e As OpenReadCompletedEventArgs) Handles WebClient.OpenReadCompleted
  
     Dim formatter As New Docx.DocxFormatProvider 
     Dim radDoc As RadDocument = formatter.Import(e.Result)
     e.Result.Close()
     Me.Editor.Document = radDoc
End Sub


1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 12 Nov 2010, 09:50 AM
Hi ANN,

The Docx format is quite complex, and not all its features are supported for now, but in the import process parser silently ignores document structures it doesn't recognize - so the behavior you identified is not normal.
Could you please open a bug report ticket and send us a sample docx file that throws the specified exception, so we can investigate the problem further?
Do not hesitate to contact us again if you experience any other issues.

Sincerely yours,
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
ANN
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or