コード例 #1
0
        /// <summary>
        /// Iterates alls XRTableCell and XRLabel cells in the given report
        /// </summary>
        /// <param name="report">The report to fix its RTL direction alignment</param>
        private static void IterateCells(XtraReport report)
        {
            // Iterate all XRTableCells and fix them
            MakeCellsRightToLeft(report, report.AllControls<XRTableCell>());

            // Iterate all XRLabels and fix them
            MakeCellsRightToLeft(report, report.AllControls<XRLabel>());
        }
コード例 #2
0
        /// <summary>
        /// Iterates alls XRTableCell and XRLabel cells in the given report
        /// </summary>
        /// <param name="report">The report to fix its RTL direction alignment</param>
        private static void IterateCells(XtraReport report)
        {
            // Iterate all XRTableCells and fix them
            MakeCellsRightToLeft(report, report.AllControls <XRTableCell>());

            // Iterate all XRLabels and fix them
            MakeCellsRightToLeft(report, report.AllControls <XRLabel>());
        }
コード例 #3
0
        private static void TranslateReport(XtraReport xtraReport)
        {
            var list = xtraReport.AllControls <XRControl>();

            foreach (var c in list)
            {
                string name = c.Report.GetType().Name + "." + c.Name;
                c.Text = TranslateString(name, c.Text);
            }
        }
コード例 #4
0
        private static void TranslateReport(XtraReport xtraReport)
        {
            var list = xtraReport.AllControls <XRControl>();

            foreach (var c in list)
            {
                if (Language == LanguageEnum.Lao)
                {
                    c.Font = new System.Drawing.Font("Saysettha Unicode", c.Font.Size, c.Font.Style);
                }
                else
                {
                    c.Font = new System.Drawing.Font("Times New Roman", c.Font.Size, c.Font.Style);
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Fix all cells (of either XRLabel and XRTableCell) by injeting Right-To-Left mark (U+200F)
        ///  to the end of their Text proeprty. SubReports are iterated automatically, too.
        /// </summary>
        /// <param name="report">The report to fix its RTL direction alignment</param>
        public static void FixRTLText(this XtraReport report)
        {
            report.BeforePrint += (sender, args) =>
            {
                IterateCells(report);

                // Iterate all XRSubReport
                var subs = report.AllControls <XRSubreport>();
                if (subs.Any())
                {
                    // Iterate all subreports and fix them
                    foreach (var subreoprt in subs)
                    {
                        subreoprt.ReportSource.FixRTLText();
                    }
                }
            };
        }
コード例 #6
0
        public void Check(XtraReport report, IDataCollector dataCollector)
        {
            if (report == null || dataCollector == null)
            {
                return;
            }

            var dynamicTableCells = dataCollector.DynamicTableCellsCollector.DynamicTableCells;

            foreach (var table in report.AllControls <XRTable>())
            {
                if (dynamicTableCells.ContainsKey(table.Name))
                {
                    var orgCell = table.Rows[0].Cells[0];

                    table.Rows.Clear();
                    var newRow = new XRTableRow();
                    table.Rows.Add(newRow);

                    var orgWidth    = table.Width;
                    var columnCount = Math.Max(dynamicTableCells[table.Name].Count, 1);
                    var newWidth    = orgWidth / columnCount;

                    foreach (var dynamicTableCell in dynamicTableCells[table.Name])
                    {
                        var newCell = CreateNewTableCell(orgCell);
                        SetDynamicTableCellProperties(newCell, dynamicTableCell);

                        newRow.Cells.Add(newCell);
                    }

                    foreach (var cell in newRow.Cells)
                    {
                        ((XRTableCell)cell).WidthF = newWidth;
                    }
                }
            }
        }
コード例 #7
0
        private ReportDataV2 CreateReport(string reportName, string layoutName, string displayName = null, Type parameters = null, string subReportUrl = null)
        {
            if (displayName == null)
            {
                displayName = reportName;
            }
            ReportDataV2 reportData = ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", displayName));

            if (reportData == null)
            {
                reportData = ObjectSpace.CreateObject <ReportDataV2>();
                XtraReport rep           = new XtraReport();
                var        assembly      = Assembly.GetExecutingAssembly();
                var        resourceNames = assembly.GetManifestResourceNames();
                var        resourceName  = resourceNames.FirstOrDefault(p => p.Contains(layoutName));

                using (Stream stream = assembly.GetManifestResourceStream(resourceName)) {
                    rep.LoadLayout(stream);
                }
                var subreport = rep.AllControls <XRSubreport>().FirstOrDefault();
                if (subreport != null && subReportUrl != null)
                {
                    subreport.ReportSourceUrl = subReportUrl;
                }
                rep.DisplayName = displayName;
                if (parameters != null)
                {
                    reportData.ParametersObjectType = parameters;
                }
                ReportDataProvider.ReportsStorage.SaveReport(reportData, rep);
                reportData.IsInplaceReport = true;
            }
            ObjectSpace.CommitChanges();

            return(reportData);
        }