private void Button_Click(object sender, RoutedEventArgs e) { PrintSizeMode sizeMode = PrintSizeMode.Stretch; chartControl.ExportToPdf(PDFFile, sizeMode); Process.Start(PDFFile); }
private void ExportChartToMHT(ChartControl chart) { // Create an object containing MHT export options. MhtExportOptions mhtOptions = new MhtExportOptions(); // Specify print size mode. PrintSizeMode sizeMode = PrintSizeMode.ProportionalZoom; // Export a chart to a stream as MHT. FileStream mhtStream = new FileStream("OutputDefault.mht", FileMode.Create); chart.ExportToMht(mhtStream, mhtOptions, sizeMode); Process.Start("OutputDefault.mht"); }
static void ExportTo(string title, string filter, string exportFormat, ImageFormat format, bool checkPrinterAvailable) { ChartControl chart = PrepeareForPrintOrExport(checkPrinterAvailable); if (chart == null) { return; } string fileName = ShowSaveFileDialog(title, filter); if (fileName != "") { Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; switch (exportFormat) { case "HTML": chart.ExportToHtml(fileName); break; case "MHT": chart.ExportToMht(fileName); break; case "PDF": PrintSizeMode sizeMode = chart.OptionsPrint.SizeMode; chart.OptionsPrint.SizeMode = PrintSizeMode.Zoom; try { chart.ExportToPdf(fileName); } finally { chart.OptionsPrint.SizeMode = sizeMode; } break; case "XLS": chart.ExportToXls(fileName); break; case "IMAGE": chart.ExportToImage(fileName, format); break; } Cursor.Current = currentCursor; OpenFile(fileName); } }
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"); }