NativeExcel for .Net Developer's Reference

IRange.ShrinkToFit Property

Determines if text automatically shrinks to fit in the available column width.

[Visual Basic]
PropertyShrinkToFitAsBoolean
[C#]
boolShrinkToFit{get;set;}
[C++]
__propertyboolget_ShrinkToFit();
__propertyvoidset_ShrinkToFit(bool);
[JScript]
functiongetShrinkToFit():bool
functionsetShrinkToFit(bool);

Property Value

true if text automatically shrinks to fit in the available column width; otherwise, false.

Example

This example sets ShrinkToFit property for the cells B5:F30 on sheet one.

[C#]
 IRange r = book.Worksheets[1].Range["B5:F30"]; 
 r.ShrinkToFit = true;
[VisualBasic]
 Dim r As IRange = book.Worksheets(1).Range("B5:F30")
 r.ShrinkToFit = True
[C++]
 IRange* r = book->Worksheets->Item[1]->Range->Item[S"B5:F30"]; 
 r->ShrinkToFit = true;

See Also

IRange Interface | NativeExcel Namespace