Click here to Skip to main content
14,767,355 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I am generating excel report with multiple sheets.

the user have to double click for expanding the columns

i used this below code:

obj_Range = objxlWorksheet.get_Range("A1", "1");
obj_Range.AutoFit();


but getting this error:
Exception from HRESULT: 0x800A03EC


Please let me know what is the problem.
Posted

1 solution

Hi,

Here you are providing the autofit property to the whole row instead you need to apply this to the specified columns or cells.

obj_Range.Columns.AutoFit();


Hope this will resolve your issue.

Thanks,
Sisir Patro
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900