We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

XlsIO importing rows of zero height

Thread ID:

Created:

Updated:

Platform:

Replies:

53418 Dec 13,2006 09:01 AM Dec 14,2006 06:39 AM Windows Forms 1
loading
Tags: GridControl
Jonathan Hartley
Asked On December 13, 2006 09:01 AM

Hello there,

We're using XlsIO to import Excel .xls files into our Essential Grid application, with much success, so thanks very much for some fine components.

One problem we've noticed is that rows with height of zero are reported as having the default row height (12.75 for us) by the return from:

Workbook wb = ExcelEngine.Excel.Workbooks.Open(filename);
h = wb.Worksheets[0].Rows[1].RowHeight;

Other non-default row sizes are reported accurately.

Any clues, workarounds, fixes, etc? Thanks for any assistance,

Jonathan


Administrator [Syncfusion]
Replied On December 14, 2006 06:39 AM

Hi Jonathan,

This can be acheived by derving the GridExcelConverterBase and create the new ExcelToGrid method to set the rowheight properly. Here is a code snippet to show this.

public class GridExcelConverterExt: Syncfusion.GridExcelConverter.GridExcelConverterBase
{
public GridExcelConverterExt():base(){}

public new void ExcelToGrid( string strFileName, GridModel grid )
{
ExcelEngine engine = CreateEngine();
IWorkbook book = engine.Excel.Workbooks.Open( strFileName );
IWorksheet sheet = book.Worksheets[ 0 ];
ExcelToGrid( sheet, grid );

grid.BeginUpdate();
CopyRowHeightToGrid(sheet,grid);
grid.EndUpdate(true);

book.Close( false );
}

private void CopyRowHeightToGrid( IWorksheet sheet, GridModel grid )
{
IRange usedRange = sheet.UsedRange;
for( int i = usedRange.Row, last = usedRange.End.Row; i <= last; i++ )
{
if( sheet.IsRowVisible(i))
grid.RowHeights[ i ] = sheet.GetRowHeightInPixels( i );
else
grid.RowHeights[ i ] = 0;
}
}
}

Please refer to attached sample for more details.
ImportExcel.zip

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;