Cellborder back to origin

S

stocki

Hi,

on a windows form (client site, using C#) I placed an OWC spreadsheet
(axsprPlanung) control. I was asked to highlight some cells in
different colors and to draw a border around them, which is not a
problem meanwhile:

// setting the backcolor
object backColor = "Red" ;
axsprPlanung.get_Range( axsprPlanung.Cells[row, col],
axsprPlanung.Cells[row, col]).Interior.set_Color( ref backColor ) ;

// drawing a border
object BorderColorBooked = "Black";
axsprPlanung.get_Range( axsprPlanung.Cells[row, col],
axsprPlanung.Cells[row,
col]).BorderAround(OWC.XlLineStyle.xlContinuous,
OWC.XlBorderWeight.xlHairline, OWC.XlColorIndex.xlColorIndexAutomatic,
BorderColorBooked );


What causes me a headache is to get the highlighted cell back to it's
origin state. The backcolor can be set to white. But how do I reset
the border?

If I use the following, my whole spreadsheet turns black:
object missing = Missing.Value ;
axsprPlanung.get_Range( axsprPlanung.Cells[row, col],
axsprPlanung.Cells[row, col]).BorderAround(missing,
OWC.XlBorderWeight.xlHairline, OWC.XlColorIndex.xlColorIndexNone,
missing );

The following comes near, but is not the origin:
object BorderColorBooked = "Lightgrey";
axsprPlanung.get_Range( axsprPlanung.Cells[row, col],
axsprPlanung.Cells[row,
col]).BorderAround(OWC.XlLineStyle.xlContinuous,
OWC.XlBorderWeight.xlHairline, OWC.XlColorIndex.xlColorIndexAutomatic,
BorderColorBooked );

Any ideas are highly appreciated!

Regards

Stocki
 
A

Alvin Bruney [MVP]

I think you can do a get_color first and store that object in a variable.
You can then reload it to reset to original. Either that, or look around the
OM for a default property on the color and border property.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top