コード例 #1
0
        public override void Build(XlsArea area, XlsFormColumnAdjuster adjuster)
        {
            var maxRow = Cells.Max(c => c.Row);
            var maxCol = Cells.Max(c => c.Col);

            for (var r = 0; r <= maxRow; r++)
            {
                var row = area.AddRow();

                var info = adjuster.Find(this, -1);
                if (LeftMargin > 0)
                {
                    var marginCell = row.AddEmptyCell(info != null ? info.ColSpan : 0);
                    marginCell.Style.Borders = TableCellBorder.None;
                }

                for (var c = 0; c <= maxCol; c++)
                {
                    info = adjuster.Find(this, c);
                    var cell = Cells.FirstOrDefault(i => i.Row == r && i.Col == c);
                    if (cell != null)
                    {
                        var xlsCell = row.AddText(cell.Text, info != null ? info.ColSpan : 1);
                        xlsCell.Style = ContentStyle.MergeStyles(Style, cell.Style);
                    }
                    else
                    {
                        var xlsCell = row.AddText("", info != null ? info.ColSpan : 1);
                        xlsCell.Style = Style;
                    }
                }
            }
        }
コード例 #2
0
        public override void Build(XlsArea area, XlsFormColumnAdjuster adjuster)
        {
            var row = area.AddRow();

            var info = adjuster.Find(this, -1);

            if (LeftMargin > 0)
            {
                row.AddEmptyCell(info != null ? info.ColSpan : 0);
            }
            info = adjuster.Find(this, 0);
            var cell = row.AddText(Text, info != null ? info.ColSpan : 1);

            cell.Style = Style;
        }
コード例 #3
0
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control, SqlQueryDataSet dataSet)
        {
            if (control.Invisible)
            {
                return;
            }

            var header = new XlsTextNode(control.Caption);

            band.AddGroup(header);
            var info = _adjuster.Find(control);
            var attr = dataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty);

            if (attr != null)
            {
                var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, attr, control));
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                    field.ColSpan  = info.ColSpan;
                }
            }

/*
 *          var field = gridRow.AddDataField(new SqlQueryDataSetField(dataSet, control));
 *          if (info != null)
 *          {
 *              header.ColSpan = info.ColSpan;
 *              field.ColSpan = info.ColSpan;
 * //                if (info.ColSpan == 1)
 * //                    field.Width = info.Size;
 *          }
 */
        }
コード例 #4
0
        protected void BuildHeaderColumns(XlsGroup band, XlsRow gridRow)
        {
            XlsTextNode header;

            foreach (var col in Table.Columns.OfType <CrossDataKeyColumn>())
            {
                header = new XlsTextNode(col.Caption);
                band.AddGroup(header);
                var info = _adjuster.Find(col);
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                }
            }
            var group = Table.Columns.OfType <CrossDataGroupColumn>().FirstOrDefault();

            if (group != null)
            {
                header = new XlsTextNode(group.Caption);
                band.AddGroup(header);
                if (group.Values != null && group.Values.Count > 0)
                {
                    foreach (var val in group.Values)
                    {
                        var h = new XlsTextNode(val.Value != null ? val.Value.ToString() : "");
                        header.AddGroup(h);
                        AddGroupBandColumns(h, val);
                    }
                }
                else
                {
                    AddGroupBandColumns(header, null);
                }
            }
        }
コード例 #5
0
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            var header = new XlsTextNode(control.Caption);

            band.AddGroup(header);
            var info = _adjuster.Find(control);

            if (DataSet != null)
            {
                var field = gridRow.AddDataField(new DocFormDataSetField(DataSet, control));
                if (info != null)
                {
                    header.ColSpan = info.ColSpan;
                    field.ColSpan  = info.ColSpan;
                }
            }
            else if (SqlDataSet != null)
            {
                if (!(control is BizDataControl))
                {
                    return;
                }

                var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty);
                if (attr != null)
                {
                    var field = gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control));
                    if (info != null)
                    {
                        header.ColSpan = info.ColSpan;
                        field.ColSpan  = info.ColSpan;
                    }
                }
            }
        }
コード例 #6
0
        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;
                    }
                }
            }
        }