Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
545
WebExcelExporter: set column width
posted

Hallo,

i'm setting column width of my grid during export:

Private Sub m_exporter_GridFieldCaptionExporting(sender As Object, e As Infragistics.Web.UI.GridControls.GridFieldCaptionExportingEventArgs) Handles m_exporter.GridFieldCaptionExporting
If (e.GridCell.OwnerField.GetType() Is GetType(TemplateDataField)) Then
Dim col As Infragistics.Documents.Excel.WorksheetColumn

col = e.Worksheet.Columns(e.WorksheetCell.ColumnIndex)
col.SetWidth(50, Infragistics.Documents.Excel.WorksheetColumnWidthUnit.Pixel)
End If
End Sub 

but it doesn'work. Why?

I'm using version 2011.1 (last release).

Thanks

Parents
No Data
Reply
  • 325
    posted

    Got this to work in version 2012.1...

    Width is defined as

    Public Property Width() As Integer
    Member of Infragistics.Documents.Excel.WorksheetColumn
    Summary:
    Gets or sets the column width including padding, in 256ths of the '0' digit character width in the workbook's default font.

     

    Protected Sub weeExportGrid_Exported(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.ExcelExportedEventArgs) Handles weeExportGrid.Exported

    e.Worksheet.Columns.Item(0).Width = 256 * 7
    e.Worksheet.Columns.Item(1).Width = 256 * 11

    e.Worksheet.Rows(0).Height = 1075

    End Sub

    A width of 256 * 7 will be approximately 6.29 pixels

Children
No Data