Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

ExcelSheetFluent

OfficeIMO.Excel

Namespace
OfficeIMO.Excel
Assembly
OfficeIMO.Excel
Modifiers
static

The fluent methods of ExcelSheet, generated from its public properties: A property-named method sets a property and a singular-named method adds to a collection, both returning the same instance.

Inheritance

  • object
  • ExcelSheetFluent

Methods

public static TSelf ColumnWidths<TSelf>(TSelf excelSheet, IReadOnlyDictionary<int, ExcelColumnWidth> columnWidths) #

Applies positive custom widths together and saves the worksheet XML once. Existing column styles, visibility and outline metadata are preserved.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
columnWidths System.Collections.Generic.IReadOnlyDictionary<int, OfficeIMO.Excel.ExcelColumnWidth> required
Widths keyed by 1-based column index. Widths above 255 are clamped.

Returns

TSelf The same instance.
public static TSelf DefaultColumnWidth<TSelf>(TSelf excelSheet, ExcelColumnWidth width, bool save = true) #

Sets the worksheet default column width from characters or a physical length.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
width OfficeIMO.Excel.ExcelColumnWidth required
Default column width. Excel supports resolved widths up to 255 character units.
save bool = true optional
Whether to save the worksheet XML immediately.

Returns

TSelf The same instance.
public static TSelf DefaultRowHeight<TSelf>(TSelf excelSheet, ExcelColumnWidth height, bool hidden = false, bool save = true) #

Sets the worksheet default row height from characters or a physical length.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
height OfficeIMO.Excel.ExcelColumnWidth required
Default row height. Excel supports physical heights up to 409 points.
hidden bool = false optional
Whether empty rows should be hidden by default.
save bool = true optional
Whether to save the worksheet XML immediately.

Returns

TSelf The same instance.
public static TSelf Document<TSelf>(TSelf excelSheet, Action<ExcelDocument> configure) #

Configures ExcelSheet.Document in place: Gets the workbook that owns this worksheet.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
configure System.Action<OfficeIMO.Excel.ExcelDocument> required
Configures the value.

Returns

TSelf The same instance.
ExecutionOverride``1 2 overloads
public static TSelf ExecutionOverride<TSelf>(TSelf excelSheet, ExcelExecutionPolicy? value) #

Sets ExcelSheet.ExecutionOverride: Override execution policy for this sheet. Null = inherit from document.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
value OfficeIMO.Excel.ExcelExecutionPolicy? required
The value.

Returns

TSelf The same instance.

Examples

// C# initializer or property            // C# fluent
excelSheet.ExecutionOverride = value;    excelSheet.ExecutionOverride(value);
public static TSelf ExecutionOverride<TSelf>(TSelf excelSheet, Action<ExcelExecutionPolicy> configure) #

Configures ExcelSheet.ExecutionOverride in place (creating it when not set): Override execution policy for this sheet. Null = inherit from document.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
configure System.Action<OfficeIMO.Excel.ExcelExecutionPolicy> required
Configures the value.

Returns

TSelf The same instance.
public static TSelf Hidden<TSelf>(TSelf excelSheet, bool hidden = true) #

Hides or shows the worksheet in the workbook.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
hidden bool = true optional
The value. True when omitted.

Returns

TSelf The same instance.
public static TSelf Name<TSelf>(TSelf excelSheet, string value) #

Sets ExcelSheet.Name: Gets or sets the worksheet name.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
value string required
The value.

Returns

TSelf The same instance.

Examples

// C# initializer or property    // C# fluent
excelSheet.Name = value;         excelSheet.Name(value);
public static TSelf OutlineSummary<TSelf>(TSelf excelSheet, bool? summaryBelow = null, bool? summaryRight = null) #

Configures the worksheet outline summary positions shown by Excel.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
summaryBelow bool? = null optional
Whether row summaries should appear below grouped rows.
summaryRight bool? = null optional
Whether column summaries should appear to the right of grouped columns.

Returns

TSelf The same instance.
public static TSelf PageSetup<TSelf>(TSelf excelSheet, Action<ExcelSheetPageSetup> configure) #

Configures ExcelSheet.PageSetup in place: Paper, orientation, scaling, margins, print area and titles, print options, headers and footers.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
configure System.Action<OfficeIMO.Excel.ExcelSheetPageSetup> required
Configures the value.

Returns

TSelf The same instance.
public static TSelf TabColor<TSelf>(TSelf excelSheet, OfficeColor color) #

Sets a literal or theme-based worksheet tab color.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
color OfficeIMO.OfficeColor required
A literal RGBA color, native theme role or status color.

Returns

TSelf The same instance.
public static TSelf TableStyle<TSelf>(TSelf excelSheet, string tableOrRange, ExcelTableStyle style, bool? showFirstColumn = null, bool? showLastColumn = null, bool? showRowStripes = null, bool? showColumnStripes = null) #

Updates the visual style flags for the table identified by range, name, or display name.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
tableOrRange string required
Table range, name, or display name.
style OfficeIMO.Excel.ExcelTableStyle required
Table style to apply.
showFirstColumn bool? = null optional
Optional first-column emphasis flag.
showLastColumn bool? = null optional
Optional last-column emphasis flag.
showRowStripes bool? = null optional
Optional row stripe flag.
showColumnStripes bool? = null optional
Optional column stripe flag.

Returns

TSelf The same instance.
public static TSelf VeryHidden<TSelf>(TSelf excelSheet, bool veryHidden = true) #

Makes the worksheet very hidden, or restores it to visible.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
veryHidden bool = true optional
Whether to set the worksheet to the very hidden workbook state. True when omitted.

Returns

TSelf The same instance.
public static TSelf View<TSelf>(TSelf excelSheet, Action<ExcelSheetView> configure) #

Configures ExcelSheet.View in place: Frozen panes, gridlines, zero values, headings, direction, zoom and view mode.

Type Parameters

TSelf

Parameters

excelSheet TSelf required
The instance.
configure System.Action<OfficeIMO.Excel.ExcelSheetView> required
Configures the value.

Returns

TSelf The same instance.