HRESULT: 0x800A03EC on Worksheet.range

前端 未结 23 2147
Happy的楠姐
Happy的楠姐 2020-11-22 07:42

I am getting HRESULT: 0x800A03EC on Worksheet.range method. Number of rows are more than 70K. Office 2007.

Code:

Microsoft.Office.Interop.Excel.Range         


        
23条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 08:18

    I got this exception because I typed:

    ws.get_Range("K:K").EntireColumn.AutoFit();
    ws.get_Range("N:N").EntireColumn.AutoFit();
    ws.get_Range("0:0").EntireColumn.AutoFit();
    

    See a mistake? Hint: Excel is accepting indexing from 1, but not from 0 as C# does.

提交回复
热议问题