OWC Formatting

R

Raj More

Hello!

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8.

Thanks,

Raj More
 
M

Mark G

You can change the properties of the Pivot Table at design time. Just change the font in the Pivot Table object's style properties. This property will be stored in the XML definition of the Pivot Table object.
Hello!

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8.

Thanks,

Raj More
 
R

Raj More

Mark,

I am using the OWC in a Windows application, not on a web site. Will what you are saying apply to WinApps also?

tia,

Raj More.
You can change the properties of the Pivot Table at design time. Just change the font in the Pivot Table object's style properties. This property will be stored in the XML definition of the Pivot Table object.
Hello!

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8.

Thanks,

Raj More
 
M

Mark G

Hi Raj,

I'm sorry to say I can't speak intelligently about using OWC in a Windows app. I doubt you have access to the Style object when developing a Windows app, so your best bet is to change the font programmatically in the application code. Here is a previous post from Keith Ammon that should probably do the trick for you:
----------
Try this after you load the pivot table:

function changeFont() {
var name = "Tahoma";
var size = 8;

var v = pivotTable.ActiveView;
v.FieldLabelFont.Name = name;
v.FieldLabelFont.Size = size + 2;
v.MemberFont.Name = name;
v.MemberFont.Size = size;
v.TotalFont.Name = name;
v.TotalFont.Size = size;

// set font name and size for all detail and subtotal fields.
for (var fs = 0; fs < v.FieldSets.Count; fs++) {
var fldSet = v.FieldSets(fs);
for (var f = 0; f < fldSet.Fields.Count; f++) {
var fld = fldSet.Fields(f);
fld.DetailFont.Name = name;
fld.DetailFont.Size = size;
fld.SubtotalFont.Name = name;
fld.SubtotalFont.Size = size;
}
}
}

-Keith Ammon

Mark,

I am using the OWC in a Windows application, not on a web site. Will what you are saying apply to WinApps also?

tia,

Raj More.
You can change the properties of the Pivot Table at design time. Just change the font in the Pivot Table object's style properties. This property will be stored in the XML definition of the Pivot Table object.
Hello!

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8.

Thanks,

Raj More
 
R

Raj More

Mark,

I will try this one out. FYI, Rolf Niklasson displayed the following code and it worked out for me.

Dim ptView
Dim name
Dim size
Function Window_OnLoad()

name = "Verdana"
size = 8
set ptView = PivotTable1.ActiveView
ptView.FieldLabelFont.Name = name
ptView.FieldLabelFont.Size = size
ptView.TotalFont.Name = name
ptView.TotalFont.Size = size
ptView.HeaderFont.Name = name
ptView.HeaderFont.Size = size
For Each ttl In ptView.FieldSets
For Each ttl2 In ptView.FieldSets(ttl).Fields
ptView.FieldSets(ttl).Fields(ttl2).DetailFont.Name = name
ptView.FieldSets(ttl).Fields(ttl2).DetailFont.Size = size
ptView.FieldSets(ttl).Fields(ttl2).SubtotalFont.Name = name
ptView.FieldSets(ttl).Fields(ttl2).SubtotalFont.Size = size
ptView.FieldSets(ttl).Fields(ttl2).GroupedFont.Name = name
ptView.FieldSets(ttl).Fields(ttl2).GroupedFont.Size = size
ptView.FieldSets(ttl).Fields(ttl2).SubtotalLabelFont.Name = name
ptView.FieldSets(ttl).Fields(ttl2).SubtotalLabelFont.Size = size

Next
Next


Thanks for your help.

Raj More

Hi Raj,

I'm sorry to say I can't speak intelligently about using OWC in a Windows app. I doubt you have access to the Style object when developing a Windows app, so your best bet is to change the font programmatically in the application code. Here is a previous post from Keith Ammon that should probably do the trick for you:
----------
Try this after you load the pivot table:

function changeFont() {
var name = "Tahoma";
var size = 8;

var v = pivotTable.ActiveView;
v.FieldLabelFont.Name = name;
v.FieldLabelFont.Size = size + 2;
v.MemberFont.Name = name;
v.MemberFont.Size = size;
v.TotalFont.Name = name;
v.TotalFont.Size = size;

// set font name and size for all detail and subtotal fields.
for (var fs = 0; fs < v.FieldSets.Count; fs++) {
var fldSet = v.FieldSets(fs);
for (var f = 0; f < fldSet.Fields.Count; f++) {
var fld = fldSet.Fields(f);
fld.DetailFont.Name = name;
fld.DetailFont.Size = size;
fld.SubtotalFont.Name = name;
fld.SubtotalFont.Size = size;
}
}
}

-Keith Ammon

Mark,

I am using the OWC in a Windows application, not on a web site. Will what you are saying apply to WinApps also?

tia,

Raj More.
You can change the properties of the Pivot Table at design time. Just change the font in the Pivot Table object's style properties. This property will be stored in the XML definition of the Pivot Table object.
Hello!

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8.

Thanks,

Raj More
 
G

garyn

Hi all
I had the exact same problem and solved it using the code below, except for one thing: when I apply grouping to items, I lose the formatting. The group labels and grand total revert back to Arial 10. This is my code
<script language = "javascript"

var name = "Verdana"
var size = 8

var v = document.PivotTable.ActiveView
v.FieldLabelFont.Name = name
v.FieldLabelFont.Size = size
v.TotalFont.Name = name
v.TotalFont.Size = size
v.HeaderFont.Name = name
v.HeaderFont.Size = size

// set font name and size for all detail and subtotal fields
for (var fs = 0; fs < v.FieldSets.Count; fs++)
var fldSet = v.FieldSets(fs)
for (var f = 0; f < fldSet.Fields.Count; f++)
var fld = fldSet.Fields(f)
fld.DetailFont.Name = name
fld.DetailFont.Size = size
fld.SubtotalFont.Name = name
fld.SubtotalFont.Size = size
fld.SubtotalLabelFont.Name = name
fld.SubtotalLabelFont.Size = size
fld.GroupedFont.Name = name
fld.GroupedFont.Size = size


</script

Any ideas

-Gar

----- Mark G wrote: ----

Hi Raj

I'm sorry to say I can't speak intelligently about using OWC in a Windows app. I doubt you have access to the Style object when developing a Windows app, so your best bet is to change the font programmatically in the application code. Here is a previous post from Keith Ammon that should probably do the trick for you
---------
Try this after you load the pivot table

function changeFont()
var name = "Tahoma"
var size = 8

var v = pivotTable.ActiveView
v.FieldLabelFont.Name = name
v.FieldLabelFont.Size = size + 2
v.MemberFont.Name = name
v.MemberFont.Size = size
v.TotalFont.Name = name
v.TotalFont.Size = size

// set font name and size for all detail and subtotal fields
for (var fs = 0; fs < v.FieldSets.Count; fs++)
var fldSet = v.FieldSets(fs)
for (var f = 0; f < fldSet.Fields.Count; f++)
var fld = fldSet.Fields(f)
fld.DetailFont.Name = name
fld.DetailFont.Size = size
fld.SubtotalFont.Name = name
fld.SubtotalFont.Size = size




-Keith Ammo

Mark

I am using the OWC in a Windows application, not on a web site. Will what you are saying apply to WinApps also

tia

Raj More
You can change the properties of the Pivot Table at design time. Just change the font in the Pivot Table object's style properties. This property will be stored in the XML definition of the Pivot Table object
Hello

How do I format my OWC PivotTable's data? It comes with a default font that is too large & ugly, and I want to change ALL cells to TAHOMA, SIZE 8

Thanks

Raj More
 

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