Esempio n. 1
0
        public void UpdateChart()
        {
            foreach (SheetView Sheet in FpSpread.Sheets)
            {
                //支持嵌入的图表
                int RowCount    = Sheet.GetLastNonEmptyRow(NonEmptyItemFlag.Style);
                int ColumnCount = Sheet.GetLastNonEmptyColumn(NonEmptyItemFlag.Style);
                for (int i = 0; i <= RowCount; i++)
                {
                    for (int j = 0; j <= ColumnCount; j++)
                    {
                        if (Sheet.Cells[i, j].CellType is ChartCellType)
                        {
                            ChartCellType ChartType = Sheet.Cells[i, j].CellType as ChartCellType;
                            Rectangle     r         = FpSpread.GetCellRectangle(0, 0, i, j);
                            ChartType.ChartSize   = r.Size;
                            ChartType.ActiveSheet = Sheet;
                            ChartType.UpdateChart();
                        }
                    }
                }

                //支持浮动的图表
                foreach (IElement Element in Sheet.DrawingContainer.ContainedObjects)
                {
                    if (Element is ChartShape)
                    {
                        ChartShape Shape = Element as ChartShape;
                        Shape.ActiveSheet = Sheet;
                        Shape.Locked      = false;
                        Shape.UpdateChart();
                    }
                }
            }
        }
Esempio n. 2
0
 private void ShowChartEditor()
 {
     if (FpSpread.ActiveSheet.ActiveCell.CellType is ChartCellType)
     {
         ChartCellType ChartCellType = FpSpread.ActiveSheet.ActiveCell.CellType as ChartCellType;
         ChartCellType.ShowChartEditor();
     }
 }
Esempio n. 3
0
        private void fpSheetEditor1_CellTypeSetting(object sender, CellTypeEventArgs e)
        {
            if (e.CellType is ChartCellType)
            {
                ChartCellType ChartCellType = e.CellType as ChartCellType;
                ChartCellType.ActiveSheet = FpSpread.ActiveSheet;
            }

            IGetFieldType FieldTypeGetter = e.CellType as IGetFieldType;


            CellRange[] CellRanges = FpSpread.ActiveSheet.GetSelections();

            foreach (CellRange Range in CellRanges)
            {
                int Row      = Range.Row;
                int RowCount = Range.RowCount;

                int Column      = Range.Column;
                int ColumnCount = Range.ColumnCount;

                if (Row < 0)
                {
                    Row = 0;
                }
                if (Column < 0)
                {
                    Column = 0;
                }
                if (RowCount < 0)
                {
                    RowCount = FpSpread.ActiveSheet.RowCount;
                }
                if (ColumnCount < 0)
                {
                    ColumnCount = FpSpread.ActiveSheet.ColumnCount;
                }
                Cell cell = FpSpread.ActiveSheet.Cells[Row, Column, Row + RowCount - 1, Column + ColumnCount - 1];
                if (cell != null)
                {
                    cell.CellType = e.CellType;
                }
            }
        }