Ejemplo n.º 1
0
 private void OnBeforeRendering(Bitmap bitmap)
 {
     BeforeRendering?.Invoke(this, new BeforeRenderingEventArgs()
     {
         Bitmap = bitmap
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Bind the template to Excel => RenderView Excel cells based on the datasource currently injected.
        /// </summary>
        internal void RenderViewDataOnly()
        {
            lock (syncRoot)
            {
                if (!IsDisposed && Renderer != null)
                {
                    if (ETKExcel.ExcelApplication.IsInEditMode())
                    {
                        throw new COMException("Excel is on Edit mode");
                    }

                    try
                    {
                        if (Renderer.RenderedRange == null)
                        {
                            RenderView();
                        }
                        else
                        {
                            using (var freezeExcel = new FreezeExcel(ETKExcel.ExcelApplication.KeepStatusVisible))
                            {
                                if (BindingContext != null && BindingContext.Body.ElementsToRender != null)
                                {
                                    BeforeRendering?.Invoke(true);

                                    Renderer.RenderDataOnly();
                                    if (log.GetLogLevel() == LogType.Debug)
                                    {
                                        log.LogFormat(LogType.Debug, "Sheet '{0}', View '{1}' from '{2}' render data only failed.", ViewSheet.Name, Ident, TemplateDefinition.Name);
                                    }

                                    AfterRendering?.Invoke(true);;

                                    CurrentSelectedCell?.Select();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        var message = $"Sheet '{ViewSheet.Name}', View '{this.Ident}' from '{TemplateDefinition.Name}' render data only failed.";
                        throw new EtkException(message, ex, false);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Bind the template to Excel => Refresh Excel cells from the datasource currently injected.
        /// </summary>
        internal void RenderView()
        {
            lock (syncRoot)
            {
                if (!IsDisposed && Renderer != null)
                {
                    if (ETKExcel.ExcelApplication.IsInEditMode())
                    {
                        throw new COMException("Excel is on Edit mode");
                    }

                    try
                    {
                        using (var freezeExcel = new FreezeExcel(ETKExcel.ExcelApplication.KeepStatusVisible))
                        {
                            BeforeRendering?.Invoke(false);

                            // Clear the previous rendering.
                            ////////////////////////////////
                            CurrentSelectedCell  = null;
                            currentSelectedRange = null;
                            Renderer.Clear();

                            Renderer.Render();

                            ExecuteAutoFit();

                            if (log.GetLogLevel() == LogType.Debug)
                            {
                                log.LogFormat(LogType.Debug, "Sheet '{0}', View '{1}' from '{2}' rendered.", ViewSheet.Name, this.Ident, TemplateDefinition.Name);
                            }

                            AfterRendering?.Invoke(true);
                            Renderer.AfterRendering();
                        }
                    }
                    catch (Exception ex)
                    {
                        string message = $"Sheet '{ViewSheet.Name}', View '{this.Ident}' from '{TemplateDefinition.Name}' render failed.";
                        throw new EtkException(message, ex, false);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void OnBeforeRendering(EventArgs e)
 {
     BeforeRendering?.Invoke(this, e);
 }
Ejemplo n.º 5
0
 protected virtual void OnBeforeRendering(EventArgs e)
 {
     BeforeRendering?.Invoke(this, e);
 }