c# - 我正在处理一个表,其中最后一列是 16368 位数字,在这种情况下,代码失败

标签 c# excel

我已经创建了一个类似的主题,我找到了如何找到最后一列。 后续代码仅适用于少量日期。我正在处理一个表,其中最后一列是 16368 位数字,不知何故,在这种情况下,代码失败。

//number of the last column
int x = MatrixRange.Collumns.Count; 

//here I check to see what is the numbering column 
//(oddly enough, I get always the correct number, but the column the program does not issue
textBox1.Text = x.ToString();

for (int Rnum = 6; Rnum <= MatrixRange.Cells.Count; Rnum++)
{
     if ((MatrixRange.Cells[Rnum,x] as Excel.Range).Value2 != null)
     {
          //at this point the program will either ignore this function or shows an error, 
          //if x = 10, not 16368, then the code works great
          string TabZeile = (MatrixRange.Cells[Rnum,x] as Eexcel.Range).Value2.ToString(); 

          neuXml.Cells [Rnum,4] = TabZeile;    
     }    
}

最佳答案

这是因为 Excel 有 limitations :

其中之一(您应该检查上面链接中的其他人):

Worksheet size 1,048,576 rows by 16,384 columns

关于c# - 我正在处理一个表,其中最后一列是 16368 位数字,在这种情况下,代码失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44180637/

相关文章:

c# - 从 Roslyn 中的方法调用中的相应参数获取方法参数的名称

c# - 一起计算 sin 和 cos 的最快方法是什么?

c# - 为图像中的对象绘制边界框

vba 将数组中的所有值设置为相同值的更好方法

arrays - 使用VBA在Excel 2007中的不同单元格中填写不同的字符串值

excel - 检查数组是否为空(vba excel)

c# - 如果我们修改了aspx页面中的部分代码,是否必须重新发布网站?

c# - 如何在 mvvm 模式中定义用户控件?

java - Excel 下拉使用 DataValidationHelper (POI)

excel - 使用 msoFileDialogFilePicker 保存