public bool Render(TableOfContent toc) { if (toc == null) { return(false); } _renderer.Render(toc, _writer); return(true); }
public static FlowDocument LoadDocumentAndRender(string strTmplName, Object data, IDocumentRenderer renderer = null) { FlowDocument doc = (FlowDocument)Application.LoadComponent(new Uri(strTmplName, UriKind.RelativeOrAbsolute)); doc.PagePadding = new Thickness(50); doc.DataContext = data; if (renderer != null) { renderer.Render(doc, data); } return(doc); }
public static FlowDocument LoadDocumentAndRender(string strTmplName, JArray data, DateTime DataDateTime, IDocumentRenderer renderer = null) { FlowDocument doc = (FlowDocument)Application.LoadComponent(new Uri($"/Office.Work.Platform;component/Remuneration/{strTmplName}", UriKind.RelativeOrAbsolute)); //doc.PagePadding = new Thickness(50); //doc.DataContext = data; if (renderer != null) { renderer.Render(doc, data, DataDateTime); } return(doc); }
public static FlowDocument LoadDocumentAndRender(string strTmplName, Object data, IDocumentRenderer renderer = null) { FlowDocument doc = (FlowDocument)Application.LoadComponent(new Uri(strTmplName, UriKind.RelativeOrAbsolute)); doc.PagePadding = new Thickness(50); doc.DataContext = data; if (renderer != null) { renderer.Render(doc, data); DocumentPaginator paginator = ((IDocumentPaginatorSource)doc).DocumentPaginator; paginator.PageSize = new Size(1188, 840); //doc.PagePadding = new Thickness(50, 50, 50, 50); doc.ColumnWidth = double.PositiveInfinity; } return(doc); }
/// <summary> /// 容器 /// </summary> /// <param name="strTmplName"></param> /// <param name="data"></param> /// <param name="renderer"></param> /// <returns></returns> public static FlowDocument LoadDocumentAndRender(string strTmplName, Object data, IDocumentRenderer renderer = null) { //strTmplName 流文件地址 // UriKind.RelativeOrAbsolute 用指定的 URI 初始化 Uri 类的新实例。 此构造函数允许指定 URI 字符串是相对 URI、绝对 URI 还是不确定 //打开流文件 并存储到流文档容器中 FlowDocument doc = (FlowDocument)Application.LoadComponent(new Uri(strTmplName, UriKind.RelativeOrAbsolute)); //设置外边距 doc.PagePadding = new Thickness(50); //DataContext 获取或设置元素在参与数据绑定时的数据上下文。 doc.DataContext = data; if (renderer != null) { renderer.Render(doc, data); } return(doc); }
public static FlowDocument LoadDocumentAndRender(string strTmplName, Object data, IDocumentRenderer renderer = null) { FlowDocument doc = null; try { doc = (FlowDocument)Application.LoadComponent(new Uri(strTmplName, UriKind.RelativeOrAbsolute)); doc.PagePadding = new Thickness(50); doc.DataContext = data; if (renderer != null) { renderer.Render(doc, data); } } catch (Exception ex) { MessageBox.Show("异常(LoadDocumentAndRender):\n" + ex.Message); } return(doc); }
/* ----------------------------------------------------------------- */ /// /// GetImage /// /// <summary> /// Gets an Image object in which the Page content is rendered. /// </summary> /// /// <param name="src">Renderer object.</param> /// <param name="page">Page object.</param> /// <param name="scale">Scale factor.</param> /// /// <returns>Image object</returns> /// /* ----------------------------------------------------------------- */ public static Image Render(this IDocumentRenderer src, Page page, double scale) => src.Render(page, page.GetViewSize(scale).Value);
/* ----------------------------------------------------------------- */ /// /// Render /// /// <summary> /// Gets an Image object in which the Page content is rendered. /// </summary> /// /// <param name="src">Renderer object.</param> /// <param name="page">Page object.</param> /// /// <returns>Image object</returns> /// /* ----------------------------------------------------------------- */ public static Image Render(this IDocumentRenderer src, Page page) => src.Render(page, 1.0);
/* ----------------------------------------------------------------- */ /// /// Render /// /// <summary> /// Renders the Page content to the Graphics object. /// </summary> /// /// <param name="src">Renderer object.</param> /// <param name="dest">Graphics object.</param> /// <param name="page">Page object.</param> /// /* ----------------------------------------------------------------- */ public static void Render(this IDocumentRenderer src, Graphics dest, Page page) => src.Render(dest, page, new PointF(0, 0), dest.VisibleClipBounds.Size);