Raysoft.Framework.Spead.SpreadHelper

//======================================================================
//
//        Copyright (C) 2007-2008 RaySoft
//        All rights reserved
//        guid1:              4b887cc8-ac8c-4397-bff3-628761c59f48
//        guid2:              80f46765-0f16-44c4-a542-2b7eb38522f7
//        guid3:              923c4a79-98ea-4148-8d1a-e13993a55545
//        guid4:              da27be46-708a-453f-aa4d-25e96d116917
//        guid5:              05158992-6744-44d1-9bcb-cb422e35afbf
//        CLR版本:            2.0.50727.5448
//        新建项输入的名称:   SpreadHelper
//        机器名称:           RAY-PC
//        注册组织名:         
//        命名空间名称:       RaySoft.Common
//        文件名:             SpreadHelper
//        当前系统时间:       2011/11/15 12:39:08
//        当前登录用户名:     Administrator
//        创建年份:           2011
//
//        created by Ray at  2011/11/15 12:39:08
//
//======================================================================

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using FarPoint.Win;
using FarPoint.Win.Spread;
using System.Windows.Forms;

namespace Raysoft.Framework.Spread
{
    public class SpreadHelper
    {
        #region 设置单元格字体样式

        /// <summary>
        /// 设置单元格字体样式
        /// </summary>
        /// <param name="fpSpread"></param>
        /// <param name="cellrange"></param>
        /// <param name="fontFamliy"></param>
        /// <param name="fontStyle"></param>
        /// <param name="fontSize"></param>
        /// <returns></returns>
        public static bool SetFont(FpSpread fpSpread, FarPoint.Win.Spread.Model.CellRange[] cellrange, string fontFamliy, FontStyle fontStyle, float fontSize)
        {
            foreach (FarPoint.Win.Spread.Model.CellRange range in cellrange)
            {
                for (int i = range.Row; i < range.RowCount + range.Row; i++)
                {
                    for (int j = range.Column; j < range.ColumnCount + range.Column; j++)
                    {
                        Font font = new Font(fontFamliy, fontSize, fontStyle);
                        fpSpread.ActiveSheet.Cells[i, j].Font = font;
                    }
                }
            }
            return true;
        }

        #endregion

        #region 设置单元格表格线

