2

I'm updating some old code, and want to replace some code to create excel documents with EPPlus. The problem is my old code indexes things from [0, n-1] and EPPlus indexes from [1, n].

Is there any way to account for this, other than to manually increment all cell addresses by [1,1]?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Zackary
  • 195
  • 9
  • I think one way to go about this would be to create something to interface the two, like an ExcelRangeCustom object that would take in [0,n-1] and make the ExcelRange calls with +1 to all the row/column indices. I'm just not quite sure how to do that, nor if that really is a decent idea. – Zackary Jul 11 '16 at 14:26

1 Answers1

2

So an interface which reads in indices at [0,n-1] and then increments the values before calling the appropriate methods probably would have worked, but for personal reasons, I couldn't use this approach.

Things that helped me:

  • Where I was using variables purposed for indexing, I could increase their initial value by 1.
  • Large sections of relatively repetitive code (same operations, different cell ranges) into small loops where there were less values to manage.
  • Helper methods for commonly used formats for were also very helpful in preventing me writing the same range multiple times.

Beyond that, however, I unfortunately didn't find a simpler way than to add [1,1] to everything.

Zackary
  • 195
  • 9