|
|
|
The PivotTable List control is represented in the object model by the PivotTable object. You use the DataSource property to specify the source of the data to be displayed in the control. Typically, this property setting will consist of an ADO data source or another one of the Office Web Component controls.
The PivotTable object has two child objects: the PivotData object and the PivotView object. The PivotData object represents the data in a PivotTable List control, and the PivotView object represents a specific view of the data in the PivotTable List control. In the following example, the ActiveView property is used to return the PivotView object so that various properties of the object can be specified.
The following code sample illustrates how to create a simple list by using the PivotTable List control. The list is filled with customer data from an ADO data source, in this case, the Northwind sample database. |
Click here to copy the following block | Sub InitializeList(pt as PivotTable) strProvider = "Microsoft.Jet.OLEDB.4.0" strDBPath = "c:\program files\microsoft office\office10\samples\northwind.mdb"
strSQL = "SELECT * FROM Customers" strTitle = "Customers of the Northwind Company"
Set cnnConnection = CreateObject("ADODB.Connection") cnnConnection.Provider = strProvider cnnConnection.Open strDBPath
pt.ConnectionString = cnnConnection.ConnectionString pt.CommandText = strSQL set view = pt.ActiveView
view.AutoLayout view.Titlebar.Caption = strTitle
view.RowAxis.Label.Visible = False view.ColumnAxis.Label.Visible = False
view.DetailMaxHeight = 32000 view.DetailMaxWidth = 32000 pt.AutoFit = False pt.Width = "100%" pt.Height = "65%"
pt.AllowGrouping = False End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
 |

|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|