Exemple #1
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);
                }
            }
        }
Exemple #2
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);
            }
        }