Solved

How to know if an Excel cell has a rectangle inside an its background color using vb.net

Posted on 2011-02-11
8
401 Views
Last Modified: 2012-05-11
Dear experts:
I'm using Microsoft.Office.Interop.Excel 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?
0
Comment
Question by:BemboX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 7

Expert Comment

by:dimaj
ID: 34876296
Try something like this:

"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],ws.Cells[1,2]);
range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;"

Please note, this has been copied and pasted from this thread: http://bytes.com/topic/c-sharp/answers/252803-setting-excel-2003-borders-programmatically
0
 

Author Comment

by:BemboX
ID: 34888300
Thanks for your answer but the rectangle is inside the cell, this is not a border.
0
 
LVL 7

Expert Comment

by:dimaj
ID: 34891995
so, that rectangle is an embedded image?
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:BemboX
ID: 34892487
I think it was created as a form (insert/form). I am attaching an example of an excel file with rectangles. Rectangles.xls
0
 
LVL 7

Expert Comment

by:dimaj
ID: 34892853
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.
0
 
LVL 7

Accepted Solution

by:
dimaj earned 500 total points
ID: 34892961
0
 

Author Comment

by:BemboX
ID: 34893055
Thanks for your answer, that code is helpful.
0
 
LVL 7

Expert Comment

by:dimaj
ID: 34893066
Glad to help :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel If Statement 3 29
Tricky Shapes formula 3 18
Hash on Excel 13 43
Broken .resx file generating errors 18 24
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question