Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
When a cell contains text or a string that is larger than the width of the cell, the string overflows if the next cell in the next column is null or empty. When you save your Excel file into HTML, you can control this overflow by specifying the cross type using the HtmlCrossType enumeration. It has the following values:
HtmlCrossType.Default: Displays like MS Excel, depending on the next cell. If the next cell is null, the string will cross; otherwise it will be truncated.
HtmlCrossType.MSExport: Displays the string as MS Excel does when exporting to HTML.
HtmlCrossType.Cross: Displays HTML cross string; the performance for creating large HTML files will be more than ten times faster than setting the value to Default or FitToCell.
HtmlCrossType.FitToCell: Only displays the string within the width of the cell.
The following sample code loads the sample Excel file and saves it to HTML format by specifying different HtmlCrossType. Please download the output HTML files generated with this code. The sample Excel file contains an image bordered in red, as shown in this screenshot, which demonstrates the effect of the HtmlCrossType values on output HTML.

#include <iostream>
#include <string>
#include "Aspose.Cells.h"
using namespace Aspose::Cells;
int main()
{
Aspose::Cells::Startup();
U16String inputFilePath(u"sampleHtmlCrossStringType.xlsx");
Workbook wb(inputFilePath);
HtmlSaveOptions opts;
opts.SetHtmlCrossStringType(HtmlCrossType::Default);
opts.SetHtmlCrossStringType(HtmlCrossType::MSExport);
opts.SetHtmlCrossStringType(HtmlCrossType::Cross);
opts.SetHtmlCrossStringType(HtmlCrossType::FitToCell);
int htmlCrossType = static_cast<int>(opts.GetHtmlCrossStringType());
std::string numStr = std::to_string(htmlCrossType);
U16String outputFilePath = U16String(u"out") + U16String(numStr.c_str()) + U16String(u".htm");
wb.Save(outputFilePath, opts);
Aspose::Cells::Cleanup();
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.