Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Created Unassigned: Issue(s) with PrinterSettings.RepeatColumns [15634]

$
0
0
Issuing a PrinterSettings.RepeatColumns on an excel file that has either been written to disk (editing an existing xlsx or issuing a package.save and then issuing a RepeatColumns) causes an error. The same error can also be triggered by issuing a sheet.DeleteColumn and then the RepeatColumns.

In either case, .Net triggers this error:
> Row cannot be less than 1. Parameter name: value.

Example code in VB.Net that triggers:

```
Dim destFileInfo As FileInfo = New FileInfo(DestFile)
Using dstPackage As ExcelPackage = new ExcelPackage(destFileInfo)
Dim SNRSheet As ExcelWorksheet
'[...snipped code to copy data between documents...]
SNRSheet.deleteColumn(StageCol, LastColNum+2)
SNRSheet.PrinterSettings.RepeatColumns = SNRSheet.Cells("A:A")
dstPackage.Save()
End using
```

Not sure if this is related or not, but in this code, if I move the RepeatColumns line up above the deleteColumns line, then no error is triggered. But the RepeatColumns action is lost during the process.


Another example that triggers this:

```
Dim file = New FileInfo(filePath)
If file.Exists Then
file.Delete()
End If

Using p = New ExcelPackage(file)
Dim wb = p.Workbook
Dim ws = If(wb.Worksheets.FirstOrDefault(), wb.Worksheets.Add("Sheet1"))

For r As var = 1 To 20
For c As var = 1 To 20
ws.Cells(r, c).Value = String.Format("{0}-{1}", r, c)
Next
Next

ws.DeleteColumn(1, 2)
ws.PrinterSettings.RepeatColumns = ws.Cells("A:A")
p.Save()
End Using
```


Third example, editing a file that already exists on disk:

```
Using dstPackage As ExcelPackage = New ExcelPackage(dstInfo)
Dim SNRSheet As ExcelWorksheet = CreateSheet(dstPackage, "SNR calcs")
SNRSheet.PrinterSettings.RepeatColumns = SNRSheet.Cells("A:A") 'Triggers error.
dstPackage.Save()
End Using
```





Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>