@koc-it-support
I’m sorry for the delayed response. The behavior you’re experiencing is the default for GroupDocs.Conversion.
- When converting Excel files, each spreadsheet is divided into pages, as shown in the files you attached.
- 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.