        /// <summary>
        /// 设置单元格表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="leftBorder"></param>
        /// <param name="topBorder"></param>
        /// <param name="rightBorder"></param>
        /// <param name="bottomBorder"></param>
        /// <returns></returns>
        public static bool SetComplexSingeCellBorders(FpSpread fps, int row, int col, FarPoint.Win.ComplexBorderSide leftBorder, FarPoint.Win.ComplexBorderSide topBorder, FarPoint.Win.ComplexBorderSide rightBorder, FarPoint.Win.ComplexBorderSide bottomBorder)
        {
            if (leftBorder != null & topBorder == null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, null, null);
            }//Left
            else if (leftBorder == null & topBorder != null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, null, null);
            }//Top
            else if (leftBorder == null & topBorder == null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, rightBorder, null);
            }//Right
            else if (leftBorder == null & topBorder == null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, null, bottomBorder);
            }//Bottom
            else if (leftBorder != null & topBorder != null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, null, null);
            }//Left + Top
            else if (leftBorder != null & topBorder == null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, rightBorder, null);
            }//Left + Right
            else if (leftBorder != null & topBorder == null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, null, bottomBorder);
            }//Left + Bottom
            else if (leftBorder == null & topBorder != null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, rightBorder, null);
            }//Top + Right
            else if (leftBorder == null & topBorder != null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, null, bottomBorder);
            }//Top + Bottom
            else if (leftBorder == null & topBorder == null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, rightBorder, bottomBorder);
            }//Right + Bottom
            else if (leftBorder != null & topBorder != null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, rightBorder, null);
            }//Left + Top + Right
            else if (leftBorder != null & topBorder != null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, null, bottomBorder);
            }//Left + Top + Bottom
            else if (leftBorder != null & topBorder == null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, null, bottomBorder);
            }//Left + Right + Bottom
            else if (leftBorder == null & topBorder != null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, rightBorder, bottomBorder);
            }//Top + Right + Bottom 原版中没有这一项.
            else if (leftBorder != null & topBorder != null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, leftBorder, bottomBorder);
            }//Left + Top + Right + Bottom
            else
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, null, null);
            }//All Null
            return true;
        }

        #endregion

        #region 清除表格线
        /// <summary>
        /// 清除表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool ClearAllCellBoders(FpSpread fps)
        {
            fps.ActiveSheet.HorizontalGridLine = new GridLine(FarPoint.Win.Spread.GridLineType.None);
            fps.ActiveSheet.VerticalGridLine = new GridLine(FarPoint.Win.Spread.GridLineType.None);
            return true;
        }
        #endregion

        #region 设置单元格对齐

        /// <summary>
        /// 设置单元格对齐
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="HorizontalAlignment"></param>
        /// <param name="VerticalAlignment"></param>
        /// <returns></returns>
        public static bool setCellAlignmentForRange(FpSpread fps, int row, int col, int row2, int col2, CellHorizontalAlignment HorizontalAlignment, CellVerticalAlignment VerticalAlignment)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].HorizontalAlignment = HorizontalAlignment;
            fps.ActiveSheet.Cells[row, col, row2, col2].VerticalAlignment = VerticalAlignment;
            return true;
        }
        #endregion

        #region 设置单元格的值

        /// <summary>
        /// 设置单元格的值
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="textVal"></param>
        /// <returns></returns>
        public static bool setValue(FpSpread fps, int row, int col, string textVal)
        {
            fps.ActiveSheet.SetValue(row, col, textVal);
            return true;
        }

        #endregion

        #region 设置单元格背景颜色

        /// <summary>
        /// 设置单元格背景颜色
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="row2"></param>
        /// <param name="col"></param>
        /// <param name="col2"></param>
        /// <param name="theBackColor"></param>
        /// <returns></returns>
        public static bool setBackColorForRange(FpSpread fps, int row, int row2, int col, int col2, Color theBackColor)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].BackColor = theBackColor;
            return true;
        }

        #endregion

        #region 设置单元格前景颜色

        /// <summary>
        /// 设置单元格前景颜色
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="theForceColor"></param>
        /// <returns></returns>
        public static bool setForceColorForRange(FpSpread fps, int row, int col, int row2, int col2, Color theForceColor)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].ForeColor = theForceColor;
            return true;
        }

        #endregion

        #region 设置单元格文本
        /// <summary>
        /// 设置单元格的文本
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="sText"></param>
        /// <returns></returns>
        public static bool setText(FpSpread fps, int row, int col, string sText)
        {
            fps.ActiveSheet.SetValue(row, col, sText);
            return true;
        }
        #endregion

        #region 设置指定行行高

        public static bool setRowHeightForRange(FpSpread fps, int row, int col, int row2, int col2, Single rowHeightInPixels)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].Row.Height = rowHeightInPixels;
            return true;
        }
        #endregion

        #region 设置指定列列宽

        public static bool setColumnWidthForRange(FpSpread fps, int row, int col, int row2, int col2, Single columnWidthInPixels)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].Column.Width = columnWidthInPixels;
            return true;
        }
        #endregion

        #region 设置单元格简单表格线
        /// <summary>
        /// 设置单元格简单表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setSingleCellBorders(FpSpread fps, int row, int col, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide topBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col].Border = new ComplexBorder(leftBorder, topBorder, rightBorder, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定区域简单表格线
        /// <summary>
        /// 设置指定区域简单表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="?"></param>
        /// <param name="?"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool SetSingleCellBordersForRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide topBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(leftBorder, topBorder, rightBorder, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定区域简单左边线
        /// <summary>
        /// 设置指定区域简单左边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setLeftBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(leftBorder, null, null, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单上边线
        /// <summary>
        /// 设置指定区域简单上边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setTopBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide TopBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, TopBorder, null, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单右边线
        /// <summary>
        /// 设置指定区域简单右边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setRightBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, null, rightBorder, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单下边线
        /// <summary>
        /// 设置指定区域简单下边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setBottomBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, null, null, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定单元格标签

        /// <summary>
        /// 设置指定单元格标签
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        public static bool setCellTag(FpSpread fps, int row, int col, string tag)
        {
            fps.ActiveSheet.Models.Data.SetTag(row, col, tag);
            return true;
        }

        #endregion

        #region 得到指定单元格标签

        /// <summary>
        /// 得到指定单元格标签
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        public static bool getCellTag(FpSpread fps, int row, int col)
        {
            fps.ActiveSheet.Models.Data.GetTag(row,col);
            return true;
        }

        #endregion

        private SpreadHelper() { }

        /// <summary>
        /// 通过单元格名称返回当前列号
        /// </summary>
        /// <param name="CellName">单元格名称</param>
        /// <returns></returns>
        public static int getColumnNum(string CellName)
        {
            int retVal = 0;
            string rowNum = "";
            Regex r = new Regex(@"[a-zA-Z]+");
            Match m = r.Match(CellName);
            rowNum = m.Value.ToUpper();

            char[] ch = rowNum.ToCharArray();
            for (int i = 0; i < rowNum.Length; i++)
            {
                retVal += ((ch[i] - 'A') + 1) * (int)Math.Pow(26, rowNum.Length - 1 - i);
            }

            retVal = retVal - 1;
            return retVal;

        }

        /// <summary>
        /// 通过单元格名称返回当前行号
        /// </summary>
        /// <param name="CellName">单元格名称</param>
        /// <returns></returns>
        public static int getRowNum(string CellName)
        {
            int retVal = 0;
            Regex r = new Regex(@"[0-9]+");
            Match m = r.Match(CellName);
            retVal = int.Parse(m.Value) - 1;
            return retVal;
        }


        /// <summary>
        /// 没有使用
        /// </summary>
        /// <param name="CellName"></param>
        /// <returns></returns>
        public static int[] GetCellID(string CellName)
        {
            int[] retVal = new int[2];
            string rowNum = "";
            Regex rRow = new Regex(@"[a-zA-Z]+");
            Match mRow = rRow.Match(CellName);
            rowNum = mRow.Value.ToUpper();

            char[] ch = rowNum.ToCharArray();
            for (int i = 0; i < rowNum.Length; i++)
            {
                retVal[0] += ((ch[i] - 'A') + 1) * (int)Math.Pow(26, rowNum.Length - 1 - i);
            }
            retVal[0] = retVal[0] - 1;

            Regex rCol = new Regex(@"[0-9]+");
            Match mCol = rCol.Match(CellName);
            retVal[1] = int.Parse(mCol.Value.ToString()) - 1;
            return retVal;
        }


        //public static bool addSheets(FpSpread fps, int numOfSheets, int startingNumberOfColumns, int startingNumberOfRows, bool protectionLikeExcelTF, Color sheetBackColor, HeaderAutoText rowHeaderAutoText, HeaderAutoText ColumnHeaderAutoText) 
        //{
        //    //'Adds a Sheet for Each Question and Sets the number of Rows and Column
        //    int x, y, z;
        //    fps.Sheets.Count = 0;
        //    //'Create the Sheets
        //    for int x=0,
        //}

        //Public Function AddSheets(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal NumberOfSheets As Integer, ByVal StartingNumberOfColumns As Integer, ByVal StartingNumberOfRows As Integer, ByVal ProtectionLikeExcelTF As Boolean, ByVal SheetBackColor As System.Drawing.Color, ByVal RowHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText, ByVal ColumnHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText) As Boolean

        //Dim x As Integer
        //Dim y As Integer
        //Dim z As Integer
        //SSControlToUse.Sheets.Count = 0
        //'Create the Sheets
        //For x = 0 To NumberOfSheets
        //Dim s As New FarPoint.Win.Spread.SheetView
        //s.ColumnCount = StartingNumberOfColumns
        //s.RowCount = StartingNumberOfRows
        //SSControlToUse.Sheets.Add(s)
        //Dim info As New FarPoint.Win.Spread.StyleInfo
        //'Set the BackColor
        //info.BackColor = SheetBackColor
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).DefaultStyle = info
        //'Set Protection Scheme to be like Excels for each sheet
        //For y = 0 To (StartingNumberOfRows - 1)
        //For z = 0 To (StartingNumberOfColumns - 1)
        //s.Cells(y, z).Locked = ProtectionLikeExcelTF
        //Next z
        //Next y
        //SSControlToUse.Sheets(x).RowHeaderAutoText = RowHeaderAutoText
        //SSControlToUse.Sheets(x).ColumnHeaderAutoText = ColumnHeaderAutoText
        //Next x
        //AddSheets = True
        //End Function 'AddSheets


        //Public Function AddSingleSheet(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal StartingNumberOfColumns As Integer, ByVal StartingNumberOfRows As Integer, ByVal ProtectionLikeExcelTF As Boolean, ByVal SheetBackColor As System.Drawing.Color, ByVal RowHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText, ByVal ColumnHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText) As Boolean
        //'Adds a Sheet for Each Question and Sets the number of Rows and Column
        //Dim x As Integer
        //Dim y As Integer
        //'Create the Sheets
        //Dim s As New FarPoint.Win.Spread.SheetView
        //s.ColumnCount = StartingNumberOfColumns
        //s.RowCount = StartingNumberOfRows
        //SSControlToUse.Sheets.Add(s)
        //Dim info As New FarPoint.Win.Spread.StyleInfo
        //'Set the BackColor
        //info.BackColor = SheetBackColor
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).DefaultStyle = info
        //'Set Protection Scheme to be like Excels for each sheet
        //For x = 0 To (StartingNumberOfRows - 1)
        //For y = 0 To (StartingNumberOfColumns - 1)
        //s.Cells(x, y).Locked = ProtectionLikeExcelTF
        //Next y
        //Next x
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).RowHeaderAutoText = RowHeaderAutoText
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).ColumnHeaderAutoText = ColumnHeaderAutoText
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).GrayAreaBackColor = Color.SlateGray
        //' Set operation mode and let users select multiple blocks of cells 
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).OperationMode = FarPoint.Win.Spread.OperationMode.Normal
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.MultiRange
        //AddSingleSheet = True
        //End Function 'AddSingleSheet


        //Public Function SSControlGlobals(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal EditModePermanentEntireWorkBookTF As Boolean, ByVal AllowCellOverFlowEntireWorkBookTF As Boolean, ByVal ControlsTabStripPolicy As FarPoint.Win.Spread.TabStripPolicy, ByVal TabStripPercentToShow As Single) As Boolean
        //' Set the sheet tabs policy
        //SSControlToUse.TabStripPolicy = ControlsTabStripPolicy
        //' Set the Tab Strip width to: .??
        //SSControlToUse.TabStripRatio = TabStripPercentToShow
        //'Eliminate the focus rectangle for the ENTIRE Control
        //SSControlToUse.EditModePermanent = EditModePermanentEntireWorkBookTF
        //'Allow Cell Text Overflow for the ENTIRE Control
        //SSControlToUse.AllowCellOverflow = AllowCellOverFlowEntireWorkBookTF

        //SSControlToUse.SelectionBlockOptions = FarPoint.Win.Spread.SelectionBlockOptions.Cells


        //End Function


        //Public Function TurnProtectionOnOffForAllSheetsInControl(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal TurnProtectionOn As Boolean) As Boolean
        //Dim x As Integer
        //Dim NumberOfSheets As Int16 = SSControlToUse.Sheets.Count

        //For x = 0 To NumberOfSheets - 1
        //SSControlToUse.Sheets(x).Protect = TurnProtectionOn
        //Next x
        //End Function


        //Public Function SetFont(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle) As Boolean
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SetFont = True
        //End Function 'SetFontBold


        //Public Function SetCellSpan(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal StartRow As Integer, ByVal StartCol As Integer, ByVal RowsToSpanCount As Integer, ByVal ColsToSpanCount As Integer) As Boolean
        //SSControlToUse.ActiveSheet.AddSpanCell(StartRow, StartCol, RowsToSpanCount, ColsToSpanCount)
        //SetCellSpan = True
        //End Function 'SetCellSpan


        //Public Function SetCellTypeTextForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal MultilineTF As Boolean, ByVal WordWrapTF As Boolean, ByVal ReadOnlyTF As Boolean, ByVal TypeOfScrollBars As System.Windows.Forms.ScrollBars, ByVal MaximumNumberOfCharacters As Int16, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.TextCellType
        //ct.Multiline = MultilineTF
        //ct.WordWrap = WordWrapTF
        //ct.ReadOnly = ReadOnlyTF
        //ct.ScrollBars = TypeOfScrollBars
        //ct.MaxLength = MaximumNumberOfCharacters
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeTextForRange = True
        //End Function 'SetCellTypeTextForRange

        //Public Function SetCellTypeGeneralForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal WordWrapTF As Boolean, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.GeneralCellType
        //ct.WordWrap = WordWrapTF
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeGeneralForRange = True
        //End Function 'SetCellTypeGeneralForRange

        //Public Function SetCellTypeButtonForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ButtonColor As Color, ByVal ButtonText As String, ByVal ButtonTextColor As Color, ByVal WordWrapTF As Boolean, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ButtonCellType
        //ct.ButtonColor = ButtonColor
        //ct.Text = ButtonText
        //ct.TextColor = ButtonTextColor
        //ct.WordWrap = WordWrapTF
        //ct.TwoState = False
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeButtonForRange = True
        //End Function 'SetCellTypeButtonForRange


        //Public Function SetCellTypeRadioButtonForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal RadioButtonItemsTextVBTabbed As String, ByVal RadioBtnOrientation As FarPoint.Win.RadioOrientation, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.MultiOptionCellType
        //'MUST Send In Item List as vbTab separated text
        //Dim ItemList() As String = Split(RadioButtonItemsTextVBTabbed, vbTab)
        //ct.Items = ItemList
        //ct.Orientation = RadioBtnOrientation
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //'SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = RadioBtnBackColor
        //'SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = RadioBtnForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeRadioButtonForRange = True
        //End Function 'SetCellTypeRadioButtonForRange

        //Public Function SetCellTypeCheckBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ChkBoxTextAlgnment As FarPoint.Win.ButtonTextAlign, ByVal ChkBoxTextIfTrue As String, ByVal ChkBoxTextIfFalse As String, ByVal ChkBoxBackColor As Color, ByVal ChkBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.CheckBoxCellType
        //ct.TextAlign = ChkBoxTextAlgnment
        //ct.TextTrue = ChkBoxTextIfTrue
        //ct.TextFalse = ChkBoxTextIfFalse
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ChkBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ChkBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeCheckBoxForRange = True
        //End Function 'SetCellTypeCheckBoxForRange


        //Public Function SetCellTypeComboBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ComboTextEditable As Boolean, ByVal ComboBoxItemsTextVBTabbed As String, ByVal ComboListAlignment As FarPoint.Win.ListAlignment, ByVal PixelsToOffsetListFromAttachedCell As Integer, ByVal ListWidthInPixels As Integer, ByVal NumbeofItemsToDisplayInDropdown As Integer, ByVal MaxLengthOfCharactersToDisplayInCell As Integer, ByVal ComboBoxBackColor As Color, ByVal ComboBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //'MUST Send In Item List as vbTab separated text
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //'MUST Send In Item List as vbTab separated text
        //Dim ItemList() As String = Split(ComboBoxItemsTextVBTabbed, vbTab)
        //ct.Editable = ComboTextEditable
        //ct.Items = ItemList
        //ct.ListAlignment = ComboListAlignment
        //ct.ListOffset = PixelsToOffsetListFromAttachedCell
        //ct.ListWidth = ListWidthInPixels
        //ct.MaxDrop = NumbeofItemsToDisplayInDropdown
        //ct.MaxLength = MaxLengthOfCharactersToDisplayInCell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ComboBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ComboBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeComboBoxForRange = True
        //End Function 'SetCellTypeComboBoxForRange


        //Public Function SetCellTypeComboBoxForRangeFor1DArray(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ComboTextEditable As Boolean, ByVal ComboBoxItemsText1DArray As String(), ByVal ComboListAlignment As FarPoint.Win.ListAlignment, ByVal PixelsToOffsetListFromAttachedCell As Integer, ByVal ListWidthInPixels As Integer, ByVal NumbeofItemsToDisplayInDropdown As Integer, ByVal MaxLengthOfCharactersToDisplayInCell As Integer, ByVal ComboBoxBackColor As Color, ByVal ComboBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //ct.Editable = ComboTextEditable
        //ct.Items = ComboBoxItemsText1DArray
        //ct.ListAlignment = ComboListAlignment
        //ct.ListOffset = PixelsToOffsetListFromAttachedCell
        //ct.ListWidth = ListWidthInPixels
        //ct.MaxDrop = NumbeofItemsToDisplayInDropdown
        //ct.MaxLength = MaxLengthOfCharactersToDisplayInCell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ComboBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ComboBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeComboBoxForRangeFor1DArray = True
        //End Function 'SetCellTypeComboBoxForRangeFor1DArray


        //Public Function SetCellTypeMaskForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal Mask As String, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim maskcell As New FarPoint.Win.Spread.CellType.MaskCellType
        //maskcell.Mask = Mask
        //'maskcell.StringTrim = StringTrimming.Character
        //'maskcell.MaskChar = ""
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = maskcell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeMaskForRange = True
        //End Function 'SetCellTypeMaskForRange


        //Public Function SetCellTypeNumberForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal DecimalSeparator As String, ByVal DecimalPlaces As Integer, ByVal LeadingZero As FarPoint.Win.Spread.CellType.LeadingZero, ByVal MaximumValue As Double, ByVal MinimumValue As Double, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim nmbrcell As New FarPoint.Win.Spread.CellType.NumberCellType
        //nmbrcell.DecimalSeparator = DecimalSeparator
        //nmbrcell.DecimalPlaces = DecimalPlaces
        //nmbrcell.LeadingZero = LeadingZero ' FarPoint.Win.Spread.CellType.LeadingZero.UseRegional
        //nmbrcell.MaximumValue = MaximumValue
        //nmbrcell.MinimumValue = MinimumValue
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = nmbrcell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeNumberForRange = True
        //End Function 'SetCellTypeNumberForRange


        //Public Function SetRowHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal HorizontalAlignment As FarPoint.Win.spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal LabelText As String) As Boolean
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).HorizontalAlignment = HorizontalAlignment
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).VerticalAlignment = VerticalAlignment
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).Label = LabelText
        //SetRowHeaderText = True
        //End Function 'SetRowHeaderText


        //Public Function SetRowHeaderColumnCount(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal ColumnCount As Integer) As Boolean
        //Dim r As FarPoint.Win.Spread.RowHeader
        //r = SSControlToUse.ActiveSheet.RowHeader
        //r.ColumnCount = ColumnCount
        //SetRowHeaderColumnCount = True
        //End Function 'SetRowHeaderColumnCount


        //Public Function SetRowHeaderBackColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal BackColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).BackColor = BackColor
        //SetRowHeaderBackColor = True
        //End Function 'SetRowHeaderBackColor


        //Public Function SetSpecialRowHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal HorizontalAlignment As FarPoint.Win.Spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.Spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal BackColor As System.Drawing.Color, ByVal foreColor As System.Drawing.Color, ByVal TheText As String) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).HorizontalAlignment = HorizontalAlignment
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).VerticalAlignment = VerticalAlignment
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).Font = New Font(FontFamily, FontSize, FontStyle)
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).BackColor = BackColor
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).ForeColor = foreColor
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).Text = TheText
        //SetSpecialRowHeaderText = True
        //End Function 'SetSpecialRowHeaderText


        //Public Function SetSpecialColumnHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal HorizontalAlignment As FarPoint.Win.Spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.Spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal BackColor As System.Drawing.Color, ByVal foreColor As System.Drawing.Color, ByVal TheText As String) As Boolean
        //Dim ch As FarPoint.Win.Spread.ColumnHeader
        //ch = SSControlToUse.ActiveSheet.ColumnHeader
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).HorizontalAlignment = HorizontalAlignment
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).VerticalAlignment = VerticalAlignment
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).Font = New Font(FontFamily, FontSize, FontStyle)
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).BackColor = BackColor
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).ForeColor = foreColor
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).Text = TheText
        //SetSpecialColumnHeaderText = True
        //End Function 'SetSpecialColumnHeaderText


        //Public Function SetRowHeaderForeColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal ForeColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).ForeColor = ForeColor
        //SetRowHeaderForeColor = True
        //End Function 'SetRowHeaderBackColor


        //Public Function SetColumnHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Col As Integer, ByVal HorizontalAlignment As FarPoint.Win.spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal LabelText As String) As Boolean
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).HorizontalAlignment = HorizontalAlignment
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).VerticalAlignment = VerticalAlignment
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).Label = LabelText
        //SetColumnHeaderText = True
        //End Function 'SetColumnHeaderText


        //Public Function SetColumnHeaderRowCount(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowCount As Integer) As Boolean
        //Dim r As FarPoint.Win.Spread.ColumnHeader
        //r = SSControlToUse.ActiveSheet.ColumnHeader
        //r.RowCount = RowCount
        //SetColumnHeaderRowCount = True
        //End Function 'SetRowHeaderColumnCount


        //Public Function SetColumnHeaderSpan(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Column As Integer, ByVal RowCount As Integer, ByVal ColumnCount As Integer) As Boolean
        //SSControlToUse.ActiveSheet.AddColumnHeaderSpanCell(Row, Column, RowCount, ColumnCount)
        //End Function


        //Public Function SetColumnHeaderBackColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal BackColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.ColumnHeader
        //rh = SSControlToUse.ActiveSheet.ColumnHeader
        //rh.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).BackColor = BackColor
        //SetColumnHeaderBackColor = True
        //End Function 'SetColumnHeaderBackColor


        //Public Function SetColumnHeaderForeColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal ForeColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.ColumnHeader
        //rh = SSControlToUse.ActiveSheet.ColumnHeader
        //rh.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).ForeColor = ForeColor
        //SetColumnHeaderForeColor = True
        //End Function 'SetColumnHeaderForeColor

        //Public Function ClearComboBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //ct.Clear()
        //ClearComboBoxForRange = True
        //End Function 'ClearComboBoxForRange


    }
}

New Version

//======================================================================
//
//        Copyright (C) 2007-2008 RaySoft
//        All rights reserved
//        guid1:              4b887cc8-ac8c-4397-bff3-628761c59f48
//        guid2:              80f46765-0f16-44c4-a542-2b7eb38522f7
//        guid3:              923c4a79-98ea-4148-8d1a-e13993a55545
//        guid4:              da27be46-708a-453f-aa4d-25e96d116917
//        guid5:              05158992-6744-44d1-9bcb-cb422e35afbf
//        CLR版本:            2.0.50727.5448
//        新建项输入的名称:   SpreadHelper
//        机器名称:           RAY-PC
//        注册组织名:         
//        命名空间名称:       Ray.Spread
//        文件名:             SpreadHelper
//        当前系统时间:       2013/07/24
//        当前登录用户名:     Administrator
//        创建年份:           2013
//
//======================================================================

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Text.RegularExpressions;

using FarPoint.Win;
using FarPoint.Win.Spread;
using FarPoint.Win.Spread.Model;
using FarPoint.Win.Spread.Design;

namespace Ray.Spread
{
    public class SpreadHelper
    {
        public SpreadHelper() { }

        #region 设置单元格字体
 
        /// <summary>
        /// 设置单元格字体名称
        /// </summary>
        /// <param name="fpSpread" >表格控件</param>
        /// <param name="cellRange">范围</param>
        /// <param name="FontName">字体名称</param>
        public static void SetFontFamilyForRange(FpSpread fpSpread, CellRange[] cellRanges, string FontName)
        {
            foreach (CellRange cellRange in cellRanges)
            {
                for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                {
                    for (int column = cellRange.Column; column < cellRange.Column + cellRange.ColumnCount; column++)
                    {
                        Font font = fpSpread.ActiveSheet.Cells[row, column].Font == null ? fpSpread.ActiveSheet.DefaultStyle.Font : fpSpread.ActiveSheet.Cells[row, column].Font;
                        fpSpread.ActiveSheet.Cells[row, column].Font = new Font(FontName, font.Size, font.Style);
                    }
                }
            }
        }

        /// <summary>
        /// 设置单元格字体大小
        /// </summary>
        /// <param name="fpSpread" >表格控件</param>
        /// <param name="cellRange">范围</param>
        /// <param name="FontSize">字体大小</param>
        public static void SetFontSizeForRange(FpSpread fpSpread, CellRange[] cellRanges, float fontSize)
        {
            foreach (CellRange cellRange in cellRanges)
            {
                for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                {
                    for (int column = cellRange.Column; column < cellRange.Column + cellRange.ColumnCount; column++)
                    {
                        Font font = fpSpread.ActiveSheet.Cells[row, column].Font == null ? fpSpread.ActiveSheet.DefaultStyle.Font : fpSpread.ActiveSheet.Cells[row, column].Font;
                        fpSpread.ActiveSheet.Cells[row, column].Font = new Font(font.FontFamily.Name, fontSize, font.Style);
                    }
                }
            }
        }

        /// <summary>
        /// 设置单元格字体样式
        /// </summary>
        /// <param name="fpSpread" >表格控件</param>
        /// <param name="cellRange">范围</param>
        /// <param name="FontStyle">字休样式</param>
        /// <param name="style" ></param>
        /// <param name="val" ></param>
        public static void SetFontStyleForRange(FpSpread fpSpread, CellRange[] cellRanges,string style, bool val)
        {
            string fs;
            foreach (CellRange cellRange in cellRanges)
            {
                for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                {
                    for (int column = cellRange.Column; column < cellRange.Column + cellRange.ColumnCount; column++)
                    {
                        Font font = fpSpread.ActiveSheet.Cells[row, column].Font == null ? fpSpread.ActiveSheet.DefaultStyle.Font : fpSpread.ActiveSheet.Cells[row, column].Font;
                        fs = "";
                        if (style == "Bold")
                        {
                            if (font.Italic)
                            {
                                fs += "Italic,";
                            }
                            if (font.Underline)
                            {
                                fs += "Underline,";
                            }
                            if (font.Strikeout)
                            {
                                fs += "Strikeout,";
                            }
                            if (val == true)
                            {
                                fs += "Bold,";
                            }
                        }
                        else if (style == "Italic")
                        {
                            if (font.Bold)
                            {
                                fs += "Bold,";
                            }
                            if (font.Underline)
                            {
                                fs += "Underline,";
                            }
                            if (font.Strikeout)
                            {
                                fs += "Strikeout,";
                            }
                            if (val == true)
                            {
                                fs += "Italic,";
                            }
                        }
                        else if (style == "Underline")
                        {
                            if (font.Bold)
                            {
                                fs += "Bold,";
                            }
                            if (font.Italic )
                            {
                                fs += "Italic,";
                            }
                            if (font.Strikeout)
                            {
                                fs += "Strikeout,";
                            }
                            if (val == true)
                            {
                                fs += "Underline,";
                            }
                        }
                        else if (style == "Strikeout")
                        {
                            if (font.Bold)
                            {
                                fs += "Bold,";
                            }
                            if (font.Italic)
                            {
                                fs += "Italic,";
                            }
                            if (font.Underline )
                            {
                                fs += "Underline,";
                            }
                            if (val == true)
                            {
                                fs += "Strikeout,";
                            }
                        }
                        else
                        {  
                        }

                        if (fs.Length > 0)
                        {
                            fpSpread.ActiveSheet.Cells[row, column].Font = new Font(font.FontFamily.Name, font.Size, (FontStyle)Enum.Parse(typeof(FontStyle), fs.Substring(0, fs.Length - 1)));
                        }
                        else
                        {
                            fpSpread.ActiveSheet.Cells[row, column].Font = new Font(font.FontFamily.Name, font.Size, (FontStyle)Enum.Parse(typeof(FontStyle), "Regular"));
                        }
                    }
                }
            }
        }

        /// <summary>
        /// 设置单元格字体样式
        /// </summary>
        /// <param name="fpSpread">表格控件</param>
        /// <param name="cellrange">范围</param>
        /// <param name="fontFamily">字体名称</param>
        /// <param name="fontStyle">字体大小</param>
        /// <param name="fontSize">字休样式</param>
        /// <returns></returns>
        public static void SetFontForRange(FpSpread fpSpread, CellRange[] cellRanges, string fontFamily, FontStyle fontStyle, float fontSize)
        {
            foreach (FarPoint.Win.Spread.Model.CellRange cellRange in cellRanges)
            {
                for (int i = cellRange.Row; i < cellRange.RowCount + cellRange.Row; i++)
                {
                    for (int j = cellRange.Column; j < cellRange.ColumnCount + cellRange.Column; j++)
                    {
                        Font font = new Font(fontFamily, fontSize, fontStyle);
                        fpSpread.ActiveSheet.Cells[i, j].Font = font;
                        
                    }
                }
            }
        }

        #endregion

        #region 设置单元格对齐

        /// <summary>
        /// 设置单元格横向对齐
        /// </summary>
        /// <param name="fpSpread" >表格控件</param>
        /// <param name="cellRange">范围</param>
        /// <param name="horizontalAlignment">横向对齐</param>
        public static void SetHorizontalAlignmentForRange(FpSpread fpSpread, CellRange[] cellRanges, FarPoint.Win.Spread.CellHorizontalAlignment horizontalAlignment)
        {
            foreach (CellRange cellRange in cellRanges)
            {
                for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                {
                    for (int column = cellRange.Column; column < cellRange.Column + cellRange.ColumnCount; column++)
                    {
                        fpSpread.ActiveSheet.Cells[row, column].HorizontalAlignment = horizontalAlignment;
                    }
                }
            }
        }
        
        /// <summary>
        /// 设置单元格纵向对齐
        /// </summary>
        /// <param name="fpSpread">表格控件</param>
        /// <param name="cellRange">范围</param>
        /// <param name="verticalAlignment">横向对齐</param>
        public static void SetVerticalAlignmentForRange(FpSpread fpSpread, CellRange[] cellRanges, CellVerticalAlignment verticalAlignment)
        {
            foreach (CellRange cellRange in cellRanges)
            {
                for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                {
                    for (int column = cellRange.Column; column < cellRange.Column + cellRange.ColumnCount; column++)
                    {
                        fpSpread.ActiveSheet.Cells[row, column].VerticalAlignment = verticalAlignment;
                    }
                }
            }
        }

        /// <summary>
        /// 设置单元格对齐
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="HorizontalAlignment"></param>
        /// <param name="VerticalAlignment"></param>
        /// <returns></returns>
        public static void setCellAlignmentForRange(FpSpread fpSpread, int row, int col, int row2, int col2, CellHorizontalAlignment HorizontalAlignment, CellVerticalAlignment VerticalAlignment)
        {
            fpSpread.ActiveSheet.Cells[row, col, row2, col2].HorizontalAlignment = HorizontalAlignment;
            fpSpread.ActiveSheet.Cells[row, col, row2, col2].VerticalAlignment = VerticalAlignment;
        }

        #endregion

        #region 设置单元格表格线

        /// <summary>
        /// 
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool SetBorderOutSideBold(FpSpread fps)
        {
            //停止重绘界面            
            fps.SuspendLayout();

            //得到用户选择区域
            CellRange[] cellRanges = fps.ActiveSheet.GetSelections();
            
            //定义一个边框
            ComplexBorderSide Border = new FarPoint.Win.ComplexBorderSide(Color.Black, 3, System.Drawing.Drawing2D.DashStyle.Solid);

            if (cellRanges != null)
            {
                foreach (CellRange cellRange in cellRanges)
                {
                    if (cellRange.RowCount == 1 && cellRange.ColumnCount == 1)//一个单元格
                    {
                        SetComplexSingeCellBorders(fps, cellRange.Row, cellRange.Column, Border, Border, Border, Border);
                    }
                    else if (cellRange.RowCount == 1)//一行
                    {
                        for (int col = cellRange.Column; col < cellRange.Column + cellRange.ColumnCount; col++)
                        {
                            if (col == cellRange.Column)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, Border, Border, null, Border);
                            }
                            else if (col == cellRange.Column + cellRange.ColumnCount - 1)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, null, Border, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, null, Border, null, Border);
                            }
                        }
                    }
                    else if (cellRange.ColumnCount == 1) //一列
                    {
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            if (row == cellRange.Row)
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, Border, Border, null);
                            }
                            else if (row == cellRange.Row + cellRange.RowCount - 1)
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, null, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, null, Border, null);
                            }
                        }
                    }
                    else//多行多列
                    {
                        //循环设置单元格上边框
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            for (int col = cellRange.Column; col < cellRange.ColumnCount + cellRange.Column; col++)
                            {
                                if (row == cellRange.Row)//第一行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, Border, null, null);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, Border, Border, null);
                                    }
                                    else//其它列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, Border, null, null);
                                    }
                                }
                                else if (row == cellRange.Row + cellRange.RowCount - 1)//最后一行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, null, null, Border);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, Border, Border);
                                    }
                                    else//其它列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, null, Border);
                                    }
                                }
                                else//其它行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, null, null, null);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, Border, null);
                                    }
                                    else
                                    {

                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                throw new Exception("未能得到用户选择的区域!");
            }
            //恢复重绘界面
            fps.ResumeLayout();

            return true;
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool SetBorderOutSide(FpSpread fps)
        {
            //停止重绘界面            
            fps.SuspendLayout();

            //得到用户选择区域
            CellRange[] cellRanges = fps.ActiveSheet.GetSelections();
            
            //定义一个边框
            ComplexBorderSide Border = new FarPoint.Win.ComplexBorderSide(Color.Black, 1, System.Drawing.Drawing2D.DashStyle.Solid);

            if (cellRanges != null)
            {
                foreach (CellRange cellRange in cellRanges)
                {
                    if (cellRange.RowCount == 1 && cellRange.ColumnCount == 1)//一个单元格
                    {
                        SetComplexSingeCellBorders(fps, cellRange.Row, cellRange.Column, Border, Border, Border, Border);
                    }
                    else if (cellRange.RowCount == 1)//一行
                    {
                        for (int col = cellRange.Column; col < cellRange.Column + cellRange.ColumnCount; col++)
                        {
                            if (col == cellRange.Column)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, Border, Border, null, Border);
                            }
                            else if (col == cellRange.Column + cellRange.ColumnCount - 1)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, null, Border, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, null, Border, null, Border);
                            }
                        }
                    }
                    else if (cellRange.ColumnCount == 1) //一列
                    {
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            if (row == cellRange.Row)
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, Border, Border, null);
                            }
                            else if (row == cellRange.Row + cellRange.RowCount - 1)
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, null, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, null, Border, null);
                            }
                        }
                    }
                    else//多行多列
                    {
                        //循环设置单元格上边框
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            for (int col = cellRange.Column; col < cellRange.ColumnCount + cellRange.Column; col++)
                            {
                                if (row == cellRange.Row)//第一行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, Border, null, null);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, Border, Border, null);
                                    }
                                    else//其它列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, Border, null, null);
                                    }
                                }
                                else if (row == cellRange.Row + cellRange.RowCount - 1)//最后一行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, null, null, Border);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, Border, Border);
                                    }
                                    else//其它列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, null, Border);
                                    }
                                }
                                else//其它行
                                {
                                    if (col == cellRange.Column)//第一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, Border, null, null, null);
                                    }
                                    else if (col == cellRange.Column + cellRange.ColumnCount - 1)//最后一列
                                    {
                                        SetComplexSingeCellBorders(fps, row, col, null, null, Border, null);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                throw new Exception("未能得到用户选择的区域!");
            }

            //恢复重绘界面
            fps.ResumeLayout();

            return true;

        }

        /// <summary>
        /// 所有边框
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool SetBorderFull(FpSpread fps)
        {
            //停止重绘界面            
            fps.SuspendLayout();

            //得到用户选择区域法
            CellRange[] cellRanges = fps.ActiveSheet.GetSelections();

            //定义一个边框
            ComplexBorderSide Border = new FarPoint.Win.ComplexBorderSide(Color.Black, 1, System.Drawing.Drawing2D.DashStyle.Solid);

            if (cellRanges != null)
            {
                foreach (CellRange cellRange in cellRanges)
                {
                    if (cellRange.RowCount == 1 && cellRange.ColumnCount == 1)//一个单元格
                    {
                        SetComplexSingeCellBorders(fps, cellRange.Row, cellRange.Column, Border, Border, Border, Border);
                    }
                    else if (cellRange.RowCount == 1)//一行
                    {
                        for (int col = cellRange.Column; col < cellRange.Column + cellRange.ColumnCount; col++)
                        {
                            if (col == cellRange.Column)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, cellRange.Column, Border, Border, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, col, null, Border, Border, Border);
                            }
                        }
                    }
                    else if (cellRange.ColumnCount == 1) //一列
                    {
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            if (row == cellRange.Row)
                            {
                                SetComplexSingeCellBorders(fps, cellRange.Row, cellRange.Column, Border, Border, Border, Border);
                            }
                            else
                            {
                                SetComplexSingeCellBorders(fps, row, cellRange.Column, Border, null, Border, Border);
                            }
                        }
                    }
                    else//多行多列
                    {
                        //循环设置单元格上边框
                        for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                        {
                            for (int col = cellRange.Column; col < cellRange.ColumnCount + cellRange.Column; col++)
                            {
                                if (row == cellRange.Row && col == cellRange.Column)
                                {
                                    SetComplexSingeCellBorders(fps, row, col, Border, Border, Border, Border);
                                }
                                else if (row == cellRange.Row)//第一行
                                {
                                    SetComplexSingeCellBorders(fps, row, col, null, Border, Border, Border);
                                }
                                else if (col == cellRange.Column)//第一列
                                {
                                    SetComplexSingeCellBorders(fps, row, col, Border, null, Border, Border);
                                }
                                else
                                {
                                    SetComplexSingeCellBorders(fps, row, col, null, null, Border, Border);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                throw new Exception("未能得到用户选择的区域!");
            }

            //恢复重绘界面
            fps.ResumeLayout();

            return true;

        }

        /// <summary>
        /// 无边框
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool SetBorderNone(FpSpread fps)
        {
            //停止重绘界面            
            fps.SuspendLayout();

            //得到用户选择区域
            CellRange[] cellRanges = fps.ActiveSheet.GetSelections();

            if (cellRanges != null)
            {
                foreach (CellRange cellRange in cellRanges)
                {
                    //循环设置单元格上边框
                    for (int row = cellRange.Row; row < cellRange.Row + cellRange.RowCount; row++)
                    {
                        for (int col = cellRange.Column; col < cellRange.ColumnCount + cellRange.Column; col++)
                        {
                            SetComplexSingeCellBorders(fps, row, col, null, null, null, null);
                        }
                    }
                }
            }
            else
            {
                throw new Exception("未能得到用户选择的区域!");
            }

            //恢复重绘界面
            fps.ResumeLayout();

            return true;
        }

        /// <summary>
        /// 设置表格边框
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="cellRanges"></param>
        /// <returns></returns>
        public static bool SetBorderSide(FpSpread fps, BorderStyle borderStyle)
        {
            //停止重绘界面            
            fps.SuspendLayout();

            CellRange[] cellRanges = fps.ActiveSheet.GetSelections();

            if (cellRanges != null)
            {

                foreach (CellRange cellRange in cellRanges)
                {
                    int row0 = cellRange.Row;
                    int row1 = cellRange.Row + cellRange.RowCount;
                    int col0 = cellRange.Column;
                    int col1 = cellRange.Column + cellRange.ColumnCount;

                    switch (borderStyle)
                    {
                        case BorderStyle .Bottom :
                            row0 = cellRange.Row + cellRange.RowCount - 1;
                            break;
                        case BorderStyle.Top:
                            row1 = cellRange.Row + 1;
                            break;
                        case BorderStyle.Right :
                            col0 = cellRange.Column + cellRange.ColumnCount - 1;
                            break;
                        case BorderStyle.Left :
                            col1 = cellRange.Column + 1;
                            break;
                        default:
                            break;
                    }

                    //循环设置单元格边框
                    for (int row = row0; row < row1; row++)
                    {
                        for (int col = col0; col < col1; col++)
                        {
                            //取得单元格边框
                            ComplexBorder border = (FarPoint.Win.ComplexBorder)fps.ActiveSheet.Cells[row, col].Border;
                            ComplexBorderSide topBorder = null;
                            ComplexBorderSide rightBorder = null;
                            ComplexBorderSide bottomBorder = null;
                            ComplexBorderSide leftBorder = null;

                            if (border != null)
                            {
                                if (border.Top.Style.ToString().ToLower() != "none") topBorder = border.Top;
                                if (border.Bottom.Style.ToString().ToLower() != "none") bottomBorder = border.Bottom;
                                if (border.Left.Style.ToString().ToLower() != "none") leftBorder = border.Left;
                                if (border.Right.Style.ToString().ToLower() != "none") rightBorder = border.Right;
                            }


                            //设置要改的单元格边框
                            ComplexBorderSide borderSide = new ComplexBorderSide(Color.Black, 1, System.Drawing.Drawing2D.DashStyle.Solid);

                            switch (borderStyle )
                            {
                                case BorderStyle.Bottom :
                                    bottomBorder = borderSide;
                                    break;
                                case BorderStyle.Top :
                                    topBorder = borderSide;
                                    break;
                                case BorderStyle.Left:
                                    leftBorder = borderSide;
                                    break;
                                case BorderStyle.Right :
                                    rightBorder = borderSide;
                                    break;
                                default:
                                    throw new Exception("边框参数错误!");
                            }
                            SetComplexSingeCellBorders(fps, row, col, leftBorder, topBorder, rightBorder, bottomBorder);
                        }
                    }
                }
            }
            else
            {
                throw new Exception("未能得到用户选择的区域!");
            }
            
            //恢复重绘界面
            fps.ResumeLayout();

            return true;
        }

        /// <summary>
        /// 打开边框编辑器
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool ShowBorderEditor(FpSpread fps)
        {
            fps.SuspendLayout();

            FarPoint.Win.Spread.Design.BorderEditor borderedit = new FarPoint.Win.Spread.Design.BorderEditor(fps);
            borderedit.Name = "边框设置";
            if (fps.ActiveSheet.SelectionCount == 0)
            {
                borderedit.StartColumn = fps.ActiveSheet.ActiveColumnIndex;
                borderedit.ColumnCount = 1;
                borderedit.StartRow = fps.ActiveSheet.ActiveRowIndex;
                borderedit.RowCount = 1;
            }
            else
            {
                FarPoint.Win.Spread.Model.CellRange range = fps.ActiveSheet.GetSelection(0);   //选中区域
                borderedit.StartColumn = range.Column;
                borderedit.ColumnCount = range.ColumnCount;
                borderedit.StartRow = range.Row;
                borderedit.RowCount = range.RowCount;
            }
            borderedit.ShowDialog();

            fps.ResumeLayout();
            return true;
        }
        
        /// <summary>
        /// 设置单元格表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="leftBorder"></param>
        /// <param name="topBorder"></param>
        /// <param name="rightBorder"></param>
        /// <param name="bottomBorder"></param>
        /// <returns></returns>
        public static bool SetComplexSingeCellBorders(FpSpread fps, int row, int col, FarPoint.Win.ComplexBorderSide leftBorder, FarPoint.Win.ComplexBorderSide topBorder, FarPoint.Win.ComplexBorderSide rightBorder, FarPoint.Win.ComplexBorderSide bottomBorder)
        {
            if (leftBorder != null & topBorder == null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, null, null);
            }//Left
            else if (leftBorder == null & topBorder != null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, null, null);
            }//Top
            else if (leftBorder == null & topBorder == null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, rightBorder, null);
            }//Right
            else if (leftBorder == null & topBorder == null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, null, bottomBorder);
            }//Bottom
            else if (leftBorder != null & topBorder != null & rightBorder == null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, null, null);
            }//Left + Top
            else if (leftBorder != null & topBorder == null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, rightBorder, null);
            }//Left + Right
            else if (leftBorder != null & topBorder == null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null, null, bottomBorder);
            }//Left + Bottom
            else if (leftBorder == null & topBorder != null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, rightBorder, null);
            }//Top + Right
            else if (leftBorder == null & topBorder != null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, null, bottomBorder);
            }//Top + Bottom
            else if (leftBorder == null & topBorder == null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, rightBorder, bottomBorder);
            }//Right + Bottom
            else if (leftBorder != null & topBorder != null & rightBorder != null & bottomBorder == null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, rightBorder, null);
            }//Left + Top + Right
            else if (leftBorder != null & topBorder != null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, null, bottomBorder);
            }//Left + Top + Bottom
            else if (leftBorder != null & topBorder == null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, null,rightBorder , bottomBorder);
            }//Left + Right + Bottom
            else if (leftBorder == null & topBorder != null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, topBorder, rightBorder, bottomBorder);
            }//Top + Right + Bottom 原版中没有这一项.
            else if (leftBorder != null & topBorder != null & rightBorder == null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder , topBorder, null, bottomBorder);
            }//Top + left + Bottom 原版中没有这一项.
            else if (leftBorder != null & topBorder != null & rightBorder != null & bottomBorder != null)
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(leftBorder, topBorder, leftBorder, bottomBorder);
            }//Left + Top + Right + Bottom
            else
            {
                fps.ActiveSheet.Cells[row, col].Border = new FarPoint.Win.ComplexBorder(null, null, null, null);
            }//All Null
            return true;
        }

        #endregion

        #region 清除表格线
        /// <summary>
        /// 清除表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <returns></returns>
        public static bool ClearAllCellBoders(FpSpread fps)
        {
            fps.ActiveSheet.HorizontalGridLine = new GridLine(FarPoint.Win.Spread.GridLineType.None);
            fps.ActiveSheet.VerticalGridLine = new GridLine(FarPoint.Win.Spread.GridLineType.None);
            return true;
        }
        #endregion

        #region 设置单元格的值

        /// <summary>
        /// 设置单元格的值
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="textVal"></param>
        /// <returns></returns>
        public static bool setValue(FpSpread fps, int row, int col, string textVal)
        {
            fps.ActiveSheet.SetValue(row, col, textVal);
            return true;
        }

        #endregion

        #region 设置单元格背景颜色

        /// <summary>
        /// 设置单元格背景颜色
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="theBackColor"></param>
        /// <returns></returns>
        public static bool setBackColorForRange(FpSpread fps, int row, int col, int row2, int col2, Color theBackColor)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].BackColor = theBackColor;
            return true;
        }

        #endregion

        #region 设置单元格前景颜色

        /// <summary>
        /// 设置单元格前景颜色
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="theForceColor"></param>
        /// <returns></returns>
        public static bool setForceColorForRange(FpSpread fps, int row, int col, int row2, int col2, Color theForceColor)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].ForeColor = theForceColor;
            return true;
        }

        #endregion

        #region 设置单元格文本
        /// <summary>
        /// 设置单元格的文本
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="sText"></param>
        /// <returns></returns>
        public static bool setText(FpSpread fps, int row, int col, string sText)
        {
            fps.ActiveSheet.SetValue(row, col, sText);
            return true;
        }
        #endregion

        #region 设置指定行行高

        public static bool setRowHeightForRange(FpSpread fps, int row, int col, int row2, int col2, Single rowHeightInPixels)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].Row.Height = rowHeightInPixels;
            return true;
        }
        #endregion

        #region 设置指定列列宽

        public static bool setColumnWidthForRange(FpSpread fps, int row, int col, int row2, int col2, Single columnWidthInPixels)
        {
            fps.ActiveSheet.Cells[row, col, row2, col2].Column.Width = columnWidthInPixels;
            return true;
        }
        #endregion

        #region 设置单元格简单表格线
        /// <summary>
        /// 设置单元格简单表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setSingleCellBorders(FpSpread fps, int row, int col, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide topBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col].Border = new ComplexBorder(leftBorder, topBorder, rightBorder, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定区域简单表格线
        /// <summary>
        /// 设置指定区域简单表格线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="?"></param>
        /// <param name="?"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool SetSingleCellBordersForRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide topBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(leftBorder, topBorder, rightBorder, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定区域简单左边线
        /// <summary>
        /// 设置指定区域简单左边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setLeftBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide leftBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(leftBorder, null, null, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单上边线
        /// <summary>
        /// 设置指定区域简单上边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setTopBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide TopBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, TopBorder, null, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单右边线
        /// <summary>
        /// 设置指定区域简单右边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setRightBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide rightBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, null, rightBorder, null);
            return true;
        }
        #endregion

        #region 设置指定区域简单下边线
        /// <summary>
        /// 设置指定区域简单下边线
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="row2"></param>
        /// <param name="col2"></param>
        /// <param name="lineWidthInPixels"></param>
        /// <returns></returns>
        public static bool setBottomBorderOfCellRange(FpSpread fps, int row, int col, int row2, int col2, int lineWidthInPixels)
        {
            ComplexBorderSide bottomBorder = new ComplexBorderSide(Color.Black, lineWidthInPixels);
            fps.ActiveSheet.Cells[row, col, row2, col2].Border = new ComplexBorder(null, null, null, bottomBorder);
            return true;
        }
        #endregion

        #region 设置指定单元格标签

        /// <summary>
        /// 设置指定单元格标签
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        public static bool setCellTag(FpSpread fps, int row, int col, string tag)
        {
            fps.ActiveSheet.Models.Data.SetTag(row, col, tag);
            return true;
        }

        #endregion

        #region 得到指定单元格标签

        /// <summary>
        /// 得到指定单元格标签
        /// </summary>
        /// <param name="fps"></param>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        public static bool getCellTag(FpSpread fps, int row, int col)
        {
            fps.ActiveSheet.Models.Data.GetTag(row,col);
            return true;
        }

        #endregion


        /// <summary>
        /// 通过单元格名称返回当前列号
        /// </summary>
        /// <param name="CellName">单元格名称</param>
        /// <returns></returns>
        public static int getColumnNum(string CellName)
        {
            int retVal = 0;
            string rowNum = "";
            Regex r = new Regex(@"[a-zA-Z]+");
            Match m = r.Match(CellName);
            rowNum = m.Value.ToUpper();

            char[] ch = rowNum.ToCharArray();
            for (int i = 0; i < rowNum.Length; i++)
            {
                retVal += ((ch[i] - 'A') + 1) * (int)Math.Pow(26, rowNum.Length - 1 - i);
            }

            retVal = retVal - 1;
            return retVal;

        }

        /// <summary>
        /// 通过单元格名称返回当前行号
        /// </summary>
        /// <param name="CellName">单元格名称</param>
        /// <returns></returns>
        public static int getRowNum(string CellName)
        {
            int retVal = 0;
            Regex r = new Regex(@"[0-9]+");
            Match m = r.Match(CellName);
            retVal = int.Parse(m.Value) - 1;
            return retVal;
        }


        /// <summary>
        /// 没有使用
        /// </summary>
        /// <param name="CellName"></param>
        /// <returns></returns>
        public static int[] GetCellID(string CellName)
        {
            int[] retVal = new int[2];
            string rowNum = "";
            Regex rRow = new Regex(@"[a-zA-Z]+");
            Match mRow = rRow.Match(CellName);
            rowNum = mRow.Value.ToUpper();

            char[] ch = rowNum.ToCharArray();
            for (int i = 0; i < rowNum.Length; i++)
            {
                retVal[0] += ((ch[i] - 'A') + 1) * (int)Math.Pow(26, rowNum.Length - 1 - i);
            }
            retVal[0] = retVal[0] - 1;

            Regex rCol = new Regex(@"[0-9]+");
            Match mCol = rCol.Match(CellName);
            retVal[1] = int.Parse(mCol.Value.ToString()) - 1;
            return retVal;
        }


        //public static bool addSheets(FpSpread fps, int numOfSheets, int startingNumberOfColumns, int startingNumberOfRows, bool protectionLikeExcelTF, Color sheetBackColor, HeaderAutoText rowHeaderAutoText, HeaderAutoText ColumnHeaderAutoText) 
        //{
        //    //'Adds a Sheet for Each Question and Sets the number of Rows and Column
        //    int x, y, z;
        //    fps.Sheets.Count = 0;
        //    //'Create the Sheets
        //    for int x=0,
        //}

        //Public Function AddSheets(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal NumberOfSheets As Integer, ByVal StartingNumberOfColumns As Integer, ByVal StartingNumberOfRows As Integer, ByVal ProtectionLikeExcelTF As Boolean, ByVal SheetBackColor As System.Drawing.Color, ByVal RowHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText, ByVal ColumnHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText) As Boolean

        //Dim x As Integer
        //Dim y As Integer
        //Dim z As Integer
        //SSControlToUse.Sheets.Count = 0
        //'Create the Sheets
        //For x = 0 To NumberOfSheets
        //Dim s As New FarPoint.Win.Spread.SheetView
        //s.ColumnCount = StartingNumberOfColumns
        //s.RowCount = StartingNumberOfRows
        //SSControlToUse.Sheets.Add(s)
        //Dim info As New FarPoint.Win.Spread.StyleInfo
        //'Set the BackColor
        //info.BackColor = SheetBackColor
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).DefaultStyle = info
        //'Set Protection Scheme to be like Excels for each sheet
        //For y = 0 To (StartingNumberOfRows - 1)
        //For z = 0 To (StartingNumberOfColumns - 1)
        //s.Cells(y, z).Locked = ProtectionLikeExcelTF
        //Next z
        //Next y
        //SSControlToUse.Sheets(x).RowHeaderAutoText = RowHeaderAutoText
        //SSControlToUse.Sheets(x).ColumnHeaderAutoText = ColumnHeaderAutoText
        //Next x
        //AddSheets = True
        //End Function 'AddSheets


        //Public Function AddSingleSheet(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal StartingNumberOfColumns As Integer, ByVal StartingNumberOfRows As Integer, ByVal ProtectionLikeExcelTF As Boolean, ByVal SheetBackColor As System.Drawing.Color, ByVal RowHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText, ByVal ColumnHeaderAutoText As FarPoint.Win.Spread.HeaderAutoText) As Boolean
        //'Adds a Sheet for Each Question and Sets the number of Rows and Column
        //Dim x As Integer
        //Dim y As Integer
        //'Create the Sheets
        //Dim s As New FarPoint.Win.Spread.SheetView
        //s.ColumnCount = StartingNumberOfColumns
        //s.RowCount = StartingNumberOfRows
        //SSControlToUse.Sheets.Add(s)
        //Dim info As New FarPoint.Win.Spread.StyleInfo
        //'Set the BackColor
        //info.BackColor = SheetBackColor
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).DefaultStyle = info
        //'Set Protection Scheme to be like Excels for each sheet
        //For x = 0 To (StartingNumberOfRows - 1)
        //For y = 0 To (StartingNumberOfColumns - 1)
        //s.Cells(x, y).Locked = ProtectionLikeExcelTF
        //Next y
        //Next x
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).RowHeaderAutoText = RowHeaderAutoText
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).ColumnHeaderAutoText = ColumnHeaderAutoText
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).GrayAreaBackColor = Color.SlateGray
        //' Set operation mode and let users select multiple blocks of cells 
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).OperationMode = FarPoint.Win.Spread.OperationMode.Normal
        //SSControlToUse.Sheets(SSControlToUse.Sheets.Count - 1).SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.MultiRange
        //AddSingleSheet = True
        //End Function 'AddSingleSheet


        //Public Function SSControlGlobals(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal EditModePermanentEntireWorkBookTF As Boolean, ByVal AllowCellOverFlowEntireWorkBookTF As Boolean, ByVal ControlsTabStripPolicy As FarPoint.Win.Spread.TabStripPolicy, ByVal TabStripPercentToShow As Single) As Boolean
        //' Set the sheet tabs policy
        //SSControlToUse.TabStripPolicy = ControlsTabStripPolicy
        //' Set the Tab Strip width to: .??
        //SSControlToUse.TabStripRatio = TabStripPercentToShow
        //'Eliminate the focus rectangle for the ENTIRE Control
        //SSControlToUse.EditModePermanent = EditModePermanentEntireWorkBookTF
        //'Allow Cell Text Overflow for the ENTIRE Control
        //SSControlToUse.AllowCellOverflow = AllowCellOverFlowEntireWorkBookTF

        //SSControlToUse.SelectionBlockOptions = FarPoint.Win.Spread.SelectionBlockOptions.Cells


        //End Function


        //Public Function TurnProtectionOnOffForAllSheetsInControl(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal TurnProtectionOn As Boolean) As Boolean
        //Dim x As Integer
        //Dim NumberOfSheets As Int16 = SSControlToUse.Sheets.Count

        //For x = 0 To NumberOfSheets - 1
        //SSControlToUse.Sheets(x).Protect = TurnProtectionOn
        //Next x
        //End Function


        //Public Function SetFont(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle) As Boolean
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SetFont = True
        //End Function 'SetFontBold


        //Public Function SetCellSpan(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal StartRow As Integer, ByVal StartCol As Integer, ByVal RowsToSpanCount As Integer, ByVal ColsToSpanCount As Integer) As Boolean
        //SSControlToUse.ActiveSheet.AddSpanCell(StartRow, StartCol, RowsToSpanCount, ColsToSpanCount)
        //SetCellSpan = True
        //End Function 'SetCellSpan


        //Public Function SetCellTypeTextForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal MultilineTF As Boolean, ByVal WordWrapTF As Boolean, ByVal ReadOnlyTF As Boolean, ByVal TypeOfScrollBars As System.Windows.Forms.ScrollBars, ByVal MaximumNumberOfCharacters As Int16, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.TextCellType
        //ct.Multiline = MultilineTF
        //ct.WordWrap = WordWrapTF
        //ct.ReadOnly = ReadOnlyTF
        //ct.ScrollBars = TypeOfScrollBars
        //ct.MaxLength = MaximumNumberOfCharacters
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeTextForRange = True
        //End Function 'SetCellTypeTextForRange

        //Public Function SetCellTypeGeneralForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal WordWrapTF As Boolean, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.GeneralCellType
        //ct.WordWrap = WordWrapTF
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeGeneralForRange = True
        //End Function 'SetCellTypeGeneralForRange

        //Public Function SetCellTypeButtonForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ButtonColor As Color, ByVal ButtonText As String, ByVal ButtonTextColor As Color, ByVal WordWrapTF As Boolean, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ButtonCellType
        //ct.ButtonColor = ButtonColor
        //ct.Text = ButtonText
        //ct.TextColor = ButtonTextColor
        //ct.WordWrap = WordWrapTF
        //ct.TwoState = False
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeButtonForRange = True
        //End Function 'SetCellTypeButtonForRange


        //Public Function SetCellTypeRadioButtonForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal RadioButtonItemsTextVBTabbed As String, ByVal RadioBtnOrientation As FarPoint.Win.RadioOrientation, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.MultiOptionCellType
        //'MUST Send In Item List as vbTab separated text
        //Dim ItemList() As String = Split(RadioButtonItemsTextVBTabbed, vbTab)
        //ct.Items = ItemList
        //ct.Orientation = RadioBtnOrientation
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //'SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = RadioBtnBackColor
        //'SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = RadioBtnForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeRadioButtonForRange = True
        //End Function 'SetCellTypeRadioButtonForRange

        //Public Function SetCellTypeCheckBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ChkBoxTextAlgnment As FarPoint.Win.ButtonTextAlign, ByVal ChkBoxTextIfTrue As String, ByVal ChkBoxTextIfFalse As String, ByVal ChkBoxBackColor As Color, ByVal ChkBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.CheckBoxCellType
        //ct.TextAlign = ChkBoxTextAlgnment
        //ct.TextTrue = ChkBoxTextIfTrue
        //ct.TextFalse = ChkBoxTextIfFalse
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ChkBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ChkBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeCheckBoxForRange = True
        //End Function 'SetCellTypeCheckBoxForRange


        //Public Function SetCellTypeComboBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ComboTextEditable As Boolean, ByVal ComboBoxItemsTextVBTabbed As String, ByVal ComboListAlignment As FarPoint.Win.ListAlignment, ByVal PixelsToOffsetListFromAttachedCell As Integer, ByVal ListWidthInPixels As Integer, ByVal NumbeofItemsToDisplayInDropdown As Integer, ByVal MaxLengthOfCharactersToDisplayInCell As Integer, ByVal ComboBoxBackColor As Color, ByVal ComboBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //'MUST Send In Item List as vbTab separated text
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //'MUST Send In Item List as vbTab separated text
        //Dim ItemList() As String = Split(ComboBoxItemsTextVBTabbed, vbTab)
        //ct.Editable = ComboTextEditable
        //ct.Items = ItemList
        //ct.ListAlignment = ComboListAlignment
        //ct.ListOffset = PixelsToOffsetListFromAttachedCell
        //ct.ListWidth = ListWidthInPixels
        //ct.MaxDrop = NumbeofItemsToDisplayInDropdown
        //ct.MaxLength = MaxLengthOfCharactersToDisplayInCell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ComboBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ComboBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeComboBoxForRange = True
        //End Function 'SetCellTypeComboBoxForRange


        //Public Function SetCellTypeComboBoxForRangeFor1DArray(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal ComboTextEditable As Boolean, ByVal ComboBoxItemsText1DArray As String(), ByVal ComboListAlignment As FarPoint.Win.ListAlignment, ByVal PixelsToOffsetListFromAttachedCell As Integer, ByVal ListWidthInPixels As Integer, ByVal NumbeofItemsToDisplayInDropdown As Integer, ByVal MaxLengthOfCharactersToDisplayInCell As Integer, ByVal ComboBoxBackColor As Color, ByVal ComboBoxForeColor As Color, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //ct.Editable = ComboTextEditable
        //ct.Items = ComboBoxItemsText1DArray
        //ct.ListAlignment = ComboListAlignment
        //ct.ListOffset = PixelsToOffsetListFromAttachedCell
        //ct.ListWidth = ListWidthInPixels
        //ct.MaxDrop = NumbeofItemsToDisplayInDropdown
        //ct.MaxLength = MaxLengthOfCharactersToDisplayInCell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).BackColor = ComboBoxBackColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).ForeColor = ComboBoxForeColor
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeComboBoxForRangeFor1DArray = True
        //End Function 'SetCellTypeComboBoxForRangeFor1DArray


        //Public Function SetCellTypeMaskForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal Mask As String, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim maskcell As New FarPoint.Win.Spread.CellType.MaskCellType
        //maskcell.Mask = Mask
        //'maskcell.StringTrim = StringTrimming.Character
        //'maskcell.MaskChar = ""
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = maskcell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeMaskForRange = True
        //End Function 'SetCellTypeMaskForRange


        //Public Function SetCellTypeNumberForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer, ByVal DecimalSeparator As String, ByVal DecimalPlaces As Integer, ByVal LeadingZero As FarPoint.Win.Spread.CellType.LeadingZero, ByVal MaximumValue As Double, ByVal MinimumValue As Double, ByVal IsLockWhenProtected As Boolean) As Boolean
        //Dim nmbrcell As New FarPoint.Win.Spread.CellType.NumberCellType
        //nmbrcell.DecimalSeparator = DecimalSeparator
        //nmbrcell.DecimalPlaces = DecimalPlaces
        //nmbrcell.LeadingZero = LeadingZero ' FarPoint.Win.Spread.CellType.LeadingZero.UseRegional
        //nmbrcell.MaximumValue = MaximumValue
        //nmbrcell.MinimumValue = MinimumValue
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = nmbrcell
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).Locked = IsLockWhenProtected
        //SetCellTypeNumberForRange = True
        //End Function 'SetCellTypeNumberForRange


        //Public Function SetRowHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal HorizontalAlignment As FarPoint.Win.spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal LabelText As String) As Boolean
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).HorizontalAlignment = HorizontalAlignment
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).VerticalAlignment = VerticalAlignment
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.RowHeader.Rows(Row).Label = LabelText
        //SetRowHeaderText = True
        //End Function 'SetRowHeaderText


        //Public Function SetRowHeaderColumnCount(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal ColumnCount As Integer) As Boolean
        //Dim r As FarPoint.Win.Spread.RowHeader
        //r = SSControlToUse.ActiveSheet.RowHeader
        //r.ColumnCount = ColumnCount
        //SetRowHeaderColumnCount = True
        //End Function 'SetRowHeaderColumnCount


        //Public Function SetRowHeaderBackColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal BackColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).BackColor = BackColor
        //SetRowHeaderBackColor = True
        //End Function 'SetRowHeaderBackColor


        //Public Function SetSpecialRowHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal HorizontalAlignment As FarPoint.Win.Spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.Spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal BackColor As System.Drawing.Color, ByVal foreColor As System.Drawing.Color, ByVal TheText As String) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).HorizontalAlignment = HorizontalAlignment
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).VerticalAlignment = VerticalAlignment
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).Font = New Font(FontFamily, FontSize, FontStyle)
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).BackColor = BackColor
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).ForeColor = foreColor
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).Text = TheText
        //SetSpecialRowHeaderText = True
        //End Function 'SetSpecialRowHeaderText


        //Public Function SetSpecialColumnHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal HorizontalAlignment As FarPoint.Win.Spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.Spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal BackColor As System.Drawing.Color, ByVal foreColor As System.Drawing.Color, ByVal TheText As String) As Boolean
        //Dim ch As FarPoint.Win.Spread.ColumnHeader
        //ch = SSControlToUse.ActiveSheet.ColumnHeader
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).HorizontalAlignment = HorizontalAlignment
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).VerticalAlignment = VerticalAlignment
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).Font = New Font(FontFamily, FontSize, FontStyle)
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).BackColor = BackColor
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).ForeColor = foreColor
        //ch.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).Text = TheText
        //SetSpecialColumnHeaderText = True
        //End Function 'SetSpecialColumnHeaderText


        //Public Function SetRowHeaderForeColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStart As Integer, ByVal ColumnStartWithinHeader As Integer, ByVal RowEnd As Integer, ByVal ColumnEndWithinHeader As Integer, ByVal ForeColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.RowHeader
        //rh = SSControlToUse.ActiveSheet.RowHeader
        //rh.Cells(RowStart, ColumnStartWithinHeader, RowEnd, ColumnEndWithinHeader).ForeColor = ForeColor
        //SetRowHeaderForeColor = True
        //End Function 'SetRowHeaderBackColor


        //Public Function SetColumnHeaderText(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Col As Integer, ByVal HorizontalAlignment As FarPoint.Win.spread.CellHorizontalAlignment, ByVal VerticalAlignment As FarPoint.Win.spread.CellVerticalAlignment, ByVal FontFamily As String, ByVal FontSize As Integer, ByRef FontStyle As FontStyle, ByVal LabelText As String) As Boolean
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).HorizontalAlignment = HorizontalAlignment
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).VerticalAlignment = VerticalAlignment
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).Font = New Font(FontFamily, FontSize, FontStyle)
        //SSControlToUse.ActiveSheet.ColumnHeader.Columns(Col).Label = LabelText
        //SetColumnHeaderText = True
        //End Function 'SetColumnHeaderText


        //Public Function SetColumnHeaderRowCount(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowCount As Integer) As Boolean
        //Dim r As FarPoint.Win.Spread.ColumnHeader
        //r = SSControlToUse.ActiveSheet.ColumnHeader
        //r.RowCount = RowCount
        //SetColumnHeaderRowCount = True
        //End Function 'SetRowHeaderColumnCount


        //Public Function SetColumnHeaderSpan(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Column As Integer, ByVal RowCount As Integer, ByVal ColumnCount As Integer) As Boolean
        //SSControlToUse.ActiveSheet.AddColumnHeaderSpanCell(Row, Column, RowCount, ColumnCount)
        //End Function


        //Public Function SetColumnHeaderBackColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal BackColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.ColumnHeader
        //rh = SSControlToUse.ActiveSheet.ColumnHeader
        //rh.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).BackColor = BackColor
        //SetColumnHeaderBackColor = True
        //End Function 'SetColumnHeaderBackColor


        //Public Function SetColumnHeaderForeColor(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal RowStartWithinHeader As Integer, ByVal ColumnStart As Integer, ByVal RowEndWithinHeader As Integer, ByVal ColumnEnd As Integer, ByVal ForeColor As System.Drawing.Color) As Boolean
        //Dim rh As FarPoint.Win.Spread.ColumnHeader
        //rh = SSControlToUse.ActiveSheet.ColumnHeader
        //rh.Cells(RowStartWithinHeader, ColumnStart, RowEndWithinHeader, ColumnEnd).ForeColor = ForeColor
        //SetColumnHeaderForeColor = True
        //End Function 'SetColumnHeaderForeColor

        //Public Function ClearComboBoxForRange(ByRef SSControlToUse As FarPoint.Win.Spread.FpSpread, ByVal Row As Integer, ByVal Col As Integer, ByVal Row2 As Integer, ByVal Col2 As Integer) As Boolean
        //Dim ct As New FarPoint.Win.Spread.CellType.ComboBoxCellType
        //SSControlToUse.ActiveSheet.Cells(Row, Col, Row2, Col2).CellType = ct
        //ct.Clear()
        //ClearComboBoxForRange = True
        //End Function 'ClearComboBoxForRange

        public enum BorderStyle 
        {
            Left = 0,
            Top = 1,
            Right = 2,
            Bottom = 3,
            None = 4,
            Builder = 5,
            Full = 6,
            OutSide= 7,
            OutSideBold = 8
        }
    }
}


源码地址: https://pan.quark.cn/s/a4b39357ea24 欧姆龙触摸屏编程软件MPTST 5.02是专门为欧姆龙品牌的工业触摸屏而研发的编程解决方案,它赋予用户在直观界面上构建、修改以及排错触摸屏应用程序的能力。 该软件在工业自动化领域具有不可替代的地位,特别是在生产线监视、设备操控以及人机互动系统中发挥着核心作用。 欧姆龙MPTST(Machine Process Terminal Software Touch)5.02版本配备了多样化的功能,旨在应对不同种类的触摸屏项目要求。 以下列举了若干核心特性:1. **图形化编程**:MPTST 5.02采用图形化的编程模式,允许用户借助拖拽动作来设计屏幕布局,设定按钮、滑块、指示灯等组件,显著简化了编程流程,并提升了工作效率。 2. **兼容性**:该软件能够适配欧姆龙的多个触摸屏产品线,包括CX-One、NS系列、NJ/NX系列等,使用户可以在同一个平台上完成对不同硬件的编程任务。 3. **数据通信**:MPTST 5.02具备与PLC(可编程逻辑控制器)进行数据交互的能力,通过将触摸屏作为操作界面,实现生产数据的显示与输入,以及设备状态的监控。 4. **报警与事件管理**:软件中集成了报警和事件管理机制,可以设定多种报警标准,一旦达到预设条件,触摸屏便会展示对应的报警提示,助力操作人员迅速做出响应。 5. **模拟测试**:在设备实际连接之前,MPTST 5.02支持用户进行脱机模拟测试,以此验证程序的正确性与稳定性。 6. **项目备份与恢复**:为了防止数据遗失,MPTST 5.02提供了项目文件的备份及还原功能,对于多版本控制与团队协作具有显著价值。 7. **多语言支持**:针对全球化的应...
本资源包为流体力学与化学传质交叉领域的研究提供了一套完整的数值模拟解决方案,重点针对湍流条件下通道内溶解物质的输运与分布规律进行定量分析。该工具集专为高等院校理工科专业的教育与科研需求设计,尤其适合计算机科学、电子工程及数学等相关学科的本科生在完成课程项目、综合设计或学位论文时使用。 软件环境兼容多个版本的MatLAB平台,包括2014a、2019b及后续的2024b发行版,确保了在不同实验室或个人计算环境中的可移植性。资源包内预置了经过验证的示例数据集,用户可直接调用主程序执行计算,显著降低了初始学习成本,使初学者能够迅速掌握基本操作流程。 代码架构采用模块化与参数驱动设计。所有关键物理参数(如流速、扩散系数、边界条件等)均集中于独立的配置模块,用户无需深入底层算法即可灵活调整计算条件,从而高效模拟多种湍流溶解场景。程序逻辑结构清晰,各功能段均配有详尽的说明注释,既阐述了数值方法的理论依据,也解释了关键步骤的实现意图,便于使用者理解模型构建过程并进行针对性修改。 在学术训练方面,本工具能够帮助学生将抽象的流体动力学与传质理论转化为可视化的数值实验结果,深化对湍流混合、浓度边界层等概念的理解。对于毕业设计或专题研究,其参数化框架支持用户嵌入自定义模型,开展创新性数值实验,为深入研究复杂流动中的溶解机制提供可靠的技术支撑。 总体而言,该MATLAB分析工具集通过结构化的代码设计、完备的案例支持与广泛的版本兼容性,为流体溶解现象的数值研究提供了一个高效、可扩展的计算平台,兼具教学示范与科研探索的双重价值。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
标题JSPM自行车个性化改装推荐系统研究AI更换标题第1章引言介绍自行车个性化改装推荐系统的研究背景、意义及国内外研究现状。1.1研究背景与意义阐述自行车个性化改装需求增长及推荐系统的重要性。1.2国内外研究现状分析国内外自行车改装推荐系统的研究进展及不足。1.3研究方法及创新点概述JSPM系统的设计方法及相较于其他系统的创新点。第2章相关理论介绍与自行车个性化改装推荐系统相关的理论基础。2.1个性化推荐理论阐述个性化推荐的基本原理和常用算法。2.2自行车改装知识介绍自行车结构、部件及改装选项等基础知识。2.3用户偏好分析理论讨论如何分析用户偏好以实现精准推荐。第3章JSPM系统设计详细介绍JSPM自行车个性化改装推荐系统的设计方案。3.1系统架构设计阐述系统的整体架构、模块划分及功能。3.2数据库设计介绍系统数据库的设计思路、表结构及关系。3.3推荐算法设计详细介绍基于用户偏好的推荐算法实现过程。第4章系统实现与测试介绍JSPM系统的实现过程及测试方法。4.1系统开发环境与工具说明系统开发所使用的环境、工具及技术栈。4.2系统实现过程阐述系统从设计到实现的具体步骤和关键代码。4.3系统测试与优化介绍系统的测试方法、测试结果及优化措施。第5章研究结果与分析展示JSPM系统的实验分析结果并进行讨论。5.1实验数据与指标介绍实验所采用的数据集、评估指标及实验环境。5.2实验结果展示通过图表等形式展示实验结果,包括推荐准确率等。5.3结果分析与讨论对实验结果进行详细分析,讨论系统的优缺点及改进方向。第6章结论与展望总结JSPM自行车个性化改装推荐系统的研究成果并展望未来。6.1研究结论概括本文的主要研究成果,包括系统设计、实现及实验结果。6.2展望指出系统存在的不足,提出未来研究的方向和改进措施。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值