Exemplo n.º 1
0
        void fpSheetEditor1_ExcelOpened(object sender, ExcelsEventArgs e)
        {
            if (e.Sheets.Count > 0)
            {
                SheetView SheetView = e.Sheets[0];

                FpSpread.Sheets.Clear();
                FpSpread.Sheets.Add(SheetView);
            }

            if (FpSpread.Sheets.Count > 0)
            {
                FpSpread.ActiveSheet = FpSpread.Sheets[FpSpread.Sheets.Count - 1];
            }

            SheetPropertyDialog PropertyDialog = new SheetPropertyDialog(FpSpread.ActiveSheet);

            PropertyDialog.RowCount.Value    = FpSpread.ActiveSheet.RowCount;
            PropertyDialog.ColumnCount.Value = FpSpread.ActiveSheet.ColumnCount;
            string row = (FpSpread.ActiveSheet.GetLastNonEmptyRow(NonEmptyItemFlag.Style) + 1).ToString();
            string col = (Arabic_Numerals_Convert.Excel_Word_Numerals(FpSpread.ActiveSheet.GetLastNonEmptyColumn(NonEmptyItemFlag.Style) + 1)).ToString();

            PropertyDialog.DisplayInformation(row, col);
            PropertyDialog.Show(this);
        }
Exemplo n.º 2
0
        private void ButtonOk_Click(object sender, EventArgs e)
        {
            TreeNode  Node      = DictionaryView.SelectedNode;
            Selection Selection = Node.Tag as Selection;

            if (Selection.TypeFlag != "@Dictionary")
            {
                this.DialogResult = DialogResult.None;
                return;
            }

            CellType.ReferenceStyle = BizCommon.ReferenceStyle.Dictionary;
            DictionaryReference Reference = CellType.ReferenceInfo as DictionaryReference;
            String Cell = Arabic_Numerals_Convert.Excel_Word_Numerals(ColumnIndex) + (RowIndex + 1).ToString();

            //bool HaveItem = SheetConfiguration.DataTableSchema.HaveDataItem(Cell);
            //if (HaveItem)
            //{
            //    FieldDefineInfo FieldInfo = SheetConfiguration.DataTableSchema.GetDataItem(Cell);
            //    if (FieldInfo != null)
            //    {
            //        Reference.TableName = FieldInfo.TableInfo.Name;
            //        Reference.ColumnName = FieldInfo.FieldName;
            //    }
            //}

            Reference.DictionaryIndex = Node.Name;
            Reference.ReferenceXml    = Node.Name;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 3
0
        public String getLiteralCell()
        {
            String LiteralColumn = Arabic_Numerals_Convert.Excel_Word_Numerals(Column);
            String LiteralRow    = (Row + 1).ToString();

            return(LiteralColumn + LiteralRow);
        }
Exemplo n.º 4
0
        private void SheetReferenceDialog_Load(object sender, EventArgs e)
        {
            //显示参照关系图
            String Cell = Arabic_Numerals_Convert.Excel_Word_Numerals(ColumnIndex) + (RowIndex + 1).ToString();

            InitReferenceDiagram(Cell);
        }
Exemplo n.º 5
0
        private void fpSpread_SheetTabClick(object sender, SheetTabClickEventArgs e)
        {
            SheetView sheet             = fpSpread.Sheets[e.SheetTabIndex];
            int       ActiveRowIndex    = (sheet.ActiveRowIndex >= 0 ? sheet.ActiveRowIndex : 0);
            int       ActiveColumnIndex = (sheet.ActiveColumnIndex >= 0 ? sheet.ActiveColumnIndex : 0);

            tTextBox_XY.Text = Arabic_Numerals_Convert.Excel_Word_Numerals(ActiveColumnIndex) + (ActiveRowIndex + 1).ToString();
        }
Exemplo n.º 6
0
        private void fpSpread_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int ActiveRowIndex    = (e.Range.Row >= 0 ? e.Range.Row : 0);
            int ActiveColumnIndex = (e.Range.Column >= 0 ? e.Range.Column : 0);

            tTextBox_XY.Text = Arabic_Numerals_Convert.Excel_Word_Numerals(ActiveColumnIndex) + (ActiveRowIndex + 1).ToString();

            OnCellClick(e);
        }
