We recently purchased your amazing package, nice work Guys!
But we ran into some problems...
We produce documents with dynamic text in the following languages - Hebrew and English. Sometimes in 2 languages together. And of course we also have numbers, sometimes it can be in the form of formulas. The final product we save as WORD and XPS. so...
1. If we apply CharacterFormat.Bidi = true on TextRange, as we sought in documentation, we get reverse numbers in formulas, the letters in Hebrew are RTL but the numbers are LTR and this parameter reverses also a numbers.
2. Designing the Lists - In some documents we need to sort lists by letters in Hebrew, but in XPS (and PDF) files are sorted by numbers ...
3. Also we have some cosmetic changes between DocX, XPS (also pdf) but it's a small issue
Thanks in advance. Attaching code for testing.
- Code: Select all
private static void RtlXPSTest()
{
var pathXPS = @"C:\RTL.xps";
var pathDOC = @"C:\RTL.DOCX";
var pathPDF = @"C:\RTL.PDF";
var text = new List<string> {
"בדיקת מספרים 12345",
"בדיקת אנגלית ABCDE",
"נוסחאות 1 + 1 = 4",
"SOME TEXT ואחרי זה משהו בעברית!"};
using (var document = new Document())
{
document.AddSection();
document.Sections[0].PageSetup.Bidi = false;
ListStyle listStyle = new ListStyle(document, ListType.Numbered);
document.ListStyles.Add(listStyle);
listStyle.Name = "hebrewListStyle";
listStyle.Levels[0].PatternType = ListPatternType.Hebrew2;
foreach (var t in text)
{
var p = document.Sections[0].AddParagraph();
p.Format.IsBidi = true;
var r = p.AppendText(t);
r.CharacterFormat.FontName = "Arial";
r.CharacterFormat.FontNameBidi = "Arial";
r.CharacterFormat.FontSize = 16;
r.CharacterFormat.FontSizeBidi = 16;
//r.CharacterFormat.Bidi = true;
p.ListFormat.ApplyStyle("hebrewListStyle");
p.AppendBreak(BreakType.LineBreak);
}
document.SaveToFile(pathDOC, FileFormat.Docx2013);
document.SaveToFile(pathXPS, FileFormat.XPS);
document.SaveToFile(pathPDF, FileFormat.PDF);
}
Process.Start(pathDOC);
Process.Start(pathXPS);
Process.Start(pathPDF);
}