This question is locked. New answers and comments are not allowed.
using this document:
DocxFormatProvider provider = new DocxFormatProvider();
using (Stream output = saveDialog.OpenFile())
{
provider.Export(EditorPrint.Document, output); --> returns an exception **
}
**
System.NullReferenceException: FromElement must not be null.
em Telerik.Windows.Documents.Model.DocumentElement.CopyPropertiesFrom(DocumentElement fromElement)
em Telerik.Windows.Documents.Model.Span..ctor(Span originalSpan)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraphMark(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraphProperties(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraph(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportBlock(Block block)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.Export()
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.DocxExporter.AddXmlContentToPackage(DocxPartExporterBase exporter)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.DocxExporter.Export()
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider.Export(RadDocument document, Stream output)
em TSB_Test.Content.Contracts.ContractDialog.RadRibbonButton_Click(Object sender, RoutedEventArgs e)}
It works fine with the same code but for pdf provider.
Even more strange if I export first as pdf and then as docx it works... any idea why?
<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents" version="1.0" DefaultPageLayoutSettings="793.6667,1122.467" LayoutMode="Paged" PageViewMargin="10,10"> <t:Section PageMargin="72,96,72,96"> <t:Paragraph Background="#00FFFFFF"> <t:Span Text="HIHUIHIUGYUFYFGFGHGHJJHKJHJKHKJHKLK "></t:Span> <t:Hyperlink FontFamily="Verdana" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Target="Blank" Text="(...) P.F. Preencher" UnderlineDecoration="None" URL="DIAS_DESCARGA"></t:Hyperlink> <t:Span Text=" "></t:Span> </t:Paragraph> <t:Paragraph Background="#00FFFFFF"> <t:Span FontWeight="Bold" Text="CLÁUSULA QUINTA - DA TAXA DE RETORNO "></t:Span> <t:Span Text=" "></t:Span> </t:Paragraph> <t:Paragraph Background="#00FFFFFF" TextAlignment="Justify"> <t:Span Text="A título de incentivo pela manutenção e participação de produtos cadastrados, as partes ajustam uma taxa de retorno de "></t:Span> <t:Hyperlink FontFamily="Verdana" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Target="Blank" Text="(...) P.F. Preencher" UnderlineDecoration="None" URL="TAXA_RETORNO"></t:Hyperlink> <t:Span HighlightColor="#00FFFFFF" Text=" %"></t:Span> <t:Span Text=" ("></t:Span> <t:Hyperlink FontFamily="Verdana" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Target="Blank" Text="(...) P.F. Preencher" UnderlineDecoration="None" URL="TAXA_RETORNO_TEXT"></t:Hyperlink> <t:Span Text=" ), incidente sobre o valor total das notas fiscais, que será cobrado pelo "></t:Span> <t:Span FontWeight="Bold" Text="COMPRADOR "></t:Span> <t:Span Text="via "></t:Span> <t:Hyperlink FontFamily="Verdana" ForeColor="#FF000000" HighlightColor="#00FFFFFF" Target="Blank" Text="(...) P.F. Preencher" UnderlineDecoration="None" URL="PAYMENT_METHOD"></t:Hyperlink> <t:Span Text=" a ser concedido pelo "></t:Span> <t:Span FontWeight="Bold" Text="FORNECEDOR "></t:Span> <t:Span Text="em cada operação de compra. "></t:Span> </t:Paragraph> <t:Paragraph Background="#00FFFFFF" TextAlignment="Justify"></t:Paragraph> <t:Paragraph Background="#00FFFFFF" TextAlignment="Justify"></t:Paragraph> </t:Section></t:RadDocument>DocxFormatProvider provider = new DocxFormatProvider();
using (Stream output = saveDialog.OpenFile())
{
provider.Export(EditorPrint.Document, output); --> returns an exception **
}
**
System.NullReferenceException: FromElement must not be null.
em Telerik.Windows.Documents.Model.DocumentElement.CopyPropertiesFrom(DocumentElement fromElement)
em Telerik.Windows.Documents.Model.Span..ctor(Span originalSpan)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraphMark(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraphProperties(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportParagraph(Paragraph paragraph)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.ExportBlock(Block block)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.MainDocumentExporter.Export()
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.DocxExporter.AddXmlContentToPackage(DocxPartExporterBase exporter)
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Export.DocxExporter.Export()
em Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider.Export(RadDocument document, Stream output)
em TSB_Test.Content.Contracts.ContractDialog.RadRibbonButton_Click(Object sender, RoutedEventArgs e)}
It works fine with the same code but for pdf provider.
Even more strange if I export first as pdf and then as docx it works... any idea why?