PdfFormatProvider creates an invalid PDF document.
Workaround:
RadDocument radDocument = null;
XamlFormatProvider xamlformatProvider = new XamlFormatProvider();
using (FileStream inputStream = new FileStream("input.xaml", FileMode.Open))
{
Console.WriteLine("reading input file");
radDocument = xamlformatProvider.Import(inputStream);
}
var provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
var bytes = provider.Export(radDocument);
var provider2 = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var flowDoc = provider2.Import(bytes);
var provider3 = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
using (Stream output = File.OpenWrite(@"output.pdf"))
{
Console.WriteLine("writing output file");
provider3.Export(flowDoc, output);
}
Console.WriteLine("done...");
Console.ReadKey();
When a merged cell contains more than one entire column, the caret is in the merged cell and you chose the option to delete the current column, the action is supposed to delete all the columns in the merged cell. What happens instead is that only the first column is deleted and the merged cell remains. Workaround: TableCell tableCell = this.radRichTextBox.Document.CaretPosition.GetCurrentInline().Parent.Parent as TableCell; if(tableCell == null) { return; } int columnSpan = tableCell.ColumnSpan; this.radRichTextBox.Document.History.BeginUndoGroup(); for (int i = 0; i < columnSpan; i++) { this.radRichTextBox.DeleteTableColumn(); } this.radRichTextBox.Document.History.EndUndoGroup("Delete Column");
When the document uses a font that cannot be found on the machine, it is substituted for another font. What should happen is to fall back to another font for the visualization, but to preserve the original font in the model. Partial workaround: for HTML import, the font can be preserved by subscribing to the FontSubstituting event: provider.ImportSettings.FontSubstituting += ImportSettings_FontSubstituting; private void ImportSettings_FontSubstituting(object sender, FontSubstitutingEventArgs e) { e.SubstitutionFontFamily = new FontFamily(e.OriginalFontName); }
Some of the methods in RadDocumentEditor/RadRichTextBox call RadDocument.EnsureDocumentMeasuredAndArranged(), but some don't, for example: - InsertAnnotationRange - InsertLine - ChangeAllFieldsDisplayMode This causes exceptions or incorrect behavior what layout is not performed on the document. Workaround: Call EnsureDocumentMeasuredAndArranged before the problematic methods.
When the users select a table using the thumb provided by the TableAdorner, the table is selected but the Table Tools contextual tab in RadRichTextBoxRibbonUI is not activated. Workaround: Attach to SelectionChanged and move the caret position to the first position of the table when the selection range is only one and is of type Table. Sample code is attached.
Switching between bulleted and numbered lists only affects current paragraph instead of changing the list for all paragraphs currently included in it. Steps to reproduce 1. Create a numbered list with several items 2. Click the bulleted list button Expected behavior: The entire list switches from numbered to bulleted Actual behavior: The current list item switches to bulleted but the rest of the list remains numbered. Workaround: When the ToggleBulletsCommand is executed, traverse the PreviousSiblings and NextSiblings of the current paragraph and change their list properties if they belong to the same list. Sample code attached. Note: the workaround will change the list properties only for the consecutive paragraphs of the same list and will create a selection to do so.
The caret gets a wrong size when positioned on annotation start/end.
Currently, RadRichTextBox only imports from HTML documents tables with spacing between cells, but it does not export tables with such style. It seems like the border-collapse: collapse value defined in the Table Normal style overrides the border-spacing value, which is applied to the cells. As a workaround, the document styles can be omitted from the exported HTML and the styling can be exported inline be changing the ExportSettings of HtmlFormatProvider: provider.ExportSettings.StylesExportMode = StylesExportMode.Inline; provider.ExportSettings.StyleRepositoryExportMode = StyleRepositoryExportMode.DontExportStyles;
Having a table with specified RowSpan and further exported to PDF does not draw the border. This is due to export optimization caused by the fact whether there is or is not a CellSpacing specified. Workaround: Set really small CellSpacing for the table.
When pasting a big image in RichTextBox, it is pasted with its original size. It should be resized so it can fit on the page. Similar logic is available in the InsertPictureCommand. Workaround: private void RadRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e) { if (!(e.Command is PasteCommand)) { return; } DocumentFragment res = ClipboardEx.GetDocumentFromClipboard("RadDocumentGUID"); if (res == null) { foreach (ClipboardHandler settings in ClipboardEx.ClipboardHandlers) { res = ClipboardEx.GetDocumentFromClipboard(settings.ClipboardDataFormat, settings.ClipboardStringFilter); } } if (res == null) { e.Cancel = true; var bitmapSource = Clipboard.GetImage(); if (bitmapSource == null) { return; } Padding sectionmargin = this.radRichTextBox.Document.CaretPosition.GetCurrentSectionBox().AssociatedSection.ActualPageMargin; double originalPixelWidth = bitmapSource.Width; double originalPixelHeight = bitmapSource.Height; if (originalPixelWidth == 0 || originalPixelHeight == 0) { originalPixelWidth = 10; originalPixelHeight = 10; } double width = originalPixelWidth; double height = originalPixelHeight; if (this.radRichTextBox.Document.LayoutMode == DocumentLayoutMode.Paged) { Section currentSection = this.radRichTextBox.Document.CaretPosition.GetCurrentSectionBox().AssociatedSection; var pageSize = (SizeF) currentSection.GetType().GetProperty("ActualPageSize", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(currentSection, null); double maxWidth = pageSize.Width - (sectionmargin.Left + sectionmargin.Right); double maxHeight = pageSize.Height - (sectionmargin.Top + sectionmargin.Bottom); width = Math.Min(maxWidth, width); height = Math.Min(maxHeight, height); } double ratio = originalPixelWidth / originalPixelHeight; width = Math.Min(width, height * ratio); height = width / ratio; Size size = new Size(width, height); ImageInline imageInline = new ImageInline(new WriteableBitmap(bitmapSource)); imageInline.Size = size; this.radRichTextBox.ActiveDocumentEditor.InsertInline(imageInline); } }
- Localization for "Simple text" in the Define New List Style dialog and Define New Style dialog at RadRichTextBox. - Levels (from 1st to 9th) are hardcoded in dialog's code behind and cannot be localized. (these are the items in the 'Apply Formatting to' comboBox)
When the position on which the users right-click is an annotation start or end marker, the context menu doesn't provide suggestions about spellcheck errors. Steps to reproduce: 1. Type "The greater the better" in RadRichTextBox with enabled spellchecking 2. Turn on track changes 3. Move the caret to the 't' of "greater" 4. Insert 't' so the word becomes wrong 5. Right-click on the 't' letter inserted in step 4 Observed: The context menu doesn't show suggestions for fixing the misspelled word Expected: The context menu should suggest a fix