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; } }