Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Forms
Imports FarPoint.Win.Spread.Data
Imports FarPoint.Win.Spread
Imports FarPoint.Win
Imports FarPoint.Win.Spread.CellType
Imports GrapeCity.DashBoard.OperationalModel
Imports GrapeCity.DashBoard.Sparklines
Imports Spread.Common.DataStore
Imports System.Reflection
Imports FarPoint.Win.Spread.Chart
Imports GrapeCity.DashBoard.GrapeCity.DashBoard.OperationalModel
Imports GrapeCity.DashBoard.GrapeCity.DashBoard.Sparklines
Imports GrapeCity.DashBoard.GrapeCity.DashBoard

Partial Public Class DashBoard
    Inherits Spread.Common.Features.Spread.Common.Features.Sample.BaseSampleControl
#Region "Fields"
    Private _productSale As ProductSale = Nothing
    Private _productTarget As ProductTarget = Nothing
    Private _regionalSale As RegionalSale = Nothing
    Private _customerSale As CustomerSale = Nothing
    Private _companyShare As CompanyShare = Nothing
    Private _productSaleList As List(Of ProductSale) = Nothing
    Private _productTargetList As List(Of ProductTarget) = Nothing
    Private _regionalSaleList As List(Of RegionalSale) = Nothing
    Private _customerSaleListByTopRevenue As List(Of CustomerSale) = Nothing
    Private _customerSaleListByTopRegion As List(Of CustomerSale) = Nothing
    Private _companyShareList As List(Of CompanyShare) = Nothing
    Private _bullGroup As BulletChartSparklineGroup = Nothing
    Private _currencyCellType As CurrencyCellType = Nothing
    Private _percentCellType As PercentCellType = Nothing
    Private _year As List(Of String) = Nothing
    Private _monthHeadres As String(,) = Nothing
    Private _headerFont As Font = Nothing
    Private _columnHeaderFont As Font = Nothing
    Private _selectedYr As String = ""
    Private _startCol As Integer = 0
    Private _startRow As Integer = 2
#End Region
#Region "ctor"
    Public Sub New()
        InitializeComponent()
        ObjectCreationAndLoad()
        AddHandler Me.fpSpread.ComboSelChange, AddressOf FpSpread_ComboSelChange
        AddHandler Me.Load, AddressOf DashBoard_Load
    End Sub
#End Region
#Region "Event Handlers"
    Private Sub FpSpread_ComboSelChange(sender As Object, e As EditorNotifyEventArgs)
        Dim ctrlTxt As String = TryCast(e.EditingControl, FpCombo).SelectedItem.ToString()
        If _selectedYr.Equals(ctrlTxt) Then
            Return
        End If
        _selectedYr = If(_year.IndexOf(ctrlTxt) >= 0, _year(_year.IndexOf(ctrlTxt)), _selectedYr)
        fpSpread.Sheets(0).Cells(1, 24).Text = _selectedYr.ToString()
        fpSpread.SuspendLayout()
        UpdateDataInSpread()
        fpSpread.ResumeLayout()
    End Sub

    Private Sub DashBoard_Load(sender As Object, e As EventArgs)
        SetColumnsRowsVisibility()
        SetColor()
        SetFont_Alignment_Text()
        SetCellType()
        SetColWidthRowHeight()
        ProtectSheetToEnterValue()
        UpdateDataInSpread()
        BuildSparklines()
        BuildBorderOfChart()
        SetHeardersInChart()
        fpSpread.Sheets(0).RowCount = 46 + _customerSaleListByTopRegion.Count
        fpSpread.Sheets(0).ColumnCount = 27
    End Sub
