Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XL89 Fix ExceltoHTML function behaviour for custom font-colours in XLSX files #79

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions ooxml/SS/Converter/ExcelToHtmlConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,17 @@ protected void ProcessSheet(ISheet sheet)

List<XmlElement> emptyRowElements = new List<XmlElement>(physicalNumberOfRows);
int maxSheetColumns = 1;
for (int r = 0; r < physicalNumberOfRows; r++)
for (int r = 0; r < sheet.LastPhysicalRowNumber; r++) //just number of rows will skip bottom rows if there's empty rows in the middle
{
IRow row = sheet.GetRow(r);

if (row == null)
continue;
{
IRow newRow = sheet.CreateRow(r); //if row is null, create an empty row
if (newRow != null)
row = newRow;
else
continue;
}

if (!OutputHiddenRows && row.ZeroHeight)
continue;
Expand Down Expand Up @@ -817,10 +822,13 @@ void BuildStyle_Font(IWorkbook workbook, StringBuilder style,
{
fontColor = st.GetTheme().GetThemeColor(font.Color);
}
else
var cellSpecificFontColour = ((XSSFFont)font).GetXSSFColor();
if (cellSpecificFontColour != null)
{
fontColor = ((XSSFFont)font).GetXSSFColor();
//themed colour is file-wide colour, cell-level colour should overwrite file-level theme colour
fontColor = cellSpecificFontColour;
}

if (fontColor != null)
hexstring = ExcelToHtmlUtils.GetColor(fontColor);
}
Expand Down
Loading