Skip to content

Commit c04fb81

Browse files
committed
Added fix for html images
1 parent 239f3cf commit c04fb81

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

src/EPPlus/Export/HtmlExport/Exporters/Internal/HtmlExporterBaseInternal.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected HTMLElement GetThead(ExcelRangeBase range, List<string> headers = null
148148

149149
AddTableData(table, contentElement, col);
150150

151-
if (Settings.Pictures.Include == (ePictureInclude.Include | ePictureInclude.IncludeInHtmlOnly))
151+
if ((Settings.Pictures.Include == ePictureInclude.Include) || (Settings.Pictures.Include == ePictureInclude.IncludeInHtmlOnly))
152152
{
153153
image = GetImage(cell.Worksheet.PositionId, cell._fromRow, cell._fromCol);
154154
}
@@ -269,7 +269,7 @@ protected HTMLElement GetTableBody(ExcelRangeBase range, int row, int endRow)
269269

270270
SetColRowSpan(range, tblData, cell);
271271

272-
if (Settings.Pictures.Include == (ePictureInclude.Include | ePictureInclude.IncludeInHtmlOnly))
272+
if ((Settings.Pictures.Include == ePictureInclude.Include) || (Settings.Pictures.Include == ePictureInclude.IncludeInHtmlOnly))
273273
{
274274
image = GetImage(cell.Worksheet.PositionId, cell._fromRow, cell._fromCol);
275275
}

src/EPPlusTest/Export/HtmlExport/TableExporterTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ public async Task WriteImages_TableAsync()
443443
exporter.Settings.SetColumnWidth = true;
444444
exporter.Settings.SetRowHeight = true;
445445
exporter.Settings.Pictures.Include = ePictureInclude.Include;
446+
exporter.Settings.Pictures.Position = ePicturePosition.Absolute;
447+
exporter.Settings.Pictures.AddMarginLeft = true;
448+
exporter.Settings.Pictures.AddMarginTop = true;
446449
exporter.Settings.Minify = false;
447450
var html = exporter.GetSinglePage();
448451
var htmlAsync = await exporter.GetSinglePageAsync();

src/EPPlusTest/Issues/ConditionalFormattingIssues.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,24 @@ public void VerifyReadWritePriority()
161161
//SaveAndCleanup(p);
162162
}
163163
}
164+
165+
[TestMethod]
166+
public void i2381()
167+
{
168+
using (var package = OpenTemplatePackage("Cabinet_template_test_clean.xlsx"))
169+
{
170+
var copyCount = package.Workbook.Worksheets.Count;
171+
var worksheets = package.Workbook.Worksheets;
172+
173+
//for (int i = 0; i < copyCount; i++)
174+
//{
175+
// package.Workbook.Worksheets.Copy(
176+
// worksheets[i].Name, $"{worksheets[i].Name}_{i}");
177+
//}
178+
179+
SaveAndCleanup(package);
180+
}
181+
}
182+
164183
}
165184
}

0 commit comments

Comments
 (0)