diff --git a/src/EPPlus.Export.Pdf.Tests/PdfTests.cs b/src/EPPlus.Export.Pdf.Tests/PdfTests.cs index 893cec994..806ec1df2 100644 --- a/src/EPPlus.Export.Pdf.Tests/PdfTests.cs +++ b/src/EPPlus.Export.Pdf.Tests/PdfTests.cs @@ -1127,5 +1127,14 @@ public void PngTransparentTest() string path = _pdfPath + "Allsvenskan2001.pdf"; ws.SaveAsPdf(path); } + + [TestMethod] + public void TableDxfStyleTest() + { + using var p = OpenTemplatePackage("TableDxfStylePdf1.xlsx"); + var ws = p.Workbook.Worksheets[0]; + string path = _pdfPath + "TableDxfStylePdf1.pdf"; + ws.SaveAsPdf(path); + } } } diff --git a/src/EPPlus/Export/PdfExport/TextMapping/PdfTextMap.cs b/src/EPPlus/Export/PdfExport/TextMapping/PdfTextMap.cs index 4d371ca36..139b985fa 100644 --- a/src/EPPlus/Export/PdfExport/TextMapping/PdfTextMap.cs +++ b/src/EPPlus/Export/PdfExport/TextMapping/PdfTextMap.cs @@ -878,21 +878,19 @@ internal static ExcelDxfBorderItem GetTopBorderItem(ExcelRangeBase cell, ExcelBo { if (table.ShowColumnStripes && (tableCol & 1) == 0) { - if (cell._fromRow - ts > range._fromRow && cell._fromRow < range._toRow) - { top = tableStyle.FirstColumnStripe.Style.Border.Horizontal; elementOrder = TableEdgeOrder.FirstColumnStripe; } - else if (cell._fromRow <= range._toRow) - { top = null; } - else - { top = tableStyle.FirstColumnStripe.Style.Border.Top; elementOrder = TableEdgeOrder.FirstColumnStripe; } + var band = tableStyle.FirstColumnStripe.Style.Border; + if (tableRow == 0) + { if (band.Top.HasValue) { top = band.Top; elementOrder = TableEdgeOrder.FirstColumnStripe; } } + else if (band.Horizontal.HasValue) + { top = band.Horizontal; elementOrder = TableEdgeOrder.FirstColumnStripe; } } if (table.ShowColumnStripes && (tableCol & 1) != 0) { - if (cell._fromRow + ts > range._fromRow && cell._fromRow < range._toRow) - { top = tableStyle.SecondColumnStripe.Style.Border.Horizontal; elementOrder = TableEdgeOrder.SecondColumnStripe; } - else if (cell._fromRow <= range._toRow) - { top = null; } - else - { top = tableStyle.SecondColumnStripe.Style.Border.Top; elementOrder = TableEdgeOrder.SecondColumnStripe; } + var band = tableStyle.SecondColumnStripe.Style.Border; + if (tableRow == 0) + { if (band.Top.HasValue) { top = band.Top; elementOrder = TableEdgeOrder.SecondColumnStripe; } } + else if (band.Horizontal.HasValue) + { top = band.Horizontal; elementOrder = TableEdgeOrder.SecondColumnStripe; } } if (table.ShowRowStripes && tableStyle.FirstRowStripe.Style.Border.Top.HasValue && (tableRow & 1) != 0) { top = tableStyle.FirstRowStripe.Style.Border.Top; elementOrder = TableEdgeOrder.FirstRowStripe; }