#End Region
#Region "Private methods"
    Private Sub ObjectCreationAndLoad()
        Dim dashBoardItems = New DataService().DashBoardDataSource.LoadDashBoardItems()
        _productSale = New ProductSale(dashBoardItems.Invoices, dashBoardItems.Sales, dashBoardItems.Products)
        _productTarget = New ProductTarget(_productSaleList, dashBoardItems.TargetMasters)
        _regionalSale = New RegionalSale(dashBoardItems.Regions, dashBoardItems.Customers, dashBoardItems.Invoices)
        _customerSale = New CustomerSale(dashBoardItems.Customers, dashBoardItems.CustomerTargets, dashBoardItems.Invoices)
        _companyShare = New CompanyShare(dashBoardItems.Companies, dashBoardItems.MarketSales)

        _currencyCellType = New CurrencyCellType() With {
            .MinimumValue = 0,
            .CurrencySymbol = "$",
            .ShowSeparator = True,
            .DecimalPlaces = 2,
            .PositiveFormat = CurrencyPositiveFormat.CurrencySymbolBefore
        }
        _percentCellType = New PercentCellType() With {
             .MinimumValue = 0,
             .ShowSeparator = True,
             .PercentSign = "%"
        }
        _headerFont = New Font("MS Sans Serif", 13, FontStyle.Bold)
        _columnHeaderFont = New Font("MS Sans Serif", 9, FontStyle.Bold)
        _monthHeadres = New String(,) {{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}}
    End Sub

    'Set visibility of headers and columns
    Private Sub SetColumnsRowsVisibility()
        fpSpread.Sheets(0).ColumnHeader.Visible = False
        fpSpread.Sheets(0).RowHeader.Visible = False
        fpSpread.Sheets(1).ColumnHeader.Visible = False
        fpSpread.Sheets(1).RowHeader.Visible = False
    End Sub

    'Update data in spread
    Private Sub UpdateDataInSpread()
        _startCol = 0
        _startRow = 2
        Dim currentSelectedYear As Integer = Convert.ToInt32(_selectedYr)
        _productSaleList = _productSale.GetListbyYear(currentSelectedYear)
        _productTarget.UpdateProductSaleList(_productSaleList)
        _productTargetList = _productTarget.GetListByYear(currentSelectedYear)
        _regionalSaleList = _regionalSale.GetListByYear(currentSelectedYear)
        _customerSaleListByTopRevenue = _customerSale.GetListbyRevenue(currentSelectedYear)
        _customerSaleListByTopRegion = _customerSale.GetListbyRegionRevenue(currentSelectedYear)
        _companyShareList = _companyShare.GetListByYear(currentSelectedYear)
        fpSpread.ActiveSheet = fpSpread.Sheets(0)
        BindDataToSpread(Of ProductTarget)(_productTargetList, _startRow, _startCol, 6, "Key Matrics", _headerFont,
            _columnHeaderFont, True)
        _startRow += _productTargetList.Count + 3
        _startCol = 0
        BindDataToSpread(Of ProductSale)(_productSaleList, _startRow, _startCol, 6, "Product Sales", _headerFont,
            _columnHeaderFont, True)
        _startRow += _productSaleList.Count + 3
        _startCol = 0
        BindDataToSpread(Of RegionalSale)(_regionalSaleList, _startRow, _startCol, 4, "Region Revenue", _headerFont,
            _columnHeaderFont, True)
        _startRow += _regionalSaleList.Count + 3
        _startCol = 0
        BindDataToSpread(Of CustomerSale)(_customerSaleListByTopRevenue, _startRow, _startCol, 4, "Top Customer by Revenue", _headerFont,
            _columnHeaderFont)
        _startRow += _customerSaleListByTopRevenue.Count + 3
        _startCol = 0
        BindDataToSpread(Of CustomerSale)(_customerSaleListByTopRegion, _startRow, _startCol, 4, "Top Customer by Region", _headerFont,
            _columnHeaderFont)
        _startRow += _customerSaleListByTopRegion.Count + 3
        _startCol = 0
        BindDataToSpread(Of CompanyShare)(_companyShareList, _startRow, _startCol, 3, "Company Share in Market", _headerFont,
            _columnHeaderFont)
        SetFormulaForPercent(_startRow, 2, _companyShareList.Count + _startRow, 3)
    End Sub
    'Bind data to a cell range
    Private Sub BindDataToSpread(Of T)(list As List(Of T), ByRef startRow As Integer, ByRef startCol As Integer, colCount As Integer, dataHeader As String, headerFont As Font,
        colHeaderFont As Font, Optional isAddedArray As Boolean = False)
        Dim _startRow As Integer = startRow
        Dim _startCol As Integer = startCol
        fpSpread.Sheets(1).Cells(startRow - 2, 0).Text = dataHeader
        fpSpread.Sheets(1).AddSpanCell(startRow - 2, 0, 1, 30)
        fpSpread.Sheets(1).Rows(startRow - 2).Font = headerFont
        fpSpread.Sheets(1).Rows(startRow - 2).BackColor = Color.FromArgb(30, 122, 197)
        fpSpread.Sheets(1).Rows(startRow - 2).ForeColor = Color.White
        fpSpread.Sheets(1).Rows(startRow - 2).Height = 30
        fpSpread.Sheets(1).Rows(startRow - 1).BackColor = Color.Gray
        fpSpread.Sheets(1).Rows(startRow - 1).ForeColor = Color.White
        fpSpread.Sheets(1).Rows(startRow - 1).Font = colHeaderFont

        If list.Count > 0 Then
            ' for data binding        
            Using data As New SpreadDataBindingAdapter()
                For Each p As PropertyInfo In GetType(T).GetProperties()
                    Dim propertyName As String = p.Name
                    If colCount > _startCol Then
                        fpSpread.Sheets(1).Cells(startRow - 1, _startCol).Text = propertyName
                        _startCol += 1

                    End If
                Next
                ' Assign the list to datasource
                data.DataSource = list
                data.Spread = fpSpread
                data.SheetName = "Data"
                data.MapperInfo = New MapperInfo(startRow, startCol, list.Count, colCount)
                data.FillSpreadDataByDataSource()
                fpSpread.Sheets(1).Cells(startRow, startCol + 2, startRow + list.Count, startCol - 1 + colCount).CellType = _currencyCellType
                startCol = startCol + colCount
                If isAddedArray Then
                    fpSpread.Sheets(1).SetArray(_startRow - 1, startCol, _monthHeadres)
                    For Each item As Object In list
                        fpSpread.Sheets(1).SetArray(_startRow, startCol, item.TwelveMonthsActual)
                        _startRow += 1
                    Next
                    fpSpread.Sheets(1).Cells(startRow, startCol, _startRow, startCol + 12).CellType = _currencyCellType
                End If
            End Using
        Else
            fpSpread.Sheets(0).AddSpanCell(0, 0, fpSpread.Sheets(0).RowCount, fpSpread.Sheets(0).ColumnCount)
            fpSpread.Sheets(0).Cells(0, 0).Text = "No record found."
            fpSpread.Sheets(1).AddSpanCell(3, 0, fpSpread.Sheets(0).RowCount, fpSpread.Sheets(0).ColumnCount)
            fpSpread.Sheets(1).Cells(3, 0).Text = "No record found."
        End If
    End Sub
    'Set formula for cell 
    Private Sub SetFormulaForPercent(startRow As Integer, srcColumn As Integer, endRow As Integer, destColumn As Integer)
        Dim columnHeader As String = fpSpread.Sheets(1).Columns(srcColumn).Label
        For i As Integer = startRow To endRow - 1

            fpSpread.Sheets(1).Cells(i, destColumn).Formula = "" & columnHeader & (i + 1) & "/SUM(" & columnHeader & startRow & ":" & columnHeader & endRow & ")"
        Next
        fpSpread.Sheets(1).Cells(startRow - 1, destColumn).Text = "Percentage"
        fpSpread.Sheets(1).Cells(startRow, destColumn, endRow, destColumn).CellType = _percentCellType
        fpSpread.Sheets(1).Cells(startRow, destColumn, endRow, destColumn).Locked = True
    End Sub

    'Set color in sheet
    Private Sub SetColor()
        '  Set alternative row color
        fpSpread.Sheets(1).AlternatingRows.Count = 2
        fpSpread.Sheets(1).AlternatingRows(0).BackColor = Color.FromArgb(246, 246, 246)
        fpSpread.Sheets(1).AlternatingRows(1).BackColor = Color.FromArgb(228, 228, 228)
        'Set color for sheet header
        fpSpread.Sheets(0).Rows(0, 2).BackColor = Color.FromArgb(30, 122, 197)
        fpSpread.Sheets(0).Rows(0, 2).ForeColor = Color.White
        fpSpread.Sheets(0).Cells(1, 23, 1, 24).BackColor = Color.WhiteSmoke
        fpSpread.Sheets(0).Cells(1, 23, 1, 24).ForeColor = Color.Black
    End Sub

    'Set font, alignment and text for cells
    Private Sub SetFont_Alignment_Text()
        fpSpread.Sheets(0).Cells(0, 1).Text = "MSC Sales Dashboard"
        fpSpread.Sheets(0).AddSpanCell(0, 1, 3, 20)
        fpSpread.Sheets(0).FrozenRowCount = 3
        fpSpread.Sheets(0).Cells(1, 21).Text = "Select Year : "
        fpSpread.Sheets(0).AddSpanCell(1, 21, 1, 3)
        fpSpread.Font = New Font("MS Sans Serif", 9, FontStyle.Regular)
        fpSpread.Sheets(0).Rows(0).Font = New Font("MS Sans Serif", 18, FontStyle.Bold)
        fpSpread.Sheets(0).Cells(1, 21, 1, 25).Font = _columnHeaderFont
        fpSpread.Sheets(0).Rows(0).HorizontalAlignment = CellHorizontalAlignment.Left
        fpSpread.Sheets(0).Cells(1, 21).HorizontalAlignment = CellHorizontalAlignment.Right
        fpSpread.Sheets(0).Cells(1, 24).HorizontalAlignment = CellHorizontalAlignment.Center
        fpSpread.Sheets(0).Cells(1, 24).Border = New LineBorder(Color.Black, 2)
        fpSpread.Sheets(0).Rows(2).HorizontalAlignment = CellHorizontalAlignment.Center
        fpSpread.Sheets(0).Rows(0, fpSpread.Sheets(0).Rows.Count - 1).VerticalAlignment = CellVerticalAlignment.Top
        fpSpread.Sheets(0).Cells(1, 0).HorizontalAlignment = CellHorizontalAlignment.Right
        fpSpread.Sheets(0).Columns(1, 2).HorizontalAlignment = CellHorizontalAlignment.Right
    End Sub
    'Set combobox celltype
    Private Sub SetCellType()
        Dim comboBoxCellType As New ComboBoxCellType()
        _year = New List(Of String)()
        _year.AddRange(New String() {DateTime.Now.Year & "", DateTime.Now.Year - 1 & ""})
        If DateTime.Now.Month < 12 Then
            _year.Add(DateTime.Now.Year - 2 & "")
        End If
        comboBoxCellType.Items = _year.ToArray()
        fpSpread.Sheets(0).Cells(1, 24).ForeColor = System.Drawing.Color.Black
        fpSpread.Sheets(0).Cells(1, 24).CellType = comboBoxCellType
        _selectedYr = _year(0)
        comboBoxCellType.Editable = False
        comboBoxCellType.MaxDrop = 4
        fpSpread.Sheets(0).Cells(1, 24).Text = DateTime.Now.Year & ""
        fpSpread.Sheets(0).Cells(1, 24).Locked = False
        fpSpread.Sheets(0).AddSpanCell(1, 24, 1, 2)
    End Sub
    'Set row's height and column's width
    Private Sub SetColWidthRowHeight()
        'Column width
        fpSpread.Sheets(0).Columns(0).Width = 10
        fpSpread.Sheets(0).Columns(1).Width = 15
        fpSpread.Sheets(0).Columns(2).Width = 170
        fpSpread.Sheets(0).Columns(3).Width = 35
        fpSpread.Sheets(0).Columns(4).Width = 100
        fpSpread.Sheets(0).Columns(5).Width = 15
        fpSpread.Sheets(0).Columns(6).Width = 72
        fpSpread.Sheets(0).Columns(7).Width = 15
        fpSpread.Sheets(0).Columns(8).Width = 72
        fpSpread.Sheets(0).Columns(9).Width = 15
        fpSpread.Sheets(0).Columns(10).Width = 72
        fpSpread.Sheets(0).Columns(11).Width = 15
        fpSpread.Sheets(0).Columns(12).Width = 70
        fpSpread.Sheets(0).Columns(13).Width = 10
        fpSpread.Sheets(0).Columns(14).Width = 10
        fpSpread.Sheets(0).Columns(15).Width = 20
        fpSpread.Sheets(0).Columns(16).Width = 180
        fpSpread.Sheets(0).Columns(17).Width = 15
        fpSpread.Sheets(0).Columns(18).Width = 72
        fpSpread.Sheets(0).Columns(19).Width = 15
        fpSpread.Sheets(0).Columns(20).Width = 72
        fpSpread.Sheets(0).Columns(21).Width = 15
        fpSpread.Sheets(0).Columns(22).Width = 72
        fpSpread.Sheets(0).Columns(23).Width = 15
        fpSpread.Sheets(0).Columns(24).Width = 70
        fpSpread.Sheets(0).Columns(25).Width = 10
        fpSpread.Sheets(0).Columns(26).Width = 10
        'row height
        fpSpread.Sheets(0).Rows(0).Height = 12
        fpSpread.Sheets(0).Rows(1).Height = 25
        fpSpread.Sheets(0).Rows(2).Height = 12
        fpSpread.Sheets(0).Rows(4, 50).Height = 22
        fpSpread.Sheets(0).Rows(3).Height = 15
        fpSpread.Sheets(0).Rows(21).Height = 10
        fpSpread.Sheets(0).Rows(38).Height = 10

        'Sheet 1            
        fpSpread.Sheets(1).Columns(0, 19).Width = 100
        fpSpread.Sheets(1).Columns(20, 21).Width = 1
        fpSpread.Sheets(1).Columns(1).Width = 200
    End Sub
    'Protect sheet form edit
    Private Sub ProtectSheetToEnterValue()
        fpSpread.Sheets(0).Protect = True
        fpSpread.Sheets(0).Cells(2, 0, fpSpread.Sheets(0).RowCount - 1, fpSpread.Sheets(0).ColumnCount - 1).Locked = True
    End Sub
    'Build chart sparklines
    Private Sub BuildSparklines()
        _startCol = 0
        _startRow = 2
        CreateSparklines(Of ProductTarget)(_productTargetList, _startRow, 0, 9, 2, 2,
            5, 3, 4, -1, -1, True,
            True, True, True, False, True)
        fpSpread.Sheets(0).Cells(9, 11, 9 + _productTargetList.Count, 11).CellType = _currencyCellType
        _startRow += _productTargetList.Count + 3
        _startCol = 0
        CreateSparklines(Of ProductSale)(_productSaleList, _startRow, 0, 27, 2, 4,
            5, -1, -1, 2, 3, True,
            True, False, False, True, True)
        _startRow += _productSaleList.Count + 3
        _startCol = 0
        CreateSparklines(Of RegionalSale)(_regionalSaleList, _startRow, 0, 44, 2, 2,
            3, -1, -1, -1, -1, True,
            True, False, False, False, True)
        fpSpread.Sheets(0).Cells(44, 11, 44 + _regionalSaleList.Count, 11).CellType = _currencyCellType
        _startRow += _regionalSaleList.Count + 3
        _startCol = 0
        CreateSparklines(Of CustomerSale)(_customerSaleListByTopRevenue, _startRow, 0, 9, 15, -1,
            3, 2, -1, -1, -1, False,
            True, True, False, False, False)
        fpSpread.Sheets(0).Cells(9, 23, 9 + _customerSaleListByTopRevenue.Count, 23).CellType = _currencyCellType
        _startRow += _customerSaleListByTopRevenue.Count + 3
        _startCol = 0
        CreateSparklines(Of CustomerSale)(_customerSaleListByTopRegion, _startRow, 0, 44, 15, -1,
            3, 2, -1, -1, -1, False,
            True, True, False, False, False)
        fpSpread.Sheets(0).Cells(44, 23, 44 + _customerSaleListByTopRegion.Count, 23).CellType = _currencyCellType
        _startRow += _customerSaleListByTopRegion.Count + 3
        _startCol = 0
        CreateSparklines(Of CompanyShare)(_companyShareList, _startRow, 0, 27, 15, -1,
            -1, 2, -1, -1, -1, False,
            False, True, False, False, False)
        fpSpread.Sheets(0).Cells(26, 23, 26 + _companyShareList.Count, 23).CellType = _percentCellType

    End Sub
    Private Sub CreateSparklines(Of T)(list As List(Of T), srcRow As Integer, srcCol As Integer, destRow As Integer, destCol As Integer, Optional targetColIndex As Integer = -1,
        Optional actualColIndex As Integer = -1, Optional goodColIndex As Integer = -1, Optional badcolIndex As Integer = -1, Optional targetUnitColIndex As Integer = -1, Optional actualUnitColIndex As Integer = -1, Optional istargetShow As Boolean = False,
        Optional isActualShow As Boolean = False, Optional isGoodShow As Boolean = False, Optional isBadShow As Boolean = False, Optional isUnitPrinted As Boolean = False, Optional isArrayContains As Boolean = False)
        Dim dbl As New System.Double()
        Dim header1 As String = Me.fpSpread.Sheets(1).Columns(Convert.ToInt32(dbl.PositiveMin(targetColIndex, badcolIndex, actualColIndex, goodColIndex))).Label
        Dim header2 As String = Me.fpSpread.Sheets(1).Columns(Convert.ToInt32(dbl.Max(targetColIndex, badcolIndex, actualColIndex, goodColIndex))).Label
        fpSpread.Sheets(1).Cells(srcRow, 20).Formula = "Max(" & header1 & "" & srcRow & ":" & header2 & "" & (srcRow + list.Count) & ")"
        header1 = Me.fpSpread.Sheets(1).Columns(Convert.ToInt32(dbl.PositiveMin(targetUnitColIndex, actualUnitColIndex, -1, -1))).Label
        header2 = Me.fpSpread.Sheets(1).Columns(Convert.ToInt32(dbl.Max(targetUnitColIndex, actualUnitColIndex, -1, -1))).Label
        fpSpread.Sheets(1).Cells(srcRow, 21).Formula = "Max(" & header1 & "" & srcRow & ":" & header2 & "" & (srcRow + list.Count) & ")"
        For i As Integer = 0 To list.Count - 1
            If isArrayContains Then
                BindExcelSparklineInRow(i + srcRow, Convert.ToInt32(dbl.Max(targetColIndex, badcolIndex, actualColIndex, goodColIndex)) + 1, i + destRow, destCol)
                DisplayText(i + srcRow, srcCol + 1, i + destRow, destCol + 2)
                fpSpread.Sheets(0).AddSpanCell(i + destRow, destCol + 3, 1, 6)
                BindSparklineInRow(i + srcRow, srcCol - 1, i + destRow, destCol + 3, targetColIndex, actualColIndex,
                    goodColIndex, badcolIndex, actualUnitColIndex, targetUnitColIndex, srcRow, istargetShow,
                    isActualShow, isGoodShow, isBadShow, isUnitPrinted)
                BindCircleSparklineInRow(i + srcRow, actualColIndex, i + destRow, destCol + 1, isUnitPrinted)
                fpSpread.Sheets(0).AddSpanCell(i + destRow, destCol + 9, 1, 2)

                DisplayText(i + srcRow, If(isUnitPrinted, actualUnitColIndex, If((actualColIndex > -1), actualColIndex, goodColIndex)), i + destRow, destCol + 9)
            Else
                DisplayText(i + srcRow, srcCol + 1, i + destRow, destCol + 1)
                fpSpread.Sheets(0).AddSpanCell(i + destRow, destCol + 2, 1, 6)
                BindSparklineInRow(i + srcRow, srcCol - 1, i + destRow, destCol + 2, targetColIndex, actualColIndex,
                    goodColIndex, badcolIndex, actualUnitColIndex, targetUnitColIndex, srcRow, istargetShow,
                    isActualShow, isGoodShow, isBadShow, isUnitPrinted)
                fpSpread.Sheets(0).AddSpanCell(i + destRow, destCol + 8, 1, 2)
                If TypeOf list(0) Is CompanyShare Then
                    goodColIndex = goodColIndex + 1
                End If
                DisplayText(i + srcRow, If((actualColIndex > -1), actualColIndex, goodColIndex), i + destRow, destCol + 8)
                If TypeOf list(0) Is CompanyShare Then
                    goodColIndex = goodColIndex - 1
                End If
            End If
        Next
    End Sub
    'Create circle sparkline based on the cell value
    Private Sub BindCircleSparklineInRow(srcRow As Integer, srcCol As Integer, destRow As Integer, destCol As Integer, isUnitPrinted As Boolean)
        Dim excelSparklineGroup As New FarPoint.Win.Spread.ExcelSparklineGroup()
        Dim excelSparklineSetting As New FarPoint.Win.Spread.ExcelSparklineSetting()
        Dim excelSparkline As New FarPoint.Win.Spread.ExcelSparkline()
        Me.fpSpread.ActiveSheet.SparklineContainer.Add(excelSparklineGroup)
        excelSparklineGroup.Renderer = New CircleSparkline(Color.Red, isUnitPrinted)
        excelSparklineGroup.Setting = excelSparklineSetting
        Dim header1 As String = Me.fpSpread.Sheets(1).Columns(srcCol - 1).Label
        Dim header2 As String = Me.fpSpread.Sheets(1).Columns(srcCol).Label
        excelSparkline.Formula = "Data!" & header1 & "" & (srcRow + 1) & ":Data!" & header2 & "" & (srcRow + 1)
        excelSparkline.Column = destCol
        excelSparkline.Row = destRow
        excelSparklineGroup.Add(excelSparkline)
    End Sub
    'Create month wise trend sparkline
    Private Sub BindExcelSparklineInRow(srcRow As Integer, srcCol As Integer, destRow As Integer, destCol As Integer)

        Dim excelSparklineGroup As FarPoint.Win.Spread.ExcelSparklineGroup = New ExcelSparklineGroup()
        Dim excelSparklineSetting As New FarPoint.Win.Spread.ExcelSparklineSetting()
        Dim excelSparkline As New FarPoint.Win.Spread.ExcelSparkline()
        Me.fpSpread.ActiveSheet.SparklineContainer.Add(excelSparklineGroup)
        excelSparklineGroup.Renderer = New LineSparklineRenderer()
        excelSparklineGroup.Setting = excelSparklineSetting
        Dim header1 As String = Me.fpSpread.Sheets(1).Columns(srcCol).Label
        Dim header2 As String = Me.fpSpread.Sheets(1).Columns(srcCol + 11).Label
        excelSparkline.Formula = "Data!" & header1 & "" & (srcRow + 1) & ":Data!" & header2 & "" & (srcRow + 1)
        excelSparklineSetting.ShowNegative = True
        excelSparkline.Column = destCol
        excelSparkline.Row = destRow
        excelSparklineGroup.Add(excelSparkline)
    End Sub
    'Create custom sparkline for chart
    Private Sub BindSparklineInRow(srcRow As Integer, srcCol As Integer, destRow As Integer, destCol As Integer, Optional targetColIndex As Integer = -1, Optional actualColIndex As Integer = -1,
        Optional goodColIndex As Integer = -1, Optional badcolIndex As Integer = -1, Optional actualUnitColIndex As Integer = -1, Optional targetUnitColIndex As Integer = -1, Optional maxUnitRevenueRowIndex As Integer = -1, Optional istargetShow As Boolean = False,
        Optional isActualShow As Boolean = False, Optional isGoodShow As Boolean = False, Optional isBadShow As Boolean = False, Optional isUnitPrinted As Boolean = False)
        Dim bulletSetting As New BulletChartSparklineSetting(Color.Gray)

        Dim bulletGroup As New BulletChartSparklineGroup() With {
            .Setting = bulletSetting
        }
        Dim actual As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(actualColIndex > -1, actualColIndex, 0), 1, 1)
        Dim good As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(goodColIndex > -1, goodColIndex, 0), 1, 1)
        Dim bad As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(badcolIndex > -1, badcolIndex, 0), 1, 1)
        Dim target As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(targetColIndex > -1, targetColIndex, 0), 1, 1)
        Dim actualUnit As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(actualUnitColIndex > -1, actualUnitColIndex, 0), 1, 1)
        Dim targetUnit As New SheetCellRange(Me.fpSpread.Sheets(1), srcRow, If(targetUnitColIndex > -1, targetUnitColIndex, 0), 1, 1)
        Dim maxUnit As New SheetCellRange(Me.fpSpread.Sheets(1), If(maxUnitRevenueRowIndex > -1, maxUnitRevenueRowIndex, 0), 21, 1, 1)
        Dim maxRevenue As New SheetCellRange(Me.fpSpread.Sheets(1), If(maxUnitRevenueRowIndex > -1, maxUnitRevenueRowIndex, 0), 20, 1, 1)

        Dim bulletSparkline As New BulletChartSparkline(Me.fpSpread.Sheets(0), destRow, destCol, actual, target, good,
            bad, actualUnit, targetUnit, maxUnit, maxRevenue, istargetShow,
            isActualShow, isGoodShow, isBadShow, isUnitPrinted)
        If _bullGroup Is Nothing Then
            _bullGroup = New BulletChartSparklineGroup() With {
                .Setting = bulletSetting
            }
            _bullGroup.Add(bulletSparkline)
            Me.fpSpread.ActiveSheet.SparklineContainer.Add(_bullGroup)
        Else
            _bullGroup.Add(bulletSparkline)
        End If
    End Sub
    'Set formula for cells in sheet[0] using the reference of sheet[1] "Data"
    Private Sub DisplayText(srcRow As Integer, srcCol As Integer, destRow As Integer, destCol As Integer)
        Dim header As String = Me.fpSpread.Sheets(1).Columns(srcCol).Label
        Me.fpSpread.Sheets(0).Cells(destRow, destCol).Formula = "IF(Data!" & header & "" & (srcRow + 1) & " = " & """GrapeCity"",""Our Company"",Data!" & header & "" & (srcRow + 1) & ")"
    End Sub

    Private Sub BuildBorderOfChart()
        SetBorder(4, 1, 10 + _productTargetList.Count, 13)
        SetBorder(4, 15, 10 + _productTargetList.Count, 25)
        SetBorder(22, 1, 27 + _productSaleList.Count, 13)
        SetBorder(22, 15, 27 + _productSaleList.Count, 25)
        SetBorder(39, 1, 45 + _customerSaleListByTopRegion.Count, 25)
    End Sub
    'Set border for charts
    Private Sub SetBorder(startRow As Integer, startCol As Integer, endRow As Integer, endCol As Integer)
        fpSpread.ActiveSheet.HorizontalGridLine = New GridLine(GridLineType.None)
        fpSpread.ActiveSheet.VerticalGridLine = New GridLine(GridLineType.None)
        fpSpread.ActiveSheet.Cells(startRow, startCol, endRow, endCol).Border = New LineBorder(Color.White, 2, True, True, True, True)
        fpSpread.ActiveSheet.Cells(startRow, startCol, endRow, startCol).Border = New LineBorder(Color.Gainsboro, 1, True, False, False, False)
        fpSpread.ActiveSheet.Cells(startRow, startCol, startRow, endCol).Border = New LineBorder(Color.Gainsboro, 1, False, True, False, False)
        fpSpread.ActiveSheet.Cells(startRow, endCol, endRow, endCol).Border = New LineBorder(Color.Gainsboro, 1, False, False, True, False)
        fpSpread.ActiveSheet.Cells(endRow, startCol, endRow, endCol).Border = New LineBorder(Color.Gainsboro, 1, False, False, False, True)
        fpSpread.ActiveSheet.Cells(startRow, startCol, startRow, startCol).Border = New LineBorder(Color.Gainsboro, 1, True, True, False, False)
        fpSpread.ActiveSheet.Cells(startRow, endCol, startRow, endCol).Border = New LineBorder(Color.Gainsboro, 1, False, True, True, False)
        fpSpread.ActiveSheet.Cells(endRow, endCol, endRow, endCol).Border = New LineBorder(Color.Gainsboro, 1, False, False, True, True)
        fpSpread.ActiveSheet.Cells(endRow, startCol, endRow, startCol).Border = New LineBorder(Color.Gainsboro, 1, True, False, False, True)

        fpSpread.ActiveSheet.Cells(startRow + 3, startCol + 1, startRow + 3, endCol - 1).Border = New LineBorder(Color.Gray, 1, False, False, False, True)
        fpSpread.ActiveSheet.Rows(startRow + 4).Height = 10
        fpSpread.ActiveSheet.Rows(startRow).Height = 10
        fpSpread.ActiveSheet.Rows(startRow + 1).Height = 10
        fpSpread.ActiveSheet.Rows(startRow + 2).Height = 10
    End Sub
    'Set headers in all chart
    Private Sub SetHeardersInChart()
        Dim actualColor As Color = Me.Darker(Color.Gray, 0)
        Dim targetColor As Color = Me.Darker(Color.Gray, 100)
        Dim badColor As Color = Me.Darker(Color.Gray, -50)
        Dim goodColor As Color = Me.Darker(Color.Gray, -100)
        Dim actualUnitColor As Color = Me.Darker(Color.Gray, -50)
        Dim foreColor As Color = Color.FromArgb(176, 152, 116)
        SetChartMainHeader(4, 2, 5, 7, 9, 11,
            -1, "Key Metrics", _headerFont, _columnHeaderFont, actualColor, targetColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(7, 2, "Month Wise Trends,Product,Actual vs Target,Actual($)", _columnHeaderFont, foreColor)
        SetChartMainHeader(4, 16, 21, 23, -1, -1,
            -1, "Top Customers", _headerFont, _columnHeaderFont, actualColor, goodColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(7, 16, "Customer,Actual vs Target,Actual($)", _columnHeaderFont, foreColor)
        SetChartMainHeader(22, 2, 7, 11, -1, -1,
            9, "Product Sales", _headerFont, _columnHeaderFont, actualColor, targetColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(25, 2, "Month Wise Trends,Product,Revenue & Units vs Target,Unit", _columnHeaderFont, foreColor)
        SetChartMainHeader(22, 16, -1, -1, -1, -1,
            -1, "Product Sales", _headerFont, _columnHeaderFont, actualColor, targetColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(25, 16, "Company,% of Total Market,%", _columnHeaderFont, foreColor)
        SetChartMainHeader(39, 2, 9, 11, -1, -1,
            -1, "Revenue by Region", _headerFont, _columnHeaderFont, actualColor, targetColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(42, 2, "Month Wise Trends,Region,Actual vs Target,Actual($)", _columnHeaderFont, foreColor)
        SetChartMainHeader(39, 16, 21, 23, -1, -1,
            -1, "Top Customer by Region", _headerFont, _columnHeaderFont, actualColor, goodColor,
            badColor, goodColor, actualUnitColor, foreColor)
        SetChartHeader(42, 16, "Customer,Actual vs Target,Actual($)", _columnHeaderFont, foreColor)
    End Sub
    Private Sub SetChartHeader(startRow As Integer, StartCol As Integer, headerStr As String, headerFont As Font, foreColor As Color)
        Dim strings As String() = headerStr.Split(","c)
        Dim cellHorizontalAlignment__1 As CellHorizontalAlignment = CellHorizontalAlignment.Left
        For Each str As String In strings

            If (strings.Count() > 3 AndAlso strings(2) = str) OrElse (strings.Count() = 3 AndAlso strings(1) = str) Then
                cellHorizontalAlignment__1 = CellHorizontalAlignment.Center
                fpSpread.Sheets(0).Cells(startRow, StartCol - 1).Text = str
                fpSpread.Sheets(0).Cells(startRow, StartCol - 1).HorizontalAlignment = cellHorizontalAlignment__1
                fpSpread.Sheets(0).Cells(startRow, StartCol - 1).Font = headerFont
                fpSpread.Sheets(0).Cells(startRow, StartCol - 1).ForeColor = foreColor
                fpSpread.Sheets(0).AddSpanCell(startRow, StartCol - 1, 1, 6)
                StartCol += 6
            Else
                fpSpread.Sheets(0).Cells(startRow, StartCol).Text = str
                fpSpread.Sheets(0).Cells(startRow, StartCol).HorizontalAlignment = cellHorizontalAlignment__1
                fpSpread.Sheets(0).Cells(startRow, StartCol).Font = headerFont
                fpSpread.Sheets(0).Cells(startRow, StartCol).ForeColor = foreColor
                StartCol += 2
            End If
        Next
    End Sub
    'Set main header in chart
    Private Sub SetChartMainHeader(startRow As Integer, StartCol As Integer, actualColIndex As Integer, targetColIndex As Integer, badColIndex As Integer, goodColIndex As Integer,
        actualUnitColIndex As Integer, HeaderText As String, headerFont As Font, subHeaderFont As Font, actualColor As Color, targetColor As Color,
        badColor As Color, goodColor As Color, actualUnitColor As Color, foreColor As Color)
        fpSpread.Sheets(0).Cells(startRow, StartCol).Text = HeaderText
        fpSpread.Sheets(0).Cells(startRow, StartCol).ForeColor = foreColor
        fpSpread.Sheets(0).Cells(startRow, StartCol).Font = headerFont
        fpSpread.Sheets(0).AddSpanCell(startRow, StartCol, 3, 3)
        fpSpread.Sheets(0).Rows(startRow).Font = subHeaderFont
        fpSpread.Sheets(0).Rows(startRow).HorizontalAlignment = CellHorizontalAlignment.Left
        fpSpread.Sheets(0).Rows(startRow).CellPadding.Top = 2
        If actualColIndex > -1 Then
            fpSpread.Sheets(0).Cells(startRow + 1, actualColIndex).BackColor = actualColor
            fpSpread.Sheets(0).Cells(startRow, actualColIndex + 1).Text = "Actual"
            fpSpread.Sheets(0).AddSpanCell(startRow, actualColIndex + 1, 3, 1)
        End If
        If targetColIndex > -1 Then
            fpSpread.Sheets(0).Cells(startRow + 1, targetColIndex).BackColor = targetColor
            fpSpread.Sheets(0).Cells(startRow, targetColIndex + 1).Text = "Target"
            fpSpread.Sheets(0).AddSpanCell(startRow, targetColIndex + 1, 3, 1)
        End If
        If badColIndex > -1 Then
            fpSpread.Sheets(0).Cells(startRow + 1, badColIndex).BackColor = badColor
            fpSpread.Sheets(0).Cells(startRow, badColIndex + 1).Text = "Bad"
            fpSpread.Sheets(0).AddSpanCell(startRow, badColIndex + 1, 3, 1)
        End If
        If goodColIndex > -1 Then
            fpSpread.Sheets(0).Cells(startRow + 1, goodColIndex).BackColor = goodColor
            fpSpread.Sheets(0).Cells(startRow, goodColIndex + 1).Text = "Good"
            fpSpread.Sheets(0).AddSpanCell(startRow, goodColIndex + 1, 3, 1)
        End If
        If actualUnitColIndex > -1 Then
            fpSpread.Sheets(0).Cells(startRow + 1, actualUnitColIndex).BackColor = actualUnitColor
            fpSpread.Sheets(0).Cells(startRow, actualUnitColIndex + 1).Text = "Units"
            fpSpread.Sheets(0).AddSpanCell(startRow, actualUnitColIndex + 1, 3, 1)
        End If

    End Sub
    'Create a method for color calculation
    Private Function Darker(color__1 As Color, delta As Integer) As Color
        Dim r As Integer = color__1.R - delta
        Dim g As Integer = color__1.G - delta
        Dim b As Integer = color__1.B - delta
        If r > &HFF Then
            r = &HFF
        End If
        If r < 0 Then
            r = 0
        End If
        If g > &HFF Then
            g = &HFF
        End If
        If g < 0 Then
            g = 0
        End If
        If b > &HFF Then
            b = &HFF
        End If
        If b < 0 Then
            b = 0
        End If
        Return Color.FromArgb(r, g, b)
    End Function
#End Region
End Class

'
'
'

Partial Class DashBoard
	''' <summary> 
	''' Required designer variable.
	''' </summary>
	Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary> 
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Shadows Sub Dispose(disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Component Designer generated code"

    ''' <summary> 
    ''' Required method for Designer support - do not modify 
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
		Dim flatScrollBarRenderer1 As New FarPoint.Win.Spread.FlatScrollBarRenderer()
		Dim flatScrollBarRenderer2 As New FarPoint.Win.Spread.FlatScrollBarRenderer()
		Me.fpSpread = New FarPoint.Win.Spread.FpSpread(FarPoint.Win.Spread.LegacyBehaviors.None)
		Me.fpSpread_Sheet1 = New FarPoint.Win.Spread.SheetView()
		Me.fpSpread_Sheet2 = New FarPoint.Win.Spread.SheetView()
		Me.pnlMain.SuspendLayout()
		DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).BeginInit()
		DirectCast(Me.fpSpread_Sheet1, System.ComponentModel.ISupportInitialize).BeginInit()
		DirectCast(Me.fpSpread_Sheet2, System.ComponentModel.ISupportInitialize).BeginInit()
		Me.SuspendLayout()
		' 
		' pnlMain
		' 
		Me.pnlMain.Controls.Add(Me.fpSpread)
		Me.pnlMain.Size = New System.Drawing.Size(547, 574)
		' 
		' pnlControls
		' 
		Me.pnlControls.Size = New System.Drawing.Size(181, 574)
		' 
		' fpSpread
		' 
		Me.fpSpread.AccessibleDescription = "fpSpread, Data, Row 0, Column 0"
		Me.fpSpread.Dock = System.Windows.Forms.DockStyle.Fill
		Me.fpSpread.HorizontalScrollBar.Buttons = New FarPoint.Win.Spread.FpScrollBarButtonCollection("BackwardLineButton,ThumbTrack,ForwardLineButton")
		Me.fpSpread.HorizontalScrollBar.Name = ""
		flatScrollBarRenderer1.ArrowColor = System.Drawing.Color.FromArgb(CInt(CByte(121)), CInt(CByte(121)), CInt(CByte(121)))
		flatScrollBarRenderer1.BackColor = System.Drawing.Color.FromArgb(CInt(CByte(255)), CInt(CByte(255)), CInt(CByte(255)))
		flatScrollBarRenderer1.BorderActiveColor = System.Drawing.Color.FromArgb(CInt(CByte(171)), CInt(CByte(171)), CInt(CByte(171)))
		flatScrollBarRenderer1.TrackBarBackColor = System.Drawing.Color.FromArgb(CInt(CByte(219)), CInt(CByte(219)), CInt(CByte(219)))
		Me.fpSpread.HorizontalScrollBar.Renderer = flatScrollBarRenderer1
		Me.fpSpread.Location = New System.Drawing.Point(0, 0)
		Me.fpSpread.Name = "fpSpread"
		Me.fpSpread.Sheets.AddRange(New FarPoint.Win.Spread.SheetView() {Me.fpSpread_Sheet1, Me.fpSpread_Sheet2})
		Me.fpSpread.Size = New System.Drawing.Size(547, 574)
		Me.fpSpread.TabIndex = 0
		Me.fpSpread.VerticalScrollBar.Buttons = New FarPoint.Win.Spread.FpScrollBarButtonCollection("BackwardLineButton,ThumbTrack,ForwardLineButton")
		Me.fpSpread.VerticalScrollBar.Name = ""
		flatScrollBarRenderer2.ArrowColor = System.Drawing.Color.FromArgb(CInt(CByte(121)), CInt(CByte(121)), CInt(CByte(121)))
		flatScrollBarRenderer2.BackColor = System.Drawing.Color.FromArgb(CInt(CByte(255)), CInt(CByte(255)), CInt(CByte(255)))
		flatScrollBarRenderer2.BorderActiveColor = System.Drawing.Color.FromArgb(CInt(CByte(171)), CInt(CByte(171)), CInt(CByte(171)))
		flatScrollBarRenderer2.TrackBarBackColor = System.Drawing.Color.FromArgb(CInt(CByte(219)), CInt(CByte(219)), CInt(CByte(219)))
		Me.fpSpread.VerticalScrollBar.Renderer = flatScrollBarRenderer2
		Me.fpSpread.ActiveSheetIndex = 1
		' 
		' fpSpread_Sheet1
		' 
		Me.fpSpread_Sheet1.Reset()
		Me.fpSpread_Sheet1.SheetName = "DashBoard"
		' Formulas and custom names must be loaded with R1C1 reference style
		Me.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
		Me.fpSpread_Sheet1.ColumnFooter.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ColumnFooter.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ColumnFooterSheetCornerStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ColumnFooterSheetCornerStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ColumnHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ColumnHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.RowHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.RowHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.SheetCornerStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.SheetCornerStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
		' 
		' fpSpread_Sheet2
		' 
		Me.fpSpread_Sheet2.Reset()
		Me.fpSpread_Sheet2.SheetName = "Data"
		' Formulas and custom names must be loaded with R1C1 reference style
		Me.fpSpread_Sheet2.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.R1C1
		Me.fpSpread_Sheet2.ColumnFooter.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ColumnFooter.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ColumnFooterSheetCornerStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ColumnFooterSheetCornerStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ColumnHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ColumnHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.RowHeader.DefaultStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.RowHeader.DefaultStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.SheetCornerStyle.BackColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.SheetCornerStyle.ForeColor = System.Drawing.Color.Empty
		Me.fpSpread_Sheet2.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1
		' 
		' DashBoard
		' 
		Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
		Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
		Me.Name = "DashBoard"
		Me.Size = New System.Drawing.Size(729, 574)
		Me.pnlMain.ResumeLayout(False)
		DirectCast(Me.fpSpread, System.ComponentModel.ISupportInitialize).EndInit()
		DirectCast(Me.fpSpread_Sheet1, System.ComponentModel.ISupportInitialize).EndInit()
		DirectCast(Me.fpSpread_Sheet2, System.ComponentModel.ISupportInitialize).EndInit()
		Me.ResumeLayout(False)

	End Sub

	#End Region

	Private fpSpread As FarPoint.Win.Spread.FpSpread
	Private fpSpread_Sheet1 As FarPoint.Win.Spread.SheetView
	Private fpSpread_Sheet2 As FarPoint.Win.Spread.SheetView
End Class