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
GM
Geetha M
Syncfusion Team
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
TB
Thomas Busl
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
GM
Geetha M
Syncfusion Team
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.htmPlease let me know if I have not correctly matched your requirement.
Regards,
Geetha
TB
Thomas Busl
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
GM
Geetha M
Syncfusion Team
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
TB
Thomas Busl
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
GM
Geetha M
Syncfusion Team
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
TB
Thomas Busl
September 17, 2008 02:39 PM UTC
Hi,
that is the solution I had looked for.
Thank you a lot
thomas
SR
Sridhar
Syncfusion Team
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