License issue prior to 18.6.0 and rowIndex versus rowOffset

We are trying to get an older code base from another vendor working in house and have a issue with our license we recently purchased. The license we have been given only works with Aspose.Cells 18.6.0 or newer. With 18.3 and 18.4 Workbook().IsLicensed returns false. With 18.6.0 and newer Workbook().IsLicensed returns true.

The code is currently using 18.3.0. But changing to use Aspose.Cells > 18.5 causes numerous build compile errors because the parameters on Cells.Item changed from rowIndex and columnIndex to rowOffset and columnOffSet. I’ve tried a dozen versions between 18.6 and the latest 23.5.0 and they cause the same compilation errors. I’ve tried searching the forums and documentation and cannot find reference to the differences between Index and Offset and how that changes behavior. I also can’t find anything in the documentation including release notes or forums related to when these parameter changed.

We need help with either of the following options

  1. A license that works with 18.3
  2. Confirmation that changing rowIndex and columnIndex to rowOffset and columnOffSet in calls to Cells.Item() does not change behavior

Thanks
Sean

@sdecker,

  1. Please use your older license to work with 18.3. If you want to stick with older version of the APIs, you do not need newer license, your older license will work just fine as always.
  2. Could you please share sample code snippet which was working fine with <= 18.5 but not with 18.6.0 or newer versions (it causes numerous build compile errors). Alternatively, kindly create a (standalone) sample console application with your code segment using newer (23.5.0) version (which is giving you compile time errors), we will check and help you to figure out the issue soon.

PS. please zip the project prior attaching here.

  1. We don’t have an older license as it was the previous vendor license not ours

For rctr = 0 To dataRange.RowCount - 1

            ' inner loop through columns - note: Aspose is zero-based

            Me.drDataRow = Me.dtDataTable.NewRow()

            If Me.dtDataTable.Columns("LLCSubmissionTrackingID") Is Nothing Then

                Me.dtDataTable.Columns.Add("LLCSubmissionTrackingID")

            End If

            Me.drDataRow("LLCSubmissionTrackingID") = Me.mLSCertSubmissionTrackingID

            If Me.dtDataTable.Columns("ExcelRowNumber") Is Nothing Then

                Me.dtDataTable.Columns.Add("ExcelRowNumber")

            End If

            Me.drDataRow("ExcelRowNumber") = rctr + firstRow

            Dim fieldName As String = ""

            ' inner loop through columns

            Dim cctr As Integer = 0 'column counter

            For Each col As FDICFileFieldMap In fieldList

                fieldName = Trim(col.MLSFieldName)

                ' make sure there is a column in the datatable

                If Me.dtDataTable.Columns(fieldName) Is Nothing Then

                    'add column to DataTable if it is missing

                    If col.MLSDataType = "bit" Then

                        Me.dtDataTable.Columns.Add(fieldName, GetType(Boolean))

                    Else

                        Me.dtDataTable.Columns.Add(fieldName)

                    End If

                End If

                tmpVal = ExcelHelper.GetCellValueAsString(dataRange.Item(rowIndex:=rctr, columnIndex:=cctr))

The last line is what errors. The new parameter names are rowOffset and columnOffset. Was this just a name change or did the behavior change?

@sdecker,

Thanks for providing further details.

I understand you now. Please note in newer versions, Range.Item indexer gets Cell object in it. It has two parameters:
rowOffset → it denotes the row offset in the range (zero based).
columnOffset → it denotes column offset in the range (zero based).

To make you understand the parameters, I have written the following example for your reference:
e.g.
Sample code:

        'Create a Workbook
        Dim workbook As Workbook = New Workbook()
        'Get Cells
        Dim cells As Cells = workbook.Worksheets(0).Cells
        'Create Range
        Dim dataRange As Range = cells.CreateRange("A1:C4")
        'Put values in each cell in the range.
        dataRange.Item(0, 0).PutValue("A1")
        dataRange.Item(0, 1).PutValue("B1")
        dataRange.Item(0, 2).PutValue("C1")
        dataRange.Item(1, 0).PutValue("A2")
        dataRange.Item(1, 1).PutValue("B2")
        dataRange.Item(1, 2).PutValue("C2")
        dataRange.Item(2, 0).PutValue("A3")
        dataRange.Item(2, 1).PutValue("B3")
        dataRange.Item(2, 2).PutValue("C3")
        dataRange.Item(3, 0).PutValue("A4")
        dataRange.Item(3, 1).PutValue("B4")
        dataRange.Item(3, 2).PutValue("C4")

        'First approach
        'Browse and get each cell (item) in the range.
        Dim ie As IEnumerator = dataRange.GetEnumerator()
        Console.WriteLine("First approach.")
        While ie.MoveNext
            Dim cell As Cell = CType(ie.Current, Cell)
            Console.WriteLine("value of " + cell.Name + ": " + cell.Value)
        End While

        'Second approach
        'Browse and get each cell (item) in the range.
        Console.WriteLine("Second approach.")
        For r As Integer = dataRange.FirstRow To dataRange.RowCount - 1
            For c As Integer = dataRange.FirstColumn To dataRange.ColumnCount - 1
                Dim cell As Cell = cells.Item(r, c)
                Console.WriteLine("value of " + cell.Name + ": " + cell.Value)
            Next

        Next

        Console.ReadLine()

Hope, this helps a bit.

It seems your code base is quite old, so, I am not sure about it.
Please note:
For previous rowIndex and columnIndex parameters in older versions, if rowIndex refers to row offset (not actual row index in the worksheet) and columIndex denotes column offset (not actual column index in the worksheet), then surely the parameters are renamed (behavior is not changed).
But if above is not true, then I am afraid, behavior is also changed.

Let us know if you still have any confusion.

Thank you for the code snippet I’ll look at it with another developer to see if it helps us get confidence. On this comment

For previous rowIndex and columnIndex parameters in older versions, if rowIndex refers to row offset (not actual row index in the worksheet) and columIndex denotes column offset (not actual column index in the worksheet), then surely the parameters are renamed (behavior is not changed).
But if above is not true, then I am afraid, behavior is also changed.

Are you not able to look back at old commits of the Cells code to confirm which type of change it was?

@sdecker,

For Range.Item(), we can confirm it is only change of parameter’s name. Because rowIndex and columnIndex is ambiguous for absolute index of one cell and offset in the range, so we renamed the parameters. But the logic does not change, the rowIndex and columnIndex in old version represents the offset in range too.

So, we are afraid we need one runnable project or code which can show the difference between versions, so we can look into it and figure the issue out for you.

Excellent, you have addressed all our issues. With those parameter changes and the latest release our license works and the code builds. We’re doing a quick validation but you’ve unstuck us.

Thank you.

@sdecker,
Thank you for your feedback. If you have any questions, please feel free to contact us.