T
Taylor H. Maxwell
I am trying to build an Office OWC 11 Web components pivot table solution.
Unfortunately, I have not been able to get date fields to show as desired
(ie, not showing the time information for Hours, Minutes, and Seconds).
Here is the code I am working with against the Northwind SQL Server 2000
database:
Dim ConnectionString As String = "Provider=SQLOLEDB.1;Persist
Security Info=True;User ID=appapollo;Password=dna;" & _
"Initial Catalog=Northwind;Data Source=localhost"
NorthwindPivot.ConnectionString = ConnectionString
NorthwindPivot.CommandText = "Select * From Invoices"
Dim NorthwindView As PivotView
NorthwindView = NorthwindPivot.ActiveView
NorthwindView.RowAxis.InsertFieldSet(NorthwindView.FieldSets("ProductName"),
0)
NorthwindView.ColumnAxis.InsertFieldSet(NorthwindView.FieldSets("SalesPerson"), 0)
NorthwindView.FilterAxis.InsertFieldSet(NorthwindView.FieldSets("ShippedDate"), 0)
NorthwindView.DataAxis.InsertFieldSet(NorthwindView.FieldSets("ExtendedPrice"), 0)
Dim fs As Integer
Dim fld As Integer
For fs = 0 To NorthwindPivot.ActiveView.FieldSets.Count - 1
If NorthwindPivot.ActiveView.FieldSets(fs).Type =
PivotFieldSetTypeEnum.plFieldSetTypeOther Then
ElseIf NorthwindPivot.ActiveView.FieldSets(fs).Type =
PivotFieldSetTypeEnum.plFieldSetTypeTime Then
For fld = 0 To
NorthwindPivot.ActiveView.FieldSets(fs).Fields.Count - 1
Select Case
NorthwindPivot.ActiveView.FieldSets(fs).Fields(fld).Type
Case PivotFieldTypeEnum.plTypeTimeHours,
PivotFieldTypeEnum.plTypeTimeMinutes, PivotFieldTypeEnum.plTypeTimeSeconds
NorthwindPivot.ActiveView.FieldSets(fs).Fields(fld).IsIncluded = False
End Select
Next
NorthwindPivot.ActiveView.FieldSets(fs).AllIncludeExclude =
PivotFieldSetAllIncludeExcludeEnum.plAllDefault
End If
Next
Unfortunately, I have not been able to get date fields to show as desired
(ie, not showing the time information for Hours, Minutes, and Seconds).
Here is the code I am working with against the Northwind SQL Server 2000
database:
Dim ConnectionString As String = "Provider=SQLOLEDB.1;Persist
Security Info=True;User ID=appapollo;Password=dna;" & _
"Initial Catalog=Northwind;Data Source=localhost"
NorthwindPivot.ConnectionString = ConnectionString
NorthwindPivot.CommandText = "Select * From Invoices"
Dim NorthwindView As PivotView
NorthwindView = NorthwindPivot.ActiveView
NorthwindView.RowAxis.InsertFieldSet(NorthwindView.FieldSets("ProductName"),
0)
NorthwindView.ColumnAxis.InsertFieldSet(NorthwindView.FieldSets("SalesPerson"), 0)
NorthwindView.FilterAxis.InsertFieldSet(NorthwindView.FieldSets("ShippedDate"), 0)
NorthwindView.DataAxis.InsertFieldSet(NorthwindView.FieldSets("ExtendedPrice"), 0)
Dim fs As Integer
Dim fld As Integer
For fs = 0 To NorthwindPivot.ActiveView.FieldSets.Count - 1
If NorthwindPivot.ActiveView.FieldSets(fs).Type =
PivotFieldSetTypeEnum.plFieldSetTypeOther Then
ElseIf NorthwindPivot.ActiveView.FieldSets(fs).Type =
PivotFieldSetTypeEnum.plFieldSetTypeTime Then
For fld = 0 To
NorthwindPivot.ActiveView.FieldSets(fs).Fields.Count - 1
Select Case
NorthwindPivot.ActiveView.FieldSets(fs).Fields(fld).Type
Case PivotFieldTypeEnum.plTypeTimeHours,
PivotFieldTypeEnum.plTypeTimeMinutes, PivotFieldTypeEnum.plTypeTimeSeconds
NorthwindPivot.ActiveView.FieldSets(fs).Fields(fld).IsIncluded = False
End Select
Next
NorthwindPivot.ActiveView.FieldSets(fs).AllIncludeExclude =
PivotFieldSetAllIncludeExcludeEnum.plAllDefault
End If
Next