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
402 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

689 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