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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Reading only marked parts of an Excel file

Thread ID:

Created:

Updated:

Platform:

Replies:

76271 Aug 29,2008 09:18 AM UTC Aug 30,2012 06:05 AM UTC WinForms 9
loading
Tags: XlsIO
Thomas Busl
Asked On August 29, 2008 09:18 AM UTC

Hi,
I want to read out only these cells of an Excel file, which are marked by the user. But at the moment I have not found figured out how to extract only the marked parts of an Excel file
Thank you in advance
thomas




Geetha M [Syncfusion]
Replied On September 2, 2008 05:13 AM UTC

Hi Thomas,

I am afraid that I am not very clear about 'marked parts of an Excel file'. Could you please update here with more details of it so that I could find a best solution?

Please let me know if you have any concerns.

Regards,
Geetha


Thomas Busl
Replied On September 2, 2008 07:53 AM UTC

Hi again,
I mean with marked, that a user has selected some cells of an Excel sheet and the selceted cells are coloured, therefore I have described them as marked
Thank's in advance for your help
thomas


Geetha M [Syncfusion]
Replied On September 5, 2008 12:03 PM UTC

Hi Thomas,

Sorry for the delay.

If you intend reading the cell filled with color from an existing Excel file, it is possible through iterating each cell in the workbook searching for the color. I have created a simple sample illustrating this behavior and is available in the following link:

http://websamples.syncfusion.com/samples/XlsIO.Windows/F76271/main.htm

Please let me know if I have not correctly matched your requirement.

Regards,
Geetha


Thomas Busl
Replied On September 5, 2008 01:25 PM UTC

Hi again,
may be I have not explained the problem properly. I have an Excel sheet with a lot of different sheets in it. In these different sheets the user has selected (marked) multiple cells. So my problem is to figure out what kind of cells the user has selected in the whole Excel file (that means looking in all the sheets)and process this data further.
Thank you for your help in advance
thomas


Geetha M [Syncfusion]
Replied On September 8, 2008 01:50 PM UTC

Hi Thomas,

I am afraid that I am still not clear about your requirement. Could you please send me a sample Excel sheet and details about what kind of cells you need to retrieve from the sheet?

Regards,
Geetha


Thomas Busl
Replied On September 8, 2008 02:10 PM UTC

Hi again,
I send you the Excel File. If you look to the sheet 01_16_2008_HCV_RUN_25 you will find some selected (marked) cells, on my computer blue coloured. My script now should extract only these selected cells and bring it to another application. So my idea is to opne the Excel File, go to every sheet and find their all the selected cells and write them to a database etc.
Thank you in advance for your help
so long
thomas



01_16_2008_HCV_RUN_25a_3f284f34.zip

Geetha M [Syncfusion]
Replied On September 17, 2008 10:56 AM UTC

Hi Thomas,

Sorry for the long delay in getting back to you.

You can identify the selected cells alone in all the worksheets using the color that is used to mark the cell. That is, by using the color value as key, and iterating through the each cell you can get the cell that is marked with the same color. The following code snippet illustrates this:

foreach (IWorksheet sheet in myWorkbook.Worksheets)
{
for (int i = sheet.UsedRange.Row; i < sheet.UsedRange.Rows.Length + 1; i++)
{
for (int j = sheet.UsedRange.Column; j < sheet.UsedRange.Columns.Length + 1; j++)
{
if (sheet.UsedRange[i, j].CellStyle.Color == Color.FromArgb(192, 192, 192))
{
count++;
//perform operation
}
}
}
}

MessageBox.Show("Number of selected cells: "+count.ToString());


Please let me know if you have any questions.

Regards,
Geetha



Thomas Busl
Replied On September 17, 2008 02:39 PM UTC

Hi,

that is the solution I had looked for.
Thank you a lot
thomas


Sridhar [Syncfusion]
Replied On August 30, 2012 06:05 AM UTC

Hi Thomas,

Thank you for the update.

Please let us know if you require any further assistance on this.

Thanks,
Sridhar.S


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.

Warning Icon 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.Close Icon

;