When the last run from a paragraph is underlined, the associated bullet has underline applied as well. The same applies for the background color.
When importing from HTML, all successive spaces in a spans are trimmed. Instead, in some cases one space should be left, e.g. between words. For example, the importing the following HTML should leave one space after the hyperlink: <p><a href="www.telerik.com" target="_blank"><span>test</span></a> and more.</p> Workaround: After importing, check if the runs after the hyperlinks start with space: foreach (var hyperlinkEnd in this.document.EnumerateChildrenOfType<FieldCharacter>().Where(f => f.FieldCharacterType == FieldCharacterType.End)) { Paragraph currentParagraph = hyperlinkEnd.Paragraph; int indexOfNextRun = currentParagraph.Inlines.IndexOf(hyperlinkEnd) + 1; if (currentParagraph.Inlines.Count > indexOfNextRun) { Run run = currentParagraph.Inlines[indexOfNextRun] as Run; if (run != null && run.Text[0] != ' ') { run.Text = " " + run.Text; } } }
Currently Run.Shading is not exported to PDF. Note: This scenario is common when converting HTML to PDF, as Run.Shading is set when construct like <span style="background-color:#ffcc00;"> is used. Workaround: Iterate all the Runs in the already imported HTML document and set their HighlightColor to Shading.BackgroundColor.LocalValue. Check this code snippet:
foreach (Run run in document.EnumerateChildrenOfType<Run>())
{
if (!run.Properties.HighlightColor.HasLocalValue)
{
run.HighlightColor = run.Shading.BackgroundColor.LocalValue;
}
}
If HTML document is imported, and it contains image with invalid URL, then the image is imported with this URL in the document model. On subsequent export to Docx, the library tries to download the image data, which throws WebException. Instead, the image should be replaced with generic 'error' image. Workaround: Manually test the image URL for correctness on HTML import, and replace the data: static void Main(string[] args) { HtmlFormatProvider htmlFormatProvider = new HtmlFormatProvider(); htmlFormatProvider.ImportSettings.LoadFromUri += (sender, e) => { if (!IsValid(e.Uri)) { e.SetData(File.ReadAllBytes("no-image.png")); } }; } private static bool IsValid(string uri) { try { using (WebClient client = new WebClient()) { client.DownloadData(uri); } } catch (WebException) { return false; } return true; }
<ul>
<li>
<div>Text</div>
</li>
</ul>
Special chars (åäö) with PdfFormatProvider wont work.
Project submitted!
public void SpecialCharsTest()
{
RadFlowDocument document = new RadFlowDocument();
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
editor.InsertText("Before text");
editor.InsertText("åäö ÅÄÖ ☕"); // This line will not appear in the pdf
editor.InsertText("After text");
using (Stream output = new FileStream("specialCharTest.pdf", FileMode.OpenOrCreate))
{
PdfFormatProvider provider = new PdfFormatProvider();
provider.Export(document, output);
}
}
Special characters wont work :-/
This element serves as a frame and allows the element to be positioned as a floating element. More information about it is available in section 22.9.2.18 ST_XAlign (Horizontal Alignment Location) of Open Office XML.
DECLINED: Duplicate with - Implement support for Text Frame Properties.
foreach (var style in this.document.StyleRepository.Styles)
{
if (style.StyleType == StyleType.Table)
{
if (style.LinkedStyleId != null)
{
style.LinkedStyleId = null;
}
}
}
When applying a table or table cell border with no thickness specified, the border is exported with a default thickness value of zero. However, by specification, the default value should be 2.
Workaround: Create a border by specifying the thickness value. For example:
table.Borders = new TableBorders(new Border(thickness, BorderStyle.Single, new ThemableColor(Colors.Black)));
In WordsProcessing on import only the lower case CSS attributes are correctly imported. Upper case and mixed case are ignored and the default values are used.
The property controls whether a paragraph should be rendered at least partially on the same page with the following paragraph when the document is shown in page view mode.