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

[ERROR] LibreOffice/OpenOffice .docx files HtmlFormatProvider Export

5 Answers 152 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 27 Oct 2016, 03:23 PM

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

5 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 01 Nov 2016, 11:58 AM
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

0
J
Top achievements
Rank 1
answered on 02 Nov 2016, 07:27 AM

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

0
Mihail
Telerik team
answered on 02 Nov 2016, 09:08 AM
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

0
J
Top achievements
Rank 1
answered on 02 Nov 2016, 09:43 AM

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?

0
Mihail
Telerik team
answered on 03 Nov 2016, 08:27 AM
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

Tags
WordsProcessing
Asked by
J
Top achievements
Rank 1
Answers by
Mihail
Telerik team
J
Top achievements
Rank 1
Share this question
or