Example #1
0
        public XlsTableReportColumnAdjustInfo(ReportColumnDef column)
            : base(column)
        {
            Control     = column;
            Id          = column.Id;
            CaptionSize = GetMaxWordLength(column.Caption);

            if (column is ReportRowNoColumnDef)
            {
                Size = Math.Max(IntegerColumnWidth, CaptionSize);
            }
            else
            {
                Size = Math.Max(TextColumnWidth, CaptionSize);
            }
        }
        protected void AddColumn(XlsGroup band, XlsRow gridRow, ReportColumnDef column, Dictionary <Guid, SqlQuerySource> sourceMap)
        {
            var header = new XlsTextNode(column.Caption);

            band.AddGroup(header);
            var info       = _adjuster.Find(column);
            var attrColumn = column as ReportAttributeColumnDef;

            if (attrColumn != null && SqlDataSet != null)
            {
                SqlQuerySource querySource;
                var            reportSource     = Report.GetSourceDef(attrColumn.Attribute.SourceId);
                var            reportSourceAttr = reportSource.Attributes != null
                    ? reportSource.Attributes.FirstOrDefault(a => a.Id == attrColumn.Attribute.AttributeId)
                    : null;

                var hasQuerySource = sourceMap.TryGetValue(attrColumn.Attribute.SourceId, out querySource);

                var attr = reportSourceAttr == null
                    ? !hasQuerySource
                        ? SqlDataSet.Reader.Query.FindAttribute(attrColumn.Attribute.AttributeId)
                        : SqlDataSet.Reader.Query.FindAttribute(querySource, attrColumn.Attribute.AttributeId)
                    : !hasQuerySource
                        ? SqlDataSet.Reader.Query.FindAttribute(reportSourceAttr.Ident)
                        : SqlDataSet.Reader.Query.FindAttribute(querySource, reportSourceAttr.Ident);

                if (attr != null)
                {
                    var field = gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, attrColumn.ToSqlGrouping()));
                    if (info != null)
                    {
                        header.ColSpan = info.ColSpan;
                        field.ColSpan  = info.ColSpan;
                    }
                }
            }
        }
 protected void AddControlColumn(ReportColumnDef column)
 {
     _columns.Add(new XlsTableReportColumnAdjustInfo(column));
 }
 protected void AddControlBand(ReportColumnDef column)
 {
     AddControlColumn(column);
 }