I found an error when open a docx file saved by RickTextBox. If you add an image to header of an document then save to an docx file, you can't open that file by Microsoft Office.
Is there any way to work around?
5 Answers, 1 is accepted
We are not aware of such a problem with the Docx export. So far, we have not encountered a case that the exported document cannot be opened with MS Word.
We would appreciate some more details on the issue:
1. What version of the controls you are using;
2. The problematic document exported to XAML.
In this way we could test directly the export of the document to docx and see what needs to be fixed.
Martin
the Telerik team
I'm using Telerik controls Q3 2011 SP1 ver. 2011.3.1220.1040
You can reproduce this error by these steps:
- Create 1 docx file with a picture as header
- Open that file with RadRichTextBox, do nothing and save it
- Open it by Microsoft Word 2010 and get error message: "The file abc.docx cannot be opened because there are problems with the contents."
You can see this error by attached image.
Hope you can resolve this error quickly.
We couldn't reproduce the issue following the steps you have listed and using the version of the controls you have specified.
Please send us the document exported to XAML, so that we can investigate the problem.
Mihail
the Telerik team
Sorry for late reponse.
This is content of xaml file I exported like you proposed.
<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" xmlns:s="clr-namespace:Telerik.Windows.Documents.Model.Styles;assembly=Telerik.Windows.Documents" version="1.2" DefaultPageLayoutSettings="816,1056" LayoutMode="Paged" PageViewMargin="10,10" ParagraphDefaultSpacingAfter="13.3333330154419" StyleName="defaultDocumentStyle"> <t:RadDocument.ProtectionSettings> <t:DocumentProtectionSettings EnableDocumentProtection="False" Enforce="False" HashingAlgorithm="None" HashingSpinCount="0" ProtectionMode="ReadOnly" /> </t:RadDocument.ProtectionSettings> <t:RadDocument.Styles> <s:StyleDefinition BasedOnName="Normal" DisplayName="Balloon Text" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="BalloonTextChar" Name="BalloonText" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="1" LineSpacingType="Auto" SpacingAfter="0" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Balloon Text Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="BalloonText" Name="BalloonTextChar" Type="Character"> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontFamily="Tahoma" FontSize="10.6666669845581" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition DisplayName="Document Default Style" IsCustom="False" IsDefault="False" IsPrimary="True" Name="defaultDocumentStyle" Type="Default"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="1.15" LineSpacingType="Auto" SpacingAfter="13.3333330154419" /> </s:StyleDefinition.ParagraphStyle> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontSize="14.6666669845581" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition DisplayName="Default Paragraph Font" IsCustom="False" IsDefault="True" IsPrimary="False" Name="DefaultParagraphFont" Type="Character" /> <s:StyleDefinition BasedOnName="Normal" DisplayName="footer" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="FooterChar" Name="Footer" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="1" LineSpacingType="Auto" SpacingAfter="0" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Footer Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Footer" Name="FooterChar" Type="Character" /> <s:StyleDefinition BasedOnName="Normal" DisplayName="header" IsCustom="False" IsDefault="False" IsPrimary="False" LinkedStyleName="HeaderChar" Name="Header" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="1" LineSpacingType="Auto" SpacingAfter="0" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Header Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Header" Name="HeaderChar" Type="Character" /> <s:StyleDefinition BasedOnName="Normal" DisplayName="heading 2" IsCustom="False" IsDefault="False" IsPrimary="True" LinkedStyleName="Heading2Char" Name="Heading2" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties FirstLineIndent="0" LeftIndent="37.7999992370605" LineSpacing="24" LineSpacingType="Exact" SpacingAfter="8" SpacingBefore="8" TextAlignment="Justify" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Heading 2 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading2" Name="Heading2Char" Type="Character"> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontFamily="Arial" FontSize="16" FontWeight="Bold" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="Normal" DisplayName="heading 3" IsCustom="False" IsDefault="False" IsPrimary="True" LinkedStyleName="Heading3Char" Name="Heading3" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties FirstLineIndent="-28.3999996185303" LeftIndent="56.7333335876465" LineSpacing="24" LineSpacingType="Exact" SpacingAfter="8" SpacingBefore="8" TextAlignment="Justify" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Heading 3 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading3" Name="Heading3Char" Type="Character"> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontFamily="Arial" FontSize="16" FontWeight="Bold" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="Normal" DisplayName="heading 4" IsCustom="False" IsDefault="False" IsPrimary="True" LinkedStyleName="Heading4Char" Name="Heading4" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="24" LineSpacingType="Exact" SpacingAfter="8" SpacingBefore="8" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Heading 4 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading4" Name="Heading4Char" Type="Character"> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontFamily="Times New Roman" FontSize="16" FontStyle="Italic" FontWeight="Bold" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="Normal" DisplayName="heading 5" IsCustom="False" IsDefault="False" IsPrimary="True" LinkedStyleName="Heading5Char" Name="Heading5" Type="Paragraph"> <s:StyleDefinition.ParagraphStyle> <s:ParagraphProperties LineSpacing="24" LineSpacingType="AtLeast" SpacingAfter="8" SpacingBefore="8" /> </s:StyleDefinition.ParagraphStyle> </s:StyleDefinition> <s:StyleDefinition BasedOnName="DefaultParagraphFont" DisplayName="Heading 5 Char" IsCustom="True" IsDefault="False" IsPrimary="False" LinkedStyleName="Heading5" Name="Heading5Char" Type="Character"> <s:StyleDefinition.SpanStyle> <s:SpanProperties FontFamily="Times New Roman" FontSize="17.3333339691162" FontStyle="Italic" FontWeight="Bold" /> </s:StyleDefinition.SpanStyle> </s:StyleDefinition> <s:StyleDefinition DisplayName="No List" IsCustom="False" IsDefault="True" IsPrimary="False" Name="NoList" Type="Numbering" /> <s:StyleDefinition DisplayName="Normal" IsCustom="False" IsDefault="True" IsPrimary="True" Name="Normal" Type="Paragraph" /> <s:StyleDefinition DisplayName="Normal Table" IsCustom="False" IsDefault="True" IsPrimary="False" Name="TableNormal" Type="Table"> <s:StyleDefinition.TableStyle> <s:TableProperties CellPadding="7,0,7,0" /> </s:StyleDefinition.TableStyle> </s:StyleDefinition> </t:RadDocument.Styles> <t:Section PageMargin="96,96,96,96"> <t:Section.Headers> <t:Headers> <t:Headers.Default> <t:Header> <t:Header.Body> <t:RadDocument DefaultPageLayoutSettings="816,1056" LayoutMode="Flow" PageViewMargin="10,10" ParagraphDefaultSpacingAfter="13.3333330154419" StyleName="defaultDocumentStyle"> <t:RadDocument.ProtectionSettings> <t:DocumentProtectionSettings EnableDocumentProtection="False" Enforce="False" HashingAlgorithm="None" HashingSpinCount="0" ProtectionMode="ReadOnly" /> </t:RadDocument.ProtectionSettings> <t:Section> <t:Paragraph LineSpacing="1" StyleName="Header"> <t:ImageInline Extension="jpg" Height="27" RawData="/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAbAKADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD/AD/6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACitjxDawWOv65ZWsflWtnrGp2ttFud/Lgt72eGGPfIzyPsjRV3SOztjLMzEk49XVpypVKlKTTlTnOnJxu4uUJOLabSdrrS6TtukbYmhPC4jEYao4uph61WhNwbcHOjUlTk4OSjJxcotxbjFtWuk9AoooqDEKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigD//2Q==" RotateAngle="0" Width="160" /> </t:Paragraph> <t:Paragraph LineSpacing="1" StyleName="Header" /> </t:Section> </t:RadDocument> </t:Header.Body> </t:Header> </t:Headers.Default> </t:Headers> </t:Section.Headers> <t:Paragraph LineSpacing="1" /> </t:Section></t:RadDocument>Thank you for the follow-up.
Actually the problem was not with the picture in the header, but with the export of the styles.
The good news is that the issue has been fixed in the development version of the control and the fix will be available in the upcoming 2012 Q1, expected in less than two weeks.
Iva Toteva
the Telerik team