The MindFusion Forums | |
Grid and Spreadsheet Components >> Windows Forms >> Check the number of rows in a worksheet
https://mindfusion.eu/Forum/YaBB.pl?num=1470723883 Message started by antoan.73 on Aug 9th, 2016 at 6:24am |
Title: Check the number of rows in a worksheet Post by antoan.73 on Aug 9th, 2016 at 6:24am
Hi, is there a simple way to get the number of rows (and columns) in a worksheet that actually contain data? I tried Worksheet.Rows.Count, but it return the total number of rows.
Cheers |
Title: Re: Check the number of rows in a worksheet Post by Meppy on Aug 9th, 2016 at 7:43am
Hi,
You can enumerate the Worksheet.Cells collection - it should iterate only over the cells containing data. The following code snippet illustrates how to do this: Code (]// Load the workbook from a file Workbook workbook = new Workbook(); ExcelImporter importer = new ExcelImporter(); importer.Import(@"c:\Users\Meppy\Hearthstone.xlsx", workbook); // Obtain the first worksheet var worksheet = workbook.Worksheets[0):
Let me know if this helps. Regards, Meppy |
The MindFusion Forums » Powered by YaBB 2.6.11! YaBB Forum Software © 2000-2024. All Rights Reserved. |