Adding Comments to a Cell and Changing the background color

C

Chinmay

Hi,

Microsoft Web Components seem to work great and provide some real muscle to
the applications we are building.

I've had trouble doing a couple of simple operations using the
AxMicrosoft.Office.Interop.Owc11 and Microsoft.Office.Interop.Owc11 APIs.

Changing the background color of a cell:

Code snippet:
Microsoft.Office.Interop.Owc11.Range userCell = userRange.get_Item(i, j);

userCell.Interior.Color = 0x00ffff;

Compile time error:

C:\Development\workspace\ConcertAM\SpreadsheetControl2\Audit.cs(95):
Property, indexer, or event 'Color' is not supported by the language; try
directly calling accessor methods
'Microsoft.Office.Interop.Owc11.Interior.get_Color()' or
'Microsoft.Office.Interop.Owc11.Interior.set_Color(ref object)'

There is no set_Color method, and I can't figure out an alternate way to
change the background color.

[II] Insert a comment to a cell

I could not find any API to insert a comment into the cell. Is there any way
to extend the control to provide this functionality?


Any help will
 
A

Alvin Bruney - ASP.NET MVP

As the black book points out, set_color is a hidden method - the reason for
hidden methods has to do with the implementation fix added for PIA support.
The color property accepts a color object set to a known color or an rgb
color, it does not respond to hexidecimal colors.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
C

Chinmay

Alvin,

Thanks for responding. Already ordered your book.
However, I did not understand your point.

For instance, the following code gives the same compile time error:
****
Microsoft.Office.Interop.Owc11.Range userCell = userRange.get_Item(i, j);
userCell.Interior.Color = System.Drawing.Color.Yellow; // or
userCell.Interior.Color = Color.FromArgb(0,13,12).Name;
****

Compile time error:
***
Property, indexer, or event 'Color' is not supported by the language; try
directly calling accessor methods
'Microsoft.Office.Interop.Owc11.Interior.get_Color()' or
'Microsoft.Office.Interop.Owc11.Interior.set_Color(ref object)'
***

Am I missing the implication of the compilation error?

Thanks in advance for your help!
Chinmay


Alvin Bruney - ASP.NET MVP said:
As the black book points out, set_color is a hidden method - the reason
for
hidden methods has to do with the implementation fix added for PIA
support.
The color property accepts a color object set to a known color or an rgb
color, it does not respond to hexidecimal colors.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Chinmay said:
Hi,

Microsoft Web Components seem to work great and provide some real muscle to
the applications we are building.

I've had trouble doing a couple of simple operations using the
AxMicrosoft.Office.Interop.Owc11 and Microsoft.Office.Interop.Owc11 APIs.

Changing the background color of a cell:

Code snippet:
Microsoft.Office.Interop.Owc11.Range userCell = userRange.get_Item(i, j);

userCell.Interior.Color = 0x00ffff;

Compile time error:

C:\Development\workspace\ConcertAM\SpreadsheetControl2\Audit.cs(95):
Property, indexer, or event 'Color' is not supported by the language; try
directly calling accessor methods
'Microsoft.Office.Interop.Owc11.Interior.get_Color()' or
'Microsoft.Office.Interop.Owc11.Interior.set_Color(ref object)'

There is no set_Color method, and I can't figure out an alternate way to
change the background color.

[II] Insert a comment to a cell

I could not find any API to insert a comment into the cell. Is there any way
to extend the control to provide this functionality?


Any help will

 
A

Alvin Bruney - ASP.NET MVP

This code works,

objChart.SeriesCollection.Add(1);
objChart.SeriesCollection[1].Border.Color = "green";
objChart.SeriesCollection[1].Type = ChartChartTypeEnum.chChartTypeLine;
objChart.SeriesCollection[1].DataLabelsCollection.Add();
objChart.SeriesCollection[1].DataLabelsCollection[0].Font.Size = 6;
objChart.SeriesCollection[1].DataLabelsCollection[0].NumberFormat =
"#,###,###";

port it to your environment. I can't run the exact code here at this moment.
If it fails for you let me know and I'll probably hash out an example on the
weekend.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Chinmay said:
Alvin,

Thanks for responding. Already ordered your book.
However, I did not understand your point.

For instance, the following code gives the same compile time error:
****
Microsoft.Office.Interop.Owc11.Range userCell = userRange.get_Item(i, j);
userCell.Interior.Color = System.Drawing.Color.Yellow; // or
userCell.Interior.Color = Color.FromArgb(0,13,12).Name;
****

Compile time error:
***
Property, indexer, or event 'Color' is not supported by the language; try
directly calling accessor methods
'Microsoft.Office.Interop.Owc11.Interior.get_Color()' or
'Microsoft.Office.Interop.Owc11.Interior.set_Color(ref object)'
***

Am I missing the implication of the compilation error?

Thanks in advance for your help!
Chinmay


Alvin Bruney - ASP.NET MVP said:
As the black book points out, set_color is a hidden method - the reason
for
hidden methods has to do with the implementation fix added for PIA
support.
The color property accepts a color object set to a known color or an rgb
color, it does not respond to hexidecimal colors.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Chinmay said:
Hi,

Microsoft Web Components seem to work great and provide some real
muscle
to
the applications we are building.

I've had trouble doing a couple of simple operations using the
AxMicrosoft.Office.Interop.Owc11 and Microsoft.Office.Interop.Owc11 APIs.

Changing the background color of a cell:

Code snippet:
Microsoft.Office.Interop.Owc11.Range userCell = userRange.get_Item(i, j);

userCell.Interior.Color = 0x00ffff;

Compile time error:

C:\Development\workspace\ConcertAM\SpreadsheetControl2\Audit.cs(95):
Property, indexer, or event 'Color' is not supported by the language; try
directly calling accessor methods
'Microsoft.Office.Interop.Owc11.Interior.get_Color()' or
'Microsoft.Office.Interop.Owc11.Interior.set_Color(ref object)'

There is no set_Color method, and I can't figure out an alternate way to
change the background color.

[II] Insert a comment to a cell

I could not find any API to insert a comment into the cell. Is there
any
way
to extend the control to provide this functionality?


Any help will

 

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