I want to change Direction by Aspose.Word Or OpenXml Word (WordprocessingDocument ) (C#). method is like here:
private static void AddHtmlToDoc()
{
var html = @"<html> <a href=""http://www.google.com/"" style=""color:#FF0000;"">Red Link</a><a href=""http://www.google.com/"" style=""color:#00FF00;"">Blue Link</a > </ html > ";
Aspose.Words.Document docAspose = new Words.Document();
Words.DocumentBuilder b1 = new DocumentBuilder(docAspose);
b1.InsertHtml(html);
docAspose.Save(dir2);
WordprocessingDocument doc = WordprocessingDocument.Open(dir2, true);
var documentPart = doc.MainDocumentPart.Document.Body;
Console.ReadKey();
}
How can I do it?
I found solution. for right to left direction we must use this code:
b1.CurrentParagraph.ParagraphFormat.Bidi
Unfortunately I use this code befor
b1.InsertHtml(html);
but when I used it after top line, it worked true. then The following method works:
private static void AddHtmlToDoc()
{
var html = @"<html> <a href=""http://www.google.com/"" style=""color:#FF0000;"">Red Link</a><a href=""http://www.google.com/"" style=""color:#00FF00;"">Blue Link</a > </ html > ";
Aspose.Words.Document docAspose = new Words.Document();
Words.DocumentBuilder b1 = new DocumentBuilder(docAspose);
b1.InsertHtml(html);
b1.CurrentParagraph.ParagraphFormat.Bidi = true;
docAspose.Save(dir2);
Console.ReadKey();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.