Analysis And Reporting Analysis And Reporting With Office Web With Office Web ComponentsComponents
Mike AmmerlaanMike AmmerlaanProgram ManagerProgram ManagerExcel/ComponentsExcel/ComponentsMicrosoft CorporationMicrosoft Corporation
4-3024-302
OverviewOverview
Components overviewComponents overview Basics:Basics:
Chart and PivotTableChart and PivotTable®® data binding data binding Chart component basicsChart component basics PivotTablePivotTable®® component basics component basics
Solutions:Solutions: Custom reporting using PivotTableCustom reporting using PivotTable®® PivotChartsPivotCharts Drill through with the PivotTableDrill through with the PivotTable®®
Food For Thought: Food For Thought: A Timesheet WeblicationA Timesheet Weblication
Web Components OverviewWeb Components Overview
Chart and PivotTable are Chart and PivotTable are COM componentsCOM components
Use them in:Use them in: Internet Explorer 4.01 or higher Internet Explorer 4.01 or higher
Edit in FrontPageEdit in FrontPage®®, Visual InterDev, Visual InterDev®®, Access , Access Data PagesData Pages
Visual BasicVisual Basic®® forms, VBE forms forms, VBE forms Other COM control containersOther COM control containers UI-lessUI-less
Connecting The Connecting The Components To DataComponents To Data
Connecting To DataConnecting To Data
Passing A Data ObjectPassing A Data Object Build the data objects using script Build the data objects using script
(e.g., an ADO Recordset)(e.g., an ADO Recordset) Pass the data objects to the controlPass the data objects to the control
Setting Connection Properties DirectlySetting Connection Properties Directly ConnectionString, CommandText, Data ConnectionString, CommandText, Data
Member propertiesMember properties
Do It Yourself Data ObjectsDo It Yourself Data Objects
PivotTable and Chart can connect to any Data PivotTable and Chart can connect to any Data Source ObjectSource Object PivotTable:PivotTable:
set ptable.DataSource = dscset ptable.DataSource = dsc
ptable.DataMember = nameptable.DataMember = name
Chart:Chart:set cds = ChartSpace.ChartDataSources.Add()set cds = ChartSpace.ChartDataSources.Add()
set cds.DataSource = dscset cds.DataSource = dsc
cds.DataMember = Namecds.DataMember = Name
PivotTable is a DSO, thus you can PivotTable is a DSO, thus you can bind Chart to itbind Chart to it
Connecting Directly Connecting Directly
PivotTable natively supports PivotTable natively supports CommandText and ConnectionString CommandText and ConnectionString for connecting directly to datafor connecting directly to data
PivotTable connects to OLAP data via PivotTable connects to OLAP data via the ConnectionString and DataMember the ConnectionString and DataMember propertiesproperties ptable.ConnectionString = ptable.ConnectionString =
“<Conn String>”“<Conn String>” ptable.ptable.DataMemberDataMember = “<Cube Name>” = “<Cube Name>”
Chart SpecificsChart Specifics
Charting TerminologyCharting Terminology
ChartChart
Chart.SeriesChart.Series
ChartSpaceChartSpaceChartSpaceChartSpace
TitleTitle
Chart.TitleChart.Title
LegendLegend
Chart.Series.Chart.Series.PointPoint
Chart Object Model MapChart Object Model MapChartSpaceChartSpace
Points(…)Points(…)
SeriesCollection(…)SeriesCollection(…)Charts(…)Charts(…)
Trendlines(…)Trendlines(…)
Axes (…)Axes (…)
LegendLegend
PlotAreaPlotArea
DataLabelsCollection(…)DataLabelsCollection(…)TitleTitle
BorderBorder
ErrorBarsCollection(…)ErrorBarsCollection(…)
PivotTable SpecificsPivotTable Specifics
PivotTable TerminologyPivotTable TerminologyTool BarTool Bar
Title BarTitle Bar
FilterFilterAxisAxis
RowRowAxisAxis
ColumnColumnAxisAxis
DataDataAxisAxis
FieldsetFieldset
FieldField
MemberMember
TotalTotal
AggregateAggregatePivotTable.SelectionPivotTable.Selection
(PivotRange)(PivotRange)
PivotTable Object ModelPivotTable Object ModelPivotTablePivotTable
Column-, Row- Column-, Row- Members(…)Members(…)
ActiveDataActiveDataActiveViewActiveView
Fieldsets(…) Fieldsets(…)
Column-, Data-, Column-, Data-, Row-, Filter- AxisRow-, Filter- Axis
Fieldsets(…)Fieldsets(…)
LabelLabel
FieldLabel*, FieldLabel*, Member*, Total*Member*, Total*
* = ForeColor, Font, * = ForeColor, Font, BackColor, etc.BackColor, etc.
Cells(…)Cells(…)
SolutionsSolutions
PivotTable Reports With PivotTable Reports With Predefined ViewsPredefined ViewsScenario: Web page for employees to view Scenario: Web page for employees to view popular report typespopular report types
PivotTable component in Web page, PivotTable component in Web page, with HTML user interface with HTML user interface
View configuration is done with:View configuration is done with: InsertFieldSet on Axis objectsInsertFieldSet on Axis objects Manipulating field objects on Manipulating field objects on
Axis.Fieldsets(…)Axis.Fieldsets(…)
PivotChartsPivotCharts
Scenario: Adding charts as views of a Scenario: Adding charts as views of a PivotTablePivotTable
Add a chart object to the pageAdd a chart object to the page Bind it to the PivotTableBind it to the PivotTable Add a data series using SetDataAdd a data series using SetData Add some logic for showing an Add some logic for showing an
appropriate chartappropriate chart
Supporting Drill Through In Supporting Drill Through In The PivotTableThe PivotTable Catch DblClick EventCatch DblClick Event
Use PivotTable.Selection property to Use PivotTable.Selection property to determine selectiondetermine selection
Get Row, Column and Filter MembersGet Row, Column and Filter Members Build SQL WHERE clause specifying Build SQL WHERE clause specifying
member namesmember names Set CommandText of new PivotTableSet CommandText of new PivotTable
More InformationMore Information
Office Web sitesOffice Web sites http://support.microsoft.com/support/http://support.microsoft.com/support/
OfficeDev/webcomp.asp OfficeDev/webcomp.asp http://www.microsoft.com/officedevhttp://www.microsoft.com/officedev Search for msowcvba.chm on your drive Search for msowcvba.chm on your drive
for an API referencefor an API reference Programming Microsoft Programming Microsoft
Office 2000 Web ComponentsOffice 2000 Web Componentsby Dave Stearns,by Dave Stearns,Microsoft PressMicrosoft Press
Microsoft Script EditorMicrosoft Script Editor
I recommend Microsoft Script Editor I recommend Microsoft Script Editor for editing your scripts:for editing your scripts: Based on Visual Interdev, but without a Based on Visual Interdev, but without a
lot of the unneeded complexitylot of the unneeded complexity Comes with Office 2000Comes with Office 2000 To use it, make sure it is installed by using To use it, make sure it is installed by using
the Office setup app (it is not installed the Office setup app (it is not installed by default)by default)
Search for MSE.EXE on your machineSearch for MSE.EXE on your machine
PivotTable IssuesPivotTable Issues
Visual totalsVisual totals If you exclude Seattle, does WA remain the same If you exclude Seattle, does WA remain the same
or does it = WA – Seattle?or does it = WA – Seattle? ActiveView.TotalAllMembers configures thisActiveView.TotalAllMembers configures this
SR1 PivotTable: PivotTable.Connection SR1 PivotTable: PivotTable.Connection propertyproperty Exposes current OLAP sessionExposes current OLAP session Execute CREATE MEMBER statements to create Execute CREATE MEMBER statements to create
calculated memberscalculated members Call PivotTable.Refresh and get new ActiveData Call PivotTable.Refresh and get new ActiveData
object to pick up new totalsobject to pick up new totals
DeploymentDeployment
No technological tie to Office 2000No technological tie to Office 2000 Can deploy to the without also deploying Can deploy to the without also deploying
Office 2000Office 2000 However, install requires a However, install requires a
MS Office 2000 license per desktopMS Office 2000 license per desktop Auto-install with Microsoft InstallerAuto-install with Microsoft Installer
Use the CODEBASE attribute, must be a Use the CODEBASE attribute, must be a file:\\ path (I.e. Intranet only)file:\\ path (I.e. Intranet only)
CAB is 1.6 MbCAB is 1.6 Mb Requires MDAC 2.1 for data-accessRequires MDAC 2.1 for data-access
Common UI ElementsCommon UI Elements
AutoFitAutoFit Grows and shrinks with dataGrows and shrinks with data Good for Internet Explorer, bad for formsGood for Internet Explorer, bad for forms
Hide/show UI elementsHide/show UI elements Display* properties control visibilityDisplay* properties control visibility Hide/Show Titlebar, Toolbar, FieldList, Hide/Show Titlebar, Toolbar, FieldList,
Property Toolbox, Expand indicators, Property Toolbox, Expand indicators, Drop zonesDrop zones
TitlebarTitlebar ActiveView.Titlebar.Caption = “Hello”ActiveView.Titlebar.Caption = “Hello”