OWC 11 - Cell Coloring in Pivot Table

L

Lucas

Hi,
does Pivot Table have cell coloring? I read these in the Office XP Web
Component Toolpack. How can It be enabled?

Thanks

LucasC
 
W

Wei-Dong Xu [MSFT]

Hi Lucas,

Thank you for posting in MSDN managed newsgroup!

From my understanding to this question, you are going to set the cell color for your pivottable. This feature is supported in OWC.

In the pivottable control, you can directly right-click the cell which contains the data and then select the "Commands and Opinions..." item. The
window "Commands and Opinions" will pop up, in the format tab, you can configure the cell background and font color.

Furthermore, you can also change the cell color programmatically. There is one sample code for you which will set the background color for all the
data cells and set the background color and forecolor of header.
'Code begin --------------------------------------------------------
'oPivot stands for the PivotTable component
Dim oConst
Dim oView

Set oConst = oPivot.Constants
Set oView= oPivot.ActiveView

'Set the background color to all the data cells
oView.TotalBackColor= "white"

'Set the header backgroundColor and ForeColor
oView.HeaderBackColor= "#FFCC00"
oView.HeaderForeColor= "Black"

...
'Code end --------------------------------------------------------

Furthermore, in the 6th sample of Pivottable from the officeXP web component toolkit, you can use custom grouping to arrange the data and then
sepcify one color for them. I list the sample code for this below which will provide some assistance for you. In addition, you can also find all the
source code for this sample from the PTDemo.htm file located in by default.

'Code begin ---------------------------------------------------------
...
function showAdhocGrouping()
{
...
'Define one grouping for the related Fields
pf = RowAxis.FieldSets("Store").AddCustomGroupField("District", "District", RowAxis.FieldSets("Store").Fields("Store City"))
...
'Set the background color
pf.GroupedBackColor = "#DACACA";
}
}...

'Code end ----------------------------------------------------------

You can also search the office web component object reference with the phrase "color " plus the component name, for example "color pivotfield"
etc. This way, it will be very simple for you to locate the different color properties for the objects in pivottable.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wei-Dong Xu [MSFT]

Hi Lucas,

Thank you for posting in MSDN managed newsgroup!

I am sorry for forgetting to add the PTDemo.htm path for you. It is located in %programfiles%\office component toolpack\Walkthroughs\Pages
\PTDemo.htm by default.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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