J
jarabe28
Hi, I need to read an Excel range into an array which I then use to modify
it's data and formulas. I then write the modified data back to Excel. This
code: shtValues = (System.Array)row.Formula;
fails when it encounters 255+ characters in a cell. My code is below. Please
tell me if there's a way to work around this.
try
{
// Creates and initializes a new CollectionBase.
this.oSheetRangeCollection = new RangeCollection();
System.Array shtValues=null;
int iLastCol = ws.UsedRange.Columns.Count;
int iLastRow = ws.UsedRange.Rows.Count;
for (int i = 1; i <= iLastRow; i++)
{
Excel.Range row = (Excel.Range) ws.get_Range(ws.Cells[i, 1], ws.Cells[i,
iLastCol]);
//insert the data into the object[,] one row at a time
shtValues = (System.Array)row.Formula;
this.oSheetRangeCollection.AddRow(shtValues);
nav.ReleaseComObj(row);
}
}
it's data and formulas. I then write the modified data back to Excel. This
code: shtValues = (System.Array)row.Formula;
fails when it encounters 255+ characters in a cell. My code is below. Please
tell me if there's a way to work around this.
try
{
// Creates and initializes a new CollectionBase.
this.oSheetRangeCollection = new RangeCollection();
System.Array shtValues=null;
int iLastCol = ws.UsedRange.Columns.Count;
int iLastRow = ws.UsedRange.Rows.Count;
for (int i = 1; i <= iLastRow; i++)
{
Excel.Range row = (Excel.Range) ws.get_Range(ws.Cells[i, 1], ws.Cells[i,
iLastCol]);
//insert the data into the object[,] one row at a time
shtValues = (System.Array)row.Formula;
this.oSheetRangeCollection.AddRow(shtValues);
nav.ReleaseComObj(row);
}
}