[ERROR] LibreOffice/OpenOffice .docx files HtmlFormatProvider Export

6 posts, 0 answers
  1. J
    J avatar
    6 posts
    Member since:
    Oct 2016

    Posted 27 Oct Link to this post

    Hi;

    I'm having problems, when I try to export with HtmlFormatProvider the OpenOffice/LibreOffice docx files.

    If the file is created with MSWord there's no problems, all works fine, the problem is with LibreOffice/Openoffice generated-documents.

    Please, I need help 'cause some of my customers uses LibreOffice to create the docx documents.

    +++++++++++++++++++++++ CODE ++++++++++++++++++++++++++

                    docxProvider = new DocxFormatProvider();
                    htmlProvider = new HtmlFormatProvider();

                    if(this._DocXByteArray == null)
                        this._DocXByteArray = System.IO.File.ReadAllBytes(this._DocXPath);

                    document = docxProvider.Import(this._DocXByteArray);
                            
                    htmlProvider.ExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
                    htmlProvider.ExportSettings.ImagesExportMode = ImagesExportMode.Embedded;
                    htmlProvider.ExportSettings.StylesExportMode = StylesExportMode.Embedded;
                            
                    string html = htmlProvider.Export(document); //heres crash with the down error trace

    +++++++++++++++++++++++ CODE ++++++++++++++++++++++++++

    I'm always getting this error

    ++++++++++++++++++++++++ ERROR TRACE ++++++++++++++++++++++++

      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.ParagraphElementBase.GetDefaultStyleId(IHtmlExportContext context, String& styleId)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.CopyStyleFrom(IHtmlExportContext context, IElementWithStyle element)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.ParagraphElementBase.OnBeforeWrite(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.Write(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.WriteContent(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Model.Elements.HtmlElementBase.Write(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Export.HtmlExporter.ExportDocumentFragment(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.Export.HtmlExporter.Export(IHtmlWriter writer, IHtmlExportContext context)
      at Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider.ExportOverride(RadFlowDocument document, Stream output)
      at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
      at Telerik.Windows.Documents.Common.FormatProviders.TextBasedFormatProviderBase`1.Export(T document)

    ++++++++++++++++++++++++ END ERROR TRACE ++++++++++++++++++++++++

     

    Thx

  2. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 01 Nov Link to this post

    Hello Jorge,

    I couldn't manage to reproduce the described problem.

    Could you provide a sample document which we can use to reproduce the issue? You could attach such document to a new support ticket as the forum thread will not allow you to attach anything different than an image. The right to open a support ticket is automatically granted to users that purchase our product or to a users who start their trial by downloading our product.

    Regards,
    Mihail
    Telerik by Progress

  3. J
    J avatar
    6 posts
    Member since:
    Oct 2016

    Posted 02 Nov in reply to Mihail Link to this post

    Hi Mihail;

    First of all, sorry for the multi-thread (^_^) but I am a bit anxious. In the future I'll only open a thread at a time.

    Ok, here it's the sample file requested.

    Hope this helps, If you need more data information, just ask for it.

    I've attached the file and added the png extension, just remove it, to get de docx vesion.

    If all goes well with this file and your tests, please post me back the c# code to try it locally.

    Greetz, and really appreciatte

  4. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 02 Nov Link to this post

    Hello JP,

    I have tested the document and I still can't reproduce the problem. Here is the code I am using:
    private void DocxImport_Click(object sender, RoutedEventArgs e)
    {
        OpenFileDialog ofd = new OpenFileDialog();
        ofd.Filter = "Docx files|*.docx";
     
        if (ofd.ShowDialog() == true)
        {
            using (Stream str = ofd.OpenFile())
            {
                DocxFormatProvider provider = new DocxFormatProvider();
                this.document = provider.Import(str);
            }
        }
    }

    and here is how I export the file:
    private void HtmlExport_Click(object sender, RoutedEventArgs e)
    {
        HtmlFormatProvider provider = new HtmlFormatProvider();
        using (Stream output = new FileStream("output.html", FileMode.OpenOrCreate))
        {
            provider.Export(this.document, output);
        }
    }

    I am using assemblies from the latest release 2016 R3 SP1. What version are you using ?

    Regards,
    Mihail
    Telerik by Progress

  5. J
    J avatar
    6 posts
    Member since:
    Oct 2016

    Posted 02 Nov in reply to Mihail Link to this post

    Hi again;

     

    Sorry for disturb but I'm getting the same error, even with your example.

    I'm, using the \UI for ASP.NET AJAX Q2 2016\AdditionalLibraries\Bin40\  version of the libraries.

    Could be this the problem?

  6. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 03 Nov Link to this post

    Hello Jorge,

    I have tested with the ASP AJAX 2016 Q2 and I couldn't manage to reproduce the problem. Please check the attached screenshot of the resulted HTML.

    Please start your trial and open a new support ticket with attached a simple demo application with all required assemblies. This way we could further investigate the problem.


    Regards,
    Mihail
    Telerik by Progress

Back to Top