Example #1
0
        void LoadTemplate(RptRoot p_newRoot, RptRoot p_oldRoot)
        {
            Throw.IfNull(p_newRoot, "报表模板不可为空!");
            _excel.IsBusy = true;

            try
            {
                ClearForms();
                if (p_oldRoot != null)
                {
                    p_oldRoot.Serializing -= OnBeforeSerialize;
                    _excelClerk.DetachEvent(p_oldRoot);
                    _excel.ColumnWidthChanged -= OnColumnWidthChanged;
                    _excel.RowHeightChanged   -= OnRowHeightChanged;
                }

                _excelClerk.AttachEvent(p_newRoot);
                using (_excel.Defer())
                {
                    CreateSheets();
                    InitRowColSize();
                    LoadItems();
                    _excel.DecorationRange = null;
                    RefreshSpliter();
                }

                p_newRoot.Serializing     += OnBeforeSerialize;
                _excel.ColumnWidthChanged += OnColumnWidthChanged;
                _excel.RowHeightChanged   += OnRowHeightChanged;
            }
            finally
            {
                _excel.IsBusy = false;
            }
        }
Example #2
0
        /// <summary>
        /// 绘制报表
        /// </summary>
        /// <returns></returns>
        public async Task <bool> Draw()
        {
            // 构造报表项实例
            RptRoot root = Info.Root;
            await root.Build(this);

            // 页面固定尺寸
            HeaderHeight = root.Header.ActualHeight;
            FooterHeight = root.Footer.ActualHeight;
            BodyHeight   = root.PageSetting.ValidHeight - HeaderHeight - FooterHeight - PageGap;
            BodyWidth    = root.PageSetting.ValidWidth - PageGap;

            // 输出成页,页眉页脚在创建页时输出
            CreatePage(0, 0);
            if (Body != null)
            {
                Body.Output();
            }

            // 渲染
            Info.Inst = this;
            RptRender render = new RptRender(Info);

            render.Render();
            return(true);
        }
Example #3
0
        /// <summary>
        /// 触发报表项更新事件
        /// </summary>
        /// <param name="p_clearOld">是否擦除原区域</param>
        public void Update(bool p_clearOld)
        {
            RptRoot root = Root;

            if (root != null)
            {
                root.OnUpdated(this, p_clearOld);
            }
        }
Example #4
0
 public RptParams(RptRoot p_root)
 {
     Root = p_root;
     Data = new Table
     {
         { "name" },
         { "type" },
         { "val" },
         { "note" },
         { "xaml" },
     };
     Data.Changed += Root.OnCellValueChanged;
 }
Example #5
0
 public RptDataSource(RptRoot p_root)
 {
     Root    = p_root;
     DataSet = new Table
     {
         { "name" },
         { "isscritp", typeof(bool) },
         { "srv" },
         { "sql" },
         { "cols" },
     };
     DataSet.Changed += Root.OnCellValueChanged;
 }
Example #6
0
 public RptViewSetting(RptRoot p_root)
 {
     Root = p_root;
     Data = new Row();
     Data.AddCell <string>("script");
     Data.AddCell("showsearchform", true);
     Data.AddCell <bool>("autoquery");
     Data.AddCell <bool>("showcolheader");
     Data.AddCell <bool>("showrowheader");
     Data.AddCell <bool>("showgridline");
     Data.AddCell("showmenu", true);
     Data.AddCell("showcontextmenu", true);
     Data.Changed += Root.OnCellValueChanged;
 }
Example #7
0
 public RptPageSetting(RptRoot p_root)
 {
     Root = p_root;
     Data = new Row();
     // 纸张名称不保存
     Data.AddCell <string>("papername");
     Data.AddCell("height", _defaultHeight);
     Data.AddCell("width", _defaultWidth);
     Data.AddCell("leftmargin", _defaultMargin);
     Data.AddCell("topmargin", _defaultMargin);
     Data.AddCell("rightmargin", _defaultMargin);
     Data.AddCell("bottommargin", _defaultMargin);
     Data.AddCell <bool>("landscape");
     Data.Changed += Root.OnCellValueChanged;
 }
Example #8
0
 public RptPart(RptRoot p_root)
 {
     Root  = p_root;
     Items = new ObservableCollection <RptItem>();
     AtachEvent();
 }
Example #9
0
 public RptHeader(RptRoot p_root)
     : base(p_root)
 {
 }
Example #10
0
 public RptFooter(RptRoot p_root)
     : base(p_root)
 {
 }
Example #11
0
 /// <summary>
 /// 松绑事件
 /// </summary>
 /// <param name="p_root"></param>
 public void DetachEvent(RptRoot p_root)
 {
     p_root.ItemsChanged -= OnItemsChanged;
     p_root.TextChanged  -= OnTextChanged;
     p_root.Updated      -= OnUpdated;
 }
Example #12
0
 public RptBody(RptRoot p_root)
     : base(p_root)
 {
 }