BemboX
asked on
How to know if an Excel cell has a rectangle inside an its background color using vb.net
Dear experts:
I'm using Microsoft.Office.Interop.E xcel to read an Excel file with vb.net. There is no problem with text or formulas but how can I know if a cell has a rectangle inside and what is the color of that rectangle?
I'm using Microsoft.Office.Interop.E
ASKER
Thanks for your answer but the rectangle is inside the cell, this is not a border.
so, that rectangle is an embedded image?
ASKER
I think it was created as a form (insert/form). I am attaching an example of an excel file with rectangles. Rectangles.xls
Thanks for that...
by the looks of it, that rectangle is not part of the cell... What you'll need to do is the following:
1) Get list of all objects on the worksheet
2) find the cell of interest and try to get that cell's coordinates
3) Loop through the list of your rectangles and see if a coordinate falls in a cell of interest.
If I'll find some code, I'll post it, but I hope this will at least give you some idea of where to start looking from.
by the looks of it, that rectangle is not part of the cell... What you'll need to do is the following:
1) Get list of all objects on the worksheet
2) find the cell of interest and try to get that cell's coordinates
3) Loop through the list of your rectangles and see if a coordinate falls in a cell of interest.
If I'll find some code, I'll post it, but I hope this will at least give you some idea of where to start looking from.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your answer, that code is helpful.
Glad to help :)
"I got few experiences with Excel automation.
Let get back to the previous post and add this line.
Excel.Range range = ws.get_Range(ws.Cells[1,1]
range.Borders.LineStyle = Excel.XlLineStyle.xlContin
Please note, this has been copied and pasted from this thread: http://bytes.com/topic/c-sharp/answers/252803-setting-excel-2003-borders-programmatically