コード例 #1
0
        private static void AddDataRows(
            this CellCursor cursor,
            DataRows dataRows,
            ReportToWorkbookProjectionContext context,
            PassKind passKind)
        {
            if (dataRows == null)
            {
                return;
            }

            if (dataRows.Rows.Any())
            {
                for (var x = 0; x < dataRows.Rows.Count; x++)
                {
                    cursor.ResetColumn();

                    cursor.MoveDown();

                    if (x == 0)
                    {
                        cursor.AddMarker(TopLeftDataCellMarker);
                    }

                    if (passKind == PassKind.Formatting)
                    {
                        cursor.CanvassedRowRange.ApplyDataRowsFormat(dataRows.Format);
                    }

                    cursor.AddRow(dataRows.Rows[x], context, passKind, dataRows.Format);
                }

                cursor.AddMarker(BottomRightDataCellMarker);
            }
        }
コード例 #2
0
        private static void AddRow(
            this CellCursor cursor,
            DataStructure.Row row,
            ReportToWorkbookProjectionContext context,
            PassKind passKind,
            DataRowsFormat dataRowsFormat)
        {
            cursor.AddRowBase(row, context, passKind);

            if (cursor.HasMarker(BottomRightNonSummaryDataCellMarker))
            {
                cursor.RemoveMarker(BottomRightNonSummaryDataCellMarker);
            }

            cursor.AddMarker(BottomRightNonSummaryDataCellMarker);

            if ((row.ChildRows != null) && row.ChildRows.Any())
            {
                foreach (var childRow in row.ChildRows)
                {
                    cursor.ResetColumn();

                    cursor.MoveDown();

                    if (passKind == PassKind.Formatting)
                    {
                        cursor.CanvassedRowRange.ApplyDataRowsFormat(dataRowsFormat);
                    }

                    cursor.AddRow(childRow, context, passKind, dataRowsFormat);
                }
            }

            if (row.CollapsedSummaryRows != null && row.CollapsedSummaryRows.Any())
            {
                throw new NotSupportedException("collapsed summary rows are not supported");
            }

            if (row.ExpandedSummaryRows != null)
            {
                foreach (var expandedSummaryRow in row.ExpandedSummaryRows)
                {
                    cursor.ResetColumn();

                    cursor.MoveDown();

                    if (passKind == PassKind.Formatting)
                    {
                        cursor.CanvassedRowRange.ApplyDataRowsFormat(dataRowsFormat);
                    }

                    cursor.AddFlatRow(expandedSummaryRow, context, passKind);
                }
            }
        }
コード例 #3
0
        private static void AddHeaderRows(
            this CellCursor cursor,
            HeaderRows headerRows,
            ReportToWorkbookProjectionContext context,
            PassKind passKind)
        {
            if (headerRows == null)
            {
                return;
            }

            if (headerRows.Rows.Any())
            {
                for (var x = 0; x < headerRows.Rows.Count; x++)
                {
                    cursor.ResetColumn();

                    cursor.MoveDown();

                    if ((x == 0) && (passKind == PassKind.Data))
                    {
                        cursor.AddMarker(TopLeftHeaderCellMarker);
                    }

                    if (passKind == PassKind.Formatting)
                    {
                        cursor.CanvassedRowRange.ApplyHeaderRowsFormat(headerRows.Format);
                    }

                    cursor.AddFlatRow(headerRows.Rows[x], context, passKind);
                }

                if (passKind == PassKind.Data)
                {
                    cursor.AddMarker(BottomRightHeaderCellMarker);
                }
            }
        }