Ejemplo n.º 1
1
        private static void SetupDataTablePrintControlPresenter(DataTable dataTable, DataTablePrintControlViewModel printControlPresenter, List<double> columnWidths, string headerTemplate)
        {

            var fieldNames = new List<string>();
            foreach (DataColumn column in dataTable.Columns)
            {
                fieldNames.Add(column.ColumnName);
            }

            double pageAccrossWidth = 0;

            foreach (var columnsWidth in columnWidths)
            {
                pageAccrossWidth += columnsWidth;
            }

            var customVisualGrid = CreateDocument(dataTable, pageAccrossWidth, columnWidths);

            var rowHeights = CalculateRowHeights(customVisualGrid);

            var drawingVisual = CreateDrawingVisual(customVisualGrid, pageAccrossWidth, customVisualGrid.ActualHeight);

            var printTableDefination = new PrintTableDefination
            {
                ColumnWidths = columnWidths,
                RowHeights = rowHeights,
                HasFooter = false,
                FooterText = null,
                ColumnNames = fieldNames.ToArray(),
                ColumnHeaderFontSize = 12,
                ColumnHeaderBrush = Brushes.Black,
                ColumnHeaderHeight = 22,
                HeaderTemplate = headerTemplate
            };

            printControlPresenter.PrintTableDefination = printTableDefination;
            printControlPresenter.DrawingVisual = drawingVisual;
            return;
        }
Ejemplo n.º 2
0
 public ItemsPaginator(DrawingVisual source, Size printSize, Thickness pageMargins, PrintTableDefination printTableDefination)
     : base(source, printSize, pageMargins, pageMargins)
 {
     PrintTableDefination = printTableDefination;
     ColumnCount = new List<int>();
     CalculateHeaderHeight();
 }
Ejemplo n.º 3
0
        private static void SetupDataTablePrintControlPresenter(DataTable dataTable, DataTablePrintControlViewModel printControlPresenter, List <double> columnWidths, string headerTemplate)
        {
            var fieldNames = new List <string>();

            foreach (DataColumn column in dataTable.Columns)
            {
                fieldNames.Add(column.ColumnName);
            }

            double pageAccrossWidth = 0;

            foreach (var columnsWidth in columnWidths)
            {
                pageAccrossWidth += columnsWidth;
            }

            var customVisualGrid = CreateDocument(dataTable, pageAccrossWidth, columnWidths);

            var rowHeights = CalculateRowHeights(customVisualGrid);

            var drawingVisual = CreateDrawingVisual(customVisualGrid, pageAccrossWidth, customVisualGrid.ActualHeight);

            var printTableDefination = new PrintTableDefination
            {
                ColumnWidths         = columnWidths,
                RowHeights           = rowHeights,
                HasFooter            = false,
                FooterText           = null,
                ColumnNames          = fieldNames.ToArray(),
                ColumnHeaderFontSize = 12,
                ColumnHeaderBrush    = Brushes.Black,
                ColumnHeaderHeight   = 22,
                HeaderTemplate       = headerTemplate
            };

            printControlPresenter.PrintTableDefination = printTableDefination;
            printControlPresenter.DrawingVisual        = drawingVisual;
            return;
        }
Ejemplo n.º 4
0
 public DataGridPaginator(DrawingVisual source, Size printSize, Thickness pageMargins, PrintTableDefination printTableDefination)
     : base(source, printSize, pageMargins, printTableDefination)
 {
 }