Exemplo n.º 7
0
 private void NumberControl_Load(object sender, EventArgs e)
 {
     if (Style == DisplayStyle.Digital)
     {
         this.textBox1.Text = (vScrollBar1.Minimum + 1).ToString();
     }
     else if (Style == DisplayStyle.Letter)
     {
         this.textBox1.Text = Arabic_Numerals_Convert.Excel_Word_Numerals(vScrollBar1.Minimum);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 显示值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void vScrollBar1_ValueChanged(object sender, EventArgs e)
        {
            if (Style == DisplayStyle.Digital)
            {
                this.textBox1.Text = (vScrollBar1.Value + 1).ToString();
            }
            else if (Style == DisplayStyle.Letter)
            {
                this.textBox1.Text = Arabic_Numerals_Convert.Excel_Word_Numerals(vScrollBar1.Value);
            }

            OnValueChanged(e);
        }
Exemplo n.º 9
0
        public static int[] ConvertColumn_Row(string Range)
        {
            int DigitIndex = Range.Length - 1;

            char[] chars = Range.ToCharArray();
            for (int i = 0; i < chars.Length; i++)
            {
                if (Char.IsDigit(chars[i]))
                {
                    DigitIndex = i;
                    break;
                }
            }

            List <int> Parts = new List <int>();

            Parts.Add(System.Convert.ToInt32(Arabic_Numerals_Convert.ToNumerals(Range.Substring(0, DigitIndex))));
            Parts.Add(System.Convert.ToInt32(Range.Substring(DigitIndex)) - 1);
            return(Parts.ToArray());
        }
Exemplo n.º 10
0
        /// <summary>
        /// 选中单元格时调用这个更新工具栏
        /// </summary>
        protected void RefreshFspreadStatus()
        {
            if (CellTools.Items.Count > 0)
            {
                CellTools.Items[0].Text = Arabic_Numerals_Convert.Excel_Word_Numerals(ActiveSheet.ActiveColumnIndex) + (ActiveSheet.ActiveRowIndex + 1).ToString();
            }

            Font font = ActiveSheet.ActiveCell.Font;

            if (font != null)
            {
                FontFamilyComboBox.SelectedIndex = FontFamilyComboBox.Items.IndexOf(font.Name);

                int      x     = -1;
                string[] Names = FontSizeFactory.FontSize.Sizes();
                for (int i = 0; i < Names.Length; i++)
                {
                    if (font.Size == FontSizeFactory.FontSize.GetSize(Names[i]))
                    {
                        x = i;
                        break;
                    }
                }
                FontSizeComboBox.SelectedIndex = x;

                BoldButton.Checked      = font.Bold;
                ItalicButton.Checked    = font.Italic;
                UnderlineButton.Checked = font.Underline;
            }
            else
            {
                FontFamilyComboBox.SelectedIndex = FontFamilyComboBox.Items.IndexOf(DefaultFontFamily);
                FontSizeComboBox.SelectedIndex   = FontSizeComboBox.Items.IndexOf(DefaultFontSize);
                BoldButton.Checked      = false;
                ItalicButton.Checked    = false;
                UnderlineButton.Checked = false;
            }

            MiddleCenterButton.Checked = (ActiveSheet.ActiveCell.RowSpan != 1 || ActiveSheet.ActiveCell.ColumnSpan != 1);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 设置数据项
        /// </summary>
        private void SettingSheetDataItem()
        {
            List <Cell> cells = new List <Cell>();

            foreach (CellRange Range in Editor.Selections)
            {
                for (int Row = 0; Row < Range.RowCount; Row++)
                {
                    for (int Column = 0; Column < Range.ColumnCount; Column++)
                    {
                        int absRow    = Range.Row + Row;
                        int absColumn = Range.Column + Column;

                        string Tag = Arabic_Numerals_Convert.Excel_Word_Numerals(absColumn) + (absRow + 1);
                        cells.Add(FpSpread.ActiveSheet.Cells[Tag]);
                    }
                }
            }
            if (cells.Count > 0)
            {
                SheetDataItemDialog Dialog = new SheetDataItemDialog(this, cells);
                Dialog.ShowDialog();
            }
        }
Exemplo n.º 12
0
        void myCell_EditModeOff(object sender, EventArgs e)
        {
            if (myCell == null)
            {
                return;
            }

            CellRange SelectRange = new CellRange(myCell.ActiveSheet.ActiveRowIndex, myCell.ActiveSheet.ActiveColumnIndex, 1, 1);

            if (!SelectRange.IsValidRange(myCell.ActiveSheet))
            {
                return;
            }

            Boolean Have = false;

            foreach (List <string> ls in chartInputData.Values)
            {
                List <string> x = new List <string>(ls[0].ToLower().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
                List <string> y = new List <string>(ls[1].ToLower().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
                String        r = Arabic_Numerals_Convert.Excel_Word_Numerals(myCell.ActiveSheet.ActiveColumnIndex) + (myCell.ActiveSheet.ActiveRowIndex + 1).ToString();
                if (x.Contains(r.ToLower()) || y.Contains(r.ToLower()))
                {
                    Have = true;
                    break;
                }
            }

            if (!Have)
            {
                return;
            }

            UpdateChartData();
            UpdateChartImage();
        }
Exemplo n.º 13
0
 public static string GetColumn_Row(int Row, int Column)
 {
     return(Arabic_Numerals_Convert.Excel_Word_Numerals(Column) + (Row + 1).ToString());
 }
Exemplo n.º 14
0
        protected void InitToolStripItems()
        {
            CellTools.Items.Clear();
            ToolStripTextBox TextBox = new ToolStripTextBox();

            TextBox.Enabled          = false;
            TextBox.ForeColor        = Color.Black;
            TextBox.BackColor        = Color.White;
            TextBox.BorderStyle      = BorderStyle.FixedSingle;
            TextBox.Text             = Arabic_Numerals_Convert.Excel_Word_Numerals(ActiveSheet.ActiveColumnIndex) + (ActiveSheet.ActiveRowIndex + 1).ToString();
            TextBox.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            CellTools.Items.Add(TextBox);

            CellTools.Items.Add(new ToolStripSeparator());

            ToolStripMenuItem MenuItem = new ToolStripMenuItem();

            MenuItem.Text        = "  类型  ";
            MenuItem.ToolTipText = "报表元素类型";
            CellTools.Items.Add(MenuItem);

            ToolStripMenuItem SubMenuItem = new ToolStripMenuItem();

            SubMenuItem.Text   = "数据列";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "普通文本";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "公式";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "图片";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "斜线";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "变量";
            SubMenuItem.Click += new EventHandler(SubMenuItem_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            CellTools.Items.Add(new ToolStripSeparator());

            MenuItem             = new ToolStripMenuItem();
            MenuItem.Text        = "  浮动元素类型  ";
            MenuItem.ToolTipText = "浮动元素类型";
            CellTools.Items.Add(MenuItem);

            SubMenuItem        = new ToolStripMenuItem();
            SubMenuItem.Text   = "图表";
            SubMenuItem.Click += new EventHandler(SubMenuItem_1_Click);
            MenuItem.DropDownItems.Add(SubMenuItem);

            CellTools.Items.Add(new ToolStripSeparator());
        }
Exemplo n.º 15
0
        void FpSpread_SelectionChanged(object sender, FarPoint.Win.Spread.SelectionChangedEventArgs e)
        {
            if (ActiveElement != null)
            {
                panel1.Visible = (ActiveElement.Value is DataColumn);

                //扩展属性
                if (ActiveElement.ExpandOrientation.Orientation == ExpandOrientation.LeftToRight)
                {
                    rButton_LeftToRight.Checked = true;
                }
                else if (ActiveElement.ExpandOrientation.Orientation == ExpandOrientation.TopToBottom)
                {
                    rButton_TopToBottom.Checked = true;
                }
                else if (ActiveElement.ExpandOrientation.Orientation == ExpandOrientation.None)
                {
                    rButton_None.Checked = true;
                }

                //数据列属性
                if (ActiveElement.Value is DataColumn)
                {
                    DataColumn data = ActiveElement.Value as DataColumn;

                    rButton_LeftToRight.Enabled = (data.DataSetting != DataSetting.Aggregation);
                    rButton_TopToBottom.Enabled = (data.DataSetting != DataSetting.Aggregation);
                    rButton_None.Enabled        = (data.DataSetting != DataSetting.Aggregation);

                    if (data.DataSetting == DataSetting.List)
                    {
                        rButton_List.Checked = true;
                    }
                    else if (data.DataSetting == DataSetting.Group)
                    {
                        rButton_Group.Checked = true;
                    }
                    else if (data.DataSetting == DataSetting.Aggregation)
                    {
                        rButton_Aggregation.Checked  = true;
                        cBoxAggregation.SelectedItem = data.FunctionInfo;
                    }
                }

                //左父格属性
                if (ActiveElement.ExpandOrientation.isDefaultLeftParent)
                {
                    LeftCoordControl.setValue(ValueSource.Default, "");
                }
                else
                {
                    ValueSource source = (ActiveElement.ExpandOrientation.LeftParent == "" ? ValueSource.None : ValueSource.UseDefined);
                    Cell        Cell   = Report.ReportSheet.GetCellFromTag(null, ActiveElement.ExpandOrientation.LeftParent);
                    String      cell   = "";
                    if (Cell != null)
                    {
                        cell = Arabic_Numerals_Convert.Excel_Word_Numerals(Cell.Column.Index) + (Cell.Row.Index + 1).ToString();
                    }
                    LeftCoordControl.setValue(source, cell);
                }

                //上父格
                if (ActiveElement.ExpandOrientation.isDefaultTopParent)
                {
                    TopCoordControl.setValue(ValueSource.Default, "");
                }
                else
                {
                    ValueSource source = (ActiveElement.ExpandOrientation.TopParent == "" ? ValueSource.None : ValueSource.UseDefined);
                    Cell        Cell   = Report.ReportSheet.GetCellFromTag(null, ActiveElement.ExpandOrientation.TopParent);
                    String      cell   = "";
                    if (Cell != null)
                    {
                        cell = Arabic_Numerals_Convert.Excel_Word_Numerals(Cell.Column.Index) + (Cell.Row.Index + 1).ToString();
                    }

                    TopCoordControl.setValue(source, cell);
                }
            }
        }
Exemplo n.º 16
0
        private void DataColumnEditor_Load(object sender, EventArgs e)
        {
            //加载数据集
            cBoxDatasets.Items.Clear();
            foreach (TableData dataSource in Report.Configuration.DataSources)
            {
                cBoxDatasets.Items.Add(dataSource);
            }

            if (cBoxDatasets.Items.Count > 0)
            {
                cBoxDatasets.SelectedIndex = 0;
            }

            //指定分组配置
            rButtonGroup.Checked    = true;
            cBoxGroup.SelectedIndex = 0;
            //指定默认的扩展方式
            rButton_TopToBottom.Checked = true;
            //初始化条件编辑器
            filterControl1.InitControl(Report.Configuration);
            //加载汇总的方式
            cBoxAggregation.Items.Clear();
            cBoxAggregation.Items.Add(FunctionInfo.Sum);
            cBoxAggregation.Items.Add(FunctionInfo.Avg);
            cBoxAggregation.Items.Add(FunctionInfo.Max);
            cBoxAggregation.Items.Add(FunctionInfo.Min);
            cBoxAggregation.Items.Add(FunctionInfo.Count);
            cBoxAggregation.Items.Add(FunctionInfo.None);
            cBoxAggregation.SelectedIndex = 0;

            if (Element != null && Element.Value is DataColumn)
            {
                DataColumn DataColumn = Element.Value as DataColumn;

                int Index = 0;
                foreach (TableData dataSource in cBoxDatasets.Items)
                {
                    if (dataSource.GetTableName().ToLower() == DataColumn.TableName.ToLower())
                    {
                        Index = cBoxDatasets.Items.IndexOf(dataSource);
                        break;
                    }
                }

                if (cBoxDatasets.Items.Count > 0)
                {
                    cBoxDatasets.SelectedIndex = Index;
                }
                else
                {
                    cBoxDatasets.SelectedIndex = -1;
                }

                Index = 0;
                foreach (FieldInfo Info in cBoxFields.Items)
                {
                    if (Info.FieldName.ToLower() == DataColumn.FieldName.ToLower())
                    {
                        Index = cBoxFields.Items.IndexOf(Info);
                        break;
                    }
                }

                if (cBoxFields.Items.Count > 0)
                {
                    cBoxFields.SelectedIndex = Index;
                }
                else
                {
                    cBoxFields.SelectedIndex = -1;
                }

                if (Element.ExpandOrientation.isDefaultLeftParent)
                {
                    LeftCoordControl.setValue(ValueSource.Default, "");
                }
                else
                {
                    ValueSource source = (Element.ExpandOrientation.LeftParent == "" ? ValueSource.None : ValueSource.UseDefined);
                    Cell        Cell   = Report.ReportSheet.GetCellFromTag(null, Element.ExpandOrientation.LeftParent);
                    String      cell   = "";
                    if (Cell != null)
                    {
                        cell = Arabic_Numerals_Convert.Excel_Word_Numerals(Cell.Column.Index) + (Cell.Row.Index + 1).ToString();
                    }
                    LeftCoordControl.setValue(source, cell);
                }

                if (Element.ExpandOrientation.isDefaultTopParent)
                {
                    TopCoordControl.setValue(ValueSource.Default, "");
                }
                else
                {
                    ValueSource source = (Element.ExpandOrientation.TopParent == "" ? ValueSource.None : ValueSource.UseDefined);
                    Cell        Cell   = Report.ReportSheet.GetCellFromTag(null, Element.ExpandOrientation.TopParent);
                    String      cell   = "";
                    if (Cell != null)
                    {
                        cell = Arabic_Numerals_Convert.Excel_Word_Numerals(Cell.Column.Index) + (Cell.Row.Index + 1).ToString();
                    }
                    TopCoordControl.setValue(source, cell);
                }

                if (DataColumn.DataSetting == DataSetting.Group)
                {
                    rButtonGroup.Checked    = true;
                    cBoxGroup.SelectedIndex = (DataColumn.IsUserDefinedGroup ? 1 : 0);
                }
                else if (DataColumn.DataSetting == DataSetting.List)
                {
                    rButtonList.Checked = true;
                }
                else if (DataColumn.DataSetting == DataSetting.Aggregation)
                {
                    rButtonAggregation.Checked = true;
                    Index = -1;
                    foreach (FunctionInfo Info in cBoxAggregation.Items)
                    {
                        if (Info.Name.ToLower() == DataColumn.FunctionInfo.Name.ToLower())
                        {
                            Index = cBoxAggregation.Items.IndexOf(Info);
                            break;
                        }
                    }
                    cBoxAggregation.SelectedIndex = Index;
                }

                if (Element.ExpandOrientation.Orientation == ExpandOrientation.TopToBottom)
                {
                    rButton_TopToBottom.Checked = true;
                }
                else if (Element.ExpandOrientation.Orientation == ExpandOrientation.LeftToRight)
                {
                    rButton_LeftToRight.Checked = true;
                }
                else if (Element.ExpandOrientation.Orientation == ExpandOrientation.None)
                {
                    rButton_None.Checked = true;
                }

                checkBox1.Checked = DataColumn.UseParentCellFilter;
                filterControl1.SetCondition(DataColumn.DataFilter);

                checkBox2.Checked      = (DataColumn.BlankCount != 0);
                numericUpDown1.Enabled = checkBox2.Checked;
                numericUpDown1.Value   = (numericUpDown1.Enabled ? DataColumn.BlankCount : 1);
            }
        }