private void radBtnPrintLayout_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args) { if (stylesInitializing) { return; } DocumentLayoutMode layout = DocumentLayoutMode.Flow; if (args.ToggleState == ToggleState.On) { layout = DocumentLayoutMode.Paged; } this.radRichTextBox1.LayoutMode = layout; this.radRichTextBox1.Focus(); }
/// <summary> /// Event handler when user wants to Export the Grid to PDF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void btnExportChartPDF_Click(RadChart chart, Stream stream, DocumentLayoutMode layoutMode = DocumentLayoutMode.Paged, PageOrientation orientation = PageOrientation.Landscape) { try { RadDocument document = PrintChart(chart); document.LayoutMode = layoutMode; document.SectionDefaultPageOrientation = orientation; document.Measure(RadDocument.MAX_DOCUMENT_SIZE); document.Arrange(new RectangleF(PointF.Empty, document.DesiredSize)); PdfFormatProvider provider = new PdfFormatProvider(); provider.Export(document, stream); } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); } }
/// <summary> /// Event handler when user wants to Export the Grid to PDF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void btnExportPDF_Click(RadGridView dataGrid, int fontSize = 10, DocumentLayoutMode layoutMode = DocumentLayoutMode.Paged, PageOrientation orientation = PageOrientation.Portrait, List <int> skipColumnDisplayIndex = null, Stream stream = null , Func <int, int, object, object, object> cellValueOverwrite = null, Func <int, int, string> columnAggregateOverWrite = null , Func <Block> initialHeaderBlock = null) { try { if (stream == null) { SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = "*.pdf"; dialog.Filter = "Adobe PDF Document (*.pdf)|*.pdf"; fontSizePDF = fontSize; if (dialog.ShowDialog() == true) { RadDocument document = CreateDocument(dataGrid, skipColumnDisplayIndex, cellValueOverwrite, columnAggregateOverWrite , initialHeaderBlock); // document.LayoutMode = layoutMode; // document.SectionDefaultPageOrientation = orientation; PdfFormatProvider provider = new PdfFormatProvider(); using (Stream output = dialog.OpenFile()) { provider.Export(document, output); } } } else { RadDocument document = CreateDocument(dataGrid, skipColumnDisplayIndex, cellValueOverwrite, columnAggregateOverWrite , initialHeaderBlock); // document.LayoutMode = layoutMode; // document.SectionDefaultPageOrientation = orientation; PdfFormatProvider provider = new PdfFormatProvider(); provider.Export(document, stream); } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); } }
/// <summary> /// Shows the spell checking dialog. /// </summary> /// <param name="controlSpellChecker"> /// The control spell checker. /// </param> /// <returns> /// A task that completes when the window is closed. /// </returns> /// <exception cref="ArgumentNullException"> /// The <paramref name="controlSpellChecker"/> parameter is null. /// </exception> public Task<SpellCheckingResult> ShowDialog(IControlSpellChecker controlSpellChecker) { if (controlSpellChecker == null) throw new ArgumentNullException("controlSpellChecker"); _tcs = new TaskCompletionSource<SpellCheckingResult>(); _controlSpellChecker = controlSpellChecker; _spellCheckingManager.SpellChecker = _controlSpellChecker.SpellChecker; _spellCheckingManager.IgnoredWords = _controlSpellChecker.IgnoredWords; var document = _controlSpellChecker.GetContentAsDocument(); RtbSpellCheckingContext.Document = document; RtbSpellCheckingContext.Document.CaretPosition.MoveToFirstPositionInDocument(); _originalDocumentLayoutMode = document.LayoutMode; document.LayoutMode = DocumentLayoutMode.Flow; HasErrors = TryLoadIncorrectSentence(true); if (HasErrors) { Dispatcher.BeginInvoke(ShowDialog); UpdateAvailableCulturesAsync(); UpdateSpellingSuggestionsAsync(_currentIncorrectWord); } else { _tcs.TrySetResult(new SpellCheckingResult(false)); } return _tcs.Task; }