Back to Devexpress

IXlColumn Interface

corelibraries-devexpress-dot-export-dot-xl-3e767bc0.md

latest3.5 KB
Original Source

IXlColumn Interface

Represents a single column in a worksheet.

Namespace : DevExpress.Export.Xl

Assembly : DevExpress.Printing.v25.2.Core.dll

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public interface IXlColumn :
    IDisposable
vb
Public Interface IXlColumn
    Inherits IDisposable

The following members return IXlColumn objects:

LibraryRelated API Members
Cross-Platform Class LibraryCustomizeDocumentColumnEventArgs.DocumentColumn
IXlSheet.CreateColumn()
IXlSheet.CreateColumn(Int32)
BlazorGridExportCustomizeColumnEventArgs.Column
TreeListExportCustomizeColumnEventArgs.Column

Remarks

The IXlColumn object specifies an individual column in a worksheet and can be created using the IXlSheet.CreateColumn method. Use this object’s properties and methods to manage worksheet columns. For details, see the Rows and Columns section of examples.

Note

When you finish working with the IXlColumn object, call the Dispose method to release all the resources used by the object. Otherwise, generated content is not written to the output file. You can also modify the IXlColumn object within the using statement ( Using block in Visual Basic).

Example

The example below demonstrates how to create and modify a column in a worksheet. To do this, use the IXlSheet.CreateColumn method. To specify where a created column should be located in a worksheet, pass a zero-based column index to the method as a parameter.

csharp
// Create a new worksheet.
using (IXlSheet sheet = document.CreateSheet())
{
    // Create the column "A" and set its width to 100 pixels.
    using (IXlColumn column = sheet.CreateColumn())
    {
        column.WidthInPixels = 100;
    }

    // Create the column D and set its width to 24.5 characters.
    using (IXlColumn column = sheet.CreateColumn(3))
    {
        column.WidthInCharacters = 24.5f;
    }
}
vb
' Create a new worksheet.
Using sheet As IXlSheet = document.CreateSheet()
    ' Create the column "A" and set its width to 100 pixels.
    Using column As IXlColumn = sheet.CreateColumn()
        column.WidthInPixels = 100
    End Using

    ' Create the column D and set its width to 24.5 characters.
    Using column As IXlColumn = sheet.CreateColumn(3)
        column.WidthInCharacters = 24.5F
    End Using
End Using

See Also

IXlColumn Members

DevExpress.Export.Xl Namespace