Beispiel #1
0
        public void Render(Rdl.Render.GenericRender rpt)
        {
            rpt.SetSizes(false);

            TopMargin    = rpt.Report.TopMargin.points;
            BottomMargin = rpt.Report.BottomMargin.points;
            LeftMargin   = rpt.Report.LeftMargin.points;
            RightMargin  = rpt.Report.RightMargin.points;
            PageWidth    = rpt.Report.PageWidth.points;
            // Give the height a bit of breathing room because if we try to be exact
            // some browsers will put in extra blank pages.
            PageHeight = rpt.Report.PageHeight.points - 7.2m;
            _top       = rpt.Report.TopMargin.points;
            _left      = rpt.Report.LeftMargin.points;
            _width     = rpt.Report.PageWidth.points - rpt.Report.RightMargin.points - rpt.Report.LeftMargin.points;
            _height    = rpt.Report.PageHeight.points - rpt.Report.TopMargin.points - rpt.Report.BottomMargin.points;

            _pageList = new List <Page>();
            Container b = null;
            Page      p = new Page(
                rpt,
                0,
                rpt.BodyContainer.Width, //PageWidth - RightMargin - LeftMargin,
                PageHeight - TopMargin - BottomMargin,
                0,
                null,
                ref b);

            _pageList.Add(p);
            RecurseRender(rpt, rpt.BodyContainer, ref b, ref p, 0, rpt.BodyContainer.Top, 0, 0);

            //p.AddFooters(rpt, null, true);
            p.RemoveLastPageHeadersAndFooters(rpt);
            p.ResolveReportItemReferences();
        }
Beispiel #2
0
        public string Render(Rdl.Render.GenericRender report)
        {
            report.SetSizes(true);

            _rows = new List <TextLine>();
            RecurseBuildRows(report.BodyContainer, 0, 0);
            _rows.Sort(delegate(TextLine d1, TextLine d2) { return(decimal.Compare(d1.pos, d2.pos)); });

            StringBuilder sb = new StringBuilder();

            foreach (TextLine t in _rows)
            {
                t.text.Sort(delegate(TextPoint d1, TextPoint d2) { return(decimal.Compare(d1.pos, d2.pos)); });

                bool first = true;
                foreach (TextPoint p in t.text)
                {
                    if (!first)
                    {
                        sb.Append(",");
                    }
                    first = false;

                    sb.Append("\"" + p.text.Replace("\"", "\"\"").TrimEnd() + "\"");
                }
                sb.AppendLine();
            }

            return(sb.ToString());
        }
Beispiel #3
0
        public void RenderBody(bool forPrint)
        {
            _body.Length = 0;

            _sourceReport.SetSizes(false);

            RecurseRender(_sourceReport, _body, _sourceReport.PageHeaderContainer, 1, forPrint);
            RecurseRender(_sourceReport, _body, _sourceReport.BodyContainer, 1, forPrint);
            RecurseRender(_sourceReport, _body, _sourceReport.PageFooterContainer, 1, forPrint);
        }
Beispiel #4
0
        public byte[] Render(Rdl.Render.GenericRender report, bool renderAll)
        {
            _report = report;
            MemoryStream ms = new MemoryStream();

            report.SetSizes(renderAll);

            _workbook = Workbook.createWorkbook(ms);
            //_workbook = Workbook.createWorkbook(new System.IO.FileInfo(@"c:\foo.xls"));
            _ws = _workbook.createSheet("Sheet 1", 0);

            RecurseBuildRowsCols(report.BodyContainer, 0, 0, renderAll);
            _rows.Add(0);
            _rows.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); });
            _cols.Add(0);
            _cols.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); });

            for (int i = 1; i < _rows.Count; i++)
            {
                _ws.setRowView(i - 1, (int)((_rows[i] - _rows[i - 1]) * _lineHeight));
            }

            for (int i = 1; i < _cols.Count; i++)
            {
                _ws.setColumnView(i - 1, (int)((_cols[i] - _cols[i - 1]) * _colWidth));
            }

            formats = new WritableCellFormat[report.StyleList.Count];
            for (int i = 0; i < report.StyleList.Count; i++)
            {
                if (report.StyleList[i] is TextStyle)
                {
                    formats[i] = GetWritableFormat((TextStyle)report.StyleList[i]);
                }
            }

            RecurseRender(report.BodyContainer, 0, 0, renderAll);

            _workbook.write();
            _workbook.close();
            //BIFF8Writer.WriteWorkbookToStream(_workbook, ms);
            return(ms.ToArray());
        }
Beispiel #5
0
        public string Render(Rdl.Render.GenericRender report)
        {
            report.SetSizes(true);

            RecurseBuildRows(report.BodyContainer, 0);
            _rows.Add(0);
            _rows.Sort(delegate(decimal d1, decimal d2) { return(decimal.Compare(d1, d2)); });

            // Convert the list of text positions into text lines assuming 12 points per line.
            _rowsToLines = new int[_rows.Count];
            int     line    = 0;
            decimal lastPos = 0;

            for (int i = 0; i < _rows.Count; i++)
            {
                int lineAdd = (int)((_rows[i] - lastPos) / 24);
                line           += lineAdd;
                _rowsToLines[i] = line;
                lastPos         = _rows[i];

                line++;
            }
            _lines = new string[line];

            // Render the report onto _lines.
            RecurseRender(report.BodyContainer, 0, 0);

            StringBuilder sb = new StringBuilder();

            for (Int32 i = 0; i < line; i++)
            {
                if (_lines[i] == null)
                {
                    sb.AppendLine();
                }
                else
                {
                    sb.AppendLine(_lines[i]);
                }
            }

            return(sb.ToString());
        }