R
Renato Leandro Giuliana
Hi list...
I have a page aspx with the code below:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Create an in-memory reference to the PivotTable component.
Dim oPivot
oPivot = Server.CreateObject("OWC10.PivotTable")
'Connect to the database and provide the commandtext for the rowset.
oPivot.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = c:\program files\microsoft office\office10\" & _
"samples\northwind.mdb"
oPivot.CommandText = "Select
CategoryName,ProductName,ProductSales,ShippedQuarter from [Product Sales for
1997]"
Dim oView
oView = oPivot.ActiveView
'Add fields to the row axis and column axis for grouping.
Dim oCategoryFields, oProductFields, oQtrFields, oTotalSales
oCategoryFields = oView.FieldSets("CategoryName")
oCategoryFields.Fields(0).Caption = "Category"
oView.RowAxis.InsertFieldSet(oCategoryFields)
oProductFields = oView.FieldSets("ProductName")
oProductFields.Fields(0).Caption = "Product"
oView.RowAxis.InsertFieldSet(oProductFields)
oQtrFields = oView.FieldSets("ShippedQuarter")
oView.ColumnAxis.InsertFieldSet(oQtrFields)
oQtrFields.Fields(0).Caption = "Quarter"
oView.DataAxis.InsertTotal(oView.AddTotal("Total Sales",
oView.Fieldsets("ProductSales").Fields(0), oPivot.Constants.plFunctionSum))
oView.Totals("Total Sales").NumberFormat = "$#,##0"
'Add a total for the ProductSales fieldset.
oView.Totals(oTotalSales).NumberFormat = "$#,##0"
'Collapse rows and columns.
oView.ExpandDetails = oPivot.Constants.plExpandNever
'Hide the Filter axis and change the PivotTable title.
oView.FilterAxis.Label.Visible = False
oView.TitleBar.Caption = "Product Sales for 1997"
oView.TitleBar.BackColor = "Black"
'Change colors and font style for the fields and subtotals.
oPivot.BackColor = "Lavender"
oView.FieldLabelBackColor = "Lavender"
oView.TotalBackColor = "White"
oView.HeaderBackColor = "Gold"
oQtrFields.Fields(0).GroupedBackColor = "MidnightBlue"
oQtrFields.Fields(0).GroupedFont.Color = "Lavender"
oQtrFields.Fields(0).SubtotalBackColor = "Gold"
oQtrFields.Fields(0).SubtotalLabelBackColor = "MidnightBlue"
oQtrFields.Fields(0).SubtotalLabelFont.Bold = True
oQtrFields.Fields(0).SubtotalLabelFont.Color = "Lavender"
oProductFields.Fields(0).GroupedBackColor = "MidnightBlue"
oProductFields.Fields(0).GroupedFont.Color = "Lavender"
oProductFields.Fields(0).SubtotalBackColor = "LemonChiffon"
oProductFields.Fields(0).SubtotalLabelBackColor = "MidNightBlue"
oProductFields.Fields(0).SubtotalFont.Bold = True
oProductFields.Fields(0).SubtotalLabelFont.Color = "LemonChiffon"
oProductFields.Fields(0).SubtotalLabelFont.Bold = True
oCategoryFields.Fields(0).GroupedBackColor = "MidnightBlue"
oCategoryFields.Fields(0).GroupedFont.Color = "Lavender"
oCategoryFields.Fields(0).SubtotalBackColor = "Gold"
oCategoryFields.Fields(0).SubtotalLabelBackColor = "MidNightBlue"
oCategoryFields.Fields(0).SubtotalLabelFont.Bold = True
oCategoryFields.Fields(0).SubtotalLabelFont.Color = "Lavender"
Response.Write(oPivot.HTMLData)
End Sub
When I execute this page I received this error message:
System.Runtime.InteropServices.COMException: Member not found
[]'s
Renato
I have a page aspx with the code below:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Create an in-memory reference to the PivotTable component.
Dim oPivot
oPivot = Server.CreateObject("OWC10.PivotTable")
'Connect to the database and provide the commandtext for the rowset.
oPivot.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = c:\program files\microsoft office\office10\" & _
"samples\northwind.mdb"
oPivot.CommandText = "Select
CategoryName,ProductName,ProductSales,ShippedQuarter from [Product Sales for
1997]"
Dim oView
oView = oPivot.ActiveView
'Add fields to the row axis and column axis for grouping.
Dim oCategoryFields, oProductFields, oQtrFields, oTotalSales
oCategoryFields = oView.FieldSets("CategoryName")
oCategoryFields.Fields(0).Caption = "Category"
oView.RowAxis.InsertFieldSet(oCategoryFields)
oProductFields = oView.FieldSets("ProductName")
oProductFields.Fields(0).Caption = "Product"
oView.RowAxis.InsertFieldSet(oProductFields)
oQtrFields = oView.FieldSets("ShippedQuarter")
oView.ColumnAxis.InsertFieldSet(oQtrFields)
oQtrFields.Fields(0).Caption = "Quarter"
oView.DataAxis.InsertTotal(oView.AddTotal("Total Sales",
oView.Fieldsets("ProductSales").Fields(0), oPivot.Constants.plFunctionSum))
oView.Totals("Total Sales").NumberFormat = "$#,##0"
'Add a total for the ProductSales fieldset.
oView.Totals(oTotalSales).NumberFormat = "$#,##0"
'Collapse rows and columns.
oView.ExpandDetails = oPivot.Constants.plExpandNever
'Hide the Filter axis and change the PivotTable title.
oView.FilterAxis.Label.Visible = False
oView.TitleBar.Caption = "Product Sales for 1997"
oView.TitleBar.BackColor = "Black"
'Change colors and font style for the fields and subtotals.
oPivot.BackColor = "Lavender"
oView.FieldLabelBackColor = "Lavender"
oView.TotalBackColor = "White"
oView.HeaderBackColor = "Gold"
oQtrFields.Fields(0).GroupedBackColor = "MidnightBlue"
oQtrFields.Fields(0).GroupedFont.Color = "Lavender"
oQtrFields.Fields(0).SubtotalBackColor = "Gold"
oQtrFields.Fields(0).SubtotalLabelBackColor = "MidnightBlue"
oQtrFields.Fields(0).SubtotalLabelFont.Bold = True
oQtrFields.Fields(0).SubtotalLabelFont.Color = "Lavender"
oProductFields.Fields(0).GroupedBackColor = "MidnightBlue"
oProductFields.Fields(0).GroupedFont.Color = "Lavender"
oProductFields.Fields(0).SubtotalBackColor = "LemonChiffon"
oProductFields.Fields(0).SubtotalLabelBackColor = "MidNightBlue"
oProductFields.Fields(0).SubtotalFont.Bold = True
oProductFields.Fields(0).SubtotalLabelFont.Color = "LemonChiffon"
oProductFields.Fields(0).SubtotalLabelFont.Bold = True
oCategoryFields.Fields(0).GroupedBackColor = "MidnightBlue"
oCategoryFields.Fields(0).GroupedFont.Color = "Lavender"
oCategoryFields.Fields(0).SubtotalBackColor = "Gold"
oCategoryFields.Fields(0).SubtotalLabelBackColor = "MidNightBlue"
oCategoryFields.Fields(0).SubtotalLabelFont.Bold = True
oCategoryFields.Fields(0).SubtotalLabelFont.Color = "Lavender"
Response.Write(oPivot.HTMLData)
End Sub
When I execute this page I received this error message:
System.Runtime.InteropServices.COMException: Member not found
[]'s
Renato