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
399 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
formula how to get the number incrementor? 3 22
VB.NET 2008 - SQL Timeout 9 24
tableview is not updating 1 8
Excel VBA - Constants 4 15
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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