We are transitioning from using Microsoft’s Excel libraries in .NET to Aspose. Is there a way I can dynamically modify a range’s size within a worksheet?
Code using Microsoft library:
xlSheet.Range(“A2”).Resize(oDTView.Rows.Count, oDTView.Columns.Count)
I’m trying to do something similar so that when I import a datatable, and refresh my pivot tables, it will pick up all the data.
Thanks
Hi Amjad, thanks for the quick reply.
I looked at the documentation you referenced and couldn’t find what I was trying to do. I ended up using your example somewhat.
Dim oRange As Aspose.Cells.Range = xlSheet.Cells.CreateRange(1, 0, oDTView.Rows.Count, oDTView.Columns.Count)
oRange.Name = “DataSource”
For k As Integer = 0 To oDTView.Rows.Count - 1
For l As Integer = 0 To oDTView.Columns.Count - 1
If l = 0 Then
oRange(k, l).PutValue("’" & IIf(oDTView.Rows(k).Item(l) Is DBNull.Value, “”, oDTView.Rows(k).Item(l)))
Else
oRange(k, l).PutValue(oDTView.Rows(k).Item(l))
End If
Next
Next
Thanks