示例#1
0
        public override void Write(IReportWriter writer, object datasource)
        {
            int listX;

            if (this.X.HasValue)
            {
                listX = this.X.Value - 1;
            }
            else
            {
                listX = writer.LastX;
            }

            writer.SetCurrentX(listX);

            if (this.Y.HasValue)
            {
                writer.SetCurrentY(this.Y.Value);
            }
            var internalDatasource = this.GetInternalDatasource(datasource);

            this.itemNumber           = 1;
            writer.Context.ItemNumber = this.itemNumber;
            var itemTemplate = this.itemTemplates.ContainsKey(writer.GetType())
                                   ? this.itemTemplates[writer.GetType()]
                                   : null;

            foreach (var item in internalDatasource)
            {
                writer.StartRow(itemTemplate);
                foreach (var reportContent in contents.Contents)
                {
                    reportContent.Write(writer, item);
                }

                if (Direction == DirectionEnum.Vertical)
                {
                    writer.CrLf();
                    writer.SetCurrentX(listX);
                }

                this.itemNumber++;
                writer.Context.ItemNumber = this.itemNumber;
            }
        }