为有中文需求的客户提供多渠道中文技术支持.

Wed Mar 15, 2023 1:00 pm

sheet0.Range["IW6"].Value = value;
sheet0.SetCellValue(6,256, value);

此代码异常,超出索引界限,此时sheet0.LastColumn=257

yang524433
 
Posts: 2
Joined: Wed Mar 15, 2023 12:56 pm

Thu Mar 16, 2023 3:06 am

excel 2003最大列限制为256

yang524433
 
Posts: 2
Joined: Wed Mar 15, 2023 12:56 pm

Thu Mar 16, 2023 7:49 am

您好

感谢来信,
是的,我们Spire.xls中new Workbook默认是以Excel 2003版本创建,这样最大列是256,Range["IW6"]是在257列,所以会有你遇到的错误。您可以通过以下代码声明高版本来创建。
Code: Select all
Workbook workbook = new Workbook();
workbook.Version = ExcelVersion.Version2013;
Worksheet sheet0 = workbook.Worksheets[0];
sheet0.Range["IW6"].Value = value;

如果还有任何问题,欢迎来信询问。

Best Regards,
Herman
E-iceblue support team
User avatar

Herman.Yan
 
Posts: 115
Joined: Wed Mar 08, 2023 2:00 am

Return to 中文技术支持