Using v8.1.10
See attachment
text in DOCX first paragraph ends as SPACE + "2"
Code creates a TextRange from the text of the paragraph, then saves in PDF format.
PDF is not rendering properly the last SPACE before the "2"
Saving in DOCX format works correctly.
- Code: Select all
internal void DoTest()
{
string inputFilename = Path.Combine(Application.StartupPath, "AA.docx");
string outputFilename = Path.Combine(Application.StartupPath, "AA.pdf");
Document document = new Document(inputFilename);
Section section = document.Sections[0];
Paragraph paragraph = section.Paragraphs[0];
string texte1 = paragraph.Text;
int nbCar = texte1.Length;
TextSelection selection = new TextSelection(paragraph, 0, nbCar - 1);
// Cette instruction perturbe la mise en forme dans le PDF, l'espace avant le chiffre de fin de ligne est contracté
TextRange range = selection.GetAsOneRange();
document.SaveToFile(outputFilename);
Process.Start(outputFilename);
}