Esempio n. 1
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;
 *          }
 */
        }
Esempio n. 2
0
        protected void AddControlColumn(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            band.AddGroup(new XlsTextNode(control.Caption));
            if (DataSet != null)
            {
                gridRow.AddDataField(new DocFormDataSetField(DataSet, control));
            }
            else if (SqlDataSet != null)
            {
                if (!(control is BizDataControl))
                {
                    return;
                }

                var attr = SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeDefId ?? Guid.Empty) ??
                           SqlDataSet.Reader.Query.FindAttribute(((BizDataControl)control).AttributeName);
                if (attr != null)
                {
                    gridRow.AddDataField(new SqlQueryDataSetField(SqlDataSet, attr, control));
                }
            }
        }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
0
 private void AddRow(XlsRow dRow, CrossDataRow row)
 {
     foreach (var data in Table.GetRowColumnDatas(row))
     {
         if (data is int)
         {
             dRow.AddInt((int)data);
         }
         else if (data is double)
         {
             dRow.AddFloat((double)data);
         }
         else if (data is bool)
         {
             dRow.AddBool((bool)data);
         }
         else if (data is DateTime)
         {
             dRow.AddDateTime((DateTime)data);
         }
         else
         {
             dRow.AddText(data != null ? data.ToString() : "");
         }
     }
     dRow.Style.AutoHeight = true;
 }
Esempio n. 5
0
        public XlsRow AddRow()
        {
            var row = new XlsRow();

            Items.Add(row);
            return(row);
        }
Esempio n. 6
0
        public XlsRow AddRow(string text, int colSpan = 0, int rowSpan = 0)
        {
            var row = new XlsRow();

            Items.Add(row);
            row.AddText(text, colSpan, rowSpan);
            return(row);
        }
        protected void AddControlBand(XlsGroup band, XlsRow gridRow, BizControl control)
        {
            if (control.Invisible)
            {
                return;
            }

            if (control is BizPanel

                /*control is BizTableColumn ||
                 * control is BizDocumentControl || control is BizDocumentListForm*/)
            {
                var node = new XlsTextNode(control.Caption);
                band.AddGroup(node);

                foreach (var child in control.Children)
                {
                    AddControlBand(node, gridRow, child);
                }
            }
            else if (control is BizTableColumn ||
                     control is BizDocumentControl || control is BizDocumentListForm)
            {
                if (control.Children != null)
                {
                    foreach (var child in control.Children)
                    {
                        AddControlBand(band, gridRow, child);
                    }
                }
            }
            else if (control is BizDataControl)
            {
                AddControlColumn(band, gridRow, control);
            }
            else
            if (control.Children != null)
            {
                foreach (var child in control.Children)
                {
                    AddControlBand(band.AddGroup(new XlsTextNode(child.Caption)), gridRow, child);
                }
            }
        }
        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;
                    }
                }
            }
        }
Esempio n. 9
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;
                    }
                }
            }
        }