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
80
UltraWinGrid Excel export with more than 256 columns
posted

Is there a way to export a WinGrid with more than 256 columns to excel spliting the data into several worksheets?

I tried the following code but I still get an exception:

UltraGridExcelExporter ultraGridExcelExporter = new UltraGridExcelExporter();

ultraGridExcelExporter.FileLimitBehaviour = FileLimitBehaviour.TruncateData;

int columnsCount = m_dataGrid.DisplayLayout.Bands[ 0 ].Columns.Count;

int startColumnIndex = 0;

int worksheetNumber = 1;

Workbook workbook = new Workbook();

while( startColumnIndex < columnsCount )

{

string worksheetNameWithNumber = worksheetName;

if( worksheetNumber > 1 )

worksheetNameWithNumber = String.Format( "{0}_{1}", worksheetName, worksheetNumber.ToString() );Worksheet worksheet = workbook.Worksheets.Add( worksheetNameWithNumber );

ultraGridExcelExporter.Export( m_dataGrid, worksheet, 0, startColumnIndex );

startColumnIndex += 256;

worksheetNumber++;

}

//write to file

BIFF8Writer.WriteWorkbookToFile( workbook, fileName );

 

Thanks,

Santiago Blanco

 

Parents Reply Children
No Data