GroupDocs Regarding Excel and DOCX files Preview

Hello Team,

I am using GroupDocs.Conversion in a .NET Core application to convert document files (e.g., Word, Excel) to HTML for preview purposes. However, I have encountered some issues during the conversion:

  • When converting an Excel file to HTML, some columns break onto the next page.

  • When converting a DOCX file to HTML, some text appears as an error.

I have uploaded the sample files along with their corresponding HTML converted files to a shared OneDrive folder and provided the link to that folder.

PreviewFiles

Details:

  • GroupDocs.Total Version: “25.2.0”

  • .NET Version: “8.0”

Could you please provide guidance on how to properly convert these files to HTML?

Thank you.

Best regards,

@koc-it-support

Can you please provide more details about the specific errors you are encountering when converting the Excel and DOCX files to HTML? Additionally, what steps have you already tried to resolve these issues?

@koc-it-support
This issue is reproduced at our end. Therefore, we have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): TOTALNET-208

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Dear Team,

Could you please provide an update on the current status or estimated timeline for the fix? Any update on the progress would be helpful so we can align our next steps accordingly.

Looking forward to your response.

Regards,

@koc-it-support

This ticket is still under investigation. We’ll notify you in case of any update.

@koc-it-support

I’m sorry for the delayed response. The behavior you’re experiencing is the default for GroupDocs.Conversion.

  1. When converting Excel files, each spreadsheet is divided into pages, as shown in the files you attached.
  2. The attached Word file contains fields that are updated before conversion. Since there are no actual values for the fields, the output contains error messages. This is also expected behavior.

Since you’re using GroupDocs.Total, you can use GroupDocs.Viewer as a workaround to perform the conversion. GroupDocs.Viewer provides options to adjust the output according to your requirements.

Convert Excel Files – One Worksheet per Page or the Entire Workbook as a Single HTML File

private static void ConvertExcel(string fileName)
{
    string workingDir = Directory.GetCurrentDirectory();
    string pageFileFormat = Path.Combine(workingDir, "out/excel/p_{0}.html");

    using (Viewer viewer = new Viewer(fileName))
    {
        HtmlViewOptions viewOptions =
            HtmlViewOptions.ForEmbeddedResources(pageFileFormat);
        viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();

        // Uncomment the next line to render to one file
        //viewOptions.RenderToSinglePage = true;

        viewer.View(viewOptions);
    }
}

The line viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet(); tells GroupDocs.Viewer to render each worksheet to a separate page.

You can also convert all the worksheets to a single file by uncommenting the line with viewOptions.RenderToSinglePage = true;.

See more about the available options at: Split a worksheet into pages | Documentation

Convert Word Files Without Updating Form Fields

GroupDocs.Viewer includes an UpdateFields option, which allows you to choose whether to update fields during conversion.

private static void ConvertWord(string fileName)
{
    string workingDir = Directory.GetCurrentDirectory();
    string pageFileFormat = Path.Combine(workingDir, "out/word/p_{0}.html");

    using (Viewer viewer = new Viewer(fileName))
    {
        HtmlViewOptions viewOptions =
            HtmlViewOptions.ForEmbeddedResources(pageFileFormat);
        viewOptions.WordProcessingOptions.UpdateFields = false;

        // Uncomment the next line to render to one file
        //viewOptions.RenderToSinglePage = true;

        viewer.View(viewOptions);
    }
}

Again, to convert the document to a single HTML file, set RenderToSinglePage to true.

Here is a sample app you can use to test conversions with GroupDocs.Viewer:
sample-app.zip (1.2 MB)


Please let us know if these workarounds can be applied in your case.