Currently, the text is exported but the strikethrough line is not drawn in the exported PDF.
The hanging indent of the paragraph affects the rendering of content with tabs. However, the indent is not respected while generating the PDF, leading to disordered content.
Workaround: Insert a tab stop with the position set to the value for hanging indent:
foreach (var paragraph in this.flowDocument.EnumerateChildrenOfType<Paragraph>())
{
if (paragraph.Properties.HangingIndent.HasLocalValue)
{
Run run = paragraph.EnumerateChildrenOfType<Run>().Where(r => r.Text == "\t").FirstOrDefault();
if (run != null)
{
paragraph.TabStops = paragraph.TabStops.Insert(new Telerik.Windows.Documents.Flow.Model.Styles.TabStop(paragraph.Properties.HangingIndent.LocalValue.Value));
}
}
}
In a WPF project targeting .NET 6, the following code snippet results in an error:
public MainWindow()
{
InitializeComponent();
Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
RadFlowDocument document = provider.Import("<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>");
}System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Text.Encoding.CodePages, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'
Workaround: edit the .csproj file and include the required package reference:
<ItemGroup>
<PackageReference Include="Telerik.Windows.Documents.Flow" Version="2024.2.426" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<FunctionsPreservedDependencies Include="System.Text.Encoding.CodePages.dll" />
</ItemGroup>
List indent is not correct when exported to PDF. All indents start from the same position.
When importing a RTF document with bullet lists and exporting the RadFlowDocument back to RTF format the following result is observed:
- the bullet's left offset is changed
- the bullets color is also changed
Workaround: use the Telerik.Windows.Documents.FormatProviders.Rtf.RtfFormatProvider available in the Telerik.Windows.Documents.FormatProviders.Rtf.dll
XmlException is thrown when importing documents containing DAT files.
Workaround:RadFlowDocument flowDocument;
using (Stream str = new FileStream("input.docx", FileMode.OpenOrCreate))
{
MemoryStream ms = new MemoryStream();
str.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
using (ZipArchive archive = ZipArchive.Update(ms, null))
{
var zipEntries = archive.Entries;
// Skip glossary on importfor (int i = zipEntries.Count() - 1; i >= 0; i--)
{
var entry = zipEntries.ElementAt(i);
string entryName = entry.FullName;
if (Regex.IsMatch(entryName, @"\[trash\]"))
{
entry.Delete();
}
}
}
}
Restrict the TableCellProperties API of a style according to specification.
When table with table border without color set is created (the color is null), and the document is exported to PDF, ArgumentNullException is thrown.
Workaround: Explicitly set a color where the color is null.
private void PdfExport()
{
var tables = this.document.EnumerateChildrenOfType<Table>();
foreach (var table in tables)
{
TableBorders coloredClone = this.CopyTableBorders_SetColorWhenOmitted(table);
table.Borders = coloredClone;
using (Stream output = new FileStream(fileName, FileMode.OpenOrCreate))
{
provider.Export(this.document, output);
}
}
}
private TableBorders CopyTableBorders_SetColorWhenOmitted(Table table)
{
var leftBorder = new Border(table.Borders.Left.Thickness,
table.Borders.Left.Style,
table.Borders.Left.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Left.Shadow,
table.Borders.Left.Frame,
table.Borders.Left.Spacing);
var rightBorder = new Border(table.Borders.Right.Thickness,
table.Borders.Right.Style,
table.Borders.Right.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Right.Shadow,
table.Borders.Right.Frame,
table.Borders.Right.Spacing);
var bottomBorder = new Border(table.Borders.Bottom.Thickness,
table.Borders.Bottom.Style,
table.Borders.Bottom.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Bottom.Shadow,
table.Borders.Bottom.Frame,
table.Borders.Bottom.Spacing);
var topBorder = new Border(table.Borders.Top.Thickness,
table.Borders.Top.Style,
table.Borders.Top.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.Top.Shadow,
table.Borders.Top.Frame,
table.Borders.Top.Spacing);
var insideHorizontalBorder = new Border(table.Borders.InsideHorizontal.Thickness,
table.Borders.InsideHorizontal.Style,
table.Borders.InsideHorizontal.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.InsideHorizontal.Shadow,
table.Borders.InsideHorizontal.Frame,
table.Borders.InsideHorizontal.Spacing);
var insideVerticalBorder = new Border(table.Borders.InsideVertical.Thickness,
table.Borders.InsideVertical.Style,
table.Borders.InsideVertical.Color ?? new ThemableColor(Colors.Transparent),
table.Borders.InsideVertical.Shadow,
table.Borders.InsideVertical.Frame,
table.Borders.InsideVertical.Spacing);
var tableBorders = new TableBorders(leftBorder, topBorder, rightBorder, bottomBorder, insideHorizontalBorder, insideVerticalBorder);
return tableBorders;
}
Center alignment is not respected for list numbering.
Expected:
Actual:
When a document with multiple headings ( Heading 1) are imported and then exported, their type from letters is changed to numbers, for example:
Original content: Part A, Part B, Part C
Exported content: Part 1, Part 2, Part 3
The generated document looks OK before printing:
However, hitting the print preview button in MS Words leads to missing text in the fields: