private void InitCellType()
 {
     normalTextCellType     = new TextCellType();
     textCellType           = new TextCellType();
     textCellType.Multiline = true;
     textCellType.WordWrap  = true;
 }
Пример #2
0
    public void logo_set()
    {
        FpSpread1.Visible             = true;
        FpSpread1.Sheets[0].SheetName = " ";
        FpSpread1.Sheets[0].RowCount  = 0;

        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 0].Text = "Sl. No";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 1].Text = "Roll No";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 2].Text = "Register No";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 3].Text = "Student Name";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 4].Text = "Subject";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 5].Text = "Attempts";
        FpSpread1.Sheets[0].ColumnHeader.Cells[0, 6].Text = "Semester";

        FpSpread1.Sheets[0].ColumnHeader.Rows[0].HorizontalAlign = HorizontalAlign.Center;

        FarPoint.Web.Spread.TextCellType txt = new TextCellType();
        FpSpread1.Sheets[0].Columns[1].CellType = txt;
        FpSpread1.Sheets[0].Columns[2].CellType = txt;
        //=header
        FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
        style.Font.Size = 10;
        style.Font.Bold = true;
        FpSpread1.Sheets[0].SheetCornerStyle          = new FarPoint.Web.Spread.StyleInfo(style);
        FpSpread1.Sheets[0].ColumnHeader.DefaultStyle = new FarPoint.Web.Spread.StyleInfo(style);

        string str = "select isnull(collname, ' ') as collname,isnull(category,'') as category,isnull(affliatedby,'') as affliated,isnull(address1, ' ') as address1,isnull(address2,' ') as address2,isnull(address3, ' ') as address3,isnull(district, ' ') as district,isnull(pincode,' ') as pincode from collinfo where college_code='" + Session["collegecode"].ToString() + "'";

        con1.Close();
        con1.Open();
        SqlCommand    comm = new SqlCommand(str, con1);
        SqlDataReader drr  = comm.ExecuteReader();

        drr.Read();
        string coll_name     = Convert.ToString(drr["collname"]);
        string coll_address1 = Convert.ToString(drr["address1"]);
        string coll_address2 = Convert.ToString(drr["address2"]);
        string coll_address3 = Convert.ToString(drr["address3"]);
        string district      = Convert.ToString(drr["district"]);
        string pin_code      = Convert.ToString(drr["pincode"]);
        string catgory       = drr["category"].ToString();

        catgory = "(An " + catgory + " Institution" + " " + "-" + "";
        string affliatedby    = drr["affliated"].ToString();
        string affliatedbynew = Regex.Replace(affliatedby, ",", " ");
        string affiliated     = catgory + " " + "Affiliated to" + " " + affliatedbynew + ")";
        string address        = coll_address1 + "," + " " + coll_address2 + "," + " " + district + "-" + " " + pin_code + ".";

        Span1.InnerHtml            = coll_name;
        spnCollegeHeader.InnerHtml = address;
        Span2.InnerHtml            = affiliated;
        Span3.InnerHtml            = "Students Wise Arrears List";
        // FpSpread1.Sheets[0].ColumnHeader.Rows[1].Visible = false;
        FpSpread1.Sheets[0].ColumnHeader.Rows[0].BackColor = Color.FromArgb(214, 235, 255);
        FpSpread1.Sheets[0].ColumnHeader.Rows[0].Font.Bold = true;
        FpSpread1.Sheets[0].ColumnHeader.Rows[0].Font.Size = FontUnit.Medium;
    }
Пример #3
0
        private Color GetColor(TextCellType b)
        {
            switch (b)
            {
            case TextCellType.Keyword:
                return(Colors.Blue);

            case TextCellType.Literal:
                return(Colors.DarkRed);

            case TextCellType.Identifier:
                return(Colors.DarkOliveGreen);

            case TextCellType.Unknown:
                return(Colors.Red);

            case TextCellType.Comment:
                return(Colors.DarkGreen);

            default:
                return(Colors.Black);
            }
        }
Пример #4
0
        private void Button_Query_Click(object sender, EventArgs e)
        {
            ProgressScreen.Current.ShowSplashScreen();
            ProgressScreen.Current.SetStatus = "正在获取数据...";

            String segment       = "";
            String company       = "";
            String testroom      = "";
            String SelectedState = cb_state.SelectedItem.ToString();

            if (ComboBox_Segments.SelectedItem is Prjsct)
            {
                segment = (ComboBox_Segments.SelectedItem as Prjsct).PrjsctCode;
            }
            if (ComboBox_Company.SelectedItem is Orginfo)
            {
                company = (ComboBox_Company.SelectedItem as Orginfo).DepCode;
            }
            if (ComboBox_TestRooms.SelectedItem is PrjFolder)
            {
                testroom = (ComboBox_TestRooms.SelectedItem as PrjFolder).FolderCode;
            }

            DateTime start = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", StartDateTimePicker.Value.Year, StartDateTimePicker.Value.Month, StartDateTimePicker.Value.Day));
            DateTime end   = DateTime.Parse(string.Format("{0}-{1}-{2} 00:00:00", EndDateTimePicker.Value.Year, EndDateTimePicker.Value.Month, EndDateTimePicker.Value.Day));

            DataTable Data = DocumentHelperClient.GetRequestChangeList(segment, company, testroom, start, end, SelectedState, tb_content.Text.Trim(), tb_user.Text.Trim());

            if (Data != null)
            {
                FpSpread  FpSpread      = fpSpread1;
                SheetView FpSpread_Info = fpSpread1_Sheet;

                FpSpread.ShowRow(FpSpread.GetActiveRowViewportIndex(), 0, VerticalPosition.Top);

                FpSpread_Info.Columns.Count     = 12;
                FpSpread_Info.Columns[0].Width  = 60;
                FpSpread_Info.Columns[1].Width  = 60;
                FpSpread_Info.Columns[2].Width  = 80;
                FpSpread_Info.Columns[3].Width  = 80;
                FpSpread_Info.Columns[4].Width  = 240;
                FpSpread_Info.Columns[5].Width  = 160;
                FpSpread_Info.Columns[6].Width  = 80;
                FpSpread_Info.Columns[7].Width  = 50;
                FpSpread_Info.Columns[8].Width  = 120;
                FpSpread_Info.Columns[9].Width  = 300;
                FpSpread_Info.Columns[10].Width = 300;

                FpSpread_Info.Columns[0, FpSpread_Info.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center;

                TextCellType text = new TextCellType();
                text.Multiline = true;
                text.WordWrap  = true;

                FpSpread_Info.Columns[0, 2].CellType = text;

                FpSpread_Info.Rows.Count = Data.Rows.Count;
                if (Data.Rows.Count > 0)
                {
                    FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Height = 20;
                    FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].Locked = true;
                    FpSpread_Info.Rows[0, FpSpread_Info.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center;
                }

                int i, j;
                foreach (System.Data.DataColumn Column in Data.Columns)
                {
                    if (Column.ColumnName == "ID" || Column.ColumnName == "DataID" || Column.ColumnName == "ModuleID")
                    {
                        continue;
                    }

                    i = Data.Columns.IndexOf(Column);
                    FpSpread_Info.Columns[i - 3].VerticalAlignment = CellVerticalAlignment.Center;
                    FpSpread_Info.Columns[i - 3].Label             = Column.ColumnName;

                    foreach (DataRow Row in Data.Rows)
                    {
                        j = Data.Rows.IndexOf(Row);
                        FpSpread_Info.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center;
                        FpSpread_Info.Cells[j, i - 3].Value       = Row[Column.ColumnName].ToString();
                    }
                }

                foreach (DataRow Row in Data.Rows)
                {
                    j = Data.Rows.IndexOf(Row);
                    FpSpread_Info.Rows[j].Tag = Row["ID"].ToString() + "," + Row["DataID"].ToString() + "," + Row["ModuleID"].ToString();// Row["ID"].ToString();
                }
                if (Data.Rows.Count == 0)
                {
                    ProgressScreen.Current.CloseSplashScreen();
                    this.Activate();
                    MessageBox.Show("无数据,请重新选择条件!");
                }
            }
            else
            {
                ProgressScreen.Current.CloseSplashScreen();
                this.Activate();
                MessageBox.Show("无数据,请重新选择条件!");
            }
            ProgressScreen.Current.CloseSplashScreen();
            this.Activate();
        }
Пример #5
0
 public TextCell(int index, TextCellType type, char cellChar)
 {
     Index = index;
     Type  = type;
     Char  = cellChar;
 }
Пример #6
0
 public TextCell(int index)
 {
     Index = index;
     Type  = default;
     Char  = default;
 }
Пример #7
0
        private Color GetColor(TextCellType b)
        {
            switch (b)
            {
                case TextCellType.Keyword:
                    //return Colors.Blue;
                    return Color.FromRgb(0, 0, 255);

                case TextCellType.Literal:
                    return Colors.DarkRed;

                case TextCellType.Identifier:
                    //return Colors.DarkOliveGreen;
                    return Color.FromRgb(85, 85, 0);

                case TextCellType.Unknown:
                    return Colors.Red;

                case TextCellType.Comment:
                    return Colors.DarkGreen;

                default:
                    return Colors.Black;
            }
        }
Пример #8
0
        private void LogDialog_Load(object sender, EventArgs e)
        {
            ProgressScreen.Current.ShowSplashScreen();
            this.AddOwnedForm(ProgressScreen.Current);
            InitLogCategoryInfo();
            Dictionary <Guid, SheetView> SheetCollection = new Dictionary <Guid, SheetView>();

            try
            {
                List <FarPoint.CalcEngine.FunctionInfo> Infos = FunctionItemInfoUtil.getFunctionItemInfos();
                FpSpread.Sheets.Clear();
                if (dataID == Guid.Empty)
                {
                    return;
                }
                JZDocument document        = DocumentHelperClient.GetDocumentByID(dataID);
                JZDocument defaultDocument = ModuleHelperClient.GetDefaultDocument(moduleID);

                List <JZFormulaData> CrossSheetFormulaInfos = ModuleHelperClient.GetFormulaByModuleIndex(moduleID);

                foreach (JZSheet sheet in defaultDocument.Sheets)
                {
                    ProgressScreen.Current.SetStatus = "正在初始化表单‘" + sheet.Name + "’";
                    String    sheetXML  = ModuleHelperClient.GetSheetXMLByID(sheet.ID);
                    SheetView SheetView = Serializer.LoadObjectXml(typeof(SheetView), sheetXML, "SheetView") as SheetView;
                    SheetView.Tag               = sheet.ID;
                    SheetView.SheetName         = sheet.Name;
                    SheetView.Cells[0, 0].Value = "";
                    SheetView.Protect           = true;
                    FpSpread.Sheets.Add(SheetView);

                    SheetCollection.Add(sheet.ID, SheetView);
                    foreach (FarPoint.CalcEngine.FunctionInfo Info in Infos)
                    {
                        SheetView.AddCustomFunction(Info);
                    }
                    foreach (JZCell dataCellDefault in sheet.Cells)
                    {
                        Cell    cell     = SheetView.Cells[dataCellDefault.Name];
                        Object  value    = JZCommonHelper.GetCellValue(document, sheet.ID, dataCellDefault.Name);
                        Boolean hasValue = true;
                        if (value == null || value.ToString() == "")
                        {
                            hasValue = false;
                        }
                        if (cell != null)
                        {
                            cell.Font = defaultFont;
                            if (cell.CellType is DownListCellType)
                            {
                                DownListCellType CellType = cell.CellType as DownListCellType;
                                CellType.DropDownButton = false;
                                CellType.DesignMode     = false;
                                cell.Value = value;
                            }
                            else if (cell.CellType is TextCellType)
                            {
                                TextCellType CellType = cell.CellType as TextCellType;
                                if (CellType.FieldType.Description == FieldType.Text.Description)
                                {
                                    CellType.Multiline = true;
                                    CellType.WordWrap  = true;
                                }
                                CellType.MaxLength = CellType.FieldType.Length;
                                if (hasValue)
                                {
                                    cell.Value = value.ToString().Trim('\r', '\n');;
                                }
                            }
                            else if (cell.CellType is LongTextCellType)
                            {
                                LongTextCellType CellType = cell.CellType as LongTextCellType;
                                if (CellType.FieldType.Description == FieldType.LongText.Description)
                                {
                                    CellType.Multiline = true;
                                    CellType.WordWrap  = true;
                                }
                                CellType.MaxLength = CellType.FieldType.Length;
                                if (hasValue)
                                {
                                    cell.Value = value.ToString().Trim('\r', '\n');;
                                }
                            }
                            else if (cell.CellType is DateTimeCellType)
                            {
                                DateTimeCellType CellType = cell.CellType as DateTimeCellType;
                                CellType.MinimumDate = new DateTime(1753, 1, 1);
                                CellType.MaximumDate = new DateTime(9999, 12, 31);
                                cell.Value           = value;
                            }
                            else if (cell.CellType is RichTextCellType)
                            {
                                RichTextCellType CellType = cell.CellType as RichTextCellType;
                                CellType.Multiline = false;
                                CellType.WordWrap  = false;
                                CellType.MaxLength = CellType.FieldType.Length;
                                if (hasValue)
                                {
                                    cell.Value = value.ToString().Trim('\r', '\n');;
                                }
                            }
                            else if (cell.CellType is NumberCellType)
                            {
                                NumberCellType CellType = cell.CellType as NumberCellType;
                                CellType.MaximumValue = 999999999.9999;
                                CellType.MinimumValue = -999999999.9999;
                                cell.Value            = value;
                            }
                            else if (cell.CellType is MaskCellType)
                            {
                                MaskCellType CellType = cell.CellType as MaskCellType;
                                CellType.Mask = "00000000000000000000000000000000000";
                                if (CellType.CustomMaskCharacters != null && CellType.CustomMaskCharacters.Length > 0)
                                {
                                    CellType.CustomMaskCharacters[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()()复检";
                                }
                                cell.Value = value;
                            }
                            else if (cell.CellType is ImageCellType)
                            {
                                if (value != null)
                                {
                                    cell.Value = JZCommonHelper.StringToBitmap(value.ToString());
                                }
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                    }
                }

                ProgressScreen.Current.SetStatus = "正在初始化跨表公式...";

                foreach (JZFormulaData formula in CrossSheetFormulaInfos)
                {
                    SheetView Sheet = SheetCollection[formula.SheetIndex];
                    try
                    {
                        Sheet.Cells[formula.RowIndex, formula.ColumnIndex].Formula = formula.Formula;
                    }
                    catch
                    {
                    }
                }

                FpSpread.LoadFormulas(true);

                ProgressScreen.Current.SetStatus = "正在显示资料...";

                UpdateChart();
                UpdateEquation();
                SetNotes();
                //设置只读模式
                if (ReadOnly)
                {
                    foreach (SheetView sheet in FpSpread.Sheets)
                    {
                        sheet.OperationMode = OperationMode.ReadOnly;
                    }
                }
            }
            catch (TimeoutException ex1)
            {
                MessageBox.Show("网络原因造成数据无法访问,请检查本机网络连接,或稍后再试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("加载试验模板出错!\r\n原因:" + (ex.InnerException != null ? ex.InnerException.Message : ex.Message), "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                try
                {
                    this.RemoveOwnedForm(ProgressScreen.Current);
                    ProgressScreen.Current.CloseSplashScreen();
                    this.Activate();
                }
                catch (Exception ex1) { }
            }
        }
Пример #9
0
        private void BindRequest(Object c)
        {
            try
            {
                Yqun.Common.ContextCache.ApplicationContext.Current = c as Yqun.Common.ContextCache.ApplicationContext;
                SheetView spread_request_sheet = new SheetView();
                spread_request_sheet.Columns.Count    = 11;
                spread_request_sheet.Columns[0].Width = 80;
                spread_request_sheet.Columns[1].Width = 100;
                spread_request_sheet.Columns[2].Width = 200;
                spread_request_sheet.Columns[3].Width = 150;
                spread_request_sheet.Columns[4].Width = 240;
                spread_request_sheet.Columns[5].Width = 80;
                spread_request_sheet.Columns[6].Width = 130;
                spread_request_sheet.Columns[7].Width = 120;
                spread_request_sheet.Columns[8].Width = 300;
                spread_request_sheet.Columns[9].Width = 300;

                spread_request_sheet.Columns[0, spread_request_sheet.Columns.Count - 1].VerticalAlignment = CellVerticalAlignment.Center;

                TextCellType text = new TextCellType();
                text.Multiline = true;
                text.WordWrap  = true;

                spread_request_sheet.Columns[0, 2].CellType = text;

                DataTable Data = DocumentHelperClient.GetUnPreocessedRequestList();
                spread_request_sheet.Rows.Count = 0;
                if (Data != null)
                {
                    //spread_request.ShowRow(spread_request.GetActiveRowViewportIndex(), 0, VerticalPosition.Top);

                    spread_request_sheet.Rows.Count = Data.Rows.Count;
                    if (Data.Rows.Count > 0)
                    {
                        spread_request_sheet.Rows[0, spread_request_sheet.Rows.Count - 1].Height = 20;
                        spread_request_sheet.Rows[0, spread_request_sheet.Rows.Count - 1].Locked = true;
                        spread_request_sheet.Rows[0, spread_request_sheet.Rows.Count - 1].HorizontalAlignment = CellHorizontalAlignment.Center;
                    }

                    int i, j;
                    foreach (System.Data.DataColumn Column in Data.Columns)
                    {
                        if (Column.ColumnName == "ID" || Column.ColumnName == "DataID" || Column.ColumnName == "ModuleID")
                        {
                            continue;
                        }

                        i = Data.Columns.IndexOf(Column);
                        spread_request_sheet.Columns[i - 3].VerticalAlignment = CellVerticalAlignment.Center;
                        spread_request_sheet.Columns[i - 3].Label             = Column.ColumnName;

                        foreach (DataRow Row in Data.Rows)
                        {
                            j = Data.Rows.IndexOf(Row);
                            spread_request_sheet.Rows[j].HorizontalAlignment = CellHorizontalAlignment.Center;
                            spread_request_sheet.Cells[j, i - 3].Value       = Row[Column.ColumnName].ToString();
                        }
                    }

                    foreach (DataRow Row in Data.Rows)
                    {
                        j = Data.Rows.IndexOf(Row);
                        spread_request_sheet.Rows[j].Tag = Row["ID"].ToString() + "," + Row["DataID"].ToString() + "," + Row["ModuleID"].ToString();
                    }
                }
                AddViewDelegate avd = new AddViewDelegate(AddView);
                spread_request.Invoke(avd, spread_request, spread_request_sheet);
                ChangeTabTitleDelegate cttd = new ChangeTabTitleDelegate(ChangeTabTitle);
                tabPage3.Invoke(cttd, tabPage3, "待审批用户申请【" + spread_request.Sheets[0].RowCount + "】");
            }
            catch
            {
            }
        }
Пример #10
0
        public static TextCellType CreateTextCellType()
        {
            TextCellType cellType = new TextCellType();

            return(cellType);
        }
Пример #11
0
        private void DataDialog_Load(object sender, EventArgs e)
        {
            ProgressScreen.Current.ShowSplashScreen();
            this.AddOwnedForm(ProgressScreen.Current);

            Dictionary <Guid, SheetView> SheetCollection = new Dictionary <Guid, SheetView>();
            JZDocument           document               = DocumentHelperClient.GetDocumentByID(DataID);
            JZDocument           defaultDocument        = ModuleHelperClient.GetDefaultDocument(ModuleID);
            List <JZFormulaData> CrossSheetFormulaInfos = ModuleHelperClient.GetLineFormulaByModuleIndex(ModuleID);

            FpSpread.Sheets.Clear();
            LoadSpread(FpSpread, ModuleID);
            #region 初始化表单
            foreach (JZSheet sheet in defaultDocument.Sheets)
            {
                SheetView SheetView = GetSheet(sheet.ID);
                foreach (JZCell dataCellDefault in sheet.Cells)
                {
                    Cell    cell     = SheetView.Cells[dataCellDefault.Name];
                    Object  value    = JZCommonHelper.GetCellValue(document, sheet.ID, dataCellDefault.Name);
                    Boolean hasValue = true;
                    if (value == null || value.ToString() == "")
                    {
                        hasValue = false;
                    }
                    if (cell != null)
                    {
                        #region 处理单元格
                        cell.Locked = false;
                        cell.Font   = defaultFont;
                        if (cell.CellType is DownListCellType)
                        {
                            DownListCellType CellType = cell.CellType as DownListCellType;
                            CellType.DropDownButton = false;
                            CellType.DesignMode     = false;
                            cell.Value = value;
                        }
                        else if (cell.CellType is TextCellType)
                        {
                            TextCellType CellType = cell.CellType as TextCellType;
                            if (CellType.FieldType.Description == FieldType.Text.Description)
                            {
                                CellType.Multiline = true;
                                CellType.WordWrap  = true;
                            }
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');;
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is LongTextCellType)
                        {
                            LongTextCellType CellType = cell.CellType as LongTextCellType;
                            if (CellType.FieldType.Description == FieldType.LongText.Description)
                            {
                                CellType.Multiline = true;
                                CellType.WordWrap  = true;
                            }
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');;
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is DateTimeCellType)
                        {
                            DateTimeCellType CellType = cell.CellType as DateTimeCellType;
                            CellType.MinimumDate = new DateTime(1753, 1, 1);
                            CellType.MaximumDate = new DateTime(9999, 12, 31);
                            cell.Value           = value;
                        }
                        else if (cell.CellType is RichTextCellType)
                        {
                            RichTextCellType CellType = cell.CellType as RichTextCellType;
                            CellType.Multiline = false;
                            CellType.WordWrap  = false;
                            CellType.MaxLength = CellType.FieldType.Length;
                            if (hasValue)
                            {
                                cell.Value = value.ToString().Trim('\r', '\n');
                            }
                            else
                            {
                                cell.Value = value;
                            }
                        }
                        else if (cell.CellType is DeleteLineCellType)
                        {//删除线
                            DeleteLineCellType CellType = cell.CellType as DeleteLineCellType;
                            CellType.Multiline = true;
                            CellType.WordWrap  = true;
                            CellType.MaxLength = CellType.FieldType.Length;
                            cell.CellType      = CellType;
                            object objOld = cell.Text;
                            if (hasValue)
                            {
                                cell.Value = new System.Text.RegularExpressions.Regex("'+").Replace(value.ToString(), "'"); //value.ToString();
                                if (string.IsNullOrEmpty(cell.Text))
                                {
                                    RichTextBox rt = new RichTextBox();
                                    rt.Text    = objOld == null ? "" : objOld.ToString();
                                    rt.Font    = new Font("宋体", 10.5f, FontStyle.Regular);
                                    cell.Value = rt.Rtf;
                                }
                            }
                            else
                            {
                                RichTextBox rt = new RichTextBox();
                                rt.Text    = objOld == null ? "" : objOld.ToString();
                                rt.Font    = new Font("宋体", 10.5f, FontStyle.Regular);
                                cell.Value = rt.Rtf;
                            }
                        }
                        else if (cell.CellType is NumberCellType)
                        {
                            NumberCellType CellType = cell.CellType as NumberCellType;
                            CellType.MaximumValue = 999999999.9999;
                            CellType.MinimumValue = -999999999.9999;
                            cell.Value            = value;
                        }
                        else if (cell.CellType is MaskCellType)
                        {
                            MaskCellType CellType = cell.CellType as MaskCellType;
                            for (int i = CellType.Mask.Length; i < CellType.FieldType.Length; i++)
                            {
                                CellType.Mask += "0";
                            }


                            if (CellType.CustomMaskCharacters != null && CellType.CustomMaskCharacters.Length > 0)
                            {
                                CellType.CustomMaskCharacters[0] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-()ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ()复检";
                            }
                            if (value == null || value.ToString().Trim() == "")
                            {
                                cell.Value = null;
                            }
                            else
                            {
                                cell.Value = value.ToString().Trim();
                            }
                        }
                        else if (cell.CellType is ImageCellType)
                        {
                            if (value != null)
                            {
                                cell.Value = JZCommonHelper.StringToBitmap(value.ToString());
                            }
                            else
                            {
                                cell.Value = null;
                            }
                        }
                        else if (cell.CellType is HyperLinkCellType)
                        {
                            if (value != null)
                            {
                                List <string>     lstLink  = new List <string>();
                                HyperLinkCellType hlnkCell = new HyperLinkCellType();
                                try
                                {
                                    lstLink       = Newtonsoft.Json.JsonConvert.DeserializeObject <List <string> >(value.ToString());
                                    hlnkCell.Text = lstLink[0];
                                    hlnkCell.Link = lstLink[1];
                                }
                                catch
                                {
                                    hlnkCell.Text = value.ToString();
                                    hlnkCell.Link = "";
                                }

                                cell.CellType = hlnkCell;
                                //cell.Value = value;
                            }
                            else
                            {
                                HyperLinkCellType hlnkCell = new HyperLinkCellType();
                                cell.CellType = hlnkCell;
                            }
                        }
                        else
                        {
                            cell.Value = value;
                        }
                        #endregion
                        JZCellProperty p = cell.Tag as JZCellProperty;
                        #region 处理单元格属性
                        if (p != null)
                        {
                            cell.Locked = false;
                        }
                        else
                        {
                            //  logger.Error("未能设置数据区信息:单元格" + dataCellDefault.Name + ",表单:" + sheet.Name);
                        }
                        #endregion
                    }
                }
                #region 线路单元格样式
                DataTable dtCellStyle = ModuleHelperClient.GetCellStyleBySheetID(sheet.ID);
                for (int i = 0; i < dtCellStyle.Rows.Count; i++)
                {
                    if (dtCellStyle.Rows[i]["CellStyle"] != null)
                    {
                        JZCellStyle CurrentCellStyle = Newtonsoft.Json.JsonConvert.DeserializeObject <JZCellStyle>(dtCellStyle.Rows[i]["CellStyle"].ToString());
                        if (CurrentCellStyle != null)
                        {
                            string strCellName = dtCellStyle.Rows[i]["CellName"].ToString();
                            Cell   cell        = SheetView.Cells[strCellName];
                            cell.ForeColor = CurrentCellStyle.ForColor;
                            cell.BackColor = CurrentCellStyle.BackColor;
                            cell.Font      = new Font(CurrentCellStyle.FamilyName, CurrentCellStyle.FontSize, CurrentCellStyle.FontStyle);
                        }
                    }
                }
                #endregion
            }
            #endregion

            UpdateChart();
            UpdateEquation();

            //设置只读模式
            if (ReadOnly)
            {
                foreach (SheetView sheet in FpSpread.Sheets)
                {
                    sheet.OperationMode = OperationMode.ReadOnly;
                }
            }
        }
Пример #12
0
        public static ICellType CreateCellType(string CellType)
        {
            ICellType Result = null;

            switch (CellType.ToLower())
            {
            case "文本":
                Result = new TextCellType();
                break;

            case "数字":
                Result = new NumberCellType();
                break;

            case "百分号":
                Result = new PercentCellType();
                break;

            case "图片":
                Result = new ImageCellType();
                break;

            case "超链接":
                Result = new HyperLinkCellType();
                break;

            case "货币":
                Result = new CurrencyCellType();
                break;

            case "日期时间":
                Result = new DateTimeCellType();
                break;

            case "复选框":
                Result = new CheckBoxCellType();
                break;

            case "上下标":
                Result = new RichTextCellType();
                break;

            case "条形码":
                Result = new BarCodeCellType();
                break;

            case "下拉框":
                Result = new DownListCellType();
                break;

            case "掩码":
                Result = new MaskCellType();
                break;

            case "删除线":
                Result = new DeleteLineCellType();
                break;

            default:
                Result = new TextCellType();
                break;
            }

            return(Result);
        }