コード例 #1
0
ファイル: CrossViewHelper.cs プロジェクト: Telesquad1/Forky
        private void InitTemplateTable()
        {
            TableColumn         column;
            CrossViewDescriptor descr;

            for (int i = 0; i < headerWidth + templateBodyWidth; i++)
            {
                column = new TableColumn();
                descr  = CrossView.Data.GetColumnDescriptor(i);
                if (descr.TemplateColumn != null)
                {
                    column.Assign(descr.TemplateColumn);
                }
                ResultTable.Columns.Add(column);
            }
            TableRow row;

            for (int i = 0; i < headerHeight + templateBodyHeight; i++)
            {
                row = new TableRow();
                int rowindex = i;
                if (crossView.ShowTitle)
                {
                    rowindex--;
                }
                if (crossView.ShowXAxisFieldsCaption)
                {
                    rowindex--;
                }
                if (rowindex >= 0)
                {
                    descr = CrossView.Data.GetRowDescriptor(rowindex);
                }
                else
                {
                    if (crossView.ShowTitle)
                    {
                        if (i == 0)
                        {
                            descr = titleDescriptor;
                        }
                        else
                        {
                            descr = xAxisFieldCaptionDescriptor;
                        }
                    }
                    else
                    {
                        descr = xAxisFieldCaptionDescriptor;
                    }
                }
                if (descr.TemplateRow != null)
                {
                    row.Assign(descr.TemplateRow);
                }
                ResultTable.Rows.Add(row);
            }
        }
コード例 #2
0
ファイル: MatrixHelper.cs プロジェクト: zwyl2001/FastReport
        private void InitResultTable(bool isTemplate)
        {
            Matrix.Data.Columns.AddTotalItems(isTemplate);
            Matrix.Data.Rows.AddTotalItems(isTemplate);
            List <MatrixHeaderItem> columnTerminalItems = Matrix.Data.Columns.RootItem.GetTerminalItems();
            List <MatrixHeaderItem> rowTerminalItems    = Matrix.Data.Rows.RootItem.GetTerminalItems();

            // create corner
            List <MatrixDescriptor> descrList = new List <MatrixDescriptor>();

            if (Matrix.ShowTitle)
            {
                descrList.Add(titleDescriptor);
            }
            descrList.AddRange(Matrix.Data.Columns.ToArray());
            if (Matrix.Data.Cells.Count > 1 && Matrix.CellsSideBySide)
            {
                descrList.Add(cellHeaderDescriptor);
            }

            foreach (MatrixDescriptor descr in descrList)
            {
                TableRow row = new TableRow();
                if (descr.TemplateRow != null)
                {
                    row.Assign(descr.TemplateRow);
                }
                ResultTable.Rows.Add(row);
            }

            descrList.Clear();
            descrList.AddRange(Matrix.Data.Rows.ToArray());
            if (Matrix.Data.Cells.Count > 1 && !Matrix.CellsSideBySide)
            {
                descrList.Add(cellHeaderDescriptor);
            }

            foreach (MatrixDescriptor descr in descrList)
            {
                TableColumn column = new TableColumn();
                if (descr.TemplateColumn != null)
                {
                    column.Assign(descr.TemplateColumn);
                }
                ResultTable.Columns.Add(column);
            }

            // determine the body location
            Point bodyLocation = GetBodyLocation();

            // create columns
            foreach (MatrixHeaderItem item in columnTerminalItems)
            {
                foreach (MatrixCellDescriptor descr in Matrix.Data.Cells)
                {
                    TableColumn column = new TableColumn();
                    if (item.TemplateColumn != null && descr.TemplateColumn != null)
                    {
                        column.Assign(Matrix.Columns[item.TemplateColumn.Index + (descr.TemplateColumn.Index - bodyLocation.X)]);
                    }
                    ResultTable.Columns.Add(column);

                    if (!Matrix.CellsSideBySide)
                    {
                        break;
                    }
                }
            }

            // create rows
            foreach (MatrixHeaderItem item in rowTerminalItems)
            {
                foreach (MatrixCellDescriptor descr in Matrix.Data.Cells)
                {
                    TableRow row = new TableRow();
                    if (item.TemplateRow != null && descr.TemplateRow != null)
                    {
                        row.Assign(Matrix.Rows[item.TemplateRow.Index + (descr.TemplateRow.Index - bodyLocation.Y)]);
                    }
                    ResultTable.Rows.Add(row);

                    if (Matrix.CellsSideBySide)
                    {
                        break;
                    }
                }
            }
        }