public override CalculatedFieldValue GetCalculatedValueCore(PieceTable sourcePieceTable, MailMergeDataMode mailMergeDataMode, Field documentField) { OfficeImage image = chart.CreateImage(); DocumentModel targetModel = sourcePieceTable.DocumentModel.GetFieldResultModel(); targetModel.MainPieceTable.InsertInlinePicture(DocumentLogPosition.Zero, image); return(new CalculatedFieldValue(targetModel)); }
private void richEditControl1_CalculateDocumentVariable(object sender, DevExpress.XtraRichEdit.CalculateDocumentVariableEventArgs e) { if (e.VariableName == "CHART") { ChartImage chart = new ChartImage(e.Arguments[0].Value.ToString()); chart.Initialize(); DocumentImageSource image = chart.CreateImage(); RichEditDocumentServer srv = new RichEditDocumentServer(); srv.Document.AppendImage(image); e.Value = srv.Document; e.Handled = true; } }