private void button1_Click(object sender, EventArgs e) { // A path to export a report. string reportPath = "c:\\Test.html"; // Create a report instance. XtraReport1 report = new XtraReport1(); // Get its HTML export options. HtmlExportOptions htmlOptions = report.ExportOptions.Html; // Set HTML-specific export options. htmlOptions.CharacterSet = "UTF-8"; htmlOptions.RemoveSecondarySymbols = false; htmlOptions.Title = "Test Title"; // Set the pages to be exported, and page-by-page options. htmlOptions.ExportMode = HtmlExportMode.SingleFilePageByPage; htmlOptions.PageRange = "1, 3-5"; htmlOptions.PageBorderColor = Color.Blue; htmlOptions.PageBorderWidth = 3; // Export the report to HTML. report.ExportToHtml(reportPath); // Show the result. StartProcess(reportPath); }
private static void SetHtmlOptions(HtmlExportOptions htmlExportOptions) { // HTML-specific options: htmlExportOptions.Title = "CustomHtmlTitle"; htmlExportOptions.ExportMode = HtmlExportMode.SingleFilePageByPage; htmlExportOptions.PageBorderColor = System.Drawing.Color.Gray; htmlExportOptions.EmbedImagesInHTML = true; }
private void ExportChartToHTML(ChartControl chart) { // Create an object containing HTML export options. HtmlExportOptions htmlOptions = new HtmlExportOptions(); // Set HTML-specific export options. htmlOptions.CharacterSet = "utf-8"; htmlOptions.RemoveSecondarySymbols = false; htmlOptions.Title = "Unicode UTF-8 Example"; // Specify print size mode. PrintSizeMode sizeMode = PrintSizeMode.Stretch; // Export a chart to an HTML file. chart.ExportToHtml("OutputUnicode.html", htmlOptions, sizeMode); Process.Start("OutputUnicode.html"); }
public HttpResponseMessage ExportToHtml(string reportId, bool onlyBody = false, string parameters = null, string entityId = null) { var report = GetXtraReport(reportId, parameters, entityId); HtmlExportOptions htmlOptions = report.ExportOptions.Html; htmlOptions.InlineCss = true; htmlOptions.PageBorderWidth = 0; htmlOptions.CharacterSet = "UTF-8"; htmlOptions.TableLayout = true; htmlOptions.RemoveSecondarySymbols = false; htmlOptions.Title = "Test Title"; htmlOptions.EmbedImagesInHTML = true; htmlOptions.ExportMode = HtmlExportMode.SingleFile; string reportHtml = null; using (var memoryStream = new MemoryStream()) { report.ExportToHtml(memoryStream); memoryStream.Position = 0; using (StreamReader sr = new StreamReader(memoryStream)) { reportHtml = sr.ReadToEnd(); } } if (onlyBody) { int bodyBegin = reportHtml.IndexOf("<body"); int bodyEnd = reportHtml.IndexOf(">", bodyBegin); reportHtml = reportHtml.Substring(bodyEnd + 1); reportHtml = reportHtml.Substring(0, reportHtml.IndexOf("</body>")); } HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(reportHtml, System.Text.Encoding.UTF8, "text/html"); response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html"); return(response); }
public void ExportToHtml(Stream stream, HtmlExportOptions options) { report.ExportToHtml(stream, options); }