Developer's Guide
Thisguideprovidesintroductoryconceptualmaterialandhow-toexplanationsforroutinetasksfordevelopersusingSpreadforASP.NET.ItdescribeshowanapplicationdeveloperwouldusethepropertiesandmethodsinSpreadtocreatespreadsheetsandgridsonWebForms,bindtodatabases,andcustomizethecomponentforyourapplication.
GettingStartedUnderstandingtheProductWorkingwiththeSpreadDesignerCustomizingtheAppearanceCustomizingUserInteractionCustomizingwithCellTypesManagingDataBindingManagingDataintheComponentManagingFormulasManagingFileOperationsUsingSheetModelsMaintainingStateWorkingwiththeChartControlUsingTouchSupportwiththeComponent
ForcompleteAPIreferenceinformation,refertotheAssemblyReference(on-linedocumentation).
Foracompletelistofdocumentation,refertotheSpreadforASP.NETDocumentation(on-linedocumentation).
Spread for ASP.NET Developer’s Guide 0
Copyright © GrapeCity, Inc. All rights reserved.
1 Table of Contents
Developer'sGuide 0
1. TableofContents 1-15
GettingStarted 16
HandlingInstallation 16
InstallingtheProduct 16
LicensingaTrialProjectafterInstallation 16
End-UserLicenseAgreement 16-17
CreatingaBuildLicense 17-18
HandlingRedistribution 18-20
ProductRequirements 20
HandlingVariationsInWindowsSettings 20
WorkingwiththeComponent 20-21
AddingaComponenttoaWebSiteusingVisualStudio2015or2017 21-23
AddingJavaScriptIntelliSenseforVisualStudio2015or2017 23-25
UnderstandingBrowserSupport 25-27
UnderstandingPartsoftheComponentInterface 27-28
WorkingwithCollectionEditors 28
WorkingwithWebParts 28-29
WorkingwithWindowsAzure 29
WorkingwithMicrosoftASP.NETMVC5 29-33
WorkingwithMicrosoftASP.NETMVC3 33-37
CopyingSharedAssembliestoLocalFolder 37-38
WorkingwithStronglyTypedDataControls 38
GettingMorePractice 38
UnderstandingProceduresintheDocumentation 38-40
GettingTechnicalSupport 40
UnderstandingtheSpreadWizard 40
StartingtheSpreadWizard 40-41
Spread for ASP.NET Developer’s Guide 1
Copyright © GrapeCity, Inc. All rights reserved.
UsingtheSpreadWizard 41-42
Tutorial:CreatingaCheckbookRegister 42
AddingSpreadtotheCheckbookProject 42
AddingSpreadtoaProject 42-44
SettingUptheRowsandColumnsoftheRegister 44-46
SettingtheCellTypesoftheRegister 46-48
AddingFormulastoCalculateBalances 48-49
UnderstandingtheProduct 50
ProductOverview 50-51
FeaturesOverview 51-52
AJAXSupport 52
ASP.NETAJAXExtenders 52-53
Built-InFunctions 53
CellTypes 53-54
ChartControl 54
Client-SideScripting 54
ConditionalFormatting 54
ContextMenu 54
CornerCustomization 54-55
CustomizedAppearance(Skins) 55
DataBinding 55
FootersforColumnsorGroups 55
FrozenRowsandColumns 55
GoalSeeking 55
Grouping 55
HeaderswithMultipleColumnsandRows 55
HierarchicalDisplay 55-56
ImportandExportCapabilities 56
LoadonDemand 56
Multiple-LineColumns 56
Spread for ASP.NET Developer’s Guide 2
Copyright © GrapeCity, Inc. All rights reserved.
MultipleSheets 56
PDFSupport 56
Printing 56-57
RowFiltering 57
RowPreview 57
RowTemplateEditor 57
SearchingFeatures 57
SortingCapabilities 57
SpannableCells 57
Sparklines 57
SpreadDesigner 57-58
SpreadWizard 58
ThemeRoller 58
TitleandSubtitle 58
TouchSupport 58
ValidationControls 58
ConceptsOverview 58
ShortcutObjects 58-60
ObjectParentage 60
UnderlyingModels 61-62
CellTypes 62
SheetViewversusFpSpread 62
FormattedversusUnformattedData 62-63
Zero-BasedIndexing 63
Client-SideScripting 63
MaintainingState 63
NamespacesOverview 64
WorkingwiththeSpreadDesigner 65
StartingtheSpreadDesigner 65
UnderstandingtheSpreadDesignerInterface 65-66
Spread for ASP.NET Developer’s Guide 3
Copyright © GrapeCity, Inc. All rights reserved.
SpreadDesignerMenus 66-67
FileMenu 67-68
HomeMenu 68
InsertMenu 68-69
DataMenu 69
ViewMenu 69
SettingsMenu 69-70
ChartToolsMenu 70
SparklinesMenu 70
SpreadDesignerToolbars 70-71
SpreadDesignerEditors 71
AlternatingRowsEditor 71-72
Cells,Columns,andRowsEditor 72-73
ContextMenuCollectionEditor 73-76
DataKeyNames(StringCollection)Editor 76-77
FormulaEditor 77-78
GroupInfoCollectionEditor 78-79
HeaderEditor 79-80
NamedStyleCollectionEditor 80-81
RowTemplateEditor 81-82
SheetSkinEditor 82-83
SheetViewCollectionEditor 83-84
SpreadDesignerContextMenus 84-85
UsingtheSpreadDesigner 85-86
CustomizingSheets,Rows,andColumnsinSpreadDesigner 86-87
CustomizingCellsinSpreadDesigner 87-89
AddingFormulastoCells 89-91
SavingandOpeningDesignFiles 91-92
ApplyingChangesandClosingSpreadDesigner 92
Spread for ASP.NET Developer’s Guide 4
Copyright © GrapeCity, Inc. All rights reserved.
CustomizingUserInteraction 93
CustomizingInteractionwiththeOverallComponent 93
DisplayingScrollBars 93-94
DisplayingScrollBarTextTips 95
CustomizingtheScrollBarColors 95-96
AllowingLoadonDemand 96-98
CustomizingInteractionBasedonEvents 98
HandlingtheTabKey 98
CustomizingtheGraphicalInterface 99-100
SearchingforDatawithCode 100-101
AddingaContextMenu 101-103
WorkingwithAJAX 103
EnablingAJAXsupport 103-104
UsingASP.NETAJAXExtenders 104-105
CustomizingtheToolbars 105
CustomizingtheCommandBarontheComponent 105-107
CustomizingtheCommandButtons 107-110
ChangingtheCommandButtonImages 110-112
HidingaSpecificCommandButton 112-113
DisplayingtheSheetNames 113-115
CustomizingPageNavigation 115-118
CustomizingPageNavigationButtonsontheClient 118-119
CustomizingtheHierarchyBar 119-120
CustomizingInteractionwithRowsandColumns 120
AllowtheUsertoMoveColumns 120-121
AllowingtheUsertoResizeRowsorColumns 121-122
FreezingRowsandColumns 122-123
SettingupRowEditTemplates 123-124
SettingupPreviewRows 124-125
ManagingFilteringofRowsofUserData 125-126
Spread for ASP.NET Developer’s Guide 5
Copyright © GrapeCity, Inc. All rights reserved.
CreatingFilteredRowsandSettingtheAppearance 126-130
CustomizingSimpleFilteringofRowsofUserData 130
UsingRowFiltering 130-131
CustomizingtheListofFilterItems 131-132
CreatingaCompletelyCustomFilter 132-133
UsingEnhancedFiltering 133-135
UsingtheFilterBar 135-138
CustomizingGroupingofRowsofUserData 138
UsingGrouping 138-139
AllowingtheUsertoGroupRows 139-140
SettingtheAppearanceofGroupedRows 140-142
CustomizingtheGroupBar 142-143
CreatingaCustomGroup 143
CompatibilitywithOtherFeatures 143-144
CustomizingSortingofRowsofUserData 144-145
AllowingUserSorting 145-146
CustomizingInteractionwithCells 146
AddingaNotetoaCell 146-147
AddingaTagtoaCell 147-149
LockingaCell 149-151
UsingConditionalFormattinginCells 151
CreatingConditionalFormattingwithRules 151-152
ColorScaleRules 152-153
DataBarRule 153-155
HighlightingRules 155-157
IconSetRule 157-158
ToporAverageRules 158-159
ConditionalFormattingofCells 159-160
CustomizingSelectionsofCells 160
SpecifyingWhattheUserCanSelect 160-162
Spread for ASP.NET Developer’s Guide 6
Copyright © GrapeCity, Inc. All rights reserved.
WorkingwithSelectionsofCells 162-163
CustomizingtheAppearanceofSelections 163-164
ManagingPrinting 164
PrintingaSpreadsheet 164-165
AddingHeadersandFooterstoPrintedPages 165
CustomizingtheAppearance 166
CustomizingtheAppearanceoftheOverallComponent 166
CustomizingtheDimensionsoftheComponent 166-167
CustomizingtheOutlineoftheComponent 167-168
CustomizingtheDefaultInitialAppearance 168-169
ResettingPartsoftheInterface 169-170
UsingthejQueryThemeRollerwithSpread 170-171
CustomizingtheAppearanceoftheSheet 171-172
WorkingwiththeActiveSheet 172
WorkingwithMultipleSheets 172-173
AddingaSheet 173-174
RemovingaSheet 174-175
ShowingorHidingaSheet 175-176
SettingtheBackgroundColoroftheSheet 176-177
AddingaTitleandSubtitletoaSheet 177-178
CustomizingthePageSize(RowstoDisplay) 178-180
DisplayingGridLinesontheSheet 180-181
CustomizingtheSheetCorner 181-183
DisplayingaFooterforColumnsorGroups 183-187
CreatingaSkinforSheets 187-189
ApplyingaSkintoaSheet 189-190
CustomizingtheAppearanceofRowsandColumns 190
CustomizingtheNumberofRowsorColumns 190-191
AddingaRoworColumn 191-192
Spread for ASP.NET Developer’s Guide 7
Copyright © GrapeCity, Inc. All rights reserved.
RemovingaRoworColumn 192-194
ShowingorHidingRowsorColumns 194-195
SettingtheRowHeightorColumnWidth 195-196
SettingtheTopRowtoDisplay 196-197
CreatingAlternatingRows 197-198
CreatingRowTemplates(Multiple-LineColumns) 198-202
CustomizingtheAppearanceofHeaders 202-203
CustomizingtheStyleofHeaderCells 203-204
ShowingorHidingHeaders 204-206
CustomizingtheDefaultHeaderLabels 206-208
CustomizingHeaderLabelText 208-209
SettingtheSizeofHeaderCells 209-210
CustomizingtheHeaderEmptyAreas 210-211
CreatingaHeaderwithMultipleRowsorColumns 211-214
CreatingaSpaninaHeader 214-215
CustomizingtheAppearanceofaCell 215-216
WorkingwiththeActiveCell 216
CustomizingtheColorsofaCell 216-218
AligningCellContents 218-219
CustomizingCellBorders 219-220
CustomizingtheMarginsandSpacingoftheCell 220-222
CreatingandApplyingaCustomStyleforCells 222-224
AssigningaCascadingStyleSheettoaCell 224-225
CreatingaRangeofCells 225-226
SpanningCells 226-228
AllowingCellstoMergeAutomatically 228-230
UsingSparklines 230-231
AddingaSparklinetoaCell 231-233
CustomizingMarkersandPointers 233-235
SpecifyingHorizontalandVerticalAxes 235-236
Spread for ASP.NET Developer’s Guide 8
Copyright © GrapeCity, Inc. All rights reserved.
WorkingwithSparklines 236-237
CustomizingwithCellTypes 238-239
UnderstandingHowCellTypesWork 239
UnderstandingCellTypeBasics 239
UnderstandingHowCellTypesDisplayData 239-241
UnderstandingHowCellTypeAffectsModelData 241-242
DeterminingtheCellTypeofaCell 242-243
WorkingwithEditableCellTypes 243
SettingaCurrencyCell 243-245
LimitingValuesforaCurrencyCell 245-246
SettingaDate-TimeCell 246-247
DisplayingaCalendarinaDate-TimeCell 247-248
SettingaDoubleCell 248-249
SettingaGeneralCell 249-250
SettinganIntegerCell 250-251
SettingaPercentCell 251-252
SettingaRegularExpressionCell 252-253
SettingaTextCell 253-254
WorkingwithGraphicalCellTypes 254
SettingaButtonCell 254-256
SettingaCheckBoxCell 256-258
SettingaComboBoxCell 258-260
SettingaHyperlinkCell 260-262
SettinganImageCell 262-263
SettingaLabelCell 263-264
SettingaListBoxCell 264-265
SettingaMultiple-ColumnComboBoxCell 265-266
SettingaRadioButtonListCell 266-268
SettingaTagCloudCell 268-270
WorkingwithASP.NETAJAXExtenderCellTypes 270-271
Spread for ASP.NET Developer’s Guide 9
Copyright © GrapeCity, Inc. All rights reserved.
SettinganAutomatic-CompletionCell 271
SettingaCalendarCell 271
SettingaComboBoxCell 272
SettingaFilteredTextCell 272
SettingaMaskedEditCell 272-273
SettingaMutuallyExclusiveCheckBoxCell 273
SettingaNumericSpinCell 273
SettingaRatingCell 273-274
SettingaSliderCell 274
SettingaSlideShowCell 274
SettingaTextBoxwithWatermarkCell 274-275
UsingValidationControls 275-279
ManagingDataBinding 280
DataBindingOverview 280-281
BindingtoaDataSource 281-282
BindingtoaRange 282-284
ModelDataBindinginASP.NET4.5 284-288
SettingtheCellTypesforBoundData 288-289
DisplayingDataasaHierarchy 289-292
HandlingRowExpansion 292-293
AddinganUnboundRow 293-294
LimitingPostbacksWhenUpdatingBoundData 294
Tutorial:BindingtoaCorporateDatabase 294
UsingSpreadwithVisualStudio2015andtheSQLDataSource 294-295
UsingSpreadwiththeAccessDataSourceControl 295-296
AddingSpreadtoaDataBindProject 296
SettinguptheDatabaseConnection 296-297
SpecifyingtheDatatoUse 297-298
CreatingtheDataSet 298-299
Spread for ASP.NET Developer’s Guide 10
Copyright © GrapeCity, Inc. All rights reserved.
BindingSpreadtotheDatabase 299-300
ImprovingtheDisplaybyChangingtheCellType 300
ManagingDataintheComponent 301
SavingDatatotheServer 301
PlacingandRetrievingData 301
HandlingDataUsingSheetMethods 301-304
HandlingDataUsingCellProperties 304
Server-SideScripting 304
UnderstandingEffectsofClient-SideValidation 304-305
UnderstandingPostbackandPageLoadEvents 305-306
UnderstandingtheEffectofModeonEvents 306-307
ManagingFormulas 308
PlacingaFormulainCells 308-309
SpecifyingaCellReferenceStyleinaFormula 309-310
UsingaCircularReferenceinaFormula 311-312
NestingFunctionsinaFormula 312
FindingaValuewithGoalSeeking 312-313
RecalculatingandUpdatingFormulasAutomatically 313-314
CreatingaCustomFunction 314-315
CreatingaCustomName 315-316
ManagingFileOperations 317
SavingDatatoaFile 317
SavingtoaSpreadXMLFile 317-318
SavingtoanExcelFile 318-319
SavingtoaTextFile 319-320
SavingtoanHTMLFile 320-321
SavingtoaPDFFile 321
SavingtoPDFMethods 321-322
SettingPrintInfoClassProperties 322
SettingSmartPrintOptions 322-324
Spread for ASP.NET Developer’s Guide 11
Copyright © GrapeCity, Inc. All rights reserved.
SettingHeadersandFooters 324-328
OpeningExistingFiles 328
OpeningaSpreadXMLFile 328-329
OpeninganExcel-FormattedFile 329-330
OpeningaTextFile 330
UsingSheetModels 331-332
UnderstandingtheModels 332
UnderstandingHowtheModelsWork 332-334
CustomizingModels 334
UnderstandingtheAxisModel 334-335
UnderstandingtheDataModel 335-338
UnderstandingtheSelectionModel 338
UnderstandingtheSpanModel 338
UnderstandingtheStyleModel 338-341
UnderstandingtheOptionalInterfaces 341
CreatingaCustomSheetModel 342-343
MaintainingState 344
StateOverview 344
SavingDatatotheViewState 344-346
SavingDatatotheSessionState 346-348
SavingDatatoanSQLDatabase 348
LoadingDataforEachPageRequest 348-354
WorkingwiththeChartControl 355
UnderstandingandCustomizingCharts 355
ChartUserInterfaceElements 355-356
ChartTypesandViews 356-357
PlotTypes 357
YPlotTypes 358
AreaCharts 358-360
BarCharts 360-363
Spread for ASP.NET Developer’s Guide 12
Copyright © GrapeCity, Inc. All rights reserved.
LineCharts 363-364
MarketData(High-Low)Charts 364-366
PointCharts 366-367
StripeCharts 367-368
XYPlotTypes 368
BubbleCharts 368-369
LineCharts 369
PointCharts 369-370
StripeCharts 370
XYZPlotTypes 370-371
PointCharts 371-372
LineCharts 372-373
SurfaceCharts 373-374
StripeCharts 374
PiePlotTypes 374
DoughnutCharts 375
PieCharts 375
PolarPlotTypes 376
PointCharts 376-377
LineCharts 377-378
AreaCharts 378-379
StripeCharts 379
RadarPlotTypes 379-380
PointCharts 380-381
LineCharts 381-382
AreaCharts 382
StripeCharts 382-383
DataPlotTypes 383-384
Series 384-385
Spread for ASP.NET Developer’s Guide 13
Copyright © GrapeCity, Inc. All rights reserved.
Walls 385-386
AxisandOtherLines 386-388
FillEffects 388-391
ElevationandRotation 391-392
Lighting,Shapes,andBorders 392-395
Size-Height,Width,andDepth 395-396
Labels 396-397
Legends 397-398
CreatingCharts 398
CreatingPlotTypes 398
CreatingaYPlot 398-400
CreatinganXYPlot 400-403
CreatinganXYZPlot 403-406
CreatingaPiePlot 406-408
CreatingaPolarPlot 408-411
CreatingaRadarPlot 411-413
CombiningPlotTypes 413-415
ConnectingtoData 415
UsingaBoundDataSource 415-417
UsinganUnboundDataSource 417-418
UsingRawDataVersusRepresentedData 418-419
UsingtheChartDesigner 419
OpeningtheChartDesigner 419-420
CreatingaChartControl 420-423
UsingtheChartCollectionEditors 423
LabelAreaCollectionEditor 423-424
LegendAreaCollectionEditor 424
PlotAreaCollectionEditor 424-425
LightCollectionEditor 425-426
SeriesCollectionEditor 426
Spread for ASP.NET Developer’s Guide 14
Copyright © GrapeCity, Inc. All rights reserved.
UsingtheSpreadDesigner 426-427
UsingtheChartControl 427
CreatingtheChartControl 427-429
RenderingorSavingtheChartControltoanImage 429
LoadingorSavingtheChartControltoXML 429-430
UsingtheChartControlinSpread 430
CreatingtheChartControlwithCode 430-433
BindingtheChartControlwithSpread 433-434
MovingandResizingtheChartControlinSpread 434-435
SelectingtheChartControlinSpread 435-436
SettingtheChartControlBorderinSpread 436-437
SettingtheChartViewType 437-438
UsingtheChartContextMenu 438-439
UsingTouchSupportwiththeComponent 440
UnderstandingTouchSupport 440
UnderstandingTouchGestures 440
UsingTouchSupport 440-441
UsingtheTouchMenuBar 441-442
UsingTouchSupportwithAutoFit 442
UsingTouchSupportwithCharts 442
UsingTouchSupportwithEditableCells 442-443
UsingTouchSupportwithFiltering 443-444
UsingTouchSupportwithGrouping 444-446
UsingTouchSupportwhenMovingColumns 446-447
UsingTouchSupportwhenResizingColumnsorRows 447-449
UsingTouchSupportwithScrolling 449-450
UsingTouchSupportwithSelections 451-452
UsingTouchSupportwithSorting 452-453
2. Index 454-492
Spread for ASP.NET Developer’s Guide 15
Copyright © GrapeCity, Inc. All rights reserved.
Getting Started
Thistopicdescribeshowtogetstartedwiththecomponent.Itincludes:
HandlingInstallationWorkingwiththeComponentGettingMorePracticeUnderstandingtheSpreadWizardTutorial:CreatingaCheckbookRegister
Handling Installation
Herearethetasksforinstallingtheproductfordevelopmentandforredistribution.
InstallingtheProductLicensingaTrialProjectafterInstallationEnd-UserLicenseAgreementCreatingaBuildLicenseHandlingRedistributionProductRequirementsHandlingVariationsinWindowsRegionalSettings
Installing the Product
InstallationinstructionsandalistofinstalledfilesforSpreadforASP.NETisprovidedintheReadMefilethataccompaniesthisproduct.ToviewtheReadMefile,dooneofthefollowing:
1. FromtheStartmenuchoosePrograms->GrapeCity->Spread.NET13->ASP.NET->SpreadASPReadMe.SelecttheReadMeundertheGrapeCitynameontheStartscreenwithMicrosoftWindows8,8.1,or10.
2. Ifyouperformedadefaultinstallation,inWindowsExplorerbrowseto\ProgramFiles\GrapeCity\Spread.NET13\Docs\ASP.NETanddouble-clickthereadme.chmfile.
YoucanalsoaccesstheReadMeonthewebsite.
Licensing a Trial Project after Installation
TolicenseASP.NETprojectsmadewiththetrialversiondothefollowing:
1. EnsurethatSpreadislicensedonthemachinebyfollowingtheinstallationstepsintheReadMe.2. OpentheprojectinMicrosoftVisualStudio.3. OpentheVisualStudioBuildmenuandselectRebuildSolution.4. Thewebapplicationisnowlicensedandnoevaluationbannersappearwhenyourunit.Youcandistributethe
Webapplicationtounlicensedmachinesandnoevaluationbannersappear.
ForlicensingWebSiteapplications,opentheVisualStudioBuildmenuandselectBuildRuntimeLicensestocreatetheApp_Licenses.dllfile.
End-User License Agreement
TheGrapeCitylicensinginformation,includingtheGrapeCityend-userlicenseagreements,frequentlyaskedlicensingquestions,andtheGrapeCitylicensingmodel,isavailableonlineathttps://www.grapecity.com/en/licensing/spread
Spread for ASP.NET Developer’s Guide 16
Copyright © GrapeCity, Inc. All rights reserved.
https://www.grapecity.com/spreadnet/docs/v13/readme.htmlhttps://www.grapecity.com/spreadnet/docs/v13/readme.htmlhttps://www.grapecity.com/en/licensing/spread
andhttps://www.grapecity.com/en/legal/eula.
Creating a Build License
Youcancreateabuildlicensetouseonabuildmachine.
Licensesarebuiltusingthelicensecompilertool(lc.exe)toproduceaspecialresourcefilewiththe.licensesfileextension.VisualStudioVB.NETandC#projectsautomaticallyhandlecompilingthelicenses.licxintheprojecttoproducethe.licensesresourcefile,whichislinkedintothetargetexecutable.Thecomponents’run-timelicensekeysinthatlicensesresourcefileareloadedandverifiedwhenthefirstinstanceofeachcomponentwiththeLicenseProviderattributeiscreatedintheapplication.Youcanremovethelicenses.licxfromyourVisualStudioprojectandaddthe.licensesresourceinitsplaceusingthefollowingsteps:
1. Buildtheprojectusingthelicensedcomponentsonadevelopermachinewhichislicensedfordevelopmentwithallthecomponentsreferencedintheproject(thiscreatesthe.licensesresource).
2. Findthelicenses.licxintheSolutionExplorerwindow.YoucanusetheShowAllFilestoolbarbuttontoseeitorexpandthePropertiesfolder.
3. Right-clickthelicenses.licxintheSolutionExplorerwindow,andthenselectExcludeFromProject.
4. UseWindowsExplorer(outsideVisualStudio)tofindthe.licensesfileintheobj\{configuration}folder(obj\Debugorobj\Release).Thefileshouldhavethename{target}.{ext}.licenses(forexample:project1.exe.licenses).
5. Copythatfiletotheprojectfolderandrenameittoremovethetargetname(renameitfrom{target}.{ext}.licensesto{ext}.licenses).Forexample:project1.exe.licensestoexe.licenses.
6. IntheVisualStudioSolutionExplorerwindow,findthe{ext}.licenses(youmightneedtorefreshthewindow),thenright-clickthefileandselectIncludeInProject.
Spread for ASP.NET Developer’s Guide 17
Copyright © GrapeCity, Inc. All rights reserved.
https://www.grapecity.com/en/licensing/spreadhttp://spread.grapecity.com/Pages/EULA/
7. ChangetheBuildActionforthe{ext}.licensesfromContenttoEmbeddedResource.
8. Theprojectcannowbebuiltwithoutrequiringadeveloperlicenseonthemachine,sincethelicensehasalreadybeenbuiltandlinkedintotheproject.
Notethefollowingrestrictions:
Thelicensesresourcecontainsthenameofthetargetmoduleencodedinitscontents,sothatlicensesresourceisspecifictothatparticularproject.Thestepsdescribedabovewillnotbypassanypartofthedesign-timelicenseenforcement.Thedeveloperlicenseisstillrequiredtoopenformscontaininginstancesofthelicensedcontrols.Ifthelicensedcomponentsintheprojectchange,thenspecialcareshouldbetaken.Thelicenses.licxshouldbeaddedbacktotheprojectfirst,sothatitdoesnotgetrecreated(empty)byVisualStudioandcausetypereferences(andembeddedlicensesintheresource)tobelost.Afterthenewlicensedcomponentsareaddedorchangedinthelicx,theabovestepsshouldberepeated.Theabovestepsonlyapplyfor.NETmanagedcodeapplicationswhichusethestandard.NETFrameworkcomponentlicensingmodel(ActiveXcontrollicensinginmanaged.NETapplicationsdoesnotusethismechanism).
Handling Redistribution
PleasereviewthisinformationconcerningredistributionofSpreadforASP.NETwithyourapplication.
Spread for ASP.NET Developer’s Guide 18
Copyright © GrapeCity, Inc. All rights reserved.
ServerRequirements
YoumustdeploytoaMicrosoftInternetInformationserver.
ServerFiles
PlacetheassembliesthatcomewithSpreadforASP.NETineitheryourserver'sglobalassemblycache(GAC)orinyourapplicationdirectory's\binfolderunderthewwwrootdirectoryonyourserver.
Placethefollowingassembliesonyourserver:
FarPoint.Web.Spread.dllFarPoint.CalcEngine.dllFarPoint.Excel.dllFarPoint.PDF.dllFarPoint.Web.Chart.dll(ifyouusetheChartcontrolorSparklines)FarPoint.Web.Spread.Extender.dll(ifyouusetheextenderclasses)System.Web.Extensions.dll(ifyouusetheFarPoint.Web.Spread.Extender.dll)AjaxControlToolkit.dll(ifyouusetheFarPoint.Web.Spread.Extender.dll)FarPoint.Mvc.Web.Spread.dll(ifyouuseSpreadinanMVC3project)
Placethefp_clientfolder(installedinSpread.NET\ASP.NET\..\fp_client)anditssubfoldersprovidedwithSpreadforASP.NETunderyourserver'swwwrootdirectory,or,ifyouwishtoputitelsewhere,setupavirtualdirectoryinIISManagertopointtothelocationofthatfolder'scontents.
Thefp_clientfoldercanalsobeplacedinthewebapplicationdirectory.Thefollowingcodewouldneedtobeaddedtothewebconfigfile.Forexample:
...
BeawarethatSpreadforASP.NETcreatesaWebservercontrolthatservesupHTMLpagesforclientsanditalsoputsHTCfilesinadirectoryontheclientmachineforclient-sidescriptingcapability.
SpreadforASP.NETusesjQuery2.x.IfthewebpageorwebapplicationusesjQuery2.0orhigher,SpreadusesthatversionofjQuery.IfthewebpageusesjQuery1.9orearlier,SpreadusesjQuery2.xinternallyanddoesnotconflictwiththewebpageversionofjQuery.
PermissionRequirements
IfyouusetheSpreadcontrolonmediumtrustwebsites,youneedtoaddSerializationFormatterandReflectionpermissionstothemachineconfigfile,web_mediumtrust.config.TheSecurityPermissionneedstheUnmanagedCodeandSerializationFormatterflags.Forexample:
RemotingConfiguration, UnmanagedCode, SerializationFormatter"/>
Product Requirements
Fordevelopingapplicationswiththe.NET4.5.2version(orabove)ofSpreadforASP.NET,youmusthavethefollowingsystemrequirements:
Operating SystemOneofthefollowing:
MicrosoftWindows7MicrosoftWindows8.1MicrosoftWindows10MicrosoftWindowsServer2008MicrosoftWindowsServer2008R2MicrosoftWindowsServer2012MicrosoftWindowsServer2012R2
SoftwareReleaseversionoftheMicrosoft.NET4.5.2Frameworkorlater.MicrosoftInternetInformationServices(IIS)SQLServerortheSQLServerdesktopenginethatshipswithVisualStudio.NETinstalledonyourmachinetobeabletorunsomeofthedatabindingsamplesTheSpreadextenderrequirestheAJAXControlToolkit(version15.x)TheSpreadDesignerrequiresMicrosoftInternetExplorer11(Windows7,Windows8.1,Windows10,EnterpriseMode)andtheMicrosoft.mshtml.dll.
Handling Variations in Windows Regional Settings
TheSpreadcomponentreadstheWindowsregionalsettingsoroptions,whicharesetbytheuserthroughtheControlPanel,butduetovariationsinhowWindowshandlesthosesettings,yourusermightexperienceunexpectedresults.
IngeneralinWindowsoperatingsystems,theSpreadcomponentdoesnotrecognizechangesmadetotheWindowsregionalsettingsuntilyourestartyourdevelopmentenvironmentoryourapplicationorperformanyoperationthatunloadsandreloadsthecurrentassemblyanddependentassemblies.Thisisbecausehandlingtheregionalsettingsisveryprocessorintensive.Tooptimizeperformancethesesettingsarenotcheckedeachtimeasimpleoperationisperformed.
InmostWindowsoperatingsystems,theregionaloptionsarereadfromthesystemregistry.Incertainsituations,Windowsdoesnotclearpreviousregionaloptionswhenreadingchangesfromthesystemregistry.Beawareofthiswhenworkingwithregionalsettings.
Working with the Component
Herearethetasksinvolvedwithstartingtoworkwiththecomponent.
AddingaComponenttoaWebSiteusingVisualStudio2015or2017AddingJavaScriptIntelliSenseforVisualStudio2015or2017UnderstandingBrowserSupportUnderstandingPartsoftheComponentInterface
Spread for ASP.NET Developer’s Guide 20
Copyright © GrapeCity, Inc. All rights reserved.
WorkingwithCollectionEditorsWorkingwithWebPartsWorkingwithWindowsAzureWorkingwithMicrosoftASP.NETMVC5WorkingwithMicrosoftASP.NETMVC3CopyingSharedAssembliestoLocalFolderWorkingwithStronglyTypedDataControls
Adding a Component to a Web Site using Visual Studio 2015 or 2017
UsethefollowingstepstoaddaSpreadcomponenttoaWebForminVisualStudio.YoucaneitheropenanexistingWebSiteorcreateanewone.
Spread,asachildcontrolofthepage,isaffectedbythestylesettingsonthatpage(similartoplacingatableonawebform,andsettingamasterCSSforeverythinginsidethepage).IfyoucreateadefaultwebapplicationwithVisualStudio2015orhigher,thedefaultmasterpagecontainsCSSstylesettings.Spread,onceplacedonthisdefaultpage,canbeaffectedbythestylesettingsandthelayoutmaychange.AvoidthefollowingHTMLtagstopreventthelayoutchange:TD,TH,TABLE,INPUT,andTEXTAREA.
Step1.StartVisualStudio.
Step2.CreateanewWebsite.
1. SelectNewProjectorfromtheFilemenu,chooseNew,WebSite.2. UnderTemplates,selectWebunderVisualBasicorVisualC#.
3. SelectASP.NETWebApplication.4. Specifyalocationandnamefortheproject.5. SelectOK.6. SelectatemplatesuchasEmpty.
Spread for ASP.NET Developer’s Guide 21
Copyright © GrapeCity, Inc. All rights reserved.
7. SelectOK.IfyourprojectdoesnotdisplaytheSolutionExplorer,fromtheViewmenu,chooseSolutionExplorer.Ifyouusedanemptysite,youmaywishtoaddawebformtotheproject(chooseAdd,WebFormafterright-clickingontheprojectnameintheSolutionExplorer).
SpecifytheItemname.SelectOK.
Step3.AddtheFpSpreadcomponenttothetoolboxifthecomponentisnotdisplayedinthetoolbox.
1. IftheToolboxisnotdisplayed,fromtheViewmenuchooseToolbox.2. OncetheToolboxisdisplayed,lookintheGrapeCitySpreadcategory(orinothercategoriesifyouhaveinstalled
Spreadandplacedthetoolboxiconinadifferentcategory).3. IftheFpSpreadcomponentisnotintheToolbox,right-clickintheToolbox,andfromthepop-upmenuchooseChooseItems.
4. IntheChooseToolboxItemsdialog,clickthe.NETFrameworkComponentstab.5. Inthe.NETFrameworkComponentstab,theFpSpreadcomponentshouldbedisplayedinthelistofcomponents.
Spread for ASP.NET Developer’s Guide 22
Copyright © GrapeCity, Inc. All rights reserved.
SelecttheFpSpreadcomponentcheckboxandclickOK.IftheFpSpreadcomponentisnotdisplayedinthelistofcomponents,clickBrowseandbrowsetotheinstallationpathfortheSpreadcomponent.Oncethere,selectFarPoint.Web.Spread.dllandclickOpen.TheFpSpreadcomponentisnowdisplayedinthelistofcomponents.SelectitandclickOK.SelectFarPoint.Web.Chart.dllifyouwishtoaddFpChartatdesigntime.
6. Youcantestthatthecomponenthasbeenaddedbyopeningaprojectandinsertingthecomponent.
Step4.AddtheFpSpreadcomponenttotheWebsite.
1. Withanopenproject,intheToolboxunderWebForms,selecttheFpSpreadcomponent.SelectFpChartifyouwishtoaddthechartatdesigntime.
2. OnyourWebFormspage,drawanFpSpreadcomponentbydraggingarectanglethesizethatyouwouldliketheinitialcomponentorsimplydouble-clickonthepage.
3. TheFpSpreadcomponentappears(asshowninthisVisualStudioproject).
Adding JavaScript IntelliSense for Visual Studio 2015 or 2017
TheSpreadcomponentcansupportclient-sidecodeIntelliSenseinVisualStudio2015orlater(includingVisualStudio2017).Thisfeatureallowsyoutotypethenameofthecontrolandgetalistofavailablemethodsandproperties.Somebrowsersmaynotsupportcertainpropertiesandmethods.
Aftersupporthasbeenadded,typethecontrolnamefollowedbyadottoseethelist.
Spread for ASP.NET Developer’s Guide 23
Copyright © GrapeCity, Inc. All rights reserved.
ThisfeaturerequirestheFpSpreadJsIntellisense.jsfilelocatedinthefp_clientfolder.Usethefollowingsteps:
1. Verifythatthe~/Scripts/_references.jsreferenceexistsinyourIntelliSensesettings.SelecttheOptionsmenuundertheToolsmenutoseethisdialog.ClickOK.
2. AddtheFpSpreadJsIntellisense.jsfiletothesamefolderwherethe_references.jsfileislocated.YoumayneedtocreateaScriptsfolderinyourprojectifthefolderdoesnotexist.Youmayalsoneedtocreatethe_references.jsfileundertheScriptsfolderifthefiledoesnotalreadyexist.
3. Addthefollowinglineto_references.js:///
4. OpenandclosetheFpSpreadJsIntellisense.jsfile.5. Spreadclient-sidemethodsandpropertiesshouldnowbedisplayedwhenyoutypethecontrolnamefollowedbyadot.
Spread for ASP.NET Developer’s Guide 24
Copyright © GrapeCity, Inc. All rights reserved.
Understanding Browser Support
TheSpreadcomponentresidesontheserverandgeneratesHTMLpageswhenitisaccessedbyendusersontheclientside.TheappearanceandamountofinteractivityoftheWebpagedependsonthebrowserusedontheclientside.TheviewoftheHTMLpagesgeneratedbytheSpreadcomponentdependsonthebrowserbeingusedtoviewthepage.ThecomponentalsodownloadssomeHTMLcomponent(HTC)filestotheclientside.Thistopicsummarizessomebrowser-specificbehaviorsoftheproduct.Theseaspectsofbrowsersupport,discussedbelow,include:
BrowserLevel
TheappearanceandamountofinteractivityoftheWebpagedependsonthelevelofbrowser.Broadly,anuplevelbrowserisonethatcansupportclient-sideJavaScript,HTMLversion4.0,theMicrosoftDocumentObjectModel,andcascadingstylesheets(CSS).Adownlevelbrowserisonethatdoesnot.Foramoredetaileddefinitionofuplevelanddownlevelbrowserandforalistofcapabilitiesofthosebrowsers,refertothebrowsercapabilityinformationintheMicrosoft.NETdocumentation.
MozillaFirefoxSupport
WhilemostfeaturesworkinMozillaFirefox,notalldo.AllfeaturesworkinthelatestversionofMicrosoftInternetExplorer(IE).HereisalistoffeaturesthatarenotsupportedinFirefox.
Scrollbarproperties(seeCustomizingtheScrollBarColors)
Forotheraffects,seethediscussionontheDOCTYPEAffectonRendering.
AppleSafariSupport
WhilemostfeaturesworkinAppleSafari,notalldo.Hereisalistoffeaturesthatarenotsupported.
Frozenrowsandcolumns(FrozenRowCount('FrozenRowCountProperty'intheon-linedocumentation)propertyandFrozenColumnCount('FrozenColumnCountProperty'intheon-linedocumentation)property)ImeModeforeditablecelltypesUIVirtualization('UIVirtualizationProperty'intheon-linedocumentation)property
AppleSafariSupportwithIPad
Spread for ASP.NET Developer’s Guide 25
Copyright © GrapeCity, Inc. All rights reserved.
Hereisalistoffeaturesthatarenotsupported.
Panningmodeisnotsupported.Customtoolbarabovethesystemkeyboardisnotsupported.Scrollbarsarenotdisplayed.
GoogleChrome
Hereisalistoffeaturesthatarenotsupported.
ImeModeforeditablecelltypesScrollbarproperties(seeCustomizingtheScrollBarColors)
Client-SideScripting
Forotherbrowsers,besidesMicrosoftInternetExplorer(IE)andMozillaFirefox,theSpreadclient-sidescriptingisnotsupported.
Inyourscriptingcode,youwillneedtocheckthebrowsertoseeifitisFirefoxorIEbeforecallingthiscode,soyoucancallitcorrectlybasedonthebrowserthatisviewingthepage.Client-sidescriptingfortheFirefoxbrowserisalittledifferentthanitisforIE.YouneedtouseFirefox'swaytoattachevents.Forexample
Code
...
window.onload = function () { var spread1 = document.getElementById(""); if (document.all) { // IE if (spread1.addEventListener) { // IE9 spread1.addEventListener("DataChanged", dataChanged, false); } else { // Other versions of IE and IE9 quirks mode (no doctype set) spread1.onDataChanged = dataChanged; } } else { // Firefox spread1.addEventListener("DataChanged", dataChanged, false); } } function dataChanged() { alert("The data has changed!"); }
FirefoxdoesnotsupportJavaScriptpropertiesasIEdoes;everythingisaccessedwithmethods.Forexample,togettheactiverowandactivecolumn,youusetheGetActiveRow(on-linedocumentation)methodandtheGetActiveCol(on-linedocumentation)methodrespectively.Incode,
Codevar row = ss.GetActiveRow(); alert(row);
Spread for ASP.NET Developer’s Guide 26
Copyright © GrapeCity, Inc. All rights reserved.
Forbrowser-levelissuesspecifictocertainmembers,refertothese:
FpSpread.EnableClientScript('EnableClientScriptProperty'intheon-linedocumentation)PropertySheetView.MessageRowStyle('MessageRowStyleProperty'intheon-linedocumentation)PropertySheetSkin.SelectionForeColor('SelectionForeColorProperty'intheon-linedocumentation)Property
andrefertoUnderstandingEffectsofClient-SideValidation.
AJAXSupport
SpreadforASP.NETsupportsAJAXinMicrosoftInternetExplorer(IE)andMozillaFirefoxbrowsers.
DOCTYPEAffectonRendering
TheDOCTYPEsettingscanaffecttherenderingofSpread.Considerthefollowing:
ColumnwidthsslightlydifferfromwhatyouseeinSpreadDesigner(IEandFirefox).SpreadinsideaDIVelementdoesnotscrollasexpected(IEandFirefox)Rowheightexpandstoshowthewrappingtext(IEandFirefox)
ThecolumnwidthsmayappearnarrowerinFirefoxthaninIE.Thishastodowiththedocumenttype(DOCTYPE)oftheHTMLpage.InIE,withcompliantmode,youwillseecolumnwidthswithmarginssettobelargerthatwhatyousetthemto.IfyouchangetheDOCTYPEofthepagetoTransitionalorremovethemarginsforthecells,youshouldseethesamecolumnwidthsusingeitherbrowser.Formoreinformation,refertotheIsStrictModemethod.
Note:SpreadrequiresthattheXMLnamespacebedeclaredasfollows:
SpreadusesHTMLtablesforthedisplayontheclientside.Whenyoudefinearowspan,itdefinesthespanfortheHTMLtableinthepage.ThedefaultbehaviorinInternetExplorerforaspannedrowinanHTMLtableistoresizetofitthetext.InSpread,therowisresizedtoavoidlayoutissues.Thereislittledocumentationoutliningthisbehavior,butyoucantestthisbehaviorinFirefoxwhereyoudonotseethecellresizeitselftodisplaythefulltext.However,itdoesnotforcethehorizontalscrollbartoremain.
Understanding Parts of the Component Interface
ThegeneratedSpreadcomponentinterfaceismadeupofthetoolbars(whichcanappearaboveandbelowthespreadsheet)andthesheetthatdisplaysthedata.Thefigurebelowshowsthemajorpartsofthecomponentinterfacethatcanbecustomized.
Spread for ASP.NET Developer’s Guide 27
Copyright © GrapeCity, Inc. All rights reserved.
http://www.w3.org/1999/xhtml
MoreinformationaboutthecomponentisavailableinCustomizingtheAppearanceoftheOverallComponentandCustomizingInteractionwiththeOverallComponent.
Thecommandbar,theoptionalpagenavigationbar,andthescrollbarsaredescribedinmoredetailinCustomizingtheToolBars.
Therowandcolumnheaders,consideredpartofthesheet,aredescribedinmoredetailinCustomizingtheAppearanceofHeaders.
Formoreinformationonthedataarea,includingthesheet,therowsandcolumns,andthecells,refertoCustomizingtheAppearanceoftheSheet,CustomizingtheAppearanceofRowsandColumns,andCustomizingtheAppearanceofaCell.
Working with Collection Editors
SeveralpropertiesthatappearinthePropertieswindowareassociatedwithcollections.Toviewandmodifythesesettings,clickontheBrowsebutton(...)andaseparateCollectionEditorwindowappears.ThisisthecasefortheNamedStyles('NamedStylesProperty'intheon-linedocumentation)propertyandtheSheets('SheetsProperty'intheon-linedocumentation)propertyintheFpSpreadcomponent.
Withthesecollectioneditors,youmustclickOKtoseetheresultsofachangetoasetting.(ThecollectioneditorsarepartoftheMicrosoft.NETframeworkanddonothaveanApplybutton.)
Spread for ASP.NET Developer’s Guide 28
Copyright © GrapeCity, Inc. All rights reserved.
Working with Web Parts
YoucanallowSpreadforASP.NETworkasaWebPartinaMicrosoftSharePointenvironment.Todoso,followthesesteps:
1. Setthetrustleveltofull.SettheTrustLevelinSharePointweb.configtoFull.2. MarktheSpreadDLLssafeinweb.config(FarPoint.CalcEngine.dll,FarPoint.Excel.dlland
FarPoint.Web.Spread.dll).
ThisassumesyouareusingthelatestversionofSharePoint(WSSorMOSS).ForearlierversionsofSharePointyoualsohadtheadditionalstepofexcludingthefp_clientfolderfromtheSharePointserver.Thisisnolongernecessary.
SpreadcanbeusedinsidetheWebPartyouaredeveloping.
Inearlierversionsoftheproduct,theFpSpread.RenderWebPartmethodwasusedforthe.NETFramework1.xwhenyoucreatedaWebPartbasedonMicrosoft.SharePoint.WebPartPages.WebPartclass.In.NETFramework2.x,theWebPartbecomespartoftheframework.IfyouusetheframeworkWebPartclass,System.Web.UI.WebControls.WebParts.WebPart,theFpSpread.RenderWebPartmethodisnolongerneeded.
SeeagoodintroductiontoWebPartsat:
https://msdn.microsoft.com/en-us/library/ee231579.aspx
Working with Windows Azure
YoucanuseSpreadforASP.NETinaWindowsAzureproject.Usethefollowingsteps:
1. Copythefp_clientfoldertoyourWebRoleprojectfolder.2. Includethisfp_clientfolderinyourWebRoleprojectandaddthefollowingsettingtotheweb.configfile.
Code
Youdonotneedtoeditweb.configifyouusethedevelopmentfabricinVisualStudio.
YoucanalsousetheChartcontrolinaWindowsAzureproject.YouwouldneedtoaddtheChartImageHttpHandlertothewebserversectionoftheweb.configfile.Ifyouareusingintegratedmanagedpipelinemode,setvalidateIntegratedModeConfigurationtoFalse.Forexample:
Code
...
Working with Microsoft ASP.NET MVC 5
YoucanuseSpreadforASP.NETinanMVC5project.MVCsupportinSpreadforASP.NETrequiresMicrosoftASP.NETMVC5,MicrosoftVisualStudio2015(orlater)with.NET4.5.2Framework(orlater),andtheMicrosoftADO.NETEntity4.1Framework.
TheRazorviewgenerallyuses@infrontofthenameandtheASPXviewgenerallyusesaroundthename.UsethefollowingstepstocreateaprojectwithSpread:
Spread for ASP.NET Developer’s Guide 29
Copyright © GrapeCity, Inc. All rights reserved.
https://msdn.microsoft.com/en-us/library/ee231579.aspx
1. ReferenceFarPoint.Mvc.Spread.dllandFarPoint.Web.Spread.dllintheproject.2. AddtheSpreadinformationtotheLicenses.licxfile:
CodeFarPoint.Web.Spread.FpSpread, FarPoint.Web.Spread, Version=12.45.20182.0, Culture=neutral, PublicKeyToken=327c3516b1b18457FarPoint.Mvc.Spread.FpSpread, FarPoint.Mvc.Spread, Version=12.45.20182.0, Culture=neutral, PublicKeyToken=327c3516b1b18457
3. OpenGlobal.asax.cs,gototheApplication_Startfunctionandaddthefollowingregistrationcode:
IfyouuseSpreadMVCon.NETFramework4.0orabove,removeFarPoint.Mvc.Spread.MvcSpreadVirtualPathProvider.AppInitialize();fromApplication_Start().
C#protected void Application_Start(){//FarPoint.Mvc.Spread.MvcSpreadVirtualPathProvider.AppInitialize();AreaRegistration.RegisterAllAreas();RegisterGlobalFilters(GlobalFilters.Filters);RegisterRoutes(RouteTable.Routes);//ModelBinders.Binders.DefaultBinder = ModelBinders.Binders[typeof(FarPoint.Mvc.Spread.FpSpread)];//ModelBinders.Binders.Add(typeof(FarPoint.Mvc.Spread.FpSpread), new FarPoint.Mvc.Spread.MvcSpreadModelBinder());}
4. DeclareSpreadwiththeMVCSpreadnamespace:
Code@using FarPoint.Mvc.Spread; or
ThisallowsyoutohaveanMVCSpreadwiththefollowingcode:
[email protected]("FpSpread1"); or
FpSpread1istheSpreadID.Itshouldbeunique.
5. ProvideaccesstoMVCSpreadfromtheController.Whentheuserpostsbackdatatotheserver,thedevelopercanaccessthedeclaredMVCSpreadasanargument(theSpreadhasfullViewStateandnewpostbackdata).Forexample:
C#public ActionResult Index([FarPoint.Mvc.Spread.MvcSpread]FarPoint.Mvc.Spread.FpSpread FpSpread1){ViewBag.Message = "Welcome to GrapeCity";if (FpSpread1 != null){var value = FpSpread1.ActiveSheetView.Cells[0, 0].Value;}return View();}
Spread for ASP.NET Developer’s Guide 30
Copyright © GrapeCity, Inc. All rights reserved.
Ifyoudonotwanttouseanattribute,opentheGlobal.asax.csanduncommentoneofthelinesinstep3.
MakesuretheSpreadIDisthesameintheviewcodeandinthecontrolleractionparameter.
6. AttachSpreadevents:SpreadsupportsattachingeventsfromtheControlleronly.IfthereisanAJAXpostback,theSpreadeventswillnotbehandled.MvcSpreadallowsattaching3mainevents:Init,Load,andPreRender.Eventscanbegroupedorungrouped.Useoneofthefollowingmethodstohandletheevent:
Createafunctionwithaspecialname.
Thespecialnameindicatesthat“IwanttobindthisfunctiontoaSpreadevent”.Forexample,toattachtotheLoadeventofFpSpread1,thefunctionlookslikethefollowing:
C#public void FpSpread1_Load(object sender, EventArgs e){}Use MvcSpreadEventAttribute.In some cases, you may want to reserve a special name (like “FpSpread1_Load”). This can only be done by using the second method: MvcSpreadEventAttribute. The event handler can be shared globally or in a group.This example handles the Init event for all FpSpreads with the ID of FpSpread1 in any view, globally:[FarPoint.Mvc.Spread.MvcSpreadEvent("Init", "FpSpread1")]private void _init(object sender, EventArgs e){}
ThissolutionalsoprovidestheabilitytobindonefunctiontomanydifferentSpreads.ThefollowingexamplehandlestheIniteventforallFpSpreadswiththeIDofFpSpread1orFpSpread2inanyview,globally:
C#[FarPoint.Mvc.Spread.MvcSpreadEvent("Init", new string[] {"FpSpread1", "FpSpread2"})]private void _init(object sender, EventArgs e){}
Thesecondsolutionrequiresthatyouindicateimplicitlythatthefunction(withspecialname)shouldnotbeattachedautomatically:
C#[FarPoint.Mvc.Spread.NoMvcSpreadEvent]private void FpSpread1_Init(object sender, EventArgs e){}
ByattachingtotheInitorLoadevent,youcanattachtoothercustomSpreadeventssuchasTopRowChange,UpdateCommand,andsoon.
Additionalinformationaboutglobal,grouped,andungroupedevents:
AttachingeventswithagroupedMvcSpread:
IftheMvcSpreadisgrouped,useagroupname.Forexample:
C#// groupName is "GroupName" -> grouped
Spread for ASP.NET Developer’s Guide 31
Copyright © GrapeCity, Inc. All rights reserved.
public ActionResult Index([MvcSpread("GroupName", false)] FpSpread FpSpread1)// no groupName specified -> not groupedpublic ActionResult Index([MvcSpread(false)] FpSpread FpSpread1)
Thefollowingexamplesshowhowtohandlegroupevents:
C#// method Func3() is used to handle the Load event for all FpSpreads with ID of FpSpread1 in any view, inside the group called "GroupName"[MvcSpreadEvent("Load", "GroupName", "FpSpread1")]private void Func3(object sender, EventArgs e){}// method Func4() is used to handle the Load event for all FpSpreads with ID of FpSpread1, or FpSpread2 in any view, inside the group called "GroupName"[MvcSpreadEvent("Load", "GroupName", new string[] { "FpSpread1", "FpSpread2" })]private void Func4(object sender, EventArgs e){}
Anyfunctionnamed“[SpreadID]_[EventName]”istreatedasaglobaleventhandler.Theeventnameisindicatedby[EventName]andonlyanMvcSpreadwithanIDthesameas[SpreadID]canhandlethiseventhandler:
C#// this is a global handler for all FpSpread1 Load eventspublic void FpSpread1_Load(object sender, EventArgs e){}
Youcanexcludesomegroups(thatcontainFpSpreadcontrolsthatarenothandledbythismethod)fromglobaleventhandlers.Thesegroupscanbereferencedbytheirnames.Forexample:
C#// method abc() is used to handle the Load event for all FpSpread1 controls, excluding the ones that belong to GroupName1 or GroupName2[MvcSpreadEvent("Load", "FpSpread1")][MvcSpreadEventExclude("GroupName1", "GroupName2")]public void abc(object sender, EventArgs e){}// this method is used to handle the Load event for all FpSpread1 controls, excluding the ones that belong to GroupName1 or GroupName2[MvcSpreadEventExclude("GroupName1", "GroupName2")]public void FpSpread1_Load(object sender, EventArgs e){}
DeveloperdoesnotdeclareMvcSpreadinsidecontroller:
TheMvcSpreadisungroupediftheMvcSpreadisdeclaredinsidetheview.UsingagroupnamewithMvcSpreadintheviewmaycauseissuessincethereisacasewherethegroupnameinthecontrollerandthegroupnameintheviewaredifferent.IfMvcSpreadisnotdeclaredinthecontroller,theeventsareattachedtoglobaleventhandlersonly.
DeveloperdeclaresMvcSpreadinsidecontroller:
Iftheeventhandlersareglobal(groupnamenotdeclaredinMvcSpreadEventAttribute),theyattachtoallSpread
Spread for ASP.NET Developer’s Guide 32
Copyright © GrapeCity, Inc. All rights reserved.
controlswhethergroupedornot.
Iftheeventhandlersareprivate(groupnameexplicitlydeclaredinMvcSpreadEventAttribute),theyattachonlytoSpreadcontrolswiththesamegroupname.
Spreadcontrolswithoutagroupnameareattachedbyglobaleventhandlers.
Iftherearetwoeventhandlersforthesameevent,thefirstoneisprivateandthesecondoneisglobal.
ThecurrentSpreadlooksfortheglobaleventhandlerfirstwhenbindingevents.Iffound,bindingforthecurrenteventhappensfirst.Theprivateonewiththesamegroupnamehappensnext.
Note:UsingthecreateparametertonotifyMvcSpreadModelBindertocreateanewinstanceofMvcSpreadthefirsttimedoesnotaffectattachingevents.AneventhandlerisattachedtoMvcSpreadiftheeventIDlistcontainstheMvcSpreadID,regardlessofwhethertheeventhandlerisprivateorglobal.
7. PassMVCSpreadfromControllertoView:IfaninstanceofFpSpreadiscreatedbyamodel,itisappliedtotheviewautomatically.ThecodethatrendersFpSpreadwiththesameID,rendersthecurrentFpSpreadtotheclientbrowser:
C#public ActionResult Index([MvcSpread(true)] FpSpread FpSpread1){FpSpread1.ActiveSheetView.Rows.Count = 30;return View();}
IntheparameterlistIndex()actiontheFpSpread1isdeclaredspecificallyas[MvcSpread(true)]FpSpreadFpSpread1.Whenrunningthiscode,anewinstanceofFpSpreadiscreatedbyourModelBinder.TheActiveSheetView.Rows.Countissetto30,andthenthisinstanceisappliedtotheviewautomatically.TheFpSpreadcontrolwiththeIDof"FpSpread1"intheviewreceivesthesechanges.
Working with Microsoft ASP.NET MVC 3
YoucanuseSpreadforASP.NETinanMVC3project.MVCsupportinSpreadforASP.NETrequiresMicrosoftASP.NETMVC3,MicrosoftVisualStudio2015(orlater)with.NET4.5.2Framework(orlater),andtheMicrosoftADO.NETEntity4.1Framework.
TheRazorviewgenerallyuses@infrontofthenameandtheASPXviewgenerallyusesaroundthename.UsethefollowingstepstocreateaprojectwithSpread:
1. ReferenceFarPoint.Mvc.Spread.dllandFarPoint.Web.Spread.dllintheproject.2. AddtheSpreadinformationtotheLicenses.licxfile:
CodeFarPoint.Web.Spread.FpSpread, FarPoint.Web.Spread, Version=12.45.20182.0, Culture=neutral, PublicKeyToken=327c3516b1b18457FarPoint.Mvc.Spread.FpSpread, FarPoint.Mvc.Spread, Version=12.45.20182.0, Culture=neutral, PublicKeyToken=327c3516b1b18457
3. OpenGlobal.asax.cs,gototheApplication_Startfunctionandaddthefollowingregistrationcode:
C#protected void Application_Start(){FarPoint.Mvc.Spread.MvcSpreadVirtualPathProvider.AppInitialize();AreaRegistration.RegisterAllAreas();RegisterGlobalFilters(GlobalFilters.Filters);RegisterRoutes(RouteTable.Routes);
Spread for ASP.NET Developer’s Guide 33
Copyright © GrapeCity, Inc. All rights reserved.
//ModelBinders.Binders.DefaultBinder = ModelBinders.Binders[typeof(FarPoint.Mvc.Spread.FpSpread)];//ModelBinders.Binders.Add(typeof(FarPoint.Mvc.Spread.FpSpread), new FarPoint.Mvc.Spread.MvcSpreadModelBinder());}
4. DeclareSpreadwiththeMVCSpreadnamespace:
Code@using FarPoint.Mvc.Spread; or
ThisallowsyoutohaveanMVCSpreadwiththefollowingcode:
[email protected]("FpSpread1"); or
FpSpread1istheSpreadID.Itshouldbeunique.
5. ProvideaccesstoMVCSpreadfromtheController.Whentheuserpostsbackdatatotheserver,thedevelopercanaccessthedeclaredMVCSpreadasanargument(theSpreadhasfullViewStateandnewpostbackdata).Forexample:
C#public ActionResult Index([FarPoint.Mvc.Spread.MvcSpread]FarPoint.Mvc.Spread.FpSpread FpSpread1){ViewBag.Message = "Welcome to GrapeCity";if (FpSpread1 != null){var value = FpSpread1.ActiveSheetView.Cells[0, 0].Value;}return View();}
Ifyoudonotwanttouseanattribute,opentheGlobal.asax.csanduncommentoneofthelinesinstep3.
MakesuretheSpreadIDisthesameintheviewcodeandinthecontrolleractionparameter.
6. AttachSpreadevents:SpreadsupportsattachingeventsfromtheControlleronly.IfthereisanAJAXpostback,theSpreadeventswillnotbehandled.MvcSpreadallowsattaching3mainevents:Init,Load,andPreRender.Eventscanbegroupedorungrouped.Useoneofthefollowingmethodstohandletheevent:
Createafunctionwithaspecialname.
Thespecialnameindicatesthat“IwanttobindthisfunctiontoaSpreadevent”.Forexample,toattachtotheLoadeventofFpSpread1,thefunctionlookslikethefollowing:
C#public void FpSpread1_Load(object sender, EventArgs e){}Use MvcSpreadEventAttribute.
In some cases, you may want to reserve a special name (like “FpSpread1_Load”). This can only be done by using the second method: MvcSpreadEventAttribute. The event handler can be shared globally or in a group.This example handles the Init event for all FpSpreads with the ID of FpSpread1 in
Spread for ASP.NET Developer’s Guide 34
Copyright © GrapeCity, Inc. All rights reserved.
any view, globally:[FarPoint.Mvc.Spread.MvcSpreadEvent("Init", "FpSpread1")]private void _init(object sender, EventArgs e){}
ThissolutionalsoprovidestheabilitytobindonefunctiontomanydifferentSpreads.ThefollowingexamplehandlestheIniteventforallFpSpreadswiththeIDofFpSpread1orFpSpread2inanyview,globally:
C#[FarPoint.Mvc.Spread.MvcSpreadEvent("Init", new string[] {"FpSpread1", "FpSpread2"})]private void _init(object sender, EventArgs e){}
Thesecondsolutionrequiresthatyouindicateimplicitlythatthefunction(withspecialname)shouldnotbeattachedautomatically:
C#[FarPoint.Mvc.Spread.NoMvcSpreadEvent]private void FpSpread1_Init(object sender, EventArgs e){}
ByattachingtotheInitorLoadevent,youcanattachtoothercustomSpreadeventssuchasTopRowChange,UpdateCommand,andsoon.
Additionalinformationaboutglobal,grouped,andungroupedevents:
AttachingeventswithagroupedMvcSpread:
IftheMvcSpreadisgrouped,useagroupname.Forexample:
C#// groupName is "GroupName" -> groupedpublic ActionResult Index([MvcSpread("GroupName", false)] FpSpread FpSpread1)// no groupName specified -> not groupedpublic ActionResult Index([MvcSpread(false)] FpSpread FpSpread1)
Thefollowingexamplesshowhowtohandlegroupevents:
C#// method Func3() is used to handle the Load event for all FpSpreads with ID of FpSpread1 in any view, inside the group called "GroupName"[MvcSpreadEvent("Load", "GroupName", "FpSpread1")]private void Func3(object sender, EventArgs e){}// method Func4() is used to handle the Load event for all FpSpreads with ID of FpSpread1, or FpSpread2 in any view, inside the group called "GroupName"[MvcSpreadEvent("Load", "GroupName", new string[] { "FpSpread1", "FpSpread2" })]private void Func4(object sender, EventArgs e){}
Anyfunctionnamed“[SpreadID]_[EventName]”istreatedasaglobaleventhandler.Theeventnameis
Spread for ASP.NET Developer’s Guide 35
Copyright © GrapeCity, Inc. All rights reserved.
indicatedby[EventName]andonlyanMvcSpreadwithanIDthesameas[SpreadID]canhandlethiseventhandler:
C#// this is a global handler for all FpSpread1 Load eventspublic void FpSpread1_Load(object sender, EventArgs e){}
Youcanexcludesomegroups(thatcontainFpSpreadcontrolsthatarenothandledbythismethod)fromglobaleventhandlers.Thesegroupscanbereferencedbytheirnames.Forexample:
C#// method abc() is used to handle the Load event for all FpSpread1 controls, excluding the ones that belong to GroupName1 or GroupName2[MvcSpreadEvent("Load", "FpSpread1")][MvcSpreadEventExclude("GroupName1", "GroupName2")]public void abc(object sender, EventArgs e){}// this method is used to handle the Load event for all FpSpread1 controls, excluding the ones that belong to GroupName1 or GroupName2[MvcSpreadEventExclude("GroupName1", "GroupName2")]public void FpSpread1_Load(object sender, EventArgs e){}
DeveloperdoesnotdeclareMvcSpreadinsidecontroller:
TheMvcSpreadisungroupediftheMvcSpreadisdeclaredinsidetheview.UsingagroupnamewithMvcSpreadintheviewmaycauseissuessincethereisacasewherethegroupnameinthecontrollerandthegroupnameintheviewaredifferent.IfMvcSpreadisnotdeclaredinthecontroller,theeventsareattachedtoglobaleventhandlersonly.
DeveloperdeclaresMvcSpreadinsidecontroller:
Iftheeventhandlersareglobal(groupnamenotdeclaredinMvcSpreadEventAttribute),theyattachtoallSpreadcontrolswhethergroupedornot.
Iftheeventhandlersareprivate(groupnameexplicitlydeclaredinMvcSpreadEventAttribute),theyattachonlytoSpreadcontrolswiththesamegroupname.
Spreadcontrolswithoutagroupnameareattachedbyglobaleventhandlers.
Iftherearetwoeventhandlersforthesameevent,thefirstoneisprivateandthesecondoneisglobal.
ThecurrentSpreadlooksfortheglobaleventhandlerfirstwhenbindingevents.Iffound,bindingforthecurrenteventhappensfirst.Theprivateonewiththesamegroupnamehappensnext.
Note:UsingthecreateparametertonotifyMvcSpreadModelBindertocreateanewinstanceofMvcSpreadthefirsttimedoesnotaffectattachingevents.AneventhandlerisattachedtoMvcSpreadiftheeventIDlistcontainstheMvcSpreadID,regardlessofwhethertheeventhandlerisprivateorglobal.
7. PassMVCSpreadfromControllertoView:IfaninstanceofFpSpreadiscreatedbyamodel,itisappliedtotheviewautomatically.ThecodethatrendersFpSpreadwiththesameID,rendersthecurrentFpSpreadtotheclientbrowser:
C#public ActionResult Index([MvcSpread(true)] FpSpread FpSpread1){
Spread for ASP.NET Developer’s Guide 36
Copyright © GrapeCity, Inc. All rights reserved.
FpSpread1.ActiveSheetView.Rows.Count = 30;return View();}
IntheparameterlistIndex()actiontheFpSpread1isdeclaredspecificallyas[MvcSpread(true)]FpSpreadFpSpread1.Whenrunningthiscode,anewinstanceofFpSpreadiscreatedbyourModelBinder.TheActiveSheetView.Rows.Countissetto30,andthenthisinstanceisappliedtotheviewautomatically.TheFpSpreadcontrolwiththeIDof"FpSpread1"intheviewreceivesthesechanges.
Copying Shared Assemblies to Local Folder
FarPoint.CalcEngine.dll,FarPoint.Excel.dll,andFarPoint.PDF.dllareinstalledtotheGACbydefaultwheninstallingSpreadforASP.NET.
Youcanusethesmarttagverb"CopySharedAssembliesLocal"tocopyFarPoint.CalcEngine.dll,FarPoint.Excel.dll,andFarPoint.PDF.dlltothelocalbinfolderonthewebsitewhendeploying.
Thesmarttagverbappearsasfollows:
Thefollowingentryisaddedtotheweb.configfile:
Code
Spread for ASP.NET Developer’s Guide 37
Copyright © GrapeCity, Inc. All rights reserved.
Working with Strongly Typed Data Controls
Strong-typeddatacontrolssupportbindingusinganewsyntaxthatisavailableinASP.NET4.5.Thisallowsyoutodirectlyreferencepropertiesonthedatasourceobjectinthemarkup.Forexample,inordertobinddatatoPreviewRowTemplateandRowEditTemplatebeforeASP.NET4.5,codetobindtotheFirstNamepropertyonyourdatasourceitemlookedlikethis:
Code
First Name is: First Name is:
WithASP.NET4.5youcanusecodelikethefollowing:
Code
First Name is: First Name is:
UsingcodeinyourmarkupthiswayallowsyoutogettheaddedbenefitsofIntelliSenselistingofyourdatasourceobject'spropertiesandvalidationofthepropertynameatdesigntime.
Getting More Practice
Herearethetasksforgettingmorepracticewiththeproduct.
UnderstandingProceduresintheDocumentationGettingTechnicalSupport(on-linedocumentation)
Understanding Procedures in the Documentation
ThereareseveraldifferentwaystoaccomplishthesameresultwhencreatingaWindowsFormspagewithaSpread
Spread for ASP.NET Developer’s Guide 38
Copyright © GrapeCity, Inc. All rights reserved.
component.Inthisdocumentation,theproceduresoftendescribemorethanoneway,includingusingthePropertieswindowinVisualStudio.NET,writingcodeincludingusingshortcutobjects,andusingtheSpreadDesigner.TheSpreadDesignersetspropertiesandcallsmethodsforthecomponent,includingpropertiesnotavailableatdesigntimethroughVisualStudio.NET,withoutproducinganyeditablecode.
Eachofthesehasitsadvantagesanddisadvantages.Usingshortcutobjectsistheshortest,quickestwayofaddingcodeusingdotnotationandsettingapropertyofashortcutobject.Usingcodewithoutusingshortcutobjectsgenerallymeansdeclaringobjectsandsettingpropertiesforthem.Typically,foreitherwayofwritingcode,thereisanexamplegiven.
DocumentationProvided
TheSpreadforASP.NETdocumentationprovidesintroductoryinformationabouttheproduct,conceptualinformation,how-totopics,andadetailedassemblyandformulafunctionreferenceinahelpfileandinPDFfiles.AdditionalinformationisprovidedintheReadmefile.
AccessingtheHelp
YoucanaccessthehelpthroughF1supportprovidedinVisualStudio.NET.Whilethecomponentoroneofitsmembershasfocus,pressF1todisplaytheSpreadforASP.NEThelp.
Youcanalsoaccessthehelpfileinastand-alonewindowbychoosingStart‑>Programs‑>GrapeCity‑>...->Product->Help.
DocumentationConventions
TheformatofthehelpissimilartothehelpprovidedforVisualStudio.NET.Referencematerialformembersprovidesmultiplelanguagereferenceforthemember.Youcanchangewhichlanguage'ssyntaxisdisplayedbyclickingtheLanguagesbuttoninthetitleofthetopic.
ListofHow-To's
Hereisalistofthecommonlyusedprocedurescoveredinthedocumentation:
AddingaNotetoaCellAddingaRoworColumnAddingaSheetApplyingaSkintoaSheetCustomizingtheDimensionsoftheComponentCustomizingtheNumberofRowsorColumnsCreatingaCustomFunctionCreatingaCustomNameCreatingaSkinforSheetsCreatingAlternatingRowsCustomizingtheOutlineoftheComponentCustomizingtheSheetCornerDisplayingGridLinesontheSheetDisplayingScrollBarsLockingaCellNestingFunctionsinaFormulaOpeningExistingFilesPlacingaFormulainCellsRemovingaRoworColumnRemovingaSheet
Spread for ASP.NET Developer’s Guide 39
Copyright © GrapeCity, Inc. All rights reserved.
SavingDatatoaFileSettingtheBackgroundColoroftheSheetSettingtheRowHeightorColumnWidthSpecifyingaCellReferenceStyleinaFormulaUsingaCircularReferenceinaFormulaWorkingwithEditableCellTypesWorkingwithGraphicalCellTypes
Getting Technical Support
Ifyouhaveatechnicalquestionaboutthisproduct,consultthefollowingsources:
Helpandotherdocumentationfilesinstalledwiththeproduct.Forinstructionsforaccessingthehelpandotherdocumentationfiles,seeUnderstandingProceduresintheDocumentation.
Productforumathttps://www.grapecity.com/en/forums#spread
Ifyoucannotfindtheanswerusingthesesources,pleasecontactTechnicalSupportusingoneofthesemethods:
Website: https://www.grapecity.com/en/forums
E-mail: [email protected]
Fax: (412)681-4384
Phone: (412)681-4738
TechnicalSupportisavailablebetweenthehoursof9:00a.m.and5:30p.m.Easterntime,MondaythroughFriday.
Understanding the Spread Wizard
YoucanusetheSpreadWizardtoquicklyandeasilybinddata,setupthecolumnstructure,andcustomizetheappearanceofaspreadsheet.Seethefollowingtopicsformoreinformation:
StartingtheSpreadWizardUsingtheSpreadWizard
Starting the Spread Wizard
YoucanlaunchtheSpreadWizardfromtheSmartTagsontheFpSpreadcomponentontheWebForminVisualStudioasshowninthisfigure.
Spread for ASP.NET Developer’s Guide 40
Copyright © GrapeCity, Inc. All rights reserved.
https://www.grapecity.com/en/forums#spreadhttps://www.grapecity.com/en/forumsmailto:[email protected]
Using the Spread Wizard
YoucanusetheSpreadWizardtobindtoadatasource,setcolumnproperties,settheoperationmode,specifytitles,selectasheetskin,andmanyothers.
Selectthemenuoptionofthefeatureyouwishtocustomize,locatedontheleftsideofthedialog.SelectthevariousoptionsforthatfeatureandthenclickNexttogotothenextstep.Whenyouarefinished,clickFinish.
Spread for ASP.NET Developer’s Guide 41
Copyright © GrapeCity, Inc. All rights reserved.
Tutorial: Creating a Checkbook Register
ThefollowingtutorialwalksyouthroughcreatinganASP.NETprojectinVisualStudio.NETusingtheSpreadforASP.NETcomponent.Bycreatingacheckbookregister,youwilllearnhowtomodifytheappearanceofaspreadsheet,workwithcelltypes,andaddsomeformulasforperformingcalculations.Inthistutorial,themajorstepsare
AddingSpreadtotheCheckbookProjectAddingSpreadtoaProjectSettingUptheRowsandColumnsoftheRegisterSettingtheCellTypesoftheRegisterAddingFormulastoCalculateBalances
Adding Spread to the Checkbook Project
StartanewVisualStudio.NETproject.Nametheprojectcheckbook.Nametheformintheprojectregister.aspx.AddtheFpSpreadcomponenttoyourproject,andthenplacethecomponentontheform.
IfyoudonotknowhowtoaddtheFpSpreadcomponenttotheproject,completethestepsinAddingSpreadtoaProject.
Spread for ASP.NET Developer’s Guide 42
Copyright © GrapeCity, Inc. All rights reserved.
Adding Spread to a Project
ThisandallthetutorialsassumethatyouhaveVisualStudio.NETinstalledonyoursystem,andInternetInformationServices(IIS)installedandrunningonyoursystemasthelocalhostserver.
PerformthestepsinthistutorialtosetupanASP.NETVisualStudio.NETprojectthatcontainstheSpreadforASP.NETcomponent.
1. StartVisualStudio.NET.2. FromtheFilemenu,chooseNew,Project.3. IntheNewProjectdialog,4. IntheProjectTypeslist,chooseeitherVisualBasicProjectsorVisualC#Projectsdependingonthe
languageyouareusing.5. IntheTemplateslist,chooseASP.NETWebApplication.6. IntheLocationbox,leavethelocationpathashttp://localhost/unlessyouprefertosavethisprojecttoanother
server.ChangetheprojectnamefromWebApplication1tothenameofyourchoice.7. ClickOK.8. IntheSolutionExplorer,right-clickontheformname,WebForm1.aspx.ChooseRenamefromthepop-up
menu,thentypethenewformnameyoupreferforthenewformname.9. IfyourprojectdoesnotdisplaytheSolutionExplorer,fromtheViewmenu,chooseSolutionExplorer.10. IftheToolboxisnotdisplayed,fromtheViewmenuchooseToolbox.11. IntheToolbox,lookintheWebFormscategory(orinothercategoriesifyouhaveinstalledSpreadandplaced
thetoolboxiconinadifferentcategory).IftheSpreadcomponentisnotintheToolbox,performsteps12through14.Otherwise,proceedtostep15.
12. Right-clickintheToolbox,andfromthepop-upmenuchooseCustomizeToolbox.13. IntheCustomizeToolboxdialog,clickthe.NETFrameworkComponentstab.14. Inthe.NETFrameworkComponentstab,
a. ClickBrowse.b. BrowsetotheinstallationpathfortheSpreadforASP.NETcomponent.Oncethere,select
FarPoint.Web.Spread.dllandclickOpen.c. TheFpSpreadcomponentisnowdisplayedinthelistofcomponents.ClickOK.
15. IntheToolboxunderWebFormsoranothertab,selecttheFpSpreadcomponent.16. Onyourform,drawanFpSpreadcomponent.17. Saveyourproject.
Yourprojectshouldnowlooksimilartothefollowingimage:
Spread for ASP.NET Developer’s Guide 43
Copyright © GrapeCity, Inc. All rights reserved.
YouhaveaddedtheSpreadcomponenttotheproject.
Setting Up the Rows and Columns of the Register
TheSpreadcomponentonyourformalreadyhasasheet,readyforyoutoconfigure.Inthisstep,youaregoingtosetupthecolumnsandcellsinthesheettoresembleacheckbookregister.
1. Double-clickontheforminyourprojecttoopenthecodewindow.2. Selectthelineofcode
C#// Put user code to initialize the page here.
VB'Put user code to initialize the page here.
andtypethefollowingcodetoreplaceit:
C#if (this.IsPostBack) return;// Set up component and rows and columns in sheet.FpSpread1.Height = Unit.Pixel(300);FpSpread1.Width = Unit.Pixel(763);FpSpread1.Sheets[0].ColumnCount = 8;
Spread for ASP.NET Developer’s Guide 44
Copyright © GrapeCity, Inc. All rights reserved.
FpSpread1.Sheets[0].RowCount = 100;
VBIf (IsPostBack) ThenReturnEnd If' Set up component and rows and columns in sheet.FpSpread1.Height = Unit.Pixel(300)FpSpread1.Width = Unit.Pixel(763)FpSpread1.Sheets(0).ColumnCount = 8FpSpread1.Sheets(0).RowCount = 100
Thiscodesetsupthecomponenttobe300pixelshighand763pixelswide,andthesheettohave8columnsand100rows.
3. Nowweneedtosetupthecolumnstohavecustomheadings.AddthefollowingcodebelowthecodeyouaddedinStep2:
C#// Add text to column heading.FpSpread1.ColumnHeader.Cells[0, 0].Text = "Check #";FpSpread1.ColumnHeader.Cells[0, 1].Text = "Date";FpSpread1.ColumnHeader.Cells[0, 2].Text = "Description";FpSpread1.ColumnHeader.Cells[0, 3].Text = "Tax?";FpSpread1.ColumnHeader.Cells[0, 4].Text = "Cleared?";FpSpread1.ColumnHeader.Cells[0, 5].Text = "Debit";FpSpread1.ColumnHeader.Cells[0, 6].Text = "Credit";FpSpread1.ColumnHeader.Cells[0, 7].Text = "Balance";
VB' Add text to column heading.FpSpread1.ColumnHeader.Cells(0, 0).Text = "Check #"FpSpread1.ColumnHeader.Cells(0, 1).Text = "Date"FpSpread1.ColumnHeader.Cells(0, 2).Text = "Description"FpSpread1.ColumnHeader.Cells(0, 3).Text = "Tax?"FpSpread1.ColumnHeader.Cells(0, 4).Text = "Cleared?"FpSpread1.ColumnHeader.Cells(0, 5).Text = "Debit"FpSpread1.ColumnHeader.Cells(0, 6).Text = "Credit"FpSpread1.ColumnHeader.Cells(0, 7).Text = "Balance"
4. Nowsetupthecolumnwidthstoproperlydisplayourheadingsandthedatayouwilladd.AddthefollowingcodebelowthecodeyouaddedinStep3:
C#// Set column widths.FpSpread1.Sheets[0].Columns[0].Width = 50;FpSpread1.Sheets[0].Columns[1].Width = 50;FpSpread1.Sheets[0].Columns[2].Width = 200;FpSpread1.Sheets[0].Columns[3].Width = 40;FpSpread1.Sheets[0].Columns[4].Width = 65;FpSpread1.Sheets[0].Columns[5].Width = 100;FpSpread1.Sheets[0].Columns[6].Width = 100;FpSpread1.Sheets[0].Columns[7].Width = 125;
VB
Spread for ASP.NET Developer’s Guide 45
Copyright © GrapeCity, Inc. All rights reserved.
' Set column widths.FpSpread1.Sheets(0).Columns(0).Width = 50FpSpread1.Sheets(0).Columns(1).Width = 50FpSpread1.Sheets(0).Columns(2).Width = 200FpSpread1.Sheets(0).Columns(3).Width = 40FpSpread1.Sheets(0).Columns(4).Width = 65FpSpread1.Sheets(0).Columns(5).Width = 100FpSpread1.Sheets(0).Columns(6).Width = 100FpSpread1.Sheets(0).Columns(7).Width = 125
5. Saveyourproject,thenfromtheDebugmenuchooseStarttorunyourproject.
YourASP.NETpageshouldlooksimilartothefollowingpicture.
Setting the Cell Types of the Register
Tosetcelltypes,foreachcustomcelltype,youhavetocreateacelltypeobject,setthepropertiesforit,andthenassignthatobjecttotheCellType('CellTypeProperty'intheon-linedocumentation)propertyforacellorrangeofcells.
1. SetthecelltypefortheCheck#columnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:
C#// Create Check # column of integer cells.FarPoint.Web.Spread.IntegerCellType objIntCell = new FarPoint.Web.Spread.IntegerCellType();FpSpread1.Sheets[0].Columns[0].CellType = objIntCell;
VB' Create Check # column of integer cells.Dim objIntCell As New FarPoint.Web.Spread.IntegerCellType()FpSpread1.Sheets(0).Columns(0).CellType = objIntCell
2. SetthecelltypefortheDatecolumnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:
C#// Create Date column of date-time cells.
Spread for ASP.NET Developer’s Guide 46
Copyright © GrapeCity, Inc. All rights reserved.
FarPoint.Web.Spread.DateTimeCellType objDateCell = new FarPoint.Web.Spread.DateTimeCellType();objDateCell.FormatString = "M/dd/yyyy";FpSpread1.Sheets[0].Columns[1].CellType = objDateCell;
VB' Create Date column of date-time cells.Dim objDateCell As New FarPoint.Web.Spread.DateTimeCellType()objDateCell.FormatString ="M/dd/yyyy"FpSpread1.Sheets(0).Columns(1).CellType = objDateCell
3. SetthecelltypefortheDescriptioncolumnbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:
C#// Create Description column of general cells.FarPoint.Web.Spread.GeneralCellType objGenCell = new FarPoint.Web.Spread.GeneralCellType();FpSpread1.Sheets[0].Columns[2].CellType = objGenCell;
VB' Create Description column of general cells.Dim objGenCell As New FarPoint.Web.Spread.GeneralCellType()FpSpread1.Sheets(0).Columns(2).CellType = objGenCell
4. SetthecelltypefortheTax?andCleared?columnsbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:
C#/// Create Tax? and Cleared? columns of check box cells.FarPoint.Web.Spread.CheckBoxCellType objCheckCell = new FarPoint.Web.Spread.CheckBoxCellType();FpSpread1.Sheets[0].Columns[3].CellType = objCheckCell;FpSpread1.Sheets[0].Columns[4].CellType = objCheckCell;
VB' Create Tax? and Cleared? columns of check box cells.Dim objCheckCell As New FarPoint.Web.Spread.CheckBoxCellType()FpSpread1.Sheets(0).Columns(3).CellType = objCheckCellFpSpread1.Sheets(0).Columns(4).CellType = objCheckCell
5. SetthecelltypefortheDebit,Credit,andBalancecolumnsbyaddingthefollowingcodebelowthecodeyouhavealreadyadded:
C#// Create the Debit, Credit, and Balance columns of currency cells.FarPoint.Web.Spread.CurrencyCellType objCurrCell = new FarPoint.Web.Spread.CurrencyCellType();FpSpread1.Sheets[0].Columns[5].CellType = objCurrCell;FpSpread1.Sheets[0].Columns[6].CellType = objCurrCell;FpSpread1.Sheets[0].Columns[7].CellType = objCurrCell;
VB' Create the Debit, Credit, and Balance columns of currency cells.Dim objCurrCell As New FarPoint.Web.Spread.CurrencyCellType()
Spread for ASP.NET Developer’s Guide 47
Copyright © GrapeCity, Inc. All rights reserved.
FpSpread1.Sheets(0).Columns(5).CellType = objCurrCellFpSpread1.Sheets(0).Columns(6).CellType = objCurrCellFpSpread1.Sheets(0).Columns(7).CellType = objCurrCell
6. Saveyourproject,thenfromtheDebugmenuchooseStarttorunyourproject.
YourASP.NETpageshouldlooksimilartothefollowingpicture.
Adding Formulas to Calculate Balances
Yourcheckbookregisterisnowsetuptolooklikeacheckbookregister;however,itdoesnotbalancethecurrencyfiguresyouenterintheregister.Thisstepsetsuptheformulaforbalancingthefigures.
1. Belowthecodeyouhavealreadyadded,addthefollowingcode:
C#// Set formula for calculating balance.FpSpread1.Sheets[0].ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1;FpSpread1.Sheets[0].Cells[0, 7].Formula = "RC[-1]-RC[-2]";for (int i = 1; i < 99; i++){ FpSpread1.Sheets[0].Cells[i, 7].Formula = "R[-1]C-RC[-2]+RC[-1]";}
VB' Set formula for calculating balance.FpSpread1.Sheets(0).ReferenceStyle = FarPoint.Web.Spread.Model.ReferenceStyle.R1C1FpSpread1.Sheets(0).Cells(0, 7).Formula = "RC[-1]-RC[-2]"Dim i As IntegerFor i = 1 To 99 FpSpread1.Sheets(0).Cells(i, 7).Formula = "R[-1]C-RC[-2]+RC[-1]"Next
2. Saveyourproject,thenfromtheDebugmenuchooseStarttorunyourproject.
YourASP.NETpageshouldlooksimilartothefollowingpicture.Typedataintoyourcheckbookregistertotestitandsee
Spread for ASP.NET Developer’s Guide 48
Copyright © GrapeCity, Inc. All rights reserved.
howitoperates.ClickonthecheckmarkicontosavethechangesorsettheClientAutoCalculationpropertyforthecontroltoTrue.
Yourcheckbookregisteriscomplete!Youhavecompletedthistutorial.
Spread for ASP.NET Developer’s Guide 49
Copyright © GrapeCity, Inc. All rights reserved.
Understanding the Product
SpreadforASP.NETprovidesacompletelynew,object-orientedspreadsheetcomponentforuseintheMicrosoft.NETframework.Thefollowingtopicsprovideanintroductiontothisuniqueandpowerfulproductandexplainsomeoftheunderlyingconcepts.
ProductOverviewFeaturesOverviewConceptsOverviewNamespacesOverview
Product Overview
SpreadforASP.NETisacomprehensivespreadsheetcomponentforWebapplicationsthatcombinesgridcapabilities,spreadsheetfunctionality,andincludestheabilitytobindtodatasources.Asinglecomponentcancontainmanysheets,columns,androws.Cross-sheetreferencingallowscalculationstomakeuseofdataandformulasonavarietyofsheets.SpreadforASP.NETusesdotnotationforobject-orientedcodingin.NET.
ASpreadcomponentmaybedroppedonaWebFormandcustomizedforarangeofapplications.Youcancontroltheappearanceandtheuserinteractioninavarietyofways.Withabuilt-inDesigner,youcanquicklycreateaprototypeorcustomizeyourfinisheddesign.WithmostoftheSpread’sappearanceandfunctionalitybasedonunderlyingmodels,theadvanceddeveloperhascompletecontroloverthecomponent.
ThecomponentresidesontheserverandgeneratesHTMLpageswhenitisaccessedbyendusersontheclientside.TheamountofinteractivityoftheWebpagedependsonthelevelofbrowserusedontheclientside.TheviewoftheHTMLpagesgeneratedbytheSpreadcomponentdependsonthebrowserbeingusedtoviewthepage.Broadly,anuplevelbrowserisonethatcansupportclient-sideJavaScript,HTMLversion4.0,theMicrosoftDocumentObjectModel,andcascadingstylesheets(CSS).Foramoredetaileddefinitionofuplevelanddownlevelbrowserandforalistofcapabilitiesofthosebrowsers,refertothebrowsercapabilityinformationintheMicrosoft.NETdocumentation.ThecomponentalsodownloadssomeHTMLcomponent(HTC)filestotheclientside.
Importandexportcapabilitiesprovideanothersourceofflexibilitywhendevelopingandexchangingdesigns.SpreadforASP.NETcanhandledatafromcomma-delimitedtextfilesaswellasmultiplespreadsheetsfromMicrosoftExcelfiles.
ThefollowingfigureprovidesaconceptualoverviewofSpreadforASP.NET.
Spread for ASP.NET Developer’s Guide 50
Copyright © GrapeCity, Inc. All rights reserved.
InSpread,youcanusethedefaultmodelsorextendthemthroughinheritance.RefertoUnderlyingModelsformoreinformationonmodels.Stylesandnamedstylesprovidewaystosavecustomizedappearancesthatcanbeappliedtoothersheets.
TheSpreadcomponentcontainstoolbarsandnavigationaids,andacollectionofsheetsthatcontainrow,column,cell,andheaderobjects.ThecontentsofthecomponentmaybesavedasaBIFF8orXLSXfilecompatiblewithMicrosoftExceloratextfileorasaSpreadXMLfile.Formoreinformationonexportingto(andimportingfrom)afile,refertotheSpreadforASP.NETImportandExportReference.
Foralistofmanyofthefeatures,seeFeaturesOverview.
Features Overview
SpreadforASP.NETintroducessomepowerfulfeatures,asdescribedinthefollowingtopics.Eachtopicreferstoothertopicsinthedocumentationthatprovidemoreinformation.
AJAXSupportASP.NETAJAXExtenders
Spread for ASP.NET Developer’s Guide 51
Copyright © GrapeCity, Inc. All rights reserved.
Built-InFunctionsCellTypesChartControlClient-SideScriptingConditionalFormattingContextMenuCornerCustomizationCustomizedAppearance(Skins)DataBindingFloatingImages(on-linedocumentation)FootersforColumnsorGroupsFormulaExtenderControl(on-linedocumentation)FrozenRowsandColumnsGoalSeekingGroupingHeaderswithMultipleColumnsandRowsHierarchicalDisplayImportandExportCapabilitiesLoadonDemandMultiple-LineColumnsMultipleSheetsPDFSupportPrintingRowFilteringRowPreviewRowTemplateEditorSearchingFeaturesSortingCapabilitiesSpannableCellsSparklinesSpreadDesignerSpreadWizardThemeRollerTitleandSubtitleTouchSupportValidationControls
AJAX Support
YoucanallowsupportforAJAX(AsynchronousJavaScriptandXML)tomakeyourapplicationsmoreresponsiveontheclientside.
Formoreinformation,refertoEnablingAJAXSupport.
ASP.NET AJAX Extenders
YoucanusethemanycelltypesintheFarPoint.Web.Spread.ExtenderassemblytoprovidecontrolsthatareavailableasASP.NETAJAXextenders.
Spread for ASP.NET Developer’s Guide 52
Copyright © GrapeCity, Inc. All rights reserved.
Formoreinformation,refertoUsingASP.NETAJAXExtenders.
Built-In Functions
Youcanusebuilt-infunctionsandoperatorstodevelopformulasandperformcalculations.Addcalculationsquicklytoyourapplicationsbyusinganyofover300pre-definedalgorithmsoraddyourowncustomfunctions.
Formoreinformation,refertoManagingFormulasandtotheFormulaReference.
Cell Types
Thereareseveraldifferenttypesofcellsthatcanbesetinasheettocustomizehowtheuserinteractswiththeinformationinthatcell.Youcanspecifythecelltypeforindividualcells,columns,rows,arangeofcells,oranentiresheet.Foreachcelltypetherearepropertiesofacellthatcanbeset.Ingeneral,workingwithcelltypesincludesdefiningthecelltype,settingtheproperties,andapplyingthatcelltypetocells.
Thefollowingimagedisplaysmanyofthecelltypesthatareavailable.Youcanalsocreatemulti-columncombo,tagcloud,andajaxextendercells.
Foracompletelistofcelltypes,refertoCustomizingwithCellTypes.
HeaderCells
Whileyoucanassignacelltypetothecellsintherowheaderorcolumnheader,thecelltypeisonlyusedforpaintingpurposes.
Details
InSpread,acellhasbothaneditor,whichdetermineshowtheuserinteractswiththevalueinthecell,aformatter,whichdetermineshowthevalueisdisplayed,andarendererwhichdoesthepaintingofthecell.TheeditorisanactualcontrolinstancethatSpreadcreatesandplacesinthelocationofthecellwhenyougointoeditmode.Theformatterdecideshowthedisplayedtextappears.Therendererissimplycodethatpaintsthatcontrolinsidethecellrectangle
Spread for ASP.NET Developer’s Guide 53
Copyright © GrapeCity, Inc. All rights reserved.
https://www.grapecity.com/spreadnet/docs/v13/online-formula/FormulaCover.html
whentheeditorisnotthere.
Formoredetailedinformationontheseobjects,refertotheindividualinterfacesintheAssemblyReference(on-linedocumentation).Formoregeneralinformationaboutcelltypesandapplyingthemtocells,columns,rows,orwholesheets,refertoCustomizingwithCellTypes.
Chart Control
YoucanaddachartcontroltotheSpreadcontrolorusethechartcontrolstandalone.Thechartcontrolsupportsmanytypesofchartsaswellas2Dor3Dviews.
Formoreinformation,refertoWorkingwiththeChartControl.
Client-Side Scripting
Withscriptingyoucanrunsmallprograms,orscripts,inyourWebpagesontheclientafterthepagesaredownloadedfromtheserver.Client-sidescriptingallowstheusertointeractwiththepageontheclientwithoutthepagehavingtobereloadedfromtheserver.Scriptscanbewritteninanyscriptinglanguagesupportedbythebrowserontheclient,suchasVBScriptorJavaScript.MostoftenscriptsarewritteninJavaScript(alsoreferredtoasECMAScript).
SpreadforASP.NETgivesyouclient-sidescriptingcapabilitiestoenhancethepowerofyourWebForms.Inaddition,youcanalsocreateyourownHTCfilesforspecificpurposes.
SpreadforASP.NETclientsidefeaturesareenabledforIE5.5andabove.Forotherbrowsers,theremaybenoclientsidescriptingsupportoritmaybelimited.
Formoreinformation,refertotheSpreadforASP.NETClient-SideScriptingReference(on-linedocumentation).
Conditional Formatting
Youcansetupconditionalformatswithincellsthatdeterminetheformattingofthecellbasedontheoutcomeofaconditionaloperationorrule.
Formoreinformation,refertoUsingConditionalFormattinginCells.
Context Menu
YoucancreateaSpreadcontextmenuthatisdisplayedwhenright-clickingontheSpreadcontrol.Formoreinformation,seeAddingaContextMenu.
Corner Customization
Youcancustomizethesheetcornerwithtext,colors,andvariousstylesettings.
Spread for ASP.NET Developer’s Guide 54
Copyright © GrapeCity, Inc. All rights reserved.
Formoreinformation,refertoCustomizingtheSheetCorner.
Customized Appearance (Skins)
EasilyandquicklyconfiguretheappearanceofSpreadusingpredefinedskinsorcreateandsaveyourowncustomskins.Customskinscanbesharedwitheveryoneinyourdevelopmentteam,allowingaconsistentlookofthecomponentacrossapplications.
Formoreinformationaboutskins,refertoApplyingaSkintoaSheetandCreatingaSkinforSheets.
Data Binding
Youcanbindthespreadsheettoadatasettodisplayandallowyouruserstoeditinformation.Spreadcanautomaticallyupdatethedatasetwiththechanges.Youcanalsobindarangeofcellstoadatasource.
Formoreinformationaboutdatabinding,refertoManagingDataBinding.
Footers for Columns or Groups
Youcandisplayafooteratthebottomofthesheetthatallowsyoutoenterformulasorinstructionswithafootercellforeachcolumn.Thisfeaturealsoworkswiththegroupingfeature.
Formoreinformation,refertoDisplayingaFooterforColumnsorGroups.
Frozen Rows and Columns
Youcanfreezecolumnsandrows(keepthemnon-scrollable)andkeepthemdisplayedregardlessofwheretheusernavigatesinthesheet.
Formoreinformation,refertoFreezingRowsandColumns.
Goal Seeking
Youcanusegoalseekingcapabilitytoiteratetowardadesiredformularesult.Usethisifyouknowtheresultofaformulabutnottheinputvaluerequiredtoobtaintheresult.
Formoreinformation,refertoFindingaValuewithGoalSeeking.
Grouping
Youcansetupthespreadsheettogrouprowsofdata.Thisisusefulfordisplayinglargeamountsofdatainorganizedgroups.
Formoreinformation,refertoCustomizingGroupingofRowsofUserData.
Headers with Multiple Columns and Rows
Youcanhavemultiplecolumnheadersandrowheaders.Youcanalsospanheadercells.Useheaderswithmultiplecolumnsorrowstoorganizeyourcolumnandrowdata.
Formoreinformation,refertoCustomizingtheAppearanceofHeaders.
Spread for ASP.NET Developer’s Guide 55
Copyright © GrapeCity, Inc. All rights reserved.
Hierarchical Display
Youcancreateasheetwithinarowtodisplayrelationaldatahierarchically,withparentrowsandchildviewsofrelateddata.
Formoreinformationabouthierarchicaldisplayofdata,refertoDisplayingDataasaHierarchy.
Import and Export Capabilities
YoucanimportdatafromandexportdataandformattingtoMicrosoftExcel,bothindividualspreadsheetsandentireworkbooks.Youcanimportandexportentirespreadsheet(s)withdataandformattingtoandfromXML.
Formoreinformationaboutopeningandsavingfiles,refertoManagingFileOperations.
Formoreinformationaboutwhathappensduringimportingorexporting,refertotheSpreadforASP.NETImportandExportReference(on-linedocumentation).
Load on Demand
YoucanallowtheWebpagetoloadondemand.AstheuserscrollsfurtherdownthespreadsheettheSpreadcomponentontheclientloadsanotherpageofrowsfromtheserverasneeded.
FpSpread.AllowLoadOnDemandSheetView.AllowLoadOnDemand
Formoreinformationaboutthisfeature,refertoAllowingLoadonDemand.
Multiple-Line Columns
Foramorecompressedformatofdisplayinginformation,youmaywanttodisplaycolumnswithmultiplelinesofinformation.
Formoreinformationonmultiple-linecolumns,refertoCreatingRowTemplates(Multiple-LineColumns).
Multiple Sheets
Spreadsupportsmultiplesheetsinasinglecomponenteachuniquelynamed.Usemultiplesheetstocategorizeyourinformation,similartousingworksheetsinMicrosoftExcel.
Sheetscanhavemultiplerowsandcolumns.Youcandefinestylesforsheetsandapplythosestylesacrossmultiplesheets.
Formoreinformationaboutsheets,refertoWorkingwithMultipleSheets.
PDF Support
YoucanallowtheusertosavethespreadsheettoaPDF(PortableDocumentFormat)file.
Formoreinformation,refertoSavingtoaPDFFile.
Printing
Youcanallowtheusertoprint.Youcanalsoaddheadersandfooterstotheprintedpagesandcustomizetheprintedpage.
Spread for ASP.NET Developer’s Guide 56
Copyright © GrapeCity, Inc. All rights reserved.
Formoreinformation,refertoManagingPrinting.
Row Filtering
Youcanallowrowfilteringbyhidingorchangingthecolorofthefilteredrows.Youcanalsouseafilterbar,simplefiltering,orenhancedfiltering.
Formoreinformation,refertoManagingFilteringofRowsofUserData.
Row Preview
Youcanaddapreviewrowthatcontainsextrainformationaboutarow.
Formoreinformation,refertoSettingupPreviewRows.
Row Template Editor
Youcanusetheroweditorortemplateeditortotypetext.
Formoreinformation,refertoSettingupRowEditTemplates.
Searching Features
Youcanprogrammaticallysearchthecelltext,headers,notes,ortags.Youcanalsospecifythestartingrowandcolumnandtheendingrowandcolumn.
UsetheSearch('SearchMethod'intheon-linedocumentation)methodortheSearchHeaders('SearchHeadersMethod'intheon-linedocumentation)methodoftheFpSpread('FpSpreadClass'intheon-linedocumentation)object.Formoreinformation,refertoSearchingforDatawithCode.
Sorting Capabilities
Youcansortrowsorcolumnsorarangeofcells.Youcanprogrammaticallysortdatabyrowsorcolumnsorallowyouruserstosortrowsautomaticallybyclickingonthecolumnheader.
Formoreinformation,refertoCustomizingSortingofRowsofUserData
Spannable Cells
Youcanspancells.Createcellspanstojoincellstogether,allowingonecelltospanacrossmultiplecellstoinclude,forexample,yourcompanylogo.Youcanspandatacellsorheaders.
Formoreinformation,refertoSpanningCells.
Sparklines
Youcanaddsparklinestoacell.Asparklineisasmallgraphthatfitsinsideacellandusesdatafromarangeofcells.
Formoreinformation,refertoUsingSparklines.
Spread Designer
Spread for ASP.NET Developer’s Guide 57
Copyright © GrapeCity, Inc. All rights reserved.
YoucanusetheSpreadDesignertodesignyourcomponentandtocreateaprototypequickly.UsetheSpreadDesignertoreducedevelopmenttimebyallowingyoutocustomizethelookandfeelofthecomponentatdesigntimeusinganintuitive,easy-to-useinterface.
FormoreinformationrefertoWorkingwiththeSpreadDesigner.
Spread Wizard
YoucanusetheSpreadWizardtodesignyourcomponentandtocreateaprototypequickly.
FormoreinformationrefertoUsingtheSpreadWizard.
Theme Roller
SpreadsupportsusingaThemeRollerthemeintheSpreadcontrol.
Formoreinformation,refertoUsingthejQueryThemeRollerwithSpread.
Title and Subtitle
YoucanaddatitletotheSpreadcomponentandsubtitletothesheet.
FormoreinformationrefertoAddingaTitleandSubtitletoaSheet.
Touch Support
TheSpreadcontrolsupportstouchgesturesinmanyareas.
Formoreinformation,refertoUsingTouchSupportwiththeComponent.
Validation Controls
YoucanpreventauserfromenteringinvalidcharactersinacellbyusingavalidationcontrolintheSpreadcell.
Formoreinformation,refertoUsingValidationControls.
Concepts Overview
WhilethosefamiliarwithpreviousgenerationsofSpreadproductsunderstandt