Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Excel FitToPagesWide to "Automatic" in C# (VTSO)

Tags:

c#

excel

vsto

When I record a macro in excel to set the FitToPagesTall = 1 and leave FitToPagesWide as "Automatic" it sets FitToPagesWide to 0. However this errors when in c# (using VSTO).

sheet.PageSetup.FitToPagesWide=0;

Any ideas? Tried setting to NULL to no avail.

like image 596
Charlotte Avatar asked Oct 18 '25 14:10

Charlotte


1 Answers

Found it.

Have to set to false.

sheet.PageSetup.FitToPagesWide = false;
like image 119
Charlotte Avatar answered Oct 20 '25 02:10

Charlotte