Exemplo n.º 1
0
        internal static void PrintTestRecipeStepsReport(SimpleDocumentRenderer doc)
        {
            int[] widths = new int[] { 50, 200, 350, 150 };

            Func <string[]> GetStep2 = MakeStepGetter();

            int i                   = -1;
            int max_rows            = 100;
            CallbackRowRenderer row = new CallbackRowRenderer((row_renderer) =>
            {
                TextCell cell(int idx)
                {
                    return(row_renderer.Cells[idx] as TextCell);
                }
                if (i++ >= max_rows)
                {
                    return(false);
                }
                if (i == 0)
                {
                    cell(0).SetText("#", MyFonts.Consolas10);
                    cell(1).SetText("Timestamp", MyFonts.Consolas10);
                    cell(2).SetText("Step Text", MyFonts.Consolas10);
                    cell(3).SetText("Step Type", MyFonts.Consolas10);
                    return(true);
                }

                var step = GetStep2();

                cell(0).SetText(i.ToString(), MyFonts.Consolas6);
                for (int j = 0; j < 3; ++j)
                {
                    cell(j + 1).SetText(step[j], MyFonts.Consolas6);
                }

                return(true);
            });

            doc.AddRow(new TextCell("Recipe Steps Report", MyFonts.Consolas20, Alignment.Center, 0));
            doc.AddRow(new TextCell(" ", MyFonts.Consolas10)); // spacer
            doc.AddRow(row);

            for (int n = 0; n < 4; ++n)
            {
                row.AddCell(new TextCell("", MyFonts.Consolas6, Alignment.Left, widths[n]));
            }

            doc.Print();
        }
Exemplo n.º 2
0
        private void _Init(SimpleDocumentRenderer p)
        {
            Printer = p;

            int[] widths = new int[] { 75, 175, 300, 150 };

            _title    = new ReportTitle("Recipe Steps Report");
            _metadata = new ReportMetadata("Batch name: \"test\"");
            _headers  = new RecordTableRow(ReportFonts.ColumnHeaderFont, "#", "Timestamp", "Step", "Type");

            _recordRow = new CallbackRowRenderer(UpdateRow);
            _record    = new RecipeStepRecord(_recordRow);

            p.AddRow(_title);
            p.AddRow(_metadata);
            p.AddRow(_headers);
            p.AddRow(_recordRow);

            _metadata.Margin.Top    = 25;
            _metadata.Margin.Bottom = 25;

            _headers.SetWidths(widths);
            _record.SetWidths(widths);
        }
Exemplo n.º 3
0
        private static void AddRowWithText(SimpleDocumentRenderer printer, string text1, string text2, string text3)
        {
            Row row = new Row();

            printer.AddRow(row);

            TextCell c1 = new TextCell(text1, MyFonts.Consolas10);

            row.AddCell(c1);
            TextCell c2 = row.AddTextCell(text2, MyFonts.Consolas10);
            TextCell c3 = row.AddTextCell(text3, MyFonts.Consolas10);

            c1.Width = 200;
            c2.Width = 200;
            c3.Width = 200;
        }
Exemplo n.º 4
0
        private static void Test2()
        {
            const string           file = "testcode2.pdf";
            SimpleDocumentRenderer doc  = CreatePDFPRinter(file);

            int[] widths = new int[] { 50, 200, 350, 150 };

            Func <string[]> GetStep2 = MakeStepGetter();

            for (int i = 0; i < 200; ++i)
            {
                Row      row  = new Row();
                string[] step = GetStep2();
                row.AddCell(new TextCell(i.ToString(), MyFonts.Consolas6, Alignment.Left, widths[0]));
                for (int j = 0; j < 3; ++j)
                {
                    row.AddCell(new TextCell(step[j], MyFonts.Consolas6, Alignment.Left, widths[j + 1]));
                }

                doc.AddRow(row);
            }
            doc.Print();
        }