コード例 #1
0
        public virtual void Render(SheetContext sheetContext)
        {
            Repeater repeater = sheetContext.WorksheetContainer.Repeaters[Name];

            if (RendererList.IsNullOrEmpty())
            {
                throw new RenderException($"RepeaterRenderer[{repeater.Name}] is empty");
            }

            if (!DataSource.IsNull())
            {
                foreach (var item in DataSource)
                {
                    sheetContext.CopyRepeaterTemplate(repeater, () =>
                    {
                        foreach (var renderer in RendererList.OrderBy(renderer => renderer.SortNum(sheetContext)))
                        {
                            renderer.Render(sheetContext, item);
                        }
                    });
                }
            }

            sheetContext.RemoveRepeaterTemplate(repeater);
        }
コード例 #2
0
        public virtual void Render(SheetContext sheetContext)
        {
            Repeater repeater = sheetContext.WorksheetContainer.Repeaters[Name];

            if (RendererList.IsNullOrEmpty())
            {
                throw new RenderException($"RepeaterRenderer[{repeater.Name}] is empty");
            }

            if (!DataSource.IsNull())
            {
                DataSource.All(item =>
                {
                    sheetContext.CopyRepeaterTemplate(repeater, () =>
                    {
                        RendererList.OrderBy(renderer => renderer.SortNum(sheetContext)).All(renderer =>
                        {
                            renderer.Render(sheetContext, item);
                            return(true);
                        });
                    });
                    return(true);
                });
            }

            sheetContext.RemoveRepeaterTemplate(repeater);
        }