Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Working with the PivotTable Component's Object Model
[ All Languages » VB »  Office]

Total Hit ( 2249)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


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

  ' Set the connection string.
  pt.ConnectionString = cnnConnection.ConnectionString
  pt.CommandText = strSQL
 
  set view = pt.ActiveView

  ' Automatically add all result columns to the detail area.
  view.AutoLayout
 
  ' Set the title.
  view.Titlebar.Caption = strTitle

  ' Hide the drop areas.
  view.RowAxis.Label.Visible = False
  view.ColumnAxis.Label.Visible = False

  ' Set detail maximum width so that it doesn't have detail scroll bars.
  view.DetailMaxHeight = 32000
  view.DetailMaxWidth = 32000
 
  ' Turn off AutoFit.
  pt.AutoFit = False
  pt.Width = "100%"
  pt.Height = "65%"

  ' Disallow grouping.
  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